tommy.controller.config_controller

Classes

class tommy.controller.config_controller.ConfigController[source]

Bases: object

Controls the access to and changes to the configuration settings.

add_configuration(name: str) bool[source]

Add a new configuration with the given name and switch to the new configuration :param name: Name of the configuration :return: Whether the config could successfully be created. Creating a config fails if a config with that name already exists

property config_switched_event: EventHandler[ConfigModel]
delete_configuration(name: str) bool[source]

Delete the configuration with the given name. If it is the currently selected configuration, switch to the previous configuration. If the currently selected configuration is the first one, switch to the next one instead :param name: Name of the configuration to delete :return: Whether or not deletion succeeded. Deletion of a configuration fails if the configuration name does not exist or if it is the only configuration

get_configuration_names() list[str][source]

Return a list of all the names of all configurations

get_selected_configuration() str[source]

Get the name of the currently selected configuration. :return: The name of the configuration

set_controller_refs(graph_controller: GraphController) None[source]

Set a reference to the graph controller :param graph_controller: The graph controller :return: None

set_model_refs(model: Model) None[source]

Set a reference to the main model so this class can manage the configurations :param model: The model :return: None

switch_configuration(name: str) bool[source]

Set the name of the config model in the main model and :param name: The name of the config to switch to :return: Whether or not the switch succeeded. Switching configuration can fail when the name is not recognized