navigate.controller.sub_controllers.channels_settings.ChannelSettingController
- class navigate.controller.sub_controllers.channels_settings.ChannelSettingController(view, parent_controller=None, configuration_controller=None)
Bases:
GUIController
Controller for the channel setting widgets.
- __init__(view, parent_controller=None, configuration_controller=None)
Initialize the ChannelSettingController.
- Parameters:
view (navigate.view.channel_setting_view.ChannelSettingView) – The view for the channel setting widgets.
parent_controller (navigate.controller.main_controller.MainController) – The parent controller.
configuration_controller (ConfigurationController) – The configuration controller.
Methods
__init__
(view[, parent_controller, ...])Initialize the ChannelSettingController.
channel_callback
(channel_id, widget_name)Callback function for the channel widgets.
execute
(command, *args)This function is called when a command is passed from a child process.
get_index
(dropdown_name, value)Get the index of the value in the dropdown list.
get_vals_by_channel
(index)Get the values of the channel widgets by channel id.
Populates the laser and filter wheel options in the View.
Populates the View with empty values.
populate_experiment_values
(setting_dict)Populates the View with the values from the setting dictionary.
register_event_listener
(event_name, ...)Register event listener in the parent_controller
Sets values of widgets based on experiment setting
set_mode
([mode])Set the mode of the channel setting controller.
set_spinbox_range_limits
(settings)Set the range limits for the spinboxes in the View.
show_verbose_info
(*info)Prints verbose information to the console
Update experiment values according to GUI
Verify channel settings and return warning info
Attributes
Custom events for the controller
The configuration controller.
The mode of the channel setting controller.
Whether the channel setting controller is in initialization.
The event id.
The channel setting dictionary.
- channel_callback(channel_id, widget_name)
Callback function for the channel widgets.
In ‘live’ mode (when acquire mode is set to ‘continuous’) and a channel is selected, any change of the channel setting will influence devices instantly this function will call the central controller to response user’s request
- Parameters:
channel_id (int) – The channel id.
widget_name (str) – The name of the widget.
- Returns:
success – Whether the callback function is executed successfully.
- Return type:
bool
- execute(command, *args)
This function is called when a command is passed from a child process.
- Parameters:
command (str) – command name
args (tuple) – command arguments
- get_index(dropdown_name, value)
Get the index of the value in the dropdown list.
- Parameters:
dropdown_name (str) – The name of the dropdown list.
value (str) – The value of the dropdown list.
- Returns:
The index of the value in the dropdown list.
- Return type:
int
- get_vals_by_channel(index)
Get the values of the channel widgets by channel id.
This function return all the variables according channel_id
- Parameters:
index (int) – The channel id.
- Returns:
The values of the channel widgets.
- Return type:
dict
- initialize()
Populates the laser and filter wheel options in the View.
- populate_empty_values()
Populates the View with empty values.
If the user changes the number of channels, the new channels need to be populated with a default value.
- populate_experiment_values(setting_dict)
Populates the View with the values from the setting dictionary.
Set channel values according to channel id the value should be a dict { ‘channel_id’: {
‘is_selected’: True(False), ‘laser’: , ‘filter’: , ‘camera_exposure_time’: , ‘laser_power’: , ‘interval_time’:}
}
- Parameters:
setting_dict (dict) – Dictionary containing the values for the experiment.
- register_event_listener(event_name, event_handler)
Register event listener in the parent_controller
- Parameters:
event_name (str) – event name
event_handler (function) – event handler
- set_experiment_values()
Sets values of widgets based on experiment setting
setting_dict is a dictionary
- set_mode(mode='stop')
Set the mode of the channel setting controller.
- Parameters:
mode (str) – “stop” or “live”
- set_spinbox_range_limits(settings)
Set the range limits for the spinboxes in the View.
This function will set the spinbox widget’s values of from_, to, step according to the settings
- Parameters:
settings (dict) – Dictionary containing the range limits for the spinboxes.
- show_verbose_info(*info)
Prints verbose information to the console
- Parameters:
info (tuple) – information to be printed
- update_experiment_values()
Update experiment values according to GUI
- verify_experiment_values()
Verify channel settings and return warning info
- Returns:
Warning info
- Return type:
string
- channel_setting_dict
The channel setting dictionary.
- Type:
dict
- configuration_controller
The configuration controller.
- Type:
- property custom_events
Custom events for the controller
- event_id
The event id.
- Type:
int
- in_initialization
Whether the channel setting controller is in initialization.
- Type:
bool
- mode
The mode of the channel setting controller. Either ‘live’ or ‘stop’.
- Type:
str
- parent_controller
parent controller
- Type:
- view
GUI view
- Type:
tkinter.Tk