pyFAI.gui.utils package¶
pyFAI.gui.utils.FilterBuilder module¶
This module provides helper to build filter descriptions.
-
class
pyFAI.gui.utils.FilterBuilder.
FilterBuilder
¶ Bases:
object
Helper to create extension filters for file dialog
-
COMPRESSED_IMAGE_EXTENSIONS
= ['gz', 'bz2']¶ List of compressed file extension supported by fabio by default.
-
__init__
()¶ Initialize self. See help(type(self)) for accurate signature.
-
addFileFormat
(description, extensions)¶ Add a file format to the filters
Parameters: - description (str) – Description of the file format
- extensions (Union[str,List]) – Description of the file format
-
addImageFormat
(description, extensions, compressedExtensions=True)¶ Add an image format to the filters
Parameters: - description (str) – Description of the file format
- extensions (Union[str,List]) – Description of the file format
- compressedExtensions (bool) – Includes derived compressed files like gz and bz2.
-
getFilters
()¶ Returns the filters as supported by
qt.QFileDialog.setNameFilters()
.Return type: List[str]
-
pyFAI.gui.utils.ProxyAction module¶
-
class
pyFAI.gui.utils.ProxyAction.
CustomProxyAction
(parent, source)¶ Bases:
pyFAI.gui.utils.ProxyAction.ProxyAction
Create a QAction synchronized with a source action.
Some properties of the source can be overrided.
-
__init__
(parent, source)¶ Initialize self. See help(type(self)) for accurate signature.
-
forceIconText
(iconText)¶ Override the iconText of the the source action.
Property can be removed by using None. In this case the text set back using the sourceAction.
-
forceText
(text)¶ Override the text of the the source action.
Property can be removed by using None. In this case the text set back using the sourceAction.
-
setIconText
(self, str)¶
-
setText
(self, str)¶
-
-
class
pyFAI.gui.utils.ProxyAction.
ProxyAction
(parent, source)¶ Bases:
PyQt5.QtWidgets.QAction
Create a QAction synchronized with a source action.
This allow to intercept all the gettes and setters by inheritance.
-
__init__
(parent, source)¶ Initialize self. See help(type(self)) for accurate signature.
-
hover
(self)¶
-
sourceAction
()¶
-
toggle
(self)¶
-
trigger
(self)¶
-
pyFAI.gui.utils.colorutils module¶
-
pyFAI.gui.utils.colorutils.
getFreeColorRange
(colormap)¶ Returns a list of 10 colors in range not covered by colormap.
Return type: List[qt.QColor]
pyFAI.gui.utils.eventutils module¶
This module provides convenient functions about Qt events.
-
class
pyFAI.gui.utils.eventutils.
QtProxifier
(target)¶ Bases:
silx.gui.qt._qt.QObject
Provide a safe Qt object from an unsafe object.
-
__init__
(target)¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
pyFAI.gui.utils.eventutils.
SimulatedSignal
¶ Bases:
object
Simulated signal to create signal at runtime.
Note
Code from http://abstractfactory.io/blog/dynamic-signals-in-pyqt/
-
__init__
()¶ Initialize self. See help(type(self)) for accurate signature.
-
connect
(func)¶
-
disconnect
(func)¶
-
emit
(*args, **kwargs)¶
-
subs
()¶
-
-
pyFAI.gui.utils.eventutils.
createCloseSignal
(widget)¶ Create a Qt close signal to the widget as sigClosed attribute
-
pyFAI.gui.utils.eventutils.
createHideSignal
(widget)¶ Create a Qt hidden signal to the widget as sigHidden attribute
-
pyFAI.gui.utils.eventutils.
createShowSignal
(widget)¶ Create a Qt shown signal to the widget as sigShown attribute
pyFAI.gui.utils.imageutils module¶
This module provides convenient functions to use with Qt objects.
-
pyFAI.gui.utils.imageutils.
convertArrayToQImage
(image)¶ Convert an array-like RGB888 image to a QImage.
The created QImage is using a copy of the array data.
Limitation: Only supports RGB888 and RGBA8888 format.
Parameters: image (numpy.ndarray of uint8 of dimension HxWx3) – Array-like image data Returns: Corresponding Qt image Return type: QImage
-
pyFAI.gui.utils.imageutils.
maskArrayToRgba
(mask, falseColor, trueColor)¶ Returns an RGBA uint8 numpy array using colors to map True (usually masked pixels) and Flase (valid pixel) from the mask array.
pyFAI.gui.utils.projecturl module¶
Module with GUI for diffraction mapping experiments
-
pyFAI.gui.utils.projecturl.
get_documentation_url
(subpath)¶ Returns the URL to the documentation
pyFAI.gui.utils.setup module¶
-
pyFAI.gui.utils.setup.
configuration
(parent_package='', top_path=None)¶
pyFAI.gui.utils.timeutils module¶
This module provides convenient functions about time.
-
class
pyFAI.gui.utils.timeutils.
Timer
(seconds)¶ Bases:
object
Kind of context manager to call a code while the amount of seconds is not finished.
timer = Timer(seconds=10) while not timer.isTimeout(): print("Tick")
-
__init__
(seconds)¶ Initialize self. See help(type(self)) for accurate signature.
-
isTimeout
()¶ Returns True if the timeout was reached.
-
pyFAI.gui.utils.tree module¶
Module with list <-> tree conversion
-
class
pyFAI.gui.utils.tree.
DataSet
(path, h5=None, nframes=None, shape=None)¶ Bases:
object
-
__init__
(path, h5=None, nframes=None, shape=None)¶ Initialize self. See help(type(self)) for accurate signature.
-
as_tuple
()¶
-
is_hdf5
()¶ Return True if the object is hdf5
-
-
pyFAI.gui.utils.tree.
DataSetNT
¶ alias of
pyFAI.gui.utils.tree.DataSet
pyFAI.gui.utils.units module¶
-
class
pyFAI.gui.utils.units.
Dimentionality
¶ Bases:
enum.Enum
An enumeration.
-
ANGLE
= 'Angle'¶
-
LENGTH
= 'Length'¶
-
PIXEL
= 'Pixel'¶
-
SCATTERING_VECTOR
= 'Scattering vector'¶
-
WAVELENGTH
= 'Wavelength'¶
-
fullname
¶
-
-
class
pyFAI.gui.utils.units.
Unit
¶ Bases:
enum.Enum
An enumeration.
-
ANGSTROM
= (('Ångström', 'Å', <Dimentionality.WAVELENGTH: 'Wavelength'>, 1),)¶
-
CENTIMETER
= (('Centimeter', 'cm', <Dimentionality.LENGTH: 'Length'>, 1),)¶
-
DEGREE
= (('Degree', 'deg', <Dimentionality.ANGLE: 'Angle'>, 1),)¶
-
ENERGY
= (('Energy', 'keV', <Dimentionality.WAVELENGTH: 'Wavelength'>, -1),)¶
-
INV_ANGSTROM
= (('Inverse Ångström', 'Å⁻¹', <Dimentionality.SCATTERING_VECTOR: 'Scattering vector'>, 1),)¶
-
INV_NANOMETER
= (('Inverse nanometer', 'nm⁻¹', <Dimentionality.SCATTERING_VECTOR: 'Scattering vector'>, 1),)¶
-
METER
= (('Meter', 'm', <Dimentionality.LENGTH: 'Length'>, 1),)¶
-
METER_WL
= (('Meter', 'm', <Dimentionality.WAVELENGTH: 'Wavelength'>, 1),)¶
-
MILLIMETER
= (('Millimeter', 'mm', <Dimentionality.LENGTH: 'Length'>, 1),)¶
-
PIXEL
= (('Pixel', 'px', <Dimentionality.PIXEL: 'Pixel'>, 1),)¶
-
RADIAN
= (('Radian', 'rad', <Dimentionality.ANGLE: 'Angle'>, 1),)¶
-
dimensionality
¶
-
direction
¶
-
fullname
¶
-
get_units
= <bound method Unit.get_units of <enum 'Unit'>>¶
-
symbol
¶
-
-
pyFAI.gui.utils.units.
convert
(value, inputUnit, outputUnit)¶
pyFAI.gui.utils.unitutils module¶
-
pyFAI.gui.utils.unitutils.
from2ThRad
(twoTheta, unit, wavelength=None, directDist=None, ai=None)¶
-
pyFAI.gui.utils.unitutils.
tthToRad
(twoTheta, unit, wavelength=None, directDist=None)¶ Convert a two theta angle from original unit to radian.
directDist = ai.getFit2D()[“directDist”]
pyFAI.gui.utils.validators module¶
-
class
pyFAI.gui.utils.validators.
AdvancedDoubleValidator
(parent=None)¶ Bases:
pyFAI.gui.utils.validators.DoubleValidator
Validate double values and provides features to allow or disable other things.
-
__init__
(parent=None)¶ Initialize self. See help(type(self)) for accurate signature.
-
setAllowEmpty
(allow)¶ Allow the field to be empty. Default is false.
An empty field is represented as a None value.
Parameters: allow (bool) – New state.
-
setIncludedBound
(minBoundIncluded, maxBoundIncluded)¶ Allow the include or exclude boundary ranges. Default including both boundaries.
-
toText
(value)¶ Convert the input string into an interpreted value
Parameters: value (object) – Input object Return type: str
-
toValue
(text)¶ Convert the input string into an interpreted value
Parameters: text (str) – Input string Return type: Tuple[object,bool] Returns: A tuple containing the resulting object and True if the string is valid
-
validate
(inputText, pos)¶ Reimplemented from QDoubleValidator.validate.
Allow to provide an empty value.
Parameters: - inputText (str) – Text to validate
- pos (int) – Position of the cursor
-
-
class
pyFAI.gui.utils.validators.
DoubleValidator
(parent=None)¶ Bases:
PyQt5.QtGui.QDoubleValidator
Double validator with extra feature.
The default locale used is not the default one. It uses locale C with RejectGroupSeparator option. This allows to have consistant rendering of double using dot separator without any comma.
QLocale provides an API to support or not groups on numbers. Unfortunatly the default Qt QDoubleValidator do not filter out the group character in case the locale rejected it. This implementation reject the group character from the validation, and remove it from the fixup. Only if the locale is defined to reject it.
This validator also allow to type a dot anywhere in the text. The last dot replace the previous one. In this way, it became convenient to fix the location of the dot, without complex manual manipulation of the text.
-
__init__
(parent=None)¶ Initialize self. See help(type(self)) for accurate signature.
-
fixup
(inputText)¶ Remove group characters from the input text if the locale is defined to do so.
Parameters: inputText (str) – Text to validate
-
toText
(value)¶ Convert the input string into an interpreted value
Parameters: value (object) – Input object Return type: str
-
toValue
(text)¶ Convert the input string into an interpreted value
Parameters: text (str) – Input string Return type: Tuple[object,bool] Returns: A tuple containing the resulting object and True if the string is valid
-
validate
(inputText, pos)¶ Reimplemented from QDoubleValidator.validate.
Parameters: - inputText (str) – Text to validate
- pos (int) – Position of the cursor
-
-
class
pyFAI.gui.utils.validators.
IntegerAndEmptyValidator
¶ Bases:
PyQt5.QtGui.QIntValidator
Validate double values or empty string.
-
toText
(value)¶ Convert the input string into an interpreted value
Parameters: value (object) – Input object Return type: str
-
toValue
(text)¶ Convert the input string into an interpreted value
Parameters: text (str) – Input string Return type: Tuple[object,bool] Returns: A tuple containing the resulting object and True if the string is valid
-
validate
(inputText, pos)¶ Reimplemented from QIntValidator.validate.
Allow to provide an empty value.
Parameters: - inputText (str) – Text to validate
- pos (int) – Position of the cursor
-
Module contents¶
Module providing gui util tools
-
class
pyFAI.gui.utils.
Event
(width, height)¶ Bases:
object
Dummy class for dummy things
-
__init__
(width, height)¶ Initialize self. See help(type(self)) for accurate signature.
-
-
pyFAI.gui.utils.
maximize_fig
(fig=None)¶ Try to set the figure fullscreen
-
pyFAI.gui.utils.
update_fig
(fig=None)¶ Update a matplotlib figure with a Qt4 backend
Parameters: fig – pylab figure