mafw.steering_gui.main_window

Main window orchestrator for the steering GUI layout.

Author:

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

Description:

Build the menu, splitter, tree, stacked editors, and status bar required by the GUI.

Classes

MainWindow([controller, parent])

Compose the steering GUI main window without executing controller logic.

class mafw.steering_gui.main_window.MainWindow(controller: SteeringController | None = None, parent: QWidget | None = None)[source]

Bases: QMainWindow

Compose the steering GUI main window without executing controller logic.

static _normalize_text(value: str) str | None[source]

Treat empty or whitespace-only strings as unset.

_confirm_discard() bool[source]

Ask whether the user wants to save/discard/cancel when the document is dirty.

_create_actions() None[source]

Declare the main window actions and store them for later menu wiring.

_create_central_widget() None[source]

Build the splitter containing the tree and editor stack.

_create_group(parent_group: str | None) str | None[source]

Create a new group and attach it to the requested parent list.

_create_menus() None[source]

Compose the menu bar using the actions previously created.

_create_status_bar() None[source]

Initialise the status bar to keep the user informed.

_display_section(section: str) None[source]

Show the editor that corresponds to the selected tree section.

_exit_app() None[source]

Close the window after ensuring dirty state obeys the user.

_finalize_connection_test(result: object | None = None) None[source]

Reset worker references and re-enable the test button.

_generate_group_name() str[source]

Return a unique group name based on the current builder state.

_load_file(path: Path) None[source]

Load the steering file through the controller and refresh the UI.

_new_file() None[source]

Reset the UI state in preparation for a new steering file.

_on_add_group_requested() None[source]

Create a new top-level group and open it in the editor.

_on_add_processor_requested() None[source]

Open the Add Processor dialog and append selections to the pipeline.

_on_connection_test_failure(exc: Exception) None[source]

Report a failure with the provided exception message.

_on_connection_test_success(_: object) None[source]

Report a successful connection and reset the UI state.

_on_database_configuration_changed(data: dict[str, Any]) None[source]

Commit every database widget change back to the controller.

_on_dirty_changed(dirty: bool) None[source]

Update the window title when the controller dirty state changes.

_on_group_add_group_requested() None[source]

Create a new group nested within the currently edited group.

_on_group_add_processor_requested() None[source]

Add processors to the currently edited group.

_on_group_description_changed(description: str) None[source]

Update the description for the currently edited group.

_on_group_move_requested(direction: str, items: list[PipelineItem]) None[source]

Reorder items inside the currently edited group.

_on_group_name_changed(new_name: str) None[source]

Rename the currently edited group.

_on_group_remove_requested(items: list[PipelineItem]) None[source]

Remove items from the currently edited group.

_on_pipeline_edit_requested(item: PipelineItem) None[source]

Switch to the appropriate placeholder editor for the selected item.

_on_pipeline_error(exc: Exception) None[source]

Report pipeline building failures to the user.

_on_pipeline_move_requested(direction: str, items: list[PipelineItem]) None[source]

Reorder the selected items within the top-level pipeline list.

_on_pipeline_ready(pipeline: ProcessorPipeline) None[source]

Update the tree and editors with the built pipeline.

_on_pipeline_remove_requested(items: list[PipelineItem]) None[source]

Remove selected items from the top-level processors_to_run list.

_on_pipeline_selection_changed(items: list[PipelineItem]) None[source]

Switch editors when a pipeline item is selected in the tree.

_on_plugin_load_failure(exc: Exception) None[source]

Report plugin loading failures to the user and refresh the UI.

_on_plugins_loaded(_: object) None[source]

Handle successful plugin loading and refresh the UI.

_on_test_connection_requested(config: dict[str, Any]) None[source]

Start an asynchronous database connection test and update the UI.

_on_ui_interface_changed(interface: str) None[source]

Tell the controller to use the selected UI interface.

_on_validation_level_changed(level: ValidationLevel | None) None[source]

Tell the controller about the user-selected validation level.

_open_file() None[source]

Stub that requests a filename without yet loading it.

_open_steering_text_editor() None[source]

Open the manual TOML editor for advanced steering edits.

_perform_save() bool[source]

Persist the current builder to its tracked path (or prompt Save As).

_perform_save_as() bool[source]

Prompt the user for a location and persist the current builder there.

_populate_from_model() None[source]

Refresh the tree and metadata editor from the controller model.

_redo() None[source]

Placeholder redo action until controller wiring occurs.

_refresh_database_editor() None[source]

Push the controller database metadata into the database editor.

_refresh_globals_editor() None[source]

Push the controller globals data into the globals editor.

_refresh_metadata_summary() None[source]

Update the metadata view with configured and available plugin data.

_refresh_pipeline_after_change(select_name: str | None = None) None[source]

Rebuild the pipeline and refresh dependent widgets.

_refresh_title_from_controller(dirty: bool | None = None) None[source]

Compose the window title with the associated file and dirty marker.

_refresh_ui_editor() None[source]

Update the UI combobox once plugin metadata or configuration changes.

_restore_window_geometry() None[source]

Restore the last-window size and position when available.

_save_file() None[source]

Action handler that keeps the QAction signature while delegating to DoSave.

_save_file_as() None[source]

Action handler for Save As that satisfies the QAction signature.

_save_window_geometry() None[source]

Persist the current geometry before exit.

_set_test_button_enabled(enabled: bool) None[source]

Toggle the database editor test button when the feature is active.

_show_about() None[source]

Display the About dialog describing the GUI.

_start_connection_test_worker(task: Callable[[], bool]) None[source]

Start the worker via a thread pool and bind completion callbacks.

_start_plugin_loading() None[source]

Trigger the controller to load plugins in the background.

_undo() None[source]

Placeholder undo action until controller wiring occurs.

_wire_controller_signals() None[source]

Wire controller dirty notifications and globals signals to the editor.

closeEvent(event: QCloseEvent) None[source]

Prompt the user to save if the current state is dirty.

mafw.steering_gui.main_window._DEFAULT_SAVE_NAME = 'mysteerfile.toml'

Default suggestion when the user invokes Save As.