The widgets.workflow_edit sub-package#

Package with widgets required for editing the workflow and selecting plugins.

class pydidas.widgets.workflow_edit.PluginCollectionBrowser(**kwargs: dict)#

Bases: CreateWidgetsMixIn, EmptyWidget

A widget allows to browse through the list of available plugins.

The PluginCollectionBrowser includes both a QTreeView to browse through the list of available plugins as well as a QTextEdit to show a description of the plugin.

Parameters:
  • parent (QWidget, optional) – The parent widget. The default is None.

  • **kwargs (dict) – Any keyword arguments. Supported keywords are generic keywords and “collection” to set the linked plugin collection. By default, this should not be changed and will default to the PluginCollection singleton.

display_plugin_description(name: str)#

Display the plugin description of the selected plugin.

Parameters:

name (str) – The name of the plugin.

class pydidas.widgets.workflow_edit.PluginInWorkflowBox(plugin_name: str, widget_id: int, **kwargs: dict)#

Bases: CreateWidgetsMixIn, QFrame

Widget to represent a Plugin in the WorkflowTree.

The widget displays plugin name, title and includes a delete button to remove the Plugin or the full branch from the workflow.

Parameters:
  • plugin_name (str) – The name of the Plugin class.

  • widget_id (int) – The widget ID. This is the same as the corresponding node ID.

  • **kwargs (dict) –

    Additional supported keyword arguments are:

    parentUnion[QtWidgets.QWidget, None], optional

    The widget’s parent. The default is None.

    labelstr, optional

    The node’s label. The default is an empty string.

    standard_sizetuple[int, int]

    The standard size in pixel.

delete()#

Send the delete request to the WorkflowTreeEditManager.

dragEnterEvent(event: QEvent)#

Enable dragging of this widget.

Parameters:

event (QtCore.QEvent) – The drag event.

dropEvent(event: QEvent)#

Allow dropping the widget on other WorkflowNode widgets.

Parameters:

event (QtCore.QEvent) – The drop event.

mouseMoveEvent(event: QEvent)#

Implement a mouse move event to drag the plugins to a new position in the WorkflowTree.

mousePressEvent(event: QMouseEvent)#

Extend the generic mousePressEvent by an activation signal.

Parameters:

event (QtCore.QEvent) – The original event.

new_widget_selected(selection: bool)#

Select or deselect the widget.

Parameters:

selection (bool) – Flag whether the widget has been selected (True) or deselected (False).

receive_consistent_signal(widget_ids: list[int])#

Handle the node consistent signal set the stylesheets.

Parameters:

widget_ids (list[int]) – The widget node ID.

receive_inconsistent_signal(widget_ids: list[int])#

Handle the node inconsistent signal set the stylesheets.

Parameters:

*widget_ids (list[int]) – The widget node IDs which are inconsistent.

update_plugin(plugin_name: str)#

Update the plugin.

Parameters:

plugin_name (str) – The type of the new plugin.

update_text(node_id: int, label: str = '')#

Update the text for node label.

Parameters:
  • node_id (int) – The unique node ID.

  • label (str, optional) – The new label for the workflow node.

class pydidas.widgets.workflow_edit.PluginRegistryTreeWidget(collection: PluginRegistry | None = None, **kwargs: dict)#

Bases: QTreeView

A QTreeView which displays all registered plugins sorted according to plugin type.

Parameters:
  • parent (Union[QWidget, None], optional) – The Qt parent widget. The default is None.

  • collection (Union[pydidas.PluginCollection, None], optional) – The plugin collection. Normally, this defaults to the generic plugin collection and should not be changed by the user.

  • **kwargs (dict) – Additional keyword arguments for widget modifications.

update_collection()#

Update the model based on the PluginCollection.

This method/slot is called for example after changing the available plugins.

update_filter(filter_text: str)#

Update the Plugin search filter.

Parameters:

filter_text (str) – The new search filter.

class pydidas.widgets.workflow_edit.SelectNewPluginWidget(collection: PluginRegistry | None = None, **kwargs: dict)#

Bases: CreateWidgetsMixIn, EmptyWidget

A widget for displaying all available Plugins and to allow the user to select one.

SelectNewPluginWidget includes a search filter field and a QTreeView which displays all the available plugins.

process_new_font_metrics(char_width: float, char_height: float)#

Adjust the window based on the new font metrics.

Parameters:
  • char_width (float) – The font width in pixels.

  • char_height (float) – The font height in pixels.

class pydidas.widgets.workflow_edit.WorkflowTreeCanvas(**kwargs: dict)#

Bases: CreateWidgetsMixIn, QFrame

The WorkflowTreeCanvas is the widget to draw the workflow tree and hold the individual plugin widgets. It is also responsible to draw the lines between plugins, if required.

Parameters:

parent (QtWidget, optional) – The parent widget. The default is None.

draw_connections()#

Draw connections between plugins.

This method will draw connections between all parent and child plugins. Relationships must be supplied through the self.update_widget_connections method.

paintEvent(event: QEvent)#

Overload the paintEvent to also draw lines connecting parent and child plugins.

Parameters:

event (QtCore.QEvent) – The calling event.

sizeHint() QSize#

Set the Qt sizeHint to be the widget’s size.

Note that the sizeHint is arbitrary large because it limits the QScrollArea’s size.

Returns:

The size of the widget.

Return type:

QtCore.QSize

update_widget_connections(widget_conns: list)#

Store updated widget connections.

This method will store updated widget connections internally and call the update method to draw these connections.

Parameters:

widget_conns (list) – A list with coordinate pairs to draw connections.