# 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)

    Initialize self. See help(type(self)) for accurate signature.

  `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)

    Initialize self. See help(type(self)) for accurate signature.

  `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: `PyQt5.QtWidgets.QFrame`

  CalibrantPreview show the rays of a calibrat at a wayvelength between 0 and Pi.

  `__init__`(parent=None)

    Initialize self. See help(type(self)) for accurate signature.

  `getCalibrant`()
  `paintEvent`(self, QPaintEvent)
  `setCalibrant`(calibrant)
  `setWaveLength`(waveLength)
  `sizeHint`(self) → QSize

## pyFAI.gui.widgets.CalibrantSelector module

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

  Bases: `PyQt5.QtWidgets.QComboBox`

  `__init__`(parent=None)

    Initialize self. See help(type(self)) for accurate signature.

  `findCalibrant`(calibrant)

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

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

## 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)

    Initialize self. See help(type(self)) for accurate signature.

  `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)

    Initialize self. See help(type(self)) for accurate signature.

  `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)

    Initialize self. See help(type(self)) for accurate signature.

  `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)

    Initialize self. See help(type(self)) for accurate signature.

  `indexFromDetector`(detector, manufacturer)

class `pyFAI.gui.widgets.DetectorModel.``DetectorFilter`(parent)

  Bases: `PyQt5.QtCore.QSortFilterProxyModel`

  `__init__`(parent)

    Initialize self. See help(type(self)) for accurate signature.

  `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)

    Initialize self. See help(type(self)) for accurate signature.

  `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)

    Initialize self. See help(type(self)) for accurate signature.

  `elideMode`
  `getElideMode`()
  `getText`()
  `getToolTip`()
  `getValueAsToolTip`()
  `resizeEvent`(self, QResizeEvent)
  `setElideMode`(elideMode)
  `setFont`(self, QFont)
  `setText`(self, str)
  `setToolTip`(self, str)
  `setValueAsToolTip`(enabled)
  `text`
  `toolTip`
  `valueAsToolTip`

## 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)

    Initialize self. See help(type(self)) for accurate signature.

  `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

class `pyFAI.gui.widgets.FitParamView.``ConstraintsPopup`(parent=None)

  Bases: `PyQt5.QtWidgets.QFrame`

  `__init__`(parent=None)

    Initialize self. See help(type(self)) for accurate signature.

  `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: `PyQt5.QtCore.QObject`

  `__init__`(parent, label, internalUnit, displayedUnit=None)

    Initialize self. See help(type(self)) for accurate signature.

  `model`()
  `setConstraintsModel`(model)
  `setDefaultConstraintsModel`(model)
  `setModel`(model)
  `sigValueAccepted`

    Emitted when a quantity was accepted.

  `widgets`()

## pyFAI.gui.widgets.GeometryHistoryComboBox module

class `pyFAI.gui.widgets.GeometryHistoryComboBox.``GeometryHistoryComboBox`(parent=None)

  Bases: `pyFAI.gui.widgets.AdvancedComboBox.AdvancedComboBox`

  `__init__`(parent=None)

    Initialize self. See help(type(self)) for accurate signature.

  `currentItem`()
  `setAngleUnit`(angleUnit)
  `setHistoryModel`(historyModel)

## 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)

    Initialize self. See help(type(self)) for accurate signature.

  `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

class `pyFAI.gui.widgets.LoadImageToolButton.``LoadImageToolButton`(parent=None)

  Bases: `PyQt5.QtWidgets.QToolButton`

  ToolButton updating a DataModel using the selection from a file dialog.

  `__init__`(parent=None)

    Initialize self. See help(type(self)) for accurate signature.

  `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, bool)
  `setModel`(model)

## pyFAI.gui.widgets.MethodLabel module

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

  Bases: `PyQt5.QtWidgets.QLabel`

  Readonly line display

  `__init__`(parent=None)

    Initialize self. See help(type(self)) for accurate signature.

  `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)

    Initialize self. See help(type(self)) for accurate signature.

  `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: `PyQt5.QtWidgets.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)

    Initialize self. See help(type(self)) for accurate signature.

  `applyedWhenFocusOut`

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

  `event`(self, QEvent) → bool
  `focusInEvent`(self, QFocusEvent)
  `getDisplayedUnit`()

    Return type: | pyFAI.gui.units.Unit

  `getDisplayedUnitModel`()

    Return type: | pyFAI.gui.model.DataModel.DataModel

  `getModelUnit`()

    Return type: | pyFAI.gui.units.Unit

  `isApplyedWhenFocusOut`()
  `keyPressEvent`(self, 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: `PyQt5.QtWidgets.QLabel`

  `__init__`(parent=None)

    Initialize self. See help(type(self)) for accurate signature.

  `getDisplayedUnitModel`()
  `isUnitEditable`()
  `mouseReleaseEvent`(self, 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: `PyQt5.QtWidgets.QLabel`

  QLabel displaying an unit.

  `__init__`(parent)

    Initialize self. See help(type(self)) for accurate signature.

  `getUnit`()

    Return type: | pyFAI.gui.units.Unit

  `getUnitModel`()

    Return type: | pyFAI.gui.model.DataUnit.DataUnit

  `isUnitEditable`()
  `mouseReleaseEvent`(self, 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: `PyQt5.QtWidgets.QComboBox`

  `__init__`(parent=None)

    Initialize self. See help(type(self)) for accurate signature.

  `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 containing a widget to configure pyFAI integration.

class `pyFAI.gui.widgets.WorkerConfigurator.``WorkerConfigurator`(parent=None)

  Bases: `PyQt5.QtWidgets.QWidget`

  Frame displaying integration configuration which can be used as input param of the ~`pyFAI.worker.Worker`.

  `__init__`(parent=None)

    Initialize self. See help(type(self)) for accurate signature.

  `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