MetaController¶
class MetaController(available_subclasses: Optional[Mapping[str, List[str]]] = None)
Bases: QObject
Base controller class that manages exactly one MetaView and MetaModel instance
Public Methods¶
Abstract Methods¶
These methods must be implemented by subclasses.
(none)
Concrete Methods¶
- MetaController.check_column_exists(table_name: str) None¶
Notify the view to check if a cluster column exists in the given table.
- Parameters:
table_name (str) – Name of the table to check.
- MetaController.display_write_status(status: bool) None¶
Emit a message indicating whether data was successfully written.
- Parameters:
status (bool) – True if write was successful, False otherwise.
- MetaController.export_plot_data() None¶
Export the currently cached plot data to a CSV file.
Attempts to retrieve cached plot data from the model, prompts the user for a filename, and saves the data as a CSV if available. If no data is cached, logs a warning.
- MetaController.get_session_state() Dict[str, Any]¶
Return extra tab-specific state to persist alongside this tab’s session history entry.
MainController calls this on every open tab immediately before writing session history to disk, and merges the result into that tab’s history entry. The base implementation returns an empty dict. A subclass that keeps state MainController cannot otherwise see (e.g. a filter list built entirely in the view) should override this, and override
restore_session_state()to apply it back.- Returns:
Extra state to serialize into this tab’s session history entry.
- Return type:
Dict[str, Any]
- MetaController.handle_kill_all_workers(subclass: str, exiting: bool = False) None¶
Kill all running workers for this tab, and say so on the display panel.
The panel message is skipped when
exitingis set: the display widget is being torn down along with everything else, so writing to it at that point would be pointless at best.
- MetaController.handle_kill_worker(subclass: str, identifier: str) None¶
Kill the selected worker if it is running, and say so on the display panel.
Every branch reports to the user. Previously the success path logged at INFO, which is below the default log level and therefore invisible, while the two no-op paths logged at WARNING and so raised a modal dialog containing a repr of the whole worker dictionary - feedback was exactly inverted, and a user aborting an operation had no way to tell whether it had taken effect.
- MetaController.load_actions_from_json(filename: str) None¶
Load and apply tab actions from a JSON file.
- Parameters:
filename (str) – Path to the JSON file containing saved actions.
- MetaController.relay_add_text_to_display(text: str, source: str) None¶
Relay text from model or view to be displayed in the main text display widget
- MetaController.restore_session_state(state: Dict[str, Any]) None¶
Restore extra tab-specific state captured by
get_session_state().Called by MainController after this tab is freshly instantiated during session load, with that tab’s full history entry (including keys unrelated to session state, which implementations should ignore). The base implementation does nothing.
- Parameters:
state (Dict[str, Any]) – This tab’s session history entry, as previously written by
get_session_state().
- MetaController.save_tab_actions(save_file: str | None = None) None¶
Emit a signal to save the current tab action history to the specified file.
- Parameters:
save_file (Optional[str]) – Optional path to the file where actions should be saved.
- MetaController.set_generator(generator: Generator[float, bool | None, None], channel: int, key: str, metaclass: str) None¶
Assign a generator to the model for asynchronous event processing.
- MetaController.update_available_plugins(available_plugins: Mapping[str, list[str]]) None¶
Called whenever a new plugin is instantiated elsewhere in the app, to keep an up to date list of possible data sources for use by this plugin
- MetaController.update_plot_data(data: Any | None) None¶
Update the view with new plot data.
- Parameters:
data (Optional[Any]) – Optional data to be plotted (e.g., event traces or fitted results).
Private Methods¶
Abstract Methods¶
These methods must be implemented by subclasses.
- abstractmethod MetaController._init() None¶
Perform additional initialization specific to the algorithm being implemented. Must be implemented by subclasses.
This function is called at the end of the class constructor to perform additional initialization specific to the algorithm being implemented. kwargs provided to the base class constructor are available as class attributes.
Concrete Methods¶
- MetaController.__init__(available_subclasses: Mapping[str, List[str]] | None = None, **kwargs: Any) None¶
Initialize the MetaController, along with its MetaView and MetaModel (built by the subclass’s _init()).
- MetaController._connect_global_signal() None¶
Connect global and data plugin signal relays from the view and model.
This enables propagation of global signals upward to the main controller.
- MetaController._relay_data_plugin_controller_signal(metaclass: str, subclass_key: str, call_function: str, call_args: tuple, return_function_name: str | None, ret_args: tuple) None¶
Push the data plugin controller signal up to the main_controller, adding the identifier for the requesting plugin. This will result in a call being made with the following signature in main_controller:
main_model.plugins['MetaController'][plugin_key].return_function(*plugins[metaclass][subclass_key].call_function(*call_args))
Validation is handled by main_controller
- Parameters:
metaclass (str) – A string matching the metaclass of the target plugin for the signal
subclass_key (str) – A string matching the identifier of a plugin that subclasses metaclass
call_function (str) – A string matching the signature of a callable in the data plugin controller. (NOT in the data plugin itself).
call_args (tuple) – A tuple that will be passed to the callable matching call_function
return_function_name (Optional[str]) – A string matching the signature of a callable function defined in this controller with a signature that matched the return type of call_function. This function must exist in this controller.
ret_args (tuple) – A tuple that will be appended to the return value of the call_function
- MetaController._relay_global_signal(metaclass: str, subclass_key: str, call_function: str, call_args: tuple, return_function_name: str | None, ret_args: tuple) None¶
Push the global signal up to the main_controller, adding the identifier for the requesting plugin. This will result in a call being made with the following signature in main_controller:
main_model.plugins['MetaController'][plugin_key].return_function(*plugins[metaclass][subclass_key].call_function(*call_args)+ret_args)
Validation is handled by main_controller
- Parameters:
metaclass (str) – A string matching the metaclass of the target plugin for the signal
subclass_key (str) – A string matching the identifier of a plugin that subclasses metaclass
call_function (str) – A string matching the signature of a callable in the plugin identified by metaclass and subclass. This function should be a public API member of another subclass that has already been instantiated.
call_args (tuple) – A tuple that will be passed to the callable matching call_function
return_function_name (Optional[str]) – A string matching the signature of a callable function defined in this controller with a signature that matched the return type of call_function. This function must exist in this controller.
ret_args (tuple) – A tuple that will be appended to the return value of the call_function