app#
- class ClearMapApp(experiment_controller, bus, gui_controller)[source]#
Bases:
ClearMapAppBaseThe Main class of the GUI. This class focuses on the real business logic of the application. This represents the main window which has instances of the different tabs derived from GenericTab , which correspond to different steps of the program.
- conf_load_error_msg(conf_name)[source]#
Display an error message on missing config file
- Parameters:
conf_name (str) – The name of the config to load (without params and extension)
- get_tab_widget(tab_title)[source]#
Get the tab widget by its title
- Parameters:
tab_title (str) – The title of the tab to get
Returns
- GenericTab
The tab matching the title
- load_sample() bool[source]#
Load the sample configuration.
If the sample path does not exist, prompt the user to clone an existing config, load a default config, or cancel. If the sample path exists, ensure a sample ID is set. The return value tells the caller whether they need to call boot_open().
Returns
- bool
True: Existing experiment; caller must call boot_open().
False: Either new experiment already bootstrapped & opened, or user canceled (src_folder is cleared).
- set_tabs(tabs: Iterable[GenericTab])[source]#
Sets the tabs received from the GuiController
- set_tabs_progress_watchers(nested=False)[source]#
Set the progress_watcher of all the tab managers
- Parameters:
nested (bool) – Whether to set the progress watcher of the tab managers to a nested progress watcher
- property sample_manager#
- property src_folder: str#
- class ClearMapAppBase[source]#
Bases:
QMainWindow,Ui_ClearMapGuiThe interface for the ClearMapGui class
It deals with the basics of logic of the main window, the plotting progress bars and performance monitors and appearance. Anything more application related is coded in the child class.
- static create_missing_file_msg(f_type: str, f_path: Path | str, default_path: Path | str) tuple[str, str][source]#
- clear_plots()[source]#
Remove all plots currently displayed in the DataViewer area of the interface The underlying widgets are also scheduled for garbage collection
- compute_default_font_size()[source]#
Gets the most represented font size in the program. This is the default font size
Returns
- int
The default font size
- find_child_by_name(child_name: str, child_type: type[QWidget], parent: QWidget | None = None) QWidget | None[source]#
Find children in the window or any other widget
- Parameters:
child_name (str) – The name of the widget we are looking for
child_type – The type of widget to search
parent (QWidget) – The parent widget to start from. If none given, will use the main window.
Returns
- QWidget
The child widget matching the name and type
- graph_by_name(name: str) QWidget[source]#
Search self.graphs for name
- Parameters:
name (str) – The objectName of the graph widget we are looking for
- handle_step_name_change(step_name: str)[source]#
Handle a change of the name of the current computation step by registering the new step and updating the progress dialog
- Parameters:
step_name (str) – The new step name
- handle_sub_step_change(step_name: str)[source]#
Handle a change of the name of the current computation sub step by updating the progress dialog and logging the new substep
- Parameters:
step_name (str) – The new step name
- make_progress_dialog(title: str = 'Processing', n_steps: int = 1, maximum: int = 100, abort: Callable | None = None, parent: QWidget | None = None)[source]#
Create a single or nested (2 nested bars) progress dialog. The dialog is initialised with the parameters below and linked to self.progress_watcher to drive updates of the titles and progress bar.
- Parameters:
title (str) – The title of the dialog
n_steps (int) – The number of steps of the main step for nested dialogs
maximum (int) – The maximum value of the progress bar (or the second bar for nested dialogs)
abort (function) – The function to trigger when the abort button is clicked
parent (QWidget) – The parent widget to the dialog
- patch_tool_boxes()[source]#
Sets all toolboxes to the first item on startup regardless of the last closed state o f the ui file in QtCreator
- popup(msg: str, base_msg: str = 'Missing configuration file', print_warning: bool = True) QMessageBox[source]#
Display a warning popup message which the user has to dismiss by clicking OK Optionally, a warning is also printed to the logs
- Parameters:
msg (str) – The more detailed text to display
base_msg (str) – The quick description of the problem
print_warning (bool) – Whether to also print msg to logs
Returns
- QMessageBox
The popup message box
- print_error_msg(msg: str | Exception)[source]#
Print a message in red in the statusbar
- Parameters:
msg (str) – The message to be printed
- print_status_msg(msg: str)[source]#
Print a message in green in the statusbar
- Parameters:
msg (str) – The message to be printed
- print_warning_msg(msg: str)[source]#
Print a message in yellow in the statusbar
- Parameters:
msg (str) – The message to be printed
- set_font_size(target_font_size=8)[source]#
Set the font sizes of the widgets based on target_font_size. All fonts will be shifted based on that size. This should preserve the size relationships of the fonts in the program. It is assumed that the program uses 4 font sizes: - small - regular - big - and huge
This will shift font sizes so that the supplied size corresponds to the new regular size.
- Parameters:
target_font_size (int) – The main font size
- setup_plots(dvs: list[DataViewer], graph_names: list[str] | None = None)[source]#
Set the plots provided as argument in the DataViewer area of the UI in a grid format. The items in the list have to be derived from QWidget
- Parameters:
dvs (List[DataViewer]) – The list of DataViewer (or any other QWidget derived object) to add to the display grid
graph_names (None or List[str]) – Optional The names attached to the graphs for later reference
- signal_process_finished(msg: str = 'Idle, waiting for input')[source]#
Handles the end of the current computation with a message to be printed and logged. It will also notify and close the progress dialog window if there is one
- Parameters:
msg (str) – The message to display
- update_cpu_bars(cpu_percent: int, thread_percent: int, ram_percent: int)[source]#
Update the performance monitoring bars in the status bar
- Parameters:
cpu_percent (int) – The CPU usage percent to display
thread_percent (int) – The percent usage of the main ClearMap thread to display
ram_percent (int) – The RAM usage percent to display
- update_gpu_bars(gpu_percent: int, v_ram_percent: int)[source]#
Update the performance monitoring bars in the status bar
- Parameters:
gpu_percent (int) – The GPU usage percent to display
v_ram_percent (int) – The Graphics RAM usage percent to display
- wrap_in_thread(func: Callable, *args, **kwargs)[source]#
Wraps the function in a thread to ensure that the GUI remains responsive In general all processing done in the GUI should go through this method
- Parameters:
func (function) – The function to wrap
args – The arguments to the function func
kwargs – The keyword arguments to forward to func
Returns
The result of the execution of the function func
- class GuiController(bus: EventBus, experiment, tab_registry: TabRegistry, group_controller: AnalysisGroupController)[source]#
Bases:
BusSubscriberMixinThe controller of the GUI. It is responsible for building the main window, installing the tabs and handling events from the EventBus. It interacts with the ExperimentController to manage the business logic of the application.
- start(app_: ClearMapApp, centered: bool = True)[source]#
- property hydrating: bool#
True when either the controller or the experiment is mid-hydration.
- property tabs: Iterable[Any]#