The widgets.parameter_config sub-package#
Package with individual QWidgets used editing pydidas Parameters.
- class pydidas.widgets.parameter_config.EditPluginParametersWidget(**kwargs: dict)#
Bases:
EmptyWidget
,ParameterWidgetsMixIn
,CreateWidgetsMixIn
The EditPluginParametersWidget widget creates the composite widget for updating and changing values of all Parameters in a Plugin.
Depending on the Parameter types, automatic typechecks are implemented.
- clear_layout()#
Clear all items from the layout and generate a new layout.
- configure_plugin(node_id: int, plugin: BasePlugin)#
Update the panel to show the Parameters of a different Plugin.
This method clears the widget and populates it again with the Parameters of the new Plugin, defined by the Plugin node_id
- Parameters:
node_id (int) – The node_id in the workflow edit tree.
plugin (BasePlugin) – The instance of the Plugin to be edited.
- class pydidas.widgets.parameter_config.ParameterEditCanvas(**kwargs: dict)#
Bases:
ParameterWidgetsMixIn
,EmptyWidget
The ParameterEditCanvas is widget for handling Parameter edit widgets.
- Parameters:
**kwargs (dict) – Additional keyword arguments
- class pydidas.widgets.parameter_config.ParameterWidget(param: Parameter, **kwargs: dict)#
Bases:
EmptyWidget
A combined widget to display and modify a Parameter with name, value and unit.
This widget is a wrapper and includes labels for name and unit and the respective Parameter edit widget which is selected based on the Parameter type and choices.
This is the public widget should be added to the GUI to display and modify Parameters.
- Parameters:
param (pydidas.core.Parameter) – The associated Parameter.
**kwargs (dict) – Additional keyword arguments
- class pydidas.widgets.parameter_config.ParameterWidgetsMixIn#
Bases:
object
The ParameterWidgetsMixIn class includes methods which can be added to other classes to add functionality to create Parameter widgets and to have access to convenience functions for settings Parameter values.
- create_param_widget(param: Parameter, **kwargs: dict)#
Add a name label and input widget for a specific parameter to the widget.
- Parameters:
param (Parameter) – A Parameter class instance.
**kwargs (dict) – Optional keyword arguments.
- Keyword Arguments:
gridPos (tuple, optional) – The grid position in the layout. The default is (-1, 0, 1, 1)
width_text (float, optional) – The relative width of the text field for the Parameter name. The default is 0.5.
width_unit (float, optional) – The relative width of the text field for the Parameter unit. The default is 0.07.
width_io (int, optional) – The relative width of the input widget. The default is 0.43.
linebreak (bool, optional) – Keyword to toggle a line break between the text label and the input widget. The default is False.
halign_io (QtCore.Qt.Alignment, optional) – The horizontal alignment for the input widget. The default is QtCore.Qt.AlignRight.
halign_text (QtCore.Qt.Alignment, optional) – The horizontal alignment for the text (label) widget. The default is QtCore.Qt.AlignRight.
parent_widget (Union[QWidget, str, None], optional) – The widget to which the label is added. If a string, this picks up the calling class’s ._widgets dictionary and selects the string key’s value. The default is self.
- set_param_value_and_widget(key: str, value: object)#
Update a parameter value both in the Parameter and the widget.
This method will update the parameter referenced by <key> and update both the Parameter.value as well as the displayed widget entry.
- Parameters:
key (str) – The reference key for the Parameter.
value (object) – The new parameter value. This must be of the same type as the Parameter datatype.
- Raises:
KeyError – If no parameter or widget has been registered with this key.
- toggle_param_widget_visibility(key: str, visible: bool)#
Toggle the visibility of widgets referenced with key.
This method allows to show/hide the label and input widget for a parameter referenced with <key>.
- Parameters:
key (str) – The reference key for the Parameter..
visible (bool) – The boolean setting for the visibility.
- Raises:
KeyError – If no widget has been registered with this key.
- update_widget_value(param_key: str, value: object)#
Update the value stored in a widget without changing the Parameter.
- Parameters:
param_key (str) – The Parameter reference key.
value (object) – The value. The type depends on the Parameter’s value.