MetaController¶
class MetaController(available_subclasses = 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.export_plot_data()¶
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.handle_kill_all_workers(subclass, exiting=False)¶
Kill all running workers.
- MetaController.handle_kill_worker(subclass, identifier)¶
Kill the selected worker if it is running.
- MetaController.ignore()¶
Placeholder method that does nothing. Can be overridden if needed.
- MetaController.load_actions_from_json(filename)¶
Load and apply tab actions from a JSON file.
- Parameters:
filename (str) – Path to the JSON file containing saved actions.
- Returns:
None
- MetaController.relay_add_text_to_display(text, source)¶
Relay text from model or view to be displayed in the main text display widget
- MetaController.save_tab_actions(save_file: str | 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_force_serial_channel_operations(serial_ops, key, channel)¶
Set a flag to enforce serial execution for specific channel operations.
- MetaController.set_generator(generator, channel, key, metaclass)¶
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)¶
Update the view with new plot data.
- Parameters:
data (Any or None) – 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=None, **kwargs) None¶
Initialize the MetaController with instances of MetaView and MetaModel
- Parameters:
view (MetaView) – an object conforming to the MetaView interface
model – an object conforming to the MetaModel interface
kwargs (dict) – Additional parameters to set as attributes on the instance
- 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_create_plugin(metaclass, subclass)¶
- 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).
return_function (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.
call_args (str) – A tuple that will be passed to the callable matching call_function
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.
return_function (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.
call_args (str) – A tuple that will be passed to the callable matching call_function
ret_args (tuple) – A tuple that will be appended to the return value of the call_function