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__()
- 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:
ProxyAction
Create a QAction synchronized with a source action.
Some properties of the source can be overrided.
- __init__(parent, source)
- 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, text: str)
- setText(self, text: str)
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:
QObject
Provide a safe Qt object from an unsafe object.
- __init__(target)
- 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__()
- 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.
pyFAI.gui.utils.tree module
Module with list <-> tree conversion
pyFAI.gui.utils.units module
- class pyFAI.gui.utils.units.Dimentionality(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
Enum
- ANGLE = 'Angle'
- LENGTH = 'Length'
- PIXEL = 'Pixel'
- SCATTERING_VECTOR = 'Scattering vector'
- WAVELENGTH = 'Wavelength'
- property fullname
- class pyFAI.gui.utils.units.Unit(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
Enum
- 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),)
- property dimensionality
- property direction
- property fullname
- classmethod get_units(dimensionality)
- property 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:
DoubleValidator
Validate double values and provides features to allow or disable other things.
- __init__(parent=None)
- 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:
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)
- 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:
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)
- 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