populse_mia.user_interface.pipeline_manager.pipeline_editor

Module that executes the actions in the pipeline manager menu and allows to graphically modify a pipeline.

Functions

find_filename(paths_list, packages_list, ...)

Locate a pipeline file within configured paths.

get_path(name, dictionary[, prev_paths, pckg])

Recursively search for a module name inside a nested dictionary structure and return its full path as a list of keys.

save_pipeline(pipeline, filename)

Save a pipeline to a file in the appropriate format.

Classes

PipelineEditor(project, main_window)

Graphical editor for creating, editing, and managing pipelines.

PipelineEditorTabs(project, scan_list, ...)

Tab widget for managing multiple pipeline editors.

class populse_mia.user_interface.pipeline_manager.pipeline_editor.PipelineEditor(project, main_window)[source]

Bases: PipelineDeveloperView

Graphical editor for creating, editing, and managing pipelines.

This view provides interactive tools to build pipeline graphs, connect nodes and plugs, edit node properties, and track modifications. It also handles persistence (save/export) and undo/redo history management.

Contains:

Methods:

  • _del_link: Deletes a link.

  • _export_plug: Export a plug to a pipeline global input or output.

  • _release_grab_link: Method called when a link is released.

  • _remove_plug: Removes a plug.

  • add_link: Add a link between two nodes.

  • add_named_process: Adds a process to the pipeline.

  • check_modifications: Checks if the nodes of the pipeline have been modified.

  • del_node: Deletes a node.

  • export_node_plugs: Exports all the plugs of a node.

  • get_current_filename: Returns the relative path the pipeline was last saved to. Empty if never saved.

  • save_pipeline: Saves the pipeline.

  • update_history: Updates the history for undos and redos.

  • update_node_name: Updates a node name.

  • update_plug_value: Updates a plug value.

Signals:

  • pipeline_modified: Signal emitted when the pipeline is modified.

  • pipeline_saved: Signal emitted when the pipeline is saved.

__init__(project, main_window)[source]

Initialize the PipelineEditor for visual pipeline development.

Sets up the pipeline editor with project context and initializes undo/redo functionality.

Parameters:
  • project – The current project instance containing pipeline data and configuration.

  • main_window – The main application window instance for UI integration.

Delete a link between two pipeline nodes.

Removes a connection between a source node’s output plug and a destination node’s input plug, updates the pipeline state, and records the action in history.

Parameters:
  • link – Link specification string in the format “source_node.output_plug->dest_node.input_plug”. If None, uses the current link stored in self._current_link.

  • from_undo – Whether this deletion is being performed as part of an undo operation. Affects history recording.

  • from_redo – Whether this deletion is being performed as part of a redo operation. Affects history recording.

Side Effects:
  • Updates self._current_link to the deleted link.

  • Modifies self._current_link_def with link component references.

  • Calls parent class’s _del_link() to perform actual deletion.

  • Records action in history unless from undo/redo.

_export_plug(pipeline_parameter=None, optional=None, weak_link=None, from_undo=False, from_redo=False, temp_plug_name=None, multi_export=False)[source]

Export a plug to a pipeline global input or output.

This method exports a node plug to the pipeline level, making it accessible as a pipeline parameter. It handles name conflicts, creates appropriate links, and maintains operation history for undo/redo functionality.

Parameters:
  • pipeline_parameter – (str) Name for the exported pipeline parameter. If None, prompts user for a name via dialog. Defaults to None.

  • optional – (bool) Whether the exported plug is optional. If None, derived from dialog checkbox or plug configuration. Defaults to None.

  • weak_link – (bool) Whether to create a weak link (doesn’t enforce execution order). If None, derived from dialog or defaults to False.

  • from_undo – (bool) True when called during an undo operation. Used to prevent circular history updates. Defaults to False.

  • from_redo – (bool) True when called during a redo operation. Used to prevent circular history updates. Defaults to False.

  • temp_plug_name – (tuple) A (node_name, plug_name) tuple specifying the plug to export. If None, uses self._temp_plug_name. Defaults to None.

  • multi_export – (bool) True when exporting multiple plugs simultaneously. Changes return behavior and error handling. Defaults to False.

Returns:

(str) When multi_export is True, returns the plug name on success or None on failure. When multi_export is False, returns None after updating the UI and history.

Raises:
  • TraitError – Logged as warning when plug export fails due to trait issues.

  • ValueError – Logged as warning when export fails due to invalid values.

Side Effects:
  • May display dialog boxes for user input.

  • Updates pipeline structure and UI.

  • Adds entry to operation history (unless from_undo/from_redo).

  • Shows status message in main window.

Handle link release event and update pipeline history.

Called when a user releases a link in the pipeline editor. This method extends the parent class behavior by recording the link addition in the history and displaying a status message.

Parameters:

event – Mouse event corresponding to the link release.

_remove_plug(plug_names=None, from_undo=False, from_redo=False, from_export_plugs=False)[source]

Remove one or more plugs from the pipeline.

This method removes plugs from the pipeline, tracks their connections for potential undo/redo operations, and updates the application history unless called from an export operation.

Parameters:
  • plug_names – A tuple (node_name, plug_name) or list of such tuples specifying the plug(s) to remove. If None, uses self._temp_plug_name.

  • from_undo – Whether this method is being called from an undo operation.

  • from_redo – Whether this method is being called from a redo operation.

  • from_export_plugs – Whether this method is being called from an export plugs undo/redo operation. When True, history is not updated.

Note

For each removed plug, stores [plug_info, connected_plugs, optional_flag] in the history for potential restoration.

Add a link between two nodes in the pipeline.

Creates a connection between a source node’s output plug and a destination node’s input plug. The link is represented as “node.plug->node.plug” format and added to the pipeline scene.

Parameters:
  • source – A tuple of (node_name, plug_name) for the source connection.

  • dest – A tuple of (node_name, plug_name) for the destination connection.

  • active – Whether the link is currently active/enabled.

  • weak – Whether the link is a weak reference that doesn’t enforce strict execution dependencies.

  • from_undo – Whether this action originates from an undo operation. Defaults to False.

  • from_redo – Whether this action originates from a redo operation. Defaults to False.

  • allow_export – Whether to allow this link in exported pipelines. Defaults to False.

Side Effects:
  • Adds the link to the pipeline scene.

  • Updates the pipeline visualization.

  • Records the action in history (unless from undo/redo).

  • Displays a status message in the main window.

add_named_process(class_process, node_name=None, from_undo=False, from_redo=False, links=None)[source]

Add a process to the pipeline with optional link restoration.

This method adds a named process to the pipeline and configures it according to project settings. It also handles link restoration when the action is part of an undo/redo operation.

Parameters:
  • class_process – (str) The name of the process class to instantiate.

  • node_name – (str) Custom name for the node. If None, the name is derived from the process’s context_name or name attribute. Defaults to None.

  • from_undo – (bool) Whether this action is part of an undo operation. Defaults to False.

  • from_redo – (bool) Whether this action is part of a redo operation. Defaults to False.

  • links – (list) List of link tuples to restore, where each tuple contains (source, dest, active, weak). Used during undo/redo operations. Defaults to None.

Side Effects:
  • Adds process to the pipeline.

  • Configures project settings if applicable.

  • Restores links if provided.

  • Updates history for undo/redo.

  • Updates UI status bar and buttons.

check_modifications()[source]

Check and update pipeline nodes that have been modified.

This method iterates through all pipeline nodes and detects if the underlying process definition has changed (added/removed inputs/outputs).

When changes are detected, it:
  • Recreates the node with the updated process definition.

  • Preserves the node’s position in the scene.

  • Attempts to restore compatible links.

  • Removes incompatible links and notifies the user.

Side Effects:

Modifies self.scene.gnodes, self.scene.glinks, and pipeline.nodes. Displays a warning dialog if any links are removed.

del_node(node_name=None, from_undo=False, from_redo=False)[source]

Deletes a node from the pipeline and updates the GUI and history accordingly.

Parameters:
  • node_name – (str) The name of the node to delete. If not provided, the currently selected node is used.

  • from_undo – (bool) True if the deletion was triggered by an undo operation.

  • from_redo – (bool) True if the deletion was triggered by a redo operation.

export_node_plugs(node_name, inputs=True, outputs=True, optional=False, from_undo=False, from_redo=False)[source]

Export plugs (parameters) from a pipeline node to make them available externally.

This method identifies and exports node plugs that meet the specified criteria (input/output type, optional status, unlinked status) and are not in the pipeline’s exclusion list.

Parameters:
  • node_name – Name of the node whose plugs should be exported.

  • inputs – Whether to export input plugs. Defaults to True.

  • outputs – Whether to export output plugs. Defaults to True.

  • optional – Whether to include optional plugs in the export. Defaults to False.

  • from_undo – Whether this call originates from an undo operation. Defaults to False.

  • from_redo – Whether this call originates from a redo operation. Defaults to False.

Note

  • Only unlinked plugs are exported (outputs without links_to, inputs without links_from).

  • Certain system plugs are automatically excluded (nodes_activation, selection_changed, etc.).

  • The operation is recorded in the history for undo/redo support.

get_current_filename()[source]

Return the relative path to the last saved pipeline file.

Returns the relative path from the current working directory to the file where this pipeline was most recently saved. If the pipeline has never been saved, returns an empty string.

Returns:

(str) Relative path to the pipeline file, or empty string if never saved.

save_pipeline(filename=None)[source]

Save the pipeline to a Python file.

This method saves the current pipeline configuration to a file. If no filename is provided, it prompts the user with a file dialog. The method performs validation to ensure the filename is valid (doesn’t start with a digit, has .py extension) and checks user permissions.

Parameters:

filename – (str) Path where the pipeline should be saved. If None, a file dialog will be shown. Defaults to None.

Returns:

(str) The absolute path of the saved pipeline file, or None if:

  • The pipeline is empty (fewer than 2 nodes).

  • The user cancelled the save dialog.

  • The filename is invalid.

  • The user lacks permission to overwrite an existing file.

Note

  • pipeline_saved: Signal emitted with the filename when save is successful.

Contains:

Inner functions:

_show_warning: Display a warning message box to the user.

update_history(history_maker, from_undo, from_redo)[source]

Update the undo/redo history after a pipeline action.

Manages the undo and redo stacks based on the action performed. When an action is undone, it’s moved to the redo stack. When a new action is performed (not from undo/redo), it’s added to the undo stack and complementary redo entries are cleaned up to maintain consistency.

Parameters:
  • history_maker – A list describing the action, where history_maker[0] is the action type (e.g., ‘add_process’, ‘delete_process’, ‘update_node_name’) and history_maker[1] is typically the affected node identifier.

  • from_undo – (bool) Whether this update stems from an undo operation. Defaults to False.

  • from_redo – (bool) Whether this update stems from a redo operation. Defaults to False.

Note

  • ‘update_node_name’ actions are not added to the undo stack.

  • Complementary actions (add/delete for the same process) are removed from the redo stack when a new action occurs.

  • pipeline_modified: Signal emitted indicating the pipeline has been modified.

update_node_name(old_node, old_node_name, new_node_name, from_undo=False, from_redo=False)[source]

Update a node’s name in the pipeline, preserving all connections.

This method renames a node by:
  1. Temporarily removing all links connected to the node.

  2. Renaming the node in the pipeline.

  3. Restoring all links with the updated node name.

  4. Recording the action in the history for undo/redo support.

Parameters:
  • old_node – The node object to rename.

  • old_node_name – The current name of the node.

  • new_node_name – The desired new name for the node.

  • from_undo – Whether this action is being performed as part of an undo operation. Defaults to False.

  • from_redo – Whether this action is being performed as part of a redo operation. Defaults to False.

Side Effects:
  • Updates the pipeline’s node registry.

  • Removes and recreates all links connected to the node.

  • Updates pipeline activation states.

  • Records action in history.

  • Displays status message to user.

update_plug_value(node_name, new_value, plug_name, value_type, from_undo=False, from_redo=False)[source]

Update a node’s plug value and record the change in history.

Updates the specified plug on the given node with a new value. The update is recorded in the history for undo/redo operations unless it’s already part of an undo/redo action.

Parameters:
  • node_name – The name of the node containing the plug.

  • new_value – The new value to assign to the plug. Will be cast to value_type unless from_undo or from_redo is True.

  • plug_name – The name of the plug to update.

  • value_type – The type constructor to apply to new_value (e.g., int, float, str). Ignored when from_undo or from_redo is True.

  • from_undo – If True, indicates this update is from an undo operation. Defaults to False.

  • from_redo – If True, indicates this update is from a redo operation. Defaults to False.

Side Effects:
  • Updates the plug value in the pipeline.

  • Records the change in history (unless from undo/redo).

  • Displays a status message in the main window.

  • Pops from the undo stack if from undo/redo.

class populse_mia.user_interface.pipeline_manager.pipeline_editor.PipelineEditorTabs(project, scan_list, main_window)[source]

Bases: QTabWidget

Tab widget for managing multiple pipeline editors.

This widget provides a tabbed interface for creating, editing, and managing multiple pipeline configurations. Each tab contains a PipelineEditor instance with its own undo/redo history.

Contains:

Methods:

  • check_modifications: Check if the nodes of the current pipeline have been modified.

  • close_tab: Close the selected tab and editor.

  • emit_node_clicked: Emit a signal when a node is clicked.

  • emit_pipeline_saved: Emit a signal when a pipeline is saved.

  • emit_switch_clicked: Emit a signal when a switch is clicked.

  • export_to_db_scans: Export the input of a filter to ‘database_scans’.

  • get_capsul_engine: Configure and return a CapsulEngine for the current pipeline.

  • get_current_editor: Return the instance of the current editor.

  • get_current_filename: Return the file name of the current pipeline.

  • get_current_pipeline: Return the instance of the current pipeline.

  • get_current_tab_name: Return the tab title of the current editor.

  • get_editor_by_file_name: Return the editor associated with the given pipeline filename.

  • get_editor_by_index: Retrieve an editor widget by its tab index.

  • get_editor_by_tab_name: Retrieve the editor instance associated with a specific tab name.

  • get_filename_by_index: get the pipeline filename from its index in the editors.

  • get_index_by_editor: Find the tab index for a given editor widget.

  • get_index_by_filename: Get the index of the editor corresponding to the given pipeline filename.

  • get_index_by_tab_name: Get the index of the editor corresponding to the given tab name.

  • get_tab_name_by_index: Get the tab title from its index in the editors.

  • has_pipeline_nodes: Check if any of the pipelines in the editor tabs have pipeline nodes.

  • load_pipeline: Load a new pipeline.

  • load_pipeline_parameters: Load parameters to the pipeline of the current editor.

  • new_tab: Create a new tab and a new editor.

  • open_filter: Open a filter widget.

  • open_sub_pipeline: Open a sub-pipeline in a new tab.

  • reset_pipeline: Reset the pipeline of the current editor.

  • save_pipeline: Save the pipeline of the current editor.

  • save_pipeline_parameters: Save the pipeline parameters of the current editor.

  • set_current_editor_by_editor: Set the specified editor as the currently active editor.

  • set_current_editor_by_file_name: Activate the editor tab containing the specified file.

  • set_current_editor_by_tab_name: Activate the editor tab with the specified name.

  • set_tab_index: Activate the tab at the specified index and update the current node.

  • update_iteration_checkbox: Update the iteration checkbox state based on pipeline node names.

  • update_current_node: Update the node parameters display for the current pipeline.

  • update_history: Update undo/redo history of an editor.

  • update_pipeline_editors: Update the pipeline editors after changes to the specified editor.

  • update_scans_list: Update the list of database scans in every editor.

Signals:

  • node_clicked: Signal emitted when a node is clicked in any editor.

  • pipeline_saved: Signal emitted when a pipeline is saved.

  • process_clicked: Signal emitted when a process is clicked.

  • switch_clicked: Signal emitted when a switch is clicked.

__init__(project, scan_list, main_window)[source]

Initialize the pipeline editor tabs.

Parameters:
  • project – Current project instance in the software.

  • scan_list – List of selected database files.

  • main_window – Main application window reference.

check_modifications(current_index)[source]

Check if nodes in the current pipeline have been modified.

Validates modifications when switching between pipeline tabs. Skips validation for the special “add new pipeline” tab (last position).

Parameters:

current_index – The index of the tab being switched to.

Note

The last tab (‘+’ button) may not have a widget, which is handled gracefully by catching AttributeError.

close_tab(idx)[source]

Close a tab and its associated editor, prompting to save if modified.

Removes the specified tab and cleans up its undo/redo history. If the tab contains unsaved changes (indicated by “ *” suffix), prompts the user to save before closing. If all tabs are closed, creates a new default pipeline.

Parameters:

idx – index of the tab to close.

emit_node_clicked(node_name, process)[source]

Emit the appropriate signal when a node is clicked.

Emits either process_clicked or node_clicked signal depending on whether the process parameter is a Process instance.

Parameters:
  • node_name – The name of the clicked node.

  • process – The process associated with the node. If this is a Process instance, emits process_clicked; otherwise emits node_clicked.

emit_pipeline_saved(filename)[source]

Update the current tab title and emit the pipeline_saved signal.

Parameters:

filename – Path to the saved pipeline file.

emit_switch_clicked(node_name, switch)[source]

Emit a signal when a switch is toggled.

Parameters:
  • node_name – The name of the node whose switch was clicked.

  • switch – The Switch associated with the node.

Emits:

switch_clicked: Signal containing the node name and the Switch.

export_to_db_scans(node_name)[source]

Export the input of a filter to “database_scans” plug.

If database_scans already exists as a pipeline parameter, creates a link from database_scans to the node’s input. Otherwise, exports the node’s input parameter as database_scans at the pipeline level.

Parameters:

node_name – Name of the node whose input should be exported.

Note

This method automatically updates the editor scene after modification.

get_capsul_engine()[source]

Configure and return a CapsulEngine for the current pipeline.

Retrieves a CapsulEngine instance from the MIA configuration and sets up the study configuration with project-specific directories. If the current pipeline has completion attributes, they are preserved during the engine setup process.

Returns:

(CapsulEngine) Configured engine instance with study directories set to the project’s raw_data and derived_data folders.

Note

This method temporarily saves and restores completion engine attributes to prevent loss of configuration when switching between pipelines.

get_current_editor()[source]

Return the editor corresponding to the currently selected tab.

Returns:

Editor instance for the active tab.

get_current_filename()[source]

Return the relative path of the file last saved in the current editor.

If the pipeline has never been saved, the current tab title is returned.

Returns:

The filename for the current editor.

get_current_pipeline()[source]

Return the pipeline associated with the current editor.

Returns None if no editor or scene is available.

Returns:

The pipeline for the current editor

get_current_tab_name()[source]

Return the name of the currently selected tab.

Trailing “*” and “&” characters are stripped.

Returns:

The current tab name.

get_editor_by_file_name(file_name)[source]

Return the editor associated with the given pipeline filename.

The filename corresponds to the last saved location of the pipeline.

Parameters:

file_name – Name of the file the pipeline was last saved to.

Returns:

The editor corresponding to the file name.

get_editor_by_index(idx)[source]

Retrieve an editor widget by its tab index.

Parameters:

idx – Zero-based index of the editor tab, or None if not found.

Returns:

The editor widget at the specified index, or None if idx is None or if the index corresponds to the “add tab” button (last tab) or if index out of range.

Note

The last tab position is reserved for the “add tab” button and does not contain an editor widget.

get_editor_by_tab_name(tab_name)[source]

Retrieve the editor instance associated with a specific tab name.

Parameters:

tab_name – (str) The name of the tab to search for.

Returns:

The editor instance corresponding to the specified tab name, or None if the tab is not found.

Raises:
  • ValueError – If tab_name is empty or None.

  • KeyError – If no tab exists with the given name.

get_filename_by_index(idx)[source]

Get the filename for the pipeline at the specified editor index.

Returns the relative path to the file where the pipeline was last saved. If the pipeline has never been saved, returns the tab title instead.

Parameters:

idx – The zero-based index of the editor tab.

Returns:

(str or None) The filename or tab title if the editor exists, None if no editor exists at the given index.

get_index_by_editor(editor)[source]

Find the tab index for a given editor widget.

Parameters:

editor – The pipeline editor widget to locate.

Returns:

The zero-based index of the editor’s tab, or None if not found.

Note

Searches all tabs except the last one (count() - 1).

get_index_by_filename(filename)[source]

Get the index of the first tab with the specified filename.

Parameters:

filename – (str) The pipeline filename to search for. Can be an absolute or relative path; will be normalized to relative.

Returns:

(int) The zero-based index of the matching tab, or None if no match is found.

Note

Filenames are internally stored as relative paths for consistency. Only searches up to count() - 1 to exclude special tabs if any.

get_index_by_tab_name(tab_name)[source]

Find the index of a tab by its name.

Searches through all tabs (excluding the last one) to find a tab matching the given name.

Parameters:

tab_name – (str) The name of the tab to locate.

Returns:

(int) The zero-based index of the matching tab, or None if no match is found.

get_tab_name_by_index(idx)[source]

Get the clean tab name at the specified index.

Retrieves the tab text at the given index and removes formatting characters:

  • Qt keyboard shortcut indicators (ampersands).

  • Unsaved file indicators (trailing “ *”).

Parameters:

idx – Zero-based index of the tab.

Returns:

(str) The cleaned tab name, or None if the index is invalid or corresponds to the “add tab” button (last position).

has_pipeline_nodes()[source]

Check if any pipeline in the editor tabs contains nodes.

Iterates through all tab widgets and checks if any pipeline editor contains nodes by examining the presence of plugs in the pipeline’s root node.

Returns:

(bool) True if at least one pipeline contains nodes, False otherwise.

load_pipeline(filename=None)[source]

Load a pipeline into the editor.

Opens a pipeline file in a new or existing tab. If the pipeline is already open, switches to that tab. If the current tab is not empty, creates a new tab for the pipeline.

Parameters:

filename – (str) Path to the pipeline file to load. If None, prompts the user to select a file. Defaults to None.

Returns:

(None) Returns early on success, or cleans up and returns on failure.

Note

This method is also called from open_sub_pipeline with a filename.

load_pipeline_parameters()[source]

Load pipeline parameters for the current editor.

Opens a file dialog in the user’s home directory to select a JSON file containing pipeline configuration parameters, then loads those parameters into the currently active editor’s pipeline.

new_tab()[source]

Create and initialize a new pipeline editor tab.

Creates a new PipelineEditor instance, connects all necessary signals, initializes its state, generates a unique tab name, and makes it the current tab. The new tab is inserted at the last tab position.

The tab name follows the pattern “New Pipeline {n}” where n is the first available index from 1 to 49.

open_filter(node_name)[source]

Open a filter widget for the specified pipeline node.

Creates and displays a FilterWidget instance for filtering data associated with the given node in the current pipeline.

Parameters:

node_name – The name of the node to apply filters to.

open_sub_pipeline(sub_pipeline)[source]

Open a sub-pipeline in a new tab.

This method locates and loads a sub-pipeline by:
  1. Reading the process configuration to find package paths.

  2. Determining the pipeline’s source package (mia_processes or custom).

  3. Resolving the full filesystem path to the pipeline file.

  4. Loading the pipeline in a new tab.

Parameters:

sub_pipeline – The pipeline object to open. Must have a ‘name’ attribute and ‘__module__’ attribute for package resolution.

reset_pipeline()[source]

Reset and refresh the currently active editor’s pipeline display.

This triggers an asynchronous update of the pipeline view after a short delay (20ms). The update strategy depends on the editor’s view mode:

  • Logical view: Displays logical representations of nodes, plugs, and links

  • Normal view: Displays standard representations of nodes, plugs, and links

Note

The update is performed asynchronously via a single-shot timer to allow the UI thread to remain responsive.

save_pipeline(new_file_name=None)[source]

Save the current pipeline to a file.

Performs either a “Save” or “Save As” operation depending on whether a filename is provided. Updates the tab text and emits a signal upon successful save.

Parameters:

new_file_name – (str) Target filename for the pipeline. If None, triggers a “Save As” dialog. Defaults to None.

Returns:

(str or None) The basename of the saved file if successful, None otherwise.

Side Effects:
  • Updates the current tab text with the new filename.

  • Emits pipeline_saved signal (only for explicit saves).

  • Modifies the editor’s _pipeline_filename attribute.

save_pipeline_parameters()[source]

Save pipeline parameters from the currently active editor.

Delegates the save operation to the current editor’s save method.

set_current_editor_by_editor(editor)[source]

Set the specified editor as the currently active editor.

Activates the tab containing the given editor by switching to its index.

Parameters:

editor – The editor instance to make active. Must be an editor that exists within one of the managed tabs.

set_current_editor_by_file_name(file_name)[source]

Activate the editor tab containing the specified file.

Sets the active editor tab to the one associated with the given file name, typically used when reopening a previously saved pipeline.

Parame file_name:

The name of the file whose editor tab should be activated.

set_current_editor_by_tab_name(tab_name)[source]

Activate the editor tab with the specified name.

Parameters:

tab_name – The display name of the tab to activate.

set_tab_index(index)[source]

Activate the tab at the specified index and update the current node.

Sets the active tab, stores it as the previous index for navigation history, and updates the current node state for the newly active editor.

Parameters:

index – The zero-based index of the tab to activate.

update_iteration_checkbox()[source]

Update the iteration checkbox state based on pipeline node names.

Sets the iteration checkbox to checked if any pipeline node has ‘iterated_’ in its key name, otherwise sets it to unchecked. If no valid pipeline exists or the pipeline lacks nodes, the checkbox is unchecked.

update_current_node()[source]

Update the node parameters display for the current pipeline.

Refreshes the UI to display parameters for all nodes in the current pipeline, updates user button states, iteration checkbox, and iterated tag display.

update_history(editor)[source]

Update the undo/redo history for the specified editor.

Saves the editor’s current undo and redo stacks and marks the active tab as modified by appending an asterisk to its title if not already present.

Parameters:

editor – The editor instance whose history should be saved.

Note

This method assumes the editor is in the currently active tab.

update_pipeline_editors(editor)[source]

Update the pipeline editors after changes to the specified editor.

Synchronizes the editor’s undo/redo history and refreshes the scans list to reflect any modifications made in the pipeline editor.

Parameters:

editor – The editor instance that was modified.

update_scans_list()[source]

Update the list of database scans in every pipeline editor.

Iterates through all editor tabs (excluding the last tab, reserved for the “add tab” button) and updates the database_scans attribute for each pipeline that supports it. Also refreshes the iteration checkbox state after updating.

Note

Silently continues if updating a pipeline fails, logging the error without interrupting the update process for remaining pipelines.

populse_mia.user_interface.pipeline_manager.pipeline_editor.find_filename(paths_list, packages_list, file_name)[source]

Locate a pipeline file within configured paths.

Searches for a file with the given name (with .py or .xml extension) by traversing through base paths combined with package subdirectories. Performs case-insensitive matching to handle filesystem sensitivity issues.

Parameters:
  • paths_list – Base directory paths from process_config.yml.

  • packages_list – Ordered list of package subdirectories to traverse.

  • file_name – Base name of the sub-pipeline file (without extension).

Returns:

Absolute path to the matched file, or None if not found.

populse_mia.user_interface.pipeline_manager.pipeline_editor.get_path(name, dictionary, prev_paths=None, pckg=None)[source]

Recursively search for a module name inside a nested dictionary structure and return its full path as a list of keys.

The tree is assumed to be a mapping where:
  • Intermediate nodes are dictionaries (packages),

  • Leaf nodes are strings (module names).

Parameters:
  • name – (str) Name of the module to locate in the tree.

  • dictionary – (dict) The nested dictionary representing the tree structure.

  • prev_paths – (list[str]) The accumulated path leading to the current dictionary. If None, a new path list is created.

  • pckg – (str) If provided, navigation starts inside that package name.

:Returns (list[str]) A list of keys representing the path to the module, or

None if the module is not found.

populse_mia.user_interface.pipeline_manager.pipeline_editor.save_pipeline(pipeline, filename)[source]

Save a pipeline to a file in the appropriate format.

Automatically detects the output format based on the file extension. Supported formats are Python source (.py) and XML (.xml). If no recognized extension is provided, defaults to Python format.

Parameters:
  • pipeline – The pipeline object to serialize and save.

  • filename – Path to the output file. The extension determines the output format (.py or .xml).

Note

Unrecognized extensions will default to Python source format (.py)

Examples

>>> save_pipeline(my_pipeline, "model.py")
>>> save_pipeline(my_pipeline, "config.xml")
>>> save_pipeline(my_pipeline, "output")  # Defaults to .py format