pyFAI.gui.widgets package
pyFAI.gui.widgets.AdvancedComboBox module
- class pyFAI.gui.widgets.AdvancedComboBox.AdvancedComboBox(parent=None)
Bases:
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, model: 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:
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
- class pyFAI.gui.widgets.CalibrantPreview.CalibrantPreview(parent=None)
Bases:
QFrame
CalibrantPreview show the rays of a calibrat at a wayvelength between 0 and Pi.
- __init__(parent=None)
- getCalibrant()
- paintEvent(self, a0: QPaintEvent)
- setCalibrant(calibrant)
- setWaveLength(waveLength)
- sizeHint(self) QSize
pyFAI.gui.widgets.CalibrantSelector module
- class pyFAI.gui.widgets.CalibrantSelector.CalibrantSelector(parent=None)
Bases:
QComboBox
Dropdown widget to select a calibrant.
It is a view on top of a calibrant model (see
setCalibrantModel()
,calibrantModel()
)The calibrant can be selected from a list of calibrant known by pyFAI.
An extra option to load a calibrant from a file can be enabled with
setFileLoadable()
. The widget does not handle the dialog or the IO but provides a signal :prop:`sigLoadFileRequested` which has to be connected.- __init__(parent=None)
- calibrantModel() CalibrantModel
- findCalibrant(calibrant)
Returns the first index containing the requested calibrant. Else return -1
- model(self) QAbstractItemModel
- setCalibrantModel(model: CalibrantModel)
- setFileLoadable(isFileLoadable)
- setModel(self, model: 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:
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
pyFAI.gui.widgets.DetectorLabel module
- class pyFAI.gui.widgets.DetectorLabel.DetectorLabel(parent=None)
Bases:
QLabel
Read-only widget to display a
Detector
.It can be setup as
a detector holder (see
setDetector()
,detector()
)a view on top of a model (see
setDetectorModel()
,detectorModel()
)
- __init__(parent=None)
- detectorModel() DetectorModel | None
- dragEnterEvent(self, a0: QDragEnterEvent)
- dropEvent(self, a0: QDropEvent)
- setDetectorModel(model: DetectorModel)
pyFAI.gui.widgets.DetectorModel module
pyFAI.gui.widgets.DetectorSelector module
- class pyFAI.gui.widgets.DetectorSelector.DetectorSelector(parent=None)
Bases:
QComboBox
- __init__(parent=None)
- findDetectorClass(detectorClass)
Returns the first index containing the requested detector. Else return -1
- model(self) QAbstractItemModel
- setManufacturerFilter(manufacturer)
- setModel(self, model: QAbstractItemModel)
pyFAI.gui.widgets.FileEdit module
- class pyFAI.gui.widgets.FileEdit.FileEdit(parent=None)
Bases:
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, a0: QDragEnterEvent)
- dropEvent(self, a0: QDropEvent)
- event(self, a0: QEvent) bool
- focusInEvent(self, a0: QFocusEvent)
- isApplyedWhenFocusOut()
- keyPressEvent(self, a0: 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
- class pyFAI.gui.widgets.FitParamView.ConstraintsPopup(parent=None)
Bases:
QFrame
- __init__(parent=None)
- fromConstaints(constraint)
Update the widget using a constraint model
- labelCenter()
- setDefaultConstraints(model)
- setLabel(text)
- setMaxFocus()
- setMinFocus()
- setUnits(internalUnit, displayedUnit)
- toConstraint(constraint)
UUpdate a constrain tmodel using the content of this widget
- class pyFAI.gui.widgets.FitParamView.FitParamView(parent, label, internalUnit, displayedUnit=None)
Bases:
QObject
- __init__(parent, label, internalUnit, displayedUnit=None)
- model()
- setConstraintsModel(model)
- setDefaultConstraintsModel(model)
- setModel(model)
- sigValueAccepted
Emitted when a quantity was accepted.
- widgets()
pyFAI.gui.widgets.GeometryHistoryComboBox module
pyFAI.gui.widgets.GeometryLabel module
- class pyFAI.gui.widgets.GeometryLabel.GeometryLabel(parent=None)
Bases:
ElidedLabel
Read-only widget to display a
GeometryModel
.a detector holder (see
setDetector()
,detector()
)a view on top of a model (see
setDetectorModel()
,detectorModel()
)
- __init__(parent=None)
- geometryModel() GeometryModel | None
Returns the geometry model
- Return type:
Union[None,GeometryModel]
- setGeometryModel(geometryModel: GeometryModel | None)
Set the geometry to display.
- Parameters:
geometryModel (GeometryModel) – A geometry.
pyFAI.gui.widgets.LoadImageToolButton module
- class pyFAI.gui.widgets.LoadImageToolButton.LoadImageToolButton(parent=None)
Bases:
QToolButton
ToolButton updating a DataModel using the selection from a file dialog.
- __init__(parent=None)
- dialogTitle()
Returns the specified dialog title
- Return type:
str
- filename()
- isEnabled(self) bool
- model()
- setDialogTitle(title)
Specify a title for the dialog
- Parameters:
title (str) – Title of the dialog
- setEnabled(self, a0: bool)
- setModel(model)
pyFAI.gui.widgets.MethodLabel module
- class pyFAI.gui.widgets.MethodLabel.MethodLabel(parent=None)
Bases:
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
pyFAI.gui.widgets.OpenClDeviceLabel module
- class pyFAI.gui.widgets.OpenClDeviceLabel.OpenClDeviceLabel(parent=None)
Bases:
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
- class pyFAI.gui.widgets.QuantityEdit.QuantityEdit(parent=None)
Bases:
QLineEdit
QLineEdit connected to a DataModel.
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.
- event(self, a0: QEvent) bool
- focusInEvent(self, a0: QFocusEvent)
- getDisplayedUnit()
- Return type:
pyFAI.gui.units.Unit
- getDisplayedUnitModel()
- Return type:
- getModelUnit()
- Return type:
pyFAI.gui.units.Unit
- isApplyedWhenFocusOut()
- keyPressEvent(self, a0: QKeyEvent)
- model()
- setApplyedWhenFocusOut(isApplyed)
- setDisplayedUnit(displayedUnit)
Set the displayed unit.
- Parameters:
displayedUnit (pyFAI.gui.units.Unit) – An unit
- setDisplayedUnitModel(displayedUnitModel)
Set the displayed unit.
- Parameters:
displayedUnitModel (pyFAI.gui.units.Unit) – A model containing a unit
- setModel(model)
- setModelUnit(modelUnit)
Set the unit of the stroed data in the model.
- Parameters:
unit (pyFAI.gui.units.Unit) – An unit
- sigValueAccepted
Emitted when a quantity 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.QuantityLabel module
- class pyFAI.gui.widgets.QuantityLabel.QuantityLabel(parent=None)
Bases:
QLabel
- __init__(parent=None)
- getDisplayedUnitModel()
- isUnitEditable()
- mouseReleaseEvent(self, ev: QMouseEvent)
- setDisplayedUnit(unit)
- setDisplayedUnitModel(model)
Set the model containing an unit.
- Parameters:
pyFAI.gui.model.DataUnit.DataUnit – Model containing the unit.
- setElasticSize(useElasticSize)
- setFloatFormatter(formatter)
Set a specific formatter for float.
If this formatter is None (default value) or the value is not a floatting point, the default formatter is used.
- setFormatter(formatter)
- setInternalUnit(unit)
- setPrefix(prefix)
- setUnitEditable(isUnitEditable)
- setValue(value)
- sizeHint(self) QSize
- usedUnit()
Returns the unit used to display the quantity
pyFAI.gui.widgets.UnitLabel module
- class pyFAI.gui.widgets.UnitLabel.UnitLabel(parent)
Bases:
QLabel
QLabel displaying an unit.
- __init__(parent)
- getUnit()
- Return type:
pyFAI.gui.units.Unit
- getUnitModel()
- Return type:
pyFAI.gui.model.DataUnit.DataUnit
- isUnitEditable()
- mouseReleaseEvent(self, ev: QMouseEvent)
- setUnit(unit)
Set the displayed unit.
- Parameters:
unit (pyFAI.gui.units.Unit) – An unit
- setUnitEditable(isUnitEditable)
- setUnitModel(model)
Set the model containing an unit.
- Parameters:
pyFAI.gui.model.DataUnit.DataUnit – Model containing the unit.
pyFAI.gui.widgets.UnitSelector module
- class pyFAI.gui.widgets.UnitSelector.UnitSelector(parent=None)
Bases:
QComboBox
- __init__(parent=None)
- findUnit(unit)
Returns the first index containing the requested detector. Else return -1
- model(self) QAbstractItemModel
- setModel(self, model: QAbstractItemModel)
- setShortNameDisplay(shortName)
- setUnits(units)
- units()
pyFAI.gui.widgets.WorkerConfigurator module
Module containing a widget to configure pyFAI integration.
- class pyFAI.gui.widgets.WorkerConfigurator.WorkerConfigurator(parent=None)
Bases:
QWidget
Frame displaying integration configuration which can be used as input param of the ~`pyFAI.worker.Worker`.
- __init__(parent=None)
- getConfig()
Read the configuration of the plugin and returns it as a dictionary
- Returns:
dict with all information.
- getOpenFileName(title)
Display a dialog to select a filename and return it.
Returns None if nothing selected.
This code is compatible PyQt4/PyQt5 which is not the case for static functions provided by qt.QFileDialog.
- loadFromJsonFile(filename)
Initialize the widget using a json file.
- loadFromPoniFile(ponifile)
- selectDetector()
- selectGeometry()
- selectMethod()
- selectOpenclDevice()
- set1dIntegrationOnly(only1d)
Enable only 1D integration for this widget.
- setConfig(dico)
Setup the widget from its description
- Parameters:
dico (dict) – dictionary with description of the widget
- setDetector(detector)
Module contents
Module containing generic widgets