The widgets.workflow_edit sub-package#
Package with widgets required for editing the workflow and selecting plugins.
- class pydidas.widgets.workflow_edit.PluginCollectionBrowser(collection: PluginRegistry | None = None, **kwargs: Any)#
Bases:
WidgetFactoryMixIn,EmptyWidgetA widget allows to browse through the list of available plugins.
The PluginCollectionBrowser includes a search filter field, a QTreeView to browse through the list of available plugins, and a QTextEdit to show a description of the plugin.
- Parameters:
parent (QWidget, optional) – The parent widget. The default is None.
collection (PluginRegistry or None, optional) – The plugin collection. Normally, this defaults to the generic plugin collection and should not be changed by the user.
**kwargs (Any) – 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) None#
Display the plugin description of the selected plugin.
- Parameters:
name (str) – The name of the plugin.
- process_new_font_metrics(char_width: float, char_height: float) None#
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.PluginInWorkflowBox(plugin_name: str, widget_id: int, **kwargs: Any)#
Bases:
WidgetFactoryMixIn,QFrameWidget to represent a Plugin in the WorkflowTree.
The widget displays the 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 (Any) –
Additional supported keyword arguments are:
- parentQtWidgets.QWidget or 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 pixels.
- dragEnterEvent(event: QDragEnterEvent) None#
Enable dragging of this widget.
- Parameters:
event (QtGui.QDragEnterEvent) – The drag event.
- dropEvent(event: QDropEvent) None#
Allow dropping the widget on other WorkflowNode widgets.
- Parameters:
event (QtGui.QDropEvent) – The drop event.
- mouseMoveEvent(event: QMouseEvent) None#
Implement a mouse move event to drag the plugins to a new position in the WorkflowTree.
- Parameters:
event (QtGui.QMouseEvent) – The mouse move event.
- mousePressEvent(event: QMouseEvent) None#
Extend the generic mousePressEvent by an activation signal.
- Parameters:
event (QtGui.QMouseEvent) – The original event.
- new_widget_selected(selection: int) None#
Select or deselect the widget.
- Parameters:
selection (int) – The node ID of the currently selected widget, or -1 if no widget is selected.
- receive_consistent_signal(widget_ids: list[int]) None#
Handle the node consistent signal set the stylesheets.
- Parameters:
widget_ids (list[int]) – The widget node ID.
- receive_inconsistent_signal(widget_ids: list[int]) None#
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) None#
Update the plugin class name.
- Parameters:
plugin_name (str) – The name of the new plugin class.
- class pydidas.widgets.workflow_edit.WorkflowTreeCanvas(**kwargs: Any)#
Bases:
WidgetFactoryMixIn,QFrameThe 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 (QtWidgets.QWidget or None, optional) – The parent widget. The default is None.
- draw_connections() None#
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: QPaintEvent) None#
Overload the paintEvent to also draw lines connecting parent and child plugins.
- Parameters:
event (QtGui.QPaintEvent) – 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[tuple[int, int, int, int]]) None#
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[tuple[int, int, int, int]]) – A list with coordinate pairs to draw connections.