populse_mia.user_interface.data_viewer.data_viewer_tab¶
Populse_mia data viewer GUI interface (in the “Data Viewer” tab).
Classes
|
A flexible and extensible widget for managing data viewers in a GUI application. |
- class populse_mia.user_interface.data_viewer.data_viewer_tab.DataViewerTab(main_window)[source]¶
Bases:
QWidgetA flexible and extensible widget for managing data viewers in a GUI application.
This widget provides a dynamic interface for loading and switching between different data viewers. Key features include:
Automatic discovery of viewers in the data_viewer directory
Graceful handling of viewer import failures
Ability to dynamically add new viewers
Centralized document and project management across viewers
- Contains:
- Methods:
activate_viewer: Activates viewer which was selected in the combobox.
change_viewer: Switches to viewer selected in the combobox.
clear: Clears all loaded viewers before closing Mia.
current_viewer: Return current viewer (selected viewer in combobox).
load_viewer: Load a viewer.
set_documents: Shares project with documents to all viewers.
- __init__(main_window)[source]¶
Initialize the DataViewerTab with a reference to the main window.
- Parameters:
main_window (populse_mia.user_interface.main_window.MainWindow) – The main application windowp providing context and potential shared resources.
- activate_viewer(viewer_name)[source]¶
Activate a specific viewer by name.
- Parameters:
viewer_name (str) – Name of the viewer to activate.
- change_viewer()[source]¶
Handle viewer change event triggered by the combobox.
Retrieves the selected viewer, activates it, and ensures that the current project and documents are set.
- clear()[source]¶
Clean up and close all loaded viewers.
Called before closing the application to ensure proper resource management.
- current_viewer()[source]¶
Retrieve the name of the currently active viewer.
- Returns:
(str) Name of the current viewer, either from the current viewer tracking or the combobox selection.
- load_viewer(viewer_name=None)[source]¶
Dynamically load viewers from the data_viewer directory.
Attempts to import and initialize viewers, handling import failures gracefully.
- Parameters:
viewer_name (str | None) – Specific viewer to load. If None, discovers all viewers.
- set_documents(project, documents)[source]¶
Distribute project and document information to the current viewer.
- Parameters:
project (populse_mia.data_manager.project.Project) – The project object.
documents (list[str]) – The list of document objects in the project.