User transformation widgets

If the data pipeline is supposed to take user actions from GUI, each transformation node should have a dedicated Qt widget that sets relevant transformation parameters. ParSeq offers the base class PropWidget that reduces the task of creating a widget down to instantiating Qt control elements, putting them in a Qt layout and registering them. The docstrings of the user widget class will be built by ParSeq using Sphinx documentation system into an html file that will be displayed under the corresponding widget window or in a web browser.

User transformation widgets can profit from using silx library, as ParSeq already uses it heavily. It has many widgets that are internally integrated to plotting e.g. ROIs. A good first point of interaction with silx is its collection of examples.

class parseq.gui.propWidget.PropWidget(*args: Any, **kwargs: Any)

The base class for user transformation widgets and a few internal ParSeq widgets. The main idea of this class is to automatize a number of tasks: setting GUI from data, changing transformation parameters of data from GUI, copying parameters to other data, starting transformation and inserting user changes into undo and redo lists.

__init__(parent=None, node=None)

node is the corresponding transformation node, instance of Node. This parental __init__() must be invoked in the derived classes at the top of their __init__() constructors. In the constructor of the derived class, the user should create control elements and register them by using the methods listed below.

registerPropGroup(groupWidget, widgets, caption)

Registers a group widget (QGroupBox) that contains individual widgets , each with its own data properties. This group will appear in the copy popup menu.

registerPropWidget(widgets, caption, prop, **kw)

Registers one or more widgets and connects them to one or more transformation parameters.

widget: a sequence of widgets or a single widget.

caption: str, will appear in the popup menu in its “apply to” part.

prop: str or a sequence of str, transformation parameter name(s). If the wished transformation parameter resides inside a dictionary, a chained dot notation can be used, e.g. ‘transformParams.aDict.aParam’.

Optional key words (in kw):

convertType: a Python type or a list of types, same length as prop, that is applied to the widget value.

hideEmpty: bool, applicable to edit GUI elements. If True and the prop is None or an empty str, the edit element is not visible.

emptyMeans: a value that is assigned to prop when the edit element is empty.

copyValue: a single value or a list of length of prop. When copy prop to other data items, this specific value can be copied. If copyValue is a list of length of prop, it can mix specific values and a str ‘from data’ that signals that the corresponding prop is taken from the actual data transformation parameter.

transformNames list of str The transforms to run after the given widgets have changed. Defaults to the names in self.node.transformsIn.

dataItems list of data items None (the transformation parameter will be applied to selected items) or ‘all’ (applied to all items).

registerStatusLabel(widget, prop, **kw)

Registers a status widget (typically QLabel) that gets updated when the transformation has been completed. The widget must have setData() or setText() or setValue() method.

Optional key words:

hideEmpty: same as in registerPropWidget().

textFormat: format specification, as in Python’s format() function e.g. ‘.4f’ .