populse_mia.user_interface.pipeline_manager.process_library

Module that contains class and methods to process the different libraries of the project.

Functions

import_file(full_name, path)

Import a Python module from a specified file path.

node_structure_from_dict(datadict[, parent, ...])

Construct a hierarchical node structure from a dictionary.

Classes

DictionaryTreeModel(root[, parent])

Data model providing a tree structure for an arbitrary dictionary.

InstallProcesses(main_window, folder)

Dialog for installing Python packages from a folder or zip file.

Node(name[, parent])

A tree-like structure to manage hierarchical data with parent-child relationships.

PackageLibrary(package_tree, paths)

A tree widget that displays user-added packages and their modules.

PackageLibraryDialog([mia_main_window, parent])

Dialog for managing package library configurations.

ProcessLibrary(d, pkg_lib)

A tree view to display available Capsul's processes.

ProcessLibraryWidget([main_window])

Widget that manages the available Capsul's processes in the software.

class populse_mia.user_interface.pipeline_manager.process_library.DictionaryTreeModel(root, parent=None)[source]

Bases: QAbstractItemModel

Data model providing a tree structure for an arbitrary dictionary.

This model is designed to represent a dictionary as a tree structure, enabling interaction with the data through a tree view.

Contains:

Methods:

  • columnCount: Return always 1.

  • data: Return the data requested by the view.

  • flags: Everything is enabled and selectable, only the leaves can be dragged.

  • getNode: Return a Node() from given index.

  • headerData: Return the name of the requested column.

  • index: Return an index from given row, column and parent.

  • insertRows: Insert rows from starting position and number given by rows.

  • mimeData: Used when the widget is dragged by the user.

  • mimeTypes: Return a constant.

  • parent: return the parent from given index.

  • removeRows: Remove the rows from position to position+rows.

  • rowCount: The number of rows is the number of children.

  • setData: Method called when the user changes data.

  • to_dict: return the root node as a dictionary.

__init__(root, parent=None)[source]

Initializes the DictionaryTreeModel with a root node.

Parameters:

root – The root node of the tree.

“param parent: (QObject): The parent object.

columnCount(parent=None)[source]

Returns the number of columns, which is always 1.

Parameters:

parent – (QModelIndex) The parent index (unused in this implementation).

Returns:

(int) The number of columns.

data(index, role)[source]

Returns the data stored under the given role for the item at the given index.

Parameters:
  • index – (QModelIndex) The index of the item.

  • role – (Qt.ItemDataRole) The role of the data to retrieve.

Returns:

The data stored under the given role, or None if not available.

flags(index)[source]

Get the item flags for the specified index.

Parameters:

index – (QModelIndex) The model index to retrieve flags for.

Returns:

(Qt.ItemFlags) The corresponding item flags.

getNode(index)[source]

Retrieves the Node object from the given index.

Parameters:

index – (QModelIndex) The index of the node.

Returns:

The Node object.

headerData(section, orientation, role)[source]

Returns the data for the given role and section in the header.

Parameters:
  • section – (int) The section number.

  • orientation – (Qt.Orientation) The orientation of the header (unused in this implementation).

  • role – (Qt.ItemDataRole) The role of the data to retrieve.

Returns:

(str) The header data, or None if not available.

index(row, column, parent)[source]

Creates an index for the given row, column, and parent.

Parameters:
  • row – (int) The row number.

  • column – (int) The column number.

  • parent – (QModelIndex) The parent index.

Returns:

(QModelIndex) The created index, or an invalid index if not available.

insertRows(position, rows, parent=<PyQt5.QtCore.QModelIndex object>)[source]

Inserts rows starting from the specified position.

Parameters:
  • position – (int) The starting position to insert rows.

  • rows – (int) The number of rows to insert.

  • parent – (QModelIndex) The parent index.

Returns:

(bool) True if the rows were successfully inserted, False otherwise.

mimeData(indexes)[source]

Generate MIME data for a drag-and-drop operation.

Parameters:

indexes – (list of QModelIndex) The list of model indexes being dragged.

Returns:

(QMimeData) A QMimeData object containing serialized node information.

mimeTypes()[source]

Returns the supported MIME types.

Returns:

(list of str) A list of supported MIME types.

parent(index)[source]

Returns the parent index for the given index.

Parameters:

index – (QModelIndex) The index of the item.

Returns:

(QModelIndex) The parent index, or an invalid index if not available.

removeRows(position, rows, parent=<PyQt5.QtCore.QModelIndex object>)[source]

Removes rows starting from the specified position to position+rows.

Parameters:
  • position – (int) The starting position to remove rows.

  • rows – (int) The number of rows to remove.

  • parent – (QModelIndex) The parent index.

Returns:

(bool) True if all rows were successfully removed, False otherwise.

rowCount(parent)[source]

Returns the number of rows, which corresponds to the number of children.

Parameters:

parent – (QModelIndex) The parent index.

Returns:

(int) The number of rows.

setData(index, value, role=2)[source]

Updates the data when the user makes changes.

Parameters:
  • index – (QModelIndex) The index of the item.

  • value – The new value to set.

  • role – (Qt.ItemDataRole) The role of the data to set.

Returns:

(bool) True if the data was successfully set, False otherwise.

to_dict()[source]

Converts the root node to a dictionary.

Returns:

(dict) The dictionary representation of the root node.

class populse_mia.user_interface.pipeline_manager.process_library.InstallProcesses(main_window, folder)[source]

Bases: QDialog

Dialog for installing Python packages from a folder or zip file.

This widget allows users to browse and select a Python package or zip file containing packages, then install them into Populse_MIA.

Contains:

Methods:

  • _add_package: Add a package and its modules to the process tree.

  • _change_pattern_in_folder: Replace pattern in all Python files within a folder.

  • _install_new_package: Install a new package.

  • _load_process_config: Load the process configuration from YAML.

  • _rollback_changes: Roll back changes in case of installation failure.

  • _show_qmessagebox: Display an error message box.

  • _show_status_message: Update status message in the main window.

  • _update_existing_package: Update an existing package.

  • _validate_input: Validate the input file or directory.

  • get_filename: Opens a file dialog to get the folder or zip file to install.

  • install: Installs the selected file/folder on Populse_mia.

Signals:

  • process_installed: Signal emitted when a process is successfully installed.

__init__(main_window, folder)[source]

Initialize the installation dialog.

Parameters:
  • main_window – The main application window.

  • folder – (bool) If True, install from folder; if False, install from zip file.

_add_package(proc_dic, module_name)[source]

Add a package and its modules to the process tree.

Parameters:
  • proc_dic – (dict) The process tree dictionary to update.

  • module_name – (str) Name of the module to add.

Returns:

(dict) The updated process tree dictionary.

_change_pattern_in_folder(path, old_pattern, new_pattern)[source]

Replace pattern in all Python files within a folder.

Parameters:
  • path – (str) Directory path to process.

  • old_pattern – (str) Pattern to search for.

  • new_pattern – (str) Pattern to replace with.

_install_new_package(filename, package_name, processes_path)[source]

Install a new package.

Parameters:
  • filename – (str) Path to zip file or directory.

  • package_name – (str) Name of the package to install.

  • processes_path – (str) Target directory for installation.

_load_process_config(config_path)[source]

Load the process configuration from YAML.

Parameters:

config_path – (str) Path to the configuration file.

Returns:

(dict) The loaded configuration or empty dict if error.

_rollback_changes(config_path, original_config, processes_path, package_names, mia_processes_not_found, tmp_folder4MIA)[source]

Roll back changes in case of installation failure.

Parameters:
  • config_path – (str) Path to configuration file.

  • original_config – (dict) Original configuration to restore.

  • processes_path – (str) Path to processes directory.

  • package_names – (list) Names of packages that were being installed.

  • mia_processes_not_found – (bool) Flag indicating if Mia processes backup was made.

  • tmp_folder4MIA – (str) Path to Mia processes backup.

_show_qmessagebox(message, critical=True)[source]

Display an error message box.

Parameters:
  • message – (str) Message to display.

  • critical – (bool) If True, display a critical message box.

_show_status_message(message)[source]

Update status message in the main window.

Parameters:

message – (str) Status message to display.

_update_existing_package(filename, package_name, processes_path)[source]

Update an existing package.

Parameters:
  • filename – (str) Path to zip file or directory.

  • package_name – (str) Name of the package to update.

  • processes_path – (str) Target directory for installation.

Returns:

(str) The new package name (with timestamp).

_validate_input(filename)[source]

Validate the input file or directory.

Parameters:

filename – (str) Path to the file or directory.

Returns:

(bool) True if valid, False otherwise

get_filename(folder)[source]

Open a file dialog to select the package source.

Parameters:

folder – (bool) If True, opens a directory selection dialog; If False, opens a zip file selection dialog.

install()[source]

Install a package from a zip file or a folder.

This method handles the complete installation process:
  1. Extracts or copies the package to the processes directory.

  2. Updates the process dictionary.

  3. Registers the new package in the configuration.

Any exceptions during installation are caught and reported to the user, with automatic rollback of any changes made.

class populse_mia.user_interface.pipeline_manager.process_library.Node(name, parent=None)[source]

Bases: object

A tree-like structure to manage hierarchical data with parent-child relationships.

This class provides functionality to create and manipulate tree nodes, where each node can have a name, value, parent, and multiple children.

Contains:

Methods:

  • __repr__: Define what should be printed by the class.

  • _recurse_dict: Recursively build a dictionary representation of the node hierarchy.

  • addChild: Add a child to the children list.

  • attrs: Get attributes of this node as a dictionary.

  • child: Return a child from its index in the list.

  • childCount: return the number of children.

  • data: Return the name or the value of the object.

  • insertChild: Insert a child to a specific position.

  • log: Generate a formatted string representation of the node hierarchy.

  • name: Gets or sets the name of the node.

  • parent: Return the parent of the node.

  • removeChild: Remove a child node at the specified position.

  • resource: Placeholder that always returns None.

  • row: Return the index of the object in its parent list of children.

  • setData: Update the name or the value of the object.

  • to_dict: Convert the node hierarchy to a dictionary.

  • to_list: Convert the node hierarchy to a list.

  • value: Gets or sets the value of the node.

__init__(name, parent=None)[source]

Initialize a new Node instance.

Parameters:
  • name – (str) The name of the node.

  • parent – The parent node. If provided, this node is automatically added as a child to the parent. Defaults to None.

_recurse_dict(d)[source]

Recursively build a dictionary representation of the node hierarchy.

Parameters:

d – (dict) The dictionary to populate with the node hierarchy.

addChild(child)[source]

Add a child node to this node.

Parameters:

child – The child node to add.

attrs()[source]

Get attributes of this node as a dictionary.

Returns:

(dict) A dictionary of property names and their values.

child(row)[source]

Get a child node by its index.

Parameters:

row – (int) The index of the child node in the children list.

Returns:

The child node at the specified index.

childCount()[source]

Get the number of children of this node.

Returns:

(int) The number of child nodes.

data(column)[source]

Get data about this node based on the column parameter.

Parameters:

column – (int) 0 for the fully qualified name (including parent names), 1 for the value of this node.

Returns:

(str) The requested data (either string path or node value).

insertChild(position, child)[source]

Insert a child node at a specific position.

Parameters:
  • position – (int) The position at which to insert the child.

  • child – The child node to insert.

Returns:

(bool) True if insertion was successful, False otherwise.

log(tabLevel=-1)[source]

Generate a formatted string representation of the node hierarchy.

Parameters:

tabLevel – (int) The current indentation level. Defaults to -1.

Returns:

(str) A formatted string showing the node hierarchy.

property name

Get the name of this node.

Returns:

(str) The name of the node.

parent()[source]

Get the parent of this node.

Returns:

The parent node or None if this is a root node.

removeChild(position, child)[source]

Remove a child node at the specified position.

Parameters:
  • position – (int) The position of the child to remove.

  • child – The child node to remove.

Returns:

(bool) True if removal was successful, False otherwise.

resource()[source]

Get resource information for this node.

This method is a placeholder that always returns None.

Returns:

None.

row()[source]

Get the index of this node in its parent’s children list.

Returns:

(int) The index of this node in its parent’s children list, or None if this node has no parent.

setData(column, value)[source]

Set the name or value of this node based on the column parameter.

Parameters:
  • column – (int) 0 to set the name, 1 to set the value.

  • value – The new name or value to set.

to_dict(d=None)[source]

Convert the node hierarchy to a dictionary.

Parameters:

d – (dict) A dictionary to populate. Defaults to empty dict.

Returns:

(dict) A dictionary representation of the node hierarchy.

to_list()[source]

Convert the node hierarchy to a list.

Returns:

(list) A list representation of the node hierarchy.

property value

Get the value of this node.

Returns:

The value of the node.

class populse_mia.user_interface.pipeline_manager.process_library.PackageLibrary(package_tree, paths)[source]

Bases: QTreeWidget

A tree widget that displays user-added packages and their modules.

This widget allows users to enable or disable packages and modules by checking or unchecking them in the tree view. The tree structure reflects the hierarchical organization of packages and their modules.

Contains:

Methods:

  • fill_item: fills the items of the tree recursively.

  • generate_tree: generates the package tree.

  • recursive_checks: checks/unchecks all child items.

  • recursive_checks_from_child: checks/unchecks all parent items.

  • set_module_view: sets if a module has to be enabled or disabled in the process library.

  • update_checks: updates the checks of the tree from an item.

__init__(package_tree, paths)[source]

Initialize the PackageLibrary widget.

Parameters:
  • package_tree – (dict) Hierarchical representation of packages.

  • paths – (list) System paths for importing the packages.

fill_item(item, value)[source]

Recursively populate the tree items.

Traverses the package tree and creates corresponding QTreeWidgetItems with appropriate check states.

Parameters:
  • item – (QTreeWidgetItem) Current tree item to populate.

  • value – (dict, list, or str) Value to populate the item with.

generate_tree()[source]

Generate the package tree structure.

Clears the current tree and populates it with items from package_tree. Temporarily disconnects the itemChanged signal to prevent unwanted updates.

recursive_checks(parent)[source]

Propagate check state down to all child items.

When a parent item is checked/unchecked, all its children inherit the same check state.

Parameters:

parent – (QTreeWidgetItem) Parent item whose check state is propagated.

recursive_checks_from_child(child)[source]

Propagate check state up to parent items.

When a child item is checked, its parents are also checked. When a child item is unchecked, its parent is unchecked only if all siblings are also unchecked.

Parameters:

child – (QTreeWidgetItem) Child item whose check state affects parents.

set_module_view(item, state)[source]

Update the module’s enabled/disabled status in the package tree.

Updates the underlying package_tree data structure when an item’s check state changes in the UI.

Parameters:
  • item – (QTreeWidgetItem) Tree item corresponding to a module.

  • state – (Qt.CheckState) New check state: Qt.Checked or Qt.Unchecked. (Qt.Checked == 2. So if val == 2 -> checkbox is checked, and if val == 0 -> checkbox is not checked)

update_checks(item, column)[source]

Handle check state changes and propagate them.

When an item’s check state changes, this method ensures the change is properly propagated to children and parent items.

Parameters:
  • item – (QTreeWidgetItem) Item whose check state changed.

  • column – (int) Column index of the change (should be 0).

class populse_mia.user_interface.pipeline_manager.process_library.PackageLibraryDialog(mia_main_window=None, parent=None)[source]

Bases: QDialog

Dialog for managing package library configurations.

This dialog allows users to add, remove, and delete packages from the process library. It provides interfaces for installing packages, updating the package tree, and saving configurations.

Contains:

Methods:

  • _create_button: Create a standardized button.

  • _create_install_buttons: Create buttons for installing processes.

  • _create_line_edit: Create and configure the line edit.

  • _create_list_group: Create a group box for a list with reset functionality.

  • _create_list_widget: Create a list widget with extended selection mode.

  • _create_main_layout: Create the main layout for the dialog.

  • _create_package_management_buttons: Create buttons for package management.

  • _create_save_cancel_layout: Create layout for save and cancel buttons.

  • _create_status_label: Create and configure the status label.

  • _load_initial_configuration: Load initial package configuration.

  • _setup_ui: Set up the user interface components

  • add_package: Add a package and its modules to the package tree.

  • add_package_with_text: Add a package from the line edit text.

  • browse_package: Open a browser to select a package (commented).

  • delete_package: Delete a package (admin-only functionality).

  • delete_package_with_text: Delete a package from the line edit text.

  • install_processes_pop_up: Open popup for installing processes.

  • load_config: Load package configuration from YAML file.

  • load_packages: Update the process library tree.

  • ok_clicked: Handle applying changes to packages.

  • remove_package: Remove a package from the package tree.

  • remove_package_with_text: Remove a package from the line edit text.

  • reset_action: Reset previous package addition or removal actions.

  • save: Save package configuration to process_config.yml.

  • save_config: save the current config to process_config.yml (commented).

  • update_config: Update package configuration and library attributes.

Signals:

  • signal_save: Signal emitted when configuration is saved.

__init__(mia_main_window=None, parent=None)[source]

Initialize the PackageLibraryDialog.

Parameters:
  • mia_main_window – Reference to the main application window.

  • parent – (QWidget) Parent widget for the dialog.

_create_button(text, callback)[source]

Create a standardized button.

Parameters:
  • text – (str) Button text.

  • callback – (a callable) Function to call when button is clicked.

Returns:

(QPushButton) Configured button.

_create_install_buttons()[source]

Create buttons for installing processes.

Returns:

(QHBoxLayout) Layout with install process buttons.

_create_line_edit()[source]

Create and configure the line edit.

Returns:

(QLineEdit) Configured line edit for package input.

_create_list_group(title, list_widget, reset_callback)[source]

Create a group box for a list with reset functionality.

Parameters:
  • title – (str) Group box title.

  • list_widget – (QListWidget) List widget to add to group.

  • reset_callback – (callable) Callback for reset button.

Returns:

(QGroupBox) Configured group box with list and reset button.

_create_list_widget()[source]

Create a list widget with extended selection mode.

Returns (QListWidget:

Configured list widget.

_create_main_layout(install_layout, management_layout, user_mode)[source]

Create the main layout for the dialog.

Parameters:
  • install_layout – (QHBoxLayout) Layout for install buttons.

  • management_layout – (QHBoxLayout) Layout for package management buttons.

  • user_mode – (bool) Whether the application is in user mode.

Returns:

(QHBoxLayout) Main layout of the dialog.

_create_package_management_buttons(user_mode)[source]

Create buttons for package management.

Parameters:

user_mode – (bool) Whether the application is in user mode.

Returns:

(QHBoxLayout) Layout with package management buttons.

_create_save_cancel_layout()[source]

Create layout for save and cancel buttons.

Returns:

(QHBoxLayout) Layout with save and cancel buttons.

_create_status_label()[source]

Create and configure the status label.

Returns:

(QLabel) Configured status label.

_load_initial_configuration()[source]

Load initial package configuration.

_setup_ui()[source]

Set up the user interface components.

add_package(module_name, class_name=None, show_error=False, init_package_tree=False)[source]

Add a package and its modules to the package tree with comprehensive module and class discovery.

This method recursively discovers and adds packages, subpackages, and their classes to the package tree. It provides flexible options for package initialization and error handling.

Parameters:
  • module_name – (str) Fully qualified name of the module to add. Example: ‘myproject.processors’

  • class_name – (str) Specific class name to focus on during package addition. If provided, only this class or its parent packages will be processed.

  • show_error – (bool) Controls error reporting behavior. If True, displays error messages in a QMessageBox. If False, collects errors silently. Defaults to False.

  • init_package_tree – (bool) If True, reinitializes the entire package tree before adding the module. Defaults to False.

Returns:

(List[str] | str) A list of error messages encountered during package addition, or “No package selected!” if no module name is provided.

add_package_with_text(package_name=False, update_view=True)[source]

Add a package to the Package Library.

This method attempts to add a package or module to the library based on the provided package name. It supports adding packages with or without file extensions, and handles various import scenarios.

Parameters:
  • package_name – (str | False) Name of the package to add. If False (default), uses the text from the line edit widget.

  • update_view – (bool) Whether to update the package list view. Defaults to True.

delete_package(index=1, to_delete=None, remove=True, loop=False, from_pipeline_manager=False)[source]

Delete a package from the library (admin-only functionality).

This method removes the package from the package library tree, updates the __init__.py file, and deletes the package directory and files if they are empty.

Parameters:
  • index – (int) Recursive index for navigating modules. Defaults to 1.

  • to_delete – (str) The package/brick to delete (e.g., ‘test.Test’). Defaults to None.

  • remove – (bool) Whether to remove the brick from the package tree. Defaults to True.

  • loop – (bool) Whether to delete silently without confirmation. Defaults to False.

  • from_pipeline_manager – (bool) Whether deletion is initiated from pipeline manager. Defaults to False.

Returns:

(list[str]) A list of deleted packages/bricks (classes).

delete_package_with_text(package_name='', update_view=True)[source]

Delete a package from the line edit’s text.

Parameters:
  • package_name – (str) The name of the package to delete. Defaults to the text in the line edit.

  • update_view – (bool) Whether to update the QListWidget after deletion. Defaults to True.

install_processes_pop_up(from_folder=False)[source]

Display the install processes pop-up.

Parameters:

from_folder – (bool) Whether the installation is from a folder. Defaults to False.

static load_config()[source]

Loads and returns the configuration from ‘process_config.yml’.

Returns:

(dict | {}) The configuration dictionary if successfully loaded, otherwise None in case of an error.

load_packages()[source]

Update the tree of the process library.

ok_clicked()[source]

Handles the click event when the ‘Apply Changes’ button is clicked.

remove_package(package)[source]

Removes a package from the package tree.

This method attempts to remove the specified package from the package library. If the package is not found, a warning message is displayed. The package tree is updated after a successful removal.

Parameters:

package – (str) The fully qualified module name (e.g., ‘nipype.interfaces.spm’).

Returns:

(bool) True if the package was successfully removed, False if the package was not found or no package was provided.

remove_package_with_text(package_name='', update_view=True, tree_remove=True)[source]

Removes the specified package from the package tree and updates the view accordingly.

Parameters:
  • package_name – (str) The name of the package to remove. If not provided, the package name is taken from the line edit.

  • update_view – (bool) Whether to update the QListWidget view after removal. Defaults to True.

  • tree_remove – (bool) Whether to remove the package from the tree. Defaults to True.

reset_action(itemlist, add)[source]

Resets a previous package addition or removal action.

Parameters:
  • itemlist – (QListWidget) The list widget containing items to reset.

  • add – (bool) If True, resets an addition by removing the package if it exists in the configuration. If False, re-adds the package.

save(close=True)[source]

Saves the package library configuration to process_config.yml.

This method updates the package information from the package library tree and writes it to the configuration file. Optionally, it can close the dialog after saving.

Parameters:

close – (bool) If True, closes the dialog after saving. Defaults to True.

update_config()[source]

Refreshes the process configuration and updates the package library.

This method reloads the configuration from ‘process_config.yml’, updates the package library attributes, and regenerates the package tree.

class populse_mia.user_interface.pipeline_manager.process_library.ProcessLibrary(d, pkg_lib)[source]

Bases: QTreeView

A tree view to display available Capsul’s processes.

Contains:

Methods:

  • keyPressEvent: Event when the delete key is pressed.

  • load_dictionary: Loads a dictionary to the tree.

  • mousePressEvent: Event when the mouse is pressed.

  • to_dict: Returns a dictionary from the current tree.

Signals:

  • item_library_clicked: Signal emitted when an item in the library is clicked.

__init__(d, pkg_lib)[source]

Initialize the ProcessLibrary class.

Parameters:
  • d – (dict) Dictionary corresponding to the tree.

  • pkg_lib – An instance of the PackageLibraryDialog class.

keyPressEvent(event)[source]

Handles key press events, specifically the Delete key.

If the Delete key is pressed and the user is not in user mode, the selected package(s) will be deleted from the package library.

Parameters:

event – (QKeyEvent) The key event triggering this handler.

load_dictionary(d)[source]

Load a dictionary into the tree.

:param d :(dict) Dictionary to load. See the packages attribute in the

ProcessLibraryWidget class.

mousePressEvent(event)[source]

Handles mouse press events on the tree view.

If a valid item is clicked, it sets the current index and emits a signal with the selected item’s text. If the right mouse button is pressed, a context menu is displayed, allowing the user to remove or delete a package.

Parameters:

event – (QMouseEvent) The mouse event triggering this handler.

to_dict()[source]

Return a dictionary representation of the current tree.

Returns:

The dictionary of the tree.

class populse_mia.user_interface.pipeline_manager.process_library.ProcessLibraryWidget(main_window=None)[source]

Bases: QWidget

Widget that manages the available Capsul’s processes in the software.

Contains:

Methods:

  • _configure_process_library: Configure the process library settings.

  • _setup_layout: Setup the layout for the widget.

  • load_config: Read the config in process_config.yml and return it as a dictionary.

  • load_packages: Set packages and paths to the widget and to the system paths.

  • open_pkg_lib: Open the package library.

  • save_config: Save the current config to process_config.yml. (commented)

  • update_config: Update the config and loads the corresponding packages.

  • update_process_library: Update the tree of the process library.

__init__(main_window=None)[source]

Initialize the ProcessLibraryWidget.

Parameters:

main_window – The current main window.

_configure_process_library()[source]

Configure the process library settings.

_setup_layout()[source]

Setup the layout for the widget.

static load_config()[source]

Read the configuration from process_config.yml and return it as a dictionary. . :Returns: The configuration as a dictionary.

load_packages()[source]

Set packages and paths to the widget and to the system paths.

open_pkg_lib()[source]

Open the package library.

update_config()[source]

Update the configuration and load the corresponding packages.

update_process_library()[source]

Update the tree of the process library.

populse_mia.user_interface.pipeline_manager.process_library.import_file(full_name, path)[source]

Import a Python module from a specified file path.

This function dynamically imports a module from a given file path and returns the module object. It does not modify sys.modules.

Parameters:
  • full_name – (str) The name of the module to import.

  • path – (str) The file path of the module.

Returns:

The imported module.

populse_mia.user_interface.pipeline_manager.process_library.node_structure_from_dict(datadict, parent=None, root_node=None)[source]

Construct a hierarchical node structure from a dictionary.

This function converts a nested dictionary into a tree structure suitable for a TreeModel. It processes nodes based on specific conditions and recursively builds the tree.

Parameters:
  • datadict – (dict) The dictionary to convert into a node structure.

  • parent – The parent node of the current node. Defaults to None.

  • root_node – The root node of the tree. Defaults to None.

Returns:

The root node of the constructed tree.