pyFAI.gui.widgets package

pyFAI.gui.widgets.AdvancedComboBox module

class pyFAI.gui.widgets.AdvancedComboBox.AdvancedComboBox(parent=None)

Bases: PyQt5.QtWidgets.QComboBox

ComboBox with other features

  • Provide a way to custom the displayed when using table view model.

  • Allow to disable hardcoded update of currentIndex.

__init__(parent=None)
initStyleOption(option)
Parameters

option (qt.QStyleOptionComboBox) – Option to initialize

paintEvent(event)
Parameters

event (qt.QPaintEvent) – Qt event

setDisplayedDataCallback(callback)

Set a callback to custom the displayed text and icon of the displayed selected item.

This was designed to be used with setModel, in case the cell to display is not part of the model provided.

Only qt.Qt.DisplayRole and qt.Qt.DecorationRole are supported.

def displayedData(widget, row, role=qt.Qt.DisplayRole):
    if role == qt.Qt.DisplayRole:
        model = widget.model()
        index0 = model.index(row, 0)
        index1 = model.index(row, 1)
        text = index0.data() + " " + index1.data()
        return text
    elif role == qt.Qt.DecorationRole:
        return None
    return None
comboBox = AdvancedComboBox()
comboBox.setModel(model)
comboBox.setDisplayedDataCallback(displayedData)
Parameters

callback (Callable(int,QVariant)) – Callback a-la Qt abstract model data. Called with the row index and the role to update the text and the icon of the displayed item.

setModel(self, QAbstractItemModel)
setUpdateCurrentIndexEnabled(enable)

Allow to disable the default behaviour of the QComboBox which update the current index to 0 when the model crow from an empty state.

pyFAI.gui.widgets.AdvancedSpinBox module

class pyFAI.gui.widgets.AdvancedSpinBox.AdvancedSpinBox(parent=None)

Bases: PyQt5.QtWidgets.QSpinBox

A spin box with a little more custom behaviour.

__init__(parent=None)
eventFilter(widget, event)
Parameters
  • widget (qt.QWidget) – The widget receiving this event

  • event (qt.QEvent) – Event received by the widget

mouseWheelEnabled()

True if the mouse wheel is used to changed the value contained by the spin box.

Return type

bool

setMouseWheelEnabled(isWheelEnabled)

Change the behaviour of the mouse wheel with the value.

Parameters

isWheelEnabled (bool) – If True the mouse wheel can be used to edit the value contained into the spin box.

pyFAI.gui.widgets.CalibrantPreview module

pyFAI.gui.widgets.CalibrantSelector module

class pyFAI.gui.widgets.CalibrantSelector.CalibrantSelector(parent=None)

Bases: PyQt5.QtWidgets.QComboBox

__init__(parent=None)
findCalibrant(calibrant)

Returns the first index containing the requested calibrant. Else return -1

model(self) QAbstractItemModel
setFileLoadable(isFileLoadable)
setModel(self, QAbstractItemModel)
sigLoadFileRequested

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

pyFAI.gui.widgets.ChoiceToolButton module

class pyFAI.gui.widgets.ChoiceToolButton.ChoiceToolButton(parent=None)

Bases: PyQt5.QtWidgets.QToolButton

ToolButton providing a set of actions to select.

The action is only triggered when the button is clicked.

The method addDefaultAction() is used to define new actions that can be selected.

__init__(parent=None)
addDefaultAction(action)

Add an action that can be selected to set the default action displayed by the tool button.

Parameters

action (qt.QAction) – An action to execute when selected on the menu and then clicked.

Return type

qt.QAction

Returns

An action triggered when the provided action is selected.

defaultAction()

Returns the default selected action.

setDefaultAction(action)

Set the default action.

Reimplement the default behaviour to avoid to add this action to the list of available actions.

setWaiting(isWaiting)

Enable a waiting state.

Parameters

isWaiting (bool) – If true switch the widget to waiting state

pyFAI.gui.widgets.ColoredCheckBox module

class pyFAI.gui.widgets.ColoredCheckBox.ColoredCheckBox(parent=None)

Bases: PyQt5.QtWidgets.QCheckBox

Check box with an explict API to change the background color of the indicator.

__init__(parent=None)
boxColor()
paintEvent(self, QPaintEvent)
setBoxColor(color)

pyFAI.gui.widgets.DetectorLabel module

class pyFAI.gui.widgets.DetectorLabel.DetectorLabel(parent=None)

Bases: PyQt5.QtWidgets.QLabel

Readonly line display

__init__(parent=None)
detector()
detectorModel()
dragEnterEvent(self, QDragEnterEvent)
dropEvent(self, QDropEvent)
setDetector(detector)
setDetectorModel(model)

pyFAI.gui.widgets.DetectorModel module

class pyFAI.gui.widgets.DetectorModel.AllDetectorModel(parent)

Bases: PyQt5.QtGui.QStandardItemModel

CLASS_ROLE = 256
MANUFACTURER_ROLE = 258
MODEL_ROLE = 257
__init__(parent)
indexFromDetector(detector, manufacturer)
class pyFAI.gui.widgets.DetectorModel.DetectorFilter(parent)

Bases: PyQt5.QtCore.QSortFilterProxyModel

__init__(parent)
filterAcceptsRow(self, int, QModelIndex) bool
indexFromDetector(detector, manufacturer)
setManufacturerFilter(manufacturer)

pyFAI.gui.widgets.DetectorSelector module

class pyFAI.gui.widgets.DetectorSelector.DetectorSelector(parent=None)

Bases: PyQt5.QtWidgets.QComboBox

__init__(parent=None)
findDetectorClass(detectorClass)

Returns the first index containing the requested detector. Else return -1

model(self) QAbstractItemModel
setManufacturerFilter(manufacturer)
setModel(self, QAbstractItemModel)

pyFAI.gui.widgets.ElidedLabel module

class pyFAI.gui.widgets.ElidedLabel.ElidedLabel(parent)

Bases: PyQt5.QtWidgets.QLabel

QLabel with an edile property.

If the value is elided, the full content is displayed as tool tip.

__init__(parent)
elideMode
pyqtProperty(type, fget=None, fset=None, freset=None, fdel=None, doc=None,

designable=True, scriptable=True, stored=True, user=False, constant=False, final=False, notify=None, revision=0) -> property attribute

type is the type of the property. It is either a type object or a string that is the name of a C++ type. freset is a function for resetting an attribute to its default value. designable sets the DESIGNABLE flag (the default is True for writable properties and False otherwise). scriptable sets the SCRIPTABLE flag. stored sets the STORED flag. user sets the USER flag. constant sets the CONSTANT flag. final sets the FINAL flag. notify is the NOTIFY signal. revision is the REVISION. The other parameters are the same as those required by the standard Python property type. Properties defined using pyqtProperty behave as both Python and Qt properties. Decorators can be used to define new properties or to modify existing ones.

getElideMode()
getText()
getToolTip()
getValueAsToolTip()
resizeEvent(self, QResizeEvent)
setElideMode(elideMode)
setFont(self, QFont)
setText(self, str)
setToolTip(self, str)
setValueAsToolTip(enabled)
text
pyqtProperty(type, fget=None, fset=None, freset=None, fdel=None, doc=None,

designable=True, scriptable=True, stored=True, user=False, constant=False, final=False, notify=None, revision=0) -> property attribute

type is the type of the property. It is either a type object or a string that is the name of a C++ type. freset is a function for resetting an attribute to its default value. designable sets the DESIGNABLE flag (the default is True for writable properties and False otherwise). scriptable sets the SCRIPTABLE flag. stored sets the STORED flag. user sets the USER flag. constant sets the CONSTANT flag. final sets the FINAL flag. notify is the NOTIFY signal. revision is the REVISION. The other parameters are the same as those required by the standard Python property type. Properties defined using pyqtProperty behave as both Python and Qt properties. Decorators can be used to define new properties or to modify existing ones.

toolTip
pyqtProperty(type, fget=None, fset=None, freset=None, fdel=None, doc=None,

designable=True, scriptable=True, stored=True, user=False, constant=False, final=False, notify=None, revision=0) -> property attribute

type is the type of the property. It is either a type object or a string that is the name of a C++ type. freset is a function for resetting an attribute to its default value. designable sets the DESIGNABLE flag (the default is True for writable properties and False otherwise). scriptable sets the SCRIPTABLE flag. stored sets the STORED flag. user sets the USER flag. constant sets the CONSTANT flag. final sets the FINAL flag. notify is the NOTIFY signal. revision is the REVISION. The other parameters are the same as those required by the standard Python property type. Properties defined using pyqtProperty behave as both Python and Qt properties. Decorators can be used to define new properties or to modify existing ones.

valueAsToolTip
pyqtProperty(type, fget=None, fset=None, freset=None, fdel=None, doc=None,

designable=True, scriptable=True, stored=True, user=False, constant=False, final=False, notify=None, revision=0) -> property attribute

type is the type of the property. It is either a type object or a string that is the name of a C++ type. freset is a function for resetting an attribute to its default value. designable sets the DESIGNABLE flag (the default is True for writable properties and False otherwise). scriptable sets the SCRIPTABLE flag. stored sets the STORED flag. user sets the USER flag. constant sets the CONSTANT flag. final sets the FINAL flag. notify is the NOTIFY signal. revision is the REVISION. The other parameters are the same as those required by the standard Python property type. Properties defined using pyqtProperty behave as both Python and Qt properties. Decorators can be used to define new properties or to modify existing ones.

pyFAI.gui.widgets.FileEdit module

class pyFAI.gui.widgets.FileEdit.FileEdit(parent=None)

Bases: PyQt5.QtWidgets.QLineEdit

QLineEdit connected to a DataModel containing a file or nothing.

It allows to edit a float value which can be nonified (by the use of an empty string).

__init__(parent=None)
applyedWhenFocusOut

Apply the current edited value to the widget when it lose the focus. By default the previous value is displayed.

dragEnterEvent(self, QDragEnterEvent)
dropEvent(self, QDropEvent)
event(self, QEvent) bool
focusInEvent(self, QFocusEvent)
isApplyedWhenFocusOut()
keyPressEvent(self, QKeyEvent)
model()
setApplyedWhenFocusOut(isApplyed)
setModel(model)
sigValueAccepted

Emitted when a file was accepted.

In case the value is still the same, no signal is sent from the DataModel, but this signal is emitted.

pyFAI.gui.widgets.FitParamView module

pyFAI.gui.widgets.GeometryHistoryComboBox module

pyFAI.gui.widgets.GeometryLabel module

class pyFAI.gui.widgets.GeometryLabel.GeometryLabel(parent=None)

Bases: pyFAI.gui.widgets.ElidedLabel.ElidedLabel

Label displaying a specific OpenCL device.

__init__(parent=None)
geometryModel()

Returns the geometry model

Return type

Union[None,GeometryModel]

setGeometryModel(geometryModel)

Set the geometry to display.

Parameters

geometryModel (GeometryModel) – A geometry.

pyFAI.gui.widgets.LoadImageToolButton module

pyFAI.gui.widgets.MethodLabel module

class pyFAI.gui.widgets.MethodLabel.MethodLabel(parent=None)

Bases: PyQt5.QtWidgets.QLabel

Readonly line display

__init__(parent=None)
labelTemplate()
method()
Return type

Union[None,method_registry.Method]

methodAvailability()
setLabelTemplate(template)

Set the template used to format the label

Parameters

template (str) – The template used to format the label

setMethod(method)
setMethodAvailability(availability)

Display or not in the widget if the method is available or not.

Parameters

availability (bool) – Display in the widget if the method is available or not.

pyFAI.gui.widgets.MonitorNameEdit module

class pyFAI.gui.widgets.MonitorNameEdit.MonitorNameEdit

Bases: PyQt5.QtWidgets.QLineEdit

QLineEdit specialied to select a monitor name from HDF5 file.

dragEnterEvent(self, QDragEnterEvent)
dropEvent(self, QDropEvent)

pyFAI.gui.widgets.OpenClDeviceLabel module

class pyFAI.gui.widgets.OpenClDeviceLabel.OpenClDeviceLabel(parent=None)

Bases: PyQt5.QtWidgets.QLabel

Label displaying a specific OpenCL device.

__init__(parent=None)
device()

Returns the selected OpenCL device.

A device can be identified as a string like ‘any’, ‘cpu’ or ‘gpu’ or a tuple containing the platform index and the device index.

Return type

Union[None,str,Tuple[int,int]]

Raises

ValueError – If no devices are selected

setDevice(device)

Select an OpenCL device displayed on this dialog.

A device can be identified as a string like ‘any’, ‘cpu’ or ‘gpu’ or a tuple containing the platform index and the device index.

If this device is available on this platform is is selected in the list. Else it is selected as a custom indexes.

Parameters

device (Union[None,str,Tuple[int,int]]) – A device.

pyFAI.gui.widgets.QuantityEdit module

pyFAI.gui.widgets.QuantityLabel module

pyFAI.gui.widgets.UnitLabel module

pyFAI.gui.widgets.UnitSelector module

class pyFAI.gui.widgets.UnitSelector.UnitSelector(parent=None)

Bases: PyQt5.QtWidgets.QComboBox

__init__(parent=None)
findUnit(unit)

Returns the first index containing the requested detector. Else return -1

model(self) QAbstractItemModel
setModel(self, QAbstractItemModel)
setShortNameDisplay(shortName)
setUnits(units)
units()

pyFAI.gui.widgets.WorkerConfigurator module

Module contents

Module containing generic widgets