mafw.steering_gui.views.processor_parameter_editor

Processor parameter editor for steering GUI pipelines.

Author:

Bulgheroni Antonio (antonio.bulgheroni@ec.europa.eu)

Description:

Display and edit processor parameters, replica metadata, and overrides in the GUI.

Classes

ListEditDialog(parameter_name, values[, ...])

Dialog for editing the items in one list-valued processor parameter.

ListEditor([parent, element_type, ...])

Compact list cell editor that opens a dedicated ListEditDialog.

LogicalReferenceEditor([parent])

Keep the serialized value visible and offer a structured edit dialog.

ParameterDelegate([parent])

Delegate that picks editors based on parameter type.

ParameterTableModel([parent])

Qt table model exposing processor parameters for editing.

PathLogicalUnionEditor(parent, annotation, ...)

Select and edit one physical or logical path alternative.

ProcessorParameterEditor([parent])

Widget used to edit parameters and metadata of a processor entry.

class mafw.steering_gui.views.processor_parameter_editor.ListEditDialog(parameter_name: str, values: Iterable[Any], element_type: Any = None, default_values: Iterable[Any] = (), volume_names: Iterable[str] = (), parent: QWidget | None = None)[source]

Bases: QDialog

Dialog for editing the items in one list-valued processor parameter.

Build the item table and controls for one list parameter.

static _display_value(value: Any) → str[source]

Render typed logical references using their portable serialized form.

_accept_if_valid() → None[source]

Close only when all non-empty items can be converted to their declared type.

_add_item() → None[source]

Add an empty row and begin editing it immediately.

_close_active_row_editor() → None[source]

Close the active cell editor before the selected row is removed.

_insert_item(value: Any) → QTableWidgetItem[source]

Append one editable row and return its table item.

_remove_all() → None[source]

Remove every row using the same deletion path as selected removal.

_remove_item() → None[source]

Remove every selected row.

_remove_rows(rows: Iterable[int]) → None[source]

Delete unique rows in reverse order and refresh selection actions.

_remove_rows_later(rows: Iterable[int]) → None[source]

Delete selected rows after Qt has completed any editor focus-out commit.

_reset_to_default() → None[source]

Replace all rows with the parameter’s ActiveParameter default items.

_selected_rows() → list[int][source]

Return selected table row numbers without duplicates.

_show_context_menu(position: QPoint) → None[source]

Select a right-clicked row and show the list actions.

_update_remove_button(*_: object) → None[source]

Enable remove actions when one or more rows are selected.

value() → list[Any][source]

Return non-empty rows converted to the parameter’s element type.

class mafw.steering_gui.views.processor_parameter_editor.ListEditor(parent: QWidget | None = None, element_type: Any = None, parameter_name: str = '', on_selected: Callable[[list[Any]], None] | None = None, default_values: Iterable[Any] = (), volume_names: Iterable[str] = ())[source]

Bases: QWidget

Compact list cell editor that opens a dedicated ListEditDialog.

Build the cell summary and its right-aligned Edit button.

_edit() → None[source]

Open the independent dialog and report its result through the model callback.

set_value(value: Any) → None[source]

Update the displayed list summary.

value() → list[Any][source]

Return the current list value.

class mafw.steering_gui.views.processor_parameter_editor.LogicalReferenceEditor(parent: QWidget | None = None)[source]

Bases: QWidget

Keep the serialized value visible and offer a structured edit dialog.

_commit_if_changed() → None[source]

Ask the delegate to store user-edited text once it leaves the field.

_edit() → None[source]

Open a small volume/path form and commit only valid references.

_show_validation_state(value: str) → None[source]

Show syntax feedback beside the active parameter editor.

set_text(value: str) → None[source]

Display existing serialized text without discarding malformed input.

set_volumes(volumes: Iterable[str]) → None[source]

Set configured volume choices used by the structured editor.

value() → LogicalFileReference | str[source]

Return a typed reference when valid, retaining malformed text otherwise.

class mafw.steering_gui.views.processor_parameter_editor.ParameterDelegate(parent: QWidget | None = None)[source]

Bases: QStyledItemDelegate

Delegate that picks editors based on parameter type.

_track_editor(editor: QWidget) → QWidget[source]

Remember the live editor so list actions can close it before row mutation.

cancel_active_editor() → None[source]

Close the current cell editor without committing its in-progress value.

class mafw.steering_gui.views.processor_parameter_editor.ParameterTableModel(parent: QWidget | None = None)[source]

Bases: QAbstractTableModel

Qt table model exposing processor parameters for editing.

static _format_type(type_hint: Any) → str[source]

Render a parameter type for the Type column.

Plain types show their name (PosixPath, int); Annotated wrappers are unwrapped to their underlying type; parameterised generics are rendered in the list[int] style using their origin and arguments.

set_parameters(parameters: Iterable[ParameterConfig]) → None[source]

Replace the rows with the provided parameters.

class mafw.steering_gui.views.processor_parameter_editor.PathLogicalUnionEditor(parent: QWidget, annotation: Any, volumes: Iterable[str], on_path_selected: Callable[[str], None] | None = None, on_browse_started: Callable[[], None] | None = None, on_browse_cancelled: Callable[[], None] | None = None)[source]

Bases: QWidget

Select and edit one physical or logical path alternative.

_commit_if_focus_leaves() → None[source]

Ignore focus changes between child controls; commit when the editor loses focus.

set_value(value: Any) → None[source]

Display the currently selected path alternative.

value() → Path | LogicalFileReference | str[source]

Return the selected typed alternative.

class mafw.steering_gui.views.processor_parameter_editor.ProcessorParameterEditor(parent: QWidget | None = None)[source]

Bases: QWidget

Widget used to edit parameters and metadata of a processor entry.

_activate_parameter_editor_on_click(index: QModelIndex) → None[source]

Show the list or path editor after one click on its value cell.

current_name() → str | None[source]

Return the currently displayed processor full name.

set_processor_data(config: ProcessorConfig) → None[source]

Populate the editor with processor configuration data.

set_storage_volumes(volumes: Iterable[str]) → None[source]

Update the volume choices offered by logical-reference editors.

class mafw.steering_gui.views.processor_parameter_editor._ListItemsTable(rows: int, columns: int, parent: QWidget | None = None)[source]

Bases: QTableWidget

One-column list table with add/remove keyboard commands.

Initialize a table that can move its selected rows internally.

dropEvent(event: QDropEvent) → None[source]

Move selected rows as a block without letting the table overwrite items.

keyPressEvent(event: QKeyEvent) → None[source]

Route list editing keys through the dialog’s shared actions.

startDrag(supported_actions: Any) → None[source]

Run an internal drag without Qt removing rows after the custom drop.

class mafw.steering_gui.views.processor_parameter_editor._ParameterRoles[source]

Bases: object

Custom roles used to expose parameter metadata to delegates.

class mafw.steering_gui.views.processor_parameter_editor._ParameterRow(config: ParameterConfig, order: int)[source]

Bases: object

Container describing a single parameter table row.

mafw.steering_gui.views.processor_parameter_editor._commit_list_editor_value(delegate: ParameterDelegate, editor: QWidget, model: QAbstractItemModel, index: QModelIndex | QPersistentModelIndex, value: Any) → None[source]

Commit a list row, dropping a newly added row dismissed while empty.

mafw.steering_gui.views.processor_parameter_editor._contains_annotation(annotation: Any, target: Any) → bool[source]

Return whether an annotation contains target, including nested wrappers.

mafw.steering_gui.views.processor_parameter_editor._is_empty_list_editor(editor: QWidget) → bool[source]

Check whether a newly added list row still has no selected value.

mafw.steering_gui.views.processor_parameter_editor._is_list_type(annotation: Any) → bool[source]

Return whether annotation denotes a list (plain or parameterised).

Any Annotated wrapper is stripped first, so Annotated[list[int], marker] is recognised as a list as well.

mafw.steering_gui.views.processor_parameter_editor._is_path_logical_union(annotation: Any) → bool[source]

Return whether an annotation is one of the supported path/reference unions.

mafw.steering_gui.views.processor_parameter_editor._remove_pending_item_later(table: QTableWidget, index: QModelIndex | QPersistentModelIndex) → None[source]

Remove an empty new row after Qt has finished closing its active editor.

mafw.steering_gui.views.processor_parameter_editor._set_list_item_value(model: QAbstractItemModel, index: QModelIndex | QPersistentModelIndex, value: Path | LogicalFileReference | str) → None[source]

Keep a list row readable while retaining its selected path type.

mafw.steering_gui.views.processor_parameter_editor._ACTIVE_COLUMN_LABEL = 'Active'

Header label for the parameter active toggle column.

mafw.steering_gui.views.processor_parameter_editor._COLUMNS = ('Active', 'Name', 'Value', 'Type', 'Source', 'Status')

Column labels for the processor parameter table.