capsul.qt_gui module¶

Graphical representations and tools for processes and pipelines. The module contains mainly widgets, based on Qt, using either PyQt4, PyQt5 or PySide.
capsul.qt_gui.board_widget submodule¶
Classes¶
BoardWidget
¶
-
class
capsul.qt_gui.board_widget.
BoardWidget
(controller, parent=None, name=None)[source]¶ Class that create a widget to visualize the controller status.
Method to initilaize the ControllerWidget class.
Parameters: -
browse_node
(node, process_nodes, view_nodes, parent_pipeline)[source]¶ Find view_node and leaf nodes, ie. Process nodes
Parameters:
-
create_board_tree
()[source]¶ Method to create a tree with five columns (processings - status - execution time - memory - logs) that will summarize all the available quality control nodes
-
capsul.qt_gui.widgets.activation_inspector submodule¶
A tool to debug and inspect nodes activation / deactivation in a pipeline.
Classes¶
ActivationInspector
¶
-
class
capsul.qt_gui.widgets.activation_inspector.
ActivationInspector
(pipeline, ui_file=None, record_file=None, developper_view=None, parent=None)[source]¶ A Widget to display the pipeline activation process step by step.
Initialize the ActivationInspector class.
Parameters: - pipeline (capsul.Pipeline (mandatory)) – the pipeline we want to inspect.
- ui_file (str (optional)) – the path to the qt user interface description file. If not specified, it will find its standard one.
- record_file (str (optional)) – a file path where the activation steps are recorded. If not specified (None), it will create a temporary file.
- developper_view (PipelineDevelopperView (optional)) – if specified it is possible to click on a plug to set a filter pattern and to update the pipeline activation accordingly.
-
find_next
()[source]¶ Forward search for a pattern in the activation list.
Returns: is_found – 1 if a match has been found, 0 otherwise. Return type: int
-
find_previous
()[source]¶ Backward search for a pattern in the activation list.
Returns: is_found – True if a match has been found, False otherwise. Return type: bool
-
refresh_activation_from_record
()[source]¶ Method to display pipeline activation steps from the recorded file.
-
class
capsul.qt_gui.widgets.activation_inspector.
ActivationInspectorApp
(pipeline_path, record_file=None, *args, **kwargs)[source]¶ ActivationInspector Application. While developing a pipeline, nodes are connected through links. Nodes will be automatically activated or disabled depending on their connections (a mandatory link to a disabled node will disable the current one). You will often wonder why a node will not be activated. This tool helps to determine when and why by “playing” activation rules sequences step-by-step and displaying nodes which activate or deactivate at each step.
Method to initialize the ActivationInspectorApp class.
Parameters:
capsul.qt_gui.widgets.attributed_process_widget submodule¶
Process or pipeline parameters view with attributes handling.
Classes¶
AttributedProcessWidget
¶
-
class
capsul.qt_gui.widgets.attributed_process_widget.
AttributedProcessWidget
(attributed_process, enable_attr_from_filename=False, enable_load_buttons=False, override_control_types=None, separate_outputs=True, user_data=None, userlevel=0, scroll=True)[source]¶ Process interface with attributes completion handling
Parameters: - attributed_process (Process instance) – process with attributes to be displayed
- enable_attr_from_filename (bool (optional)) – if enabled, it will be possible to specify an input filename to build attributes from
- override_control_types (dict (optional)) – if given, this is a “factory” dict assigning new controller editor types to some traits types in the parameters controller.
- separate_outputs (bool) – if True, inputs and outputs (traits with output=True set) will be separated into two boxes.
- user_data (any type (optional)) – optional user data that can be accessed by individual control editors
- userlevel (int) – the current user level: some traits may be marked with a non-zero userlevel, and will only be visible if the ControllerWidget userlevel is more than (or equal) the trait level.
- scroll (bool) – if True, the widget includes scrollbars in the parameters and attributes sections when needed, otherwise it will be a fixed size widget.
capsul.qt_gui.widgets.links_debugger submodule¶
Tool to debug and understand process / pipeline parameters links
capsul.qt_gui.widgets.pipeline_developper_view submodule¶
A Pipeline structure viewer widget, which displays pipeline nodes as boxes and links as lines, and provides pipelin editor features.
The only main class you should look at is the PipelineDevelopperView
widget, the remaining is internal infrastructure:
pv = PipelineDevelopperView(pipeline, allow_open_controller=True,
enable_edition=True,show_sub_pipelines=True)
pv.show()
Classes¶
ColorType
¶
Plug
¶
boxItem
¶
NodeGWidget
¶
Link
¶
PipelineScene
¶
PipelineDevelopperView
¶
-
class
capsul.qt_gui.widgets.pipeline_developper_view.
EmbeddedSubPipelineItem
(sub_pipeline_wid)[source]¶ QGraphicsItem containing a sub-pipeline view
-
class
capsul.qt_gui.widgets.pipeline_developper_view.
HandleItem
(parent=None)[source]¶ A handle that can be moved by the mouse
-
class
capsul.qt_gui.widgets.pipeline_developper_view.
PipelineDevelopperView
(pipeline=None, parent=None, show_sub_pipelines=False, allow_open_controller=False, logical_view=False, enable_edition=False, userlevel=0)[source]¶ Pipeline representation as a graph, using boxes and arrows.
Based on Qt QGraphicsView, this can be used as a Qt QWidget.
Qt signals are emitted on a right click on a node box, and on a double click on a sub-pipeline box, to allow handling at a higher level. Default behaviors can be enabled using constructor parameters.
Ctrl + double click opens sub-pipelines in embedded views inside their parent box.
-
subpipeline_clicked
¶
-
node_right_clicked
¶
-
process_clicked
¶
-
node_clicked
¶
-
node_clicked_ctrl
¶
-
plug_clicked
¶
-
plug_right_clicked
¶
-
link_right_clicked
¶
-
colored_parameters
¶
-
scene
¶
Parameters: - pipeline (Pipeline (optional)) – pipeline object to be displayed If omitted an empty pipeline will be used, and edition mode will be activated.
- parent (QWidget (optional)) – parent widget
- show_sub_pipelines (bool (optional)) – if set, sub-pipelines will appear as red/pink boxes and a double click on one of them will open another window with the sub-pipeline structure in it
- allow_open_controller (bool (optional)) – if set, a right click on any box will open another window with the underlying node controller, allowing to see and edit parameters values, switches states, etc.
- logical_view (bool (optional)) – if set, plugs and links between plugs are hidden, only links between nodes are displayed.
- enable_edition (bool (optional)) – if set, pipeline edition features are available in GUI and menus: adding process boxes, drawing links etc. If pipeline is not specified, then edition will be activated anyway.
-
class
ProcessNameEdit
(parent=None, class_type_check=<function is_process>)[source]¶ A specialized QLineEdit with completion for process name
-
add_embedded_subpipeline
(subpipeline_name, scale=None)[source] Adds an embedded sub-pipeline inside its parent node.
-
add_iterative_process
()[source]¶ Insert an iterative process node in the pipeline. Asks for the process module/name, the node name, and iterative plugs before inserting.
-
add_node
()[source]¶ Insert a custom node in the pipeline. Asks for the node module/name, and the node name before inserting.
-
add_optional_output_switch
()[source]¶ Insert an optional output switch node in the pipeline. Asks for the switch inputs/outputs, and the node name before inserting.
-
add_process
()[source]¶ Insert a process node in the pipeline. Asks for the process module/name, and the node name before inserting.
-
add_switch
()[source]¶ Insert a switch node in the pipeline. Asks for the switch inputs/outputs, and the node name before inserting.
-
auto_dot_node_positions
()[source] Calculate pipeline nodes positions using graphviz/dot, and place the pipeline view nodes accordingly.
-
colored_parameters
= True If enabled (default), parameters in nodes boxes are displayed with color codes representing their state, and the state of their values: output parameters, empty values, existing files, non-existing files…
When colored_parameters is set, however, callbacks have to be installed to track changes in traits values, so this actually has an overhead. When colored_parameters is used, the color code is as follows:
- black pamameter name: input
- red parameter name: output
- italics parameter name: Undefined, None, or empty string value
- bold parameter name: existing file or directory name
- regular font parameter name: non-existing file, or non-file parameter type
- black plug: mandatory
- green plug: optional
- grey plug: mandatory, inactive
- light green plug: optional, inactive
- grey link: inactive
- orange link: active
- dotted line link: weak link
-
edit_sub_pipeline
¶ Signal emitted when a sub-pipeline has to be edited
-
export_to_db_scans
¶ Signal emitted when an Input Filter has to be linked to database_scans
-
is_logical_view
()[source] in logical view mode, plugs and links between plugs are hidden, only links between nodes are displayed.
-
is_restricted_edition_mode
()[source]¶ Get the restricted mode status
Returns: enabled Return type: bool
-
link_right_clicked
Signal emitted when a link is right-clicked
-
load_pipeline_parameters
(root_path='')[source]¶ Loading and setting pipeline parameters (inputs and outputs) from a Json file. :return:
-
node_clicked
Signal emitted when a node box has to be open.
-
node_clicked_ctrl
Signal emitted when a node box has to be in the foreground.
-
node_right_clicked
Signal emitted when a node box is right-clicked
-
onLoadSubPipelineClicked
(node_name, sub_pipeline, modifiers)[source] Event to load a open a sub-pipeline view. If ctrl is pressed the new view will be embedded in its parent node box.
-
onOpenProcessController
(node_name, process)[source] Event to open a sub-process/sub-pipeline controller
Open the right-click menu when triggered from the pipeline backround.
-
open_filter
¶ Signal emitted when an Input Filter has to be opened
right-click popup menu for nodes
-
plug_clicked
Signal emitted when a plug is clicked
-
plug_right_clicked
Signal emitted when a plug is right-clicked
-
release_pipeline
(delete=False)[source]¶ Releases the pipeline currently viewed (and remove the callbacks)
If
delete
is set, this means the view is within deletion process and a new scene should not be built
-
reset_initial_nodes_positions
()[source] Set each pipeline node to its “saved” position, ie the one which may be found in the “node_position” variable of the pipeline.
-
save_dot_image_ui
()[source] Ask for a filename using the file dialog, and save a graphviz/dot representation of the pipeline. The pipeline representation follows the current visualization mode (“regular” or “logical” with smaller boxes) with one link of a given type (active, weak) between two given boxes: all parameters are not represented.
-
save_pipeline
()[source]¶ Ask for a filename using the file dialog, and save the pipeline as a XML or python file.
-
save_pipeline_parameters
()[source]¶ Saving pipeline parameters (inputs and outputs) to a Json file. :return:
-
scene
= None type – PipelineScene
the main scene.
-
set_enable_edition
(state=True)[source]¶ Set the editable state. Edition allows to modify a pipeline: adding / removing process boxes and switches, drawing links, etc.
-
set_logical_view
(state)[source] in logical view mode, plugs and links between plugs are hidden, only links between nodes are displayed.
Parameters: state (bool (mandatory)) – to set/unset the logical view mode
-
set_pipeline
(pipeline)[source] Assigns a new pipeline to the view.
-
set_restricted_edition_mode
(enabled)[source]¶ Set the restricted edition mode. In restricted mode, some background menu actions (“add process”, “open node controller”…) are not available.
Parameters: enabled (bool) –
-
subpipeline_clicked
Signal emitted when a sub pipeline has to be open.
-
switch_clicked
¶ Signal emitted when a switch box has to be open.
-
window
()[source] window() is overloaded from QWidget.window() to handle embedded views cases. A PipelineDevelopperView may be displayed inside a NodeGWidget. In this case, we want to go up to the parent scene’s window to the “real” top window, where QWidget.window() will end in the current graphics scene.
-
zoom_in
()[source] Zoom the view in, applying a 1.2 zoom factor
-
zoom_out
()[source] Zoom the view out, applying a 1/1.2 zool factor
-
capsul.qt_gui.widgets.pipeline_file_warning_widget submodule¶
GUI for pipeline file inputs/outputs checking
Classes¶
PipelineFileWarningWidget
¶
-
class
capsul.qt_gui.widgets.pipeline_file_warning_widget.
PipelineFileWarningWidget
(missing_inputs, overwritten_outputs, parent=None)[source]¶ This class is a GUI for pipeline file inputs/outputs checking.
It allows to check if there are missing inputs which may prevent the pipeline from running, or if there are already existing outputs which would be overwritten if the pipeline runs.
It will show warnings accordingly.
The widget is built from the output of
capsul.pipeline_tools.nodes_with_missing_inputs()
andcapsul.pipeline_tools.nodes_with_existing_outputs()
capsul.qt_gui.widgets.pipeline_user_view submodule¶
A widget to visualize a pipeline as a simple workflow