navigate.controller.sub_controllers.stages.StageController
- class navigate.controller.sub_controllers.stages.StageController(view: StageControlTab, parent_controller: Controller)
Bases:
GUIControllerThis class is the controller for the stage GUI. It handles the stage movement and the stage limits. It also handles the stage movement buttons and the stage movement limits.
- __init__(view: StageControlTab, parent_controller: Controller) → None
Initializes the StageController
- Parameters:
view (navigate.view.stage_view.StageView) – The stage view
parent_controller (navigate.controller.Controller) – The parent controller of the stage controller
Methods
__init__(view, parent_controller)Initializes the StageController
Binds position_callback() to each axis, records the trace name so we can unbind later.
disable_synthetic_stages(config)Disable synthetic stages.
down_btn_handler(axis[, large_step])This function generates command functions according to the desired axis to move.
execute(command, *args)This function is called when a command is passed from a child process.
force_enable_all_axes([event])Enables all buttons and entries on the stage tab.
This function returns current position from the view.
home_button_handler(*args)This function calls the home method of the stage.
Initialize the Stage limits of steps and positions.
joystick_button_handler([event])Toggle the joystick operation mode.
This function sets all the position and step values
position_callback(axis, *args[, require_focus])Callback functions bind to position variables.
register_event_listener(event_name, ...)Register event listener in the parent_controller
Sets values of widgets based on experiment setting
Set hover descriptions for the stage tab
set_position(position)This function is to populate(set) position in the View
set_position_silent(position)This function is to populate(set) position in the View without a trace.
show_verbose_info(*info)Prints verbose information to the console
stage_key_press(event)The stage key press.
stop_button_handler(*args)Request an immediate stop for all stages.
Unbinds position callbacks.
up_btn_handler(axis[, large_step])This function generates command functions according to the desired axis to move.
update_experiment_values(*args)Collects all the values of widgets
update_step_size_handler(axis)Callback functions bind to step size variables
Attributes
- bind_position_callbacks() → None
Binds position_callback() to each axis, records the trace name so we can unbind later.
- disable_synthetic_stages(config: ConfigurationController) → None
Disable synthetic stages.
- Parameters:
config (ConfigurationController) – The configuration controller
- down_btn_handler(axis: str, large_step: bool = False) → Callable[[], None]
This function generates command functions according to the desired axis to move.
- Parameters:
axis (str) – Should be one of ‘x’, ‘y’, ‘z’, ‘theta’, ‘f’ position_axis += step_axis
large_step (bool) – If True, the step size is 5x the normal step size.
- Returns:
handler – Function for setting desired stage positions in the View.
- Return type:
Callable[[], None]
- 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
- force_enable_all_axes(event: Optional[Event] = None, *args: Iterable) → None
Enables all buttons and entries on the stage tab.
- Parameters:
event (Optional[tk.Event]) – The tkinter event (currently unused)
*args (Iterable) – Variable length argument list
- get_position() → Optional[dict[str, float]]
This function returns current position from the view.
- Returns:
position – Dictionary of x, y, z, theta, and f values. None if the value is not valid.
- Return type:
Optional[dict[str, float]]
- home_button_handler(*args: Iterable) → None
This function calls the home method of the stage.
- Parameters:
*args (Iterable) – Variable length argument list
- initialize() → None
Initialize the Stage limits of steps and positions.
- joystick_button_handler(event: Optional[Event] = None, *args: Iterable) → None
Toggle the joystick operation mode.
- Parameters:
event (Optional[tk.Event]) – The tkinter event
*args (Iterable) – Variable length argument list
- populate_experiment_values() → None
This function sets all the position and step values
- position_callback(axis: str, *args: Iterable, require_focus: bool = True, **kwargs: dict) → Callable[[], None]
Callback functions bind to position variables.
Implements debounce functionality for user inputs (or click buttons) to reduce time costs of moving stage.
- Parameters:
axis (str) – axis can be ‘x’, ‘y’, ‘z’, ‘theta’, ‘f’
*args (Iterable) – Variable length argument list
require_focus (bool) – Ignore focus-out events when the application has no keyboard focus. Explicit jog buttons disable this check so their displayed target is still sent when Tk reports no focused widget.
kwargs (Iterable) – Variable length keyword argument list
- Returns:
handler – Function for moving stage to the desired position with debounce functionality.
- Return type:
Callable[[], None]
- 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_hover_descriptions() → None
Set hover descriptions for the stage tab
- set_position(position: Dict[str, float]) → None
This function is to populate(set) position in the View
- Parameters:
position (Dict[str, float]) – {‘x’: value, ‘y’: value, ‘z’: value, ‘theta’: value, ‘f’: value}
- set_position_silent(position: Dict[str, float]) → None
This function is to populate(set) position in the View without a trace.
- Parameters:
position (Dict[str, float]) – {‘x’: value, ‘y’: value, ‘z’: value, ‘theta’: value, ‘f’: value}
- show_verbose_info(*info)
Prints verbose information to the console
- Parameters:
info (tuple) – information to be printed
- stage_key_press(event: Event) → None
The stage key press.
This function is called when a W, A, S, or D is pressed and initializes a stage movement..
- Parameters:
event (tk.Event) – The tkinter event
- stop_button_handler(*args: Iterable) → None
Request an immediate stop for all stages.
- Parameters:
*args (Iterable) – Variable length argument list
- unbind_position_callbacks() → None
Unbinds position callbacks.
- up_btn_handler(axis: str, large_step: bool = False) → Callable[[], None]
This function generates command functions according to the desired axis to move.
- Parameters:
axis (str) – Should be one of ‘x’, ‘y’, ‘z’, ‘theta’, ‘f’ position_axis += step_axis
large_step (bool) – If True, the step size is 5x the normal step size.
- Returns:
handler – Function for setting desired stage positions in the View.
- Return type:
Callable[[], None]
- update_experiment_values(*args)
Collects all the values of widgets
setting_dict is a reference of experiment dictionary update the dictionary directly
- update_step_size_handler(axis: str) → Callable[[], None]
Callback functions bind to step size variables
- Parameters:
axis (str) – axis can be ‘xy’, ‘z’, ‘theta’, ‘f’
- Returns:
handler – Function to update step size in experiment.yml.
- Return type:
Callable[[], None]
- property custom_events
Custom events for the controller
- default_microscope
The default microscope
- Type:
str
- event_id
The event id
- Type:
dict
- flip_flags
The stage flip flags
- Type:
list
- joystick_axes
The joystick axes
- Type:
list
- joystick_is_on
The joystick mode is on.
- Type:
bool
- new_joystick_axes
The joystick axes
- Type:
dict
- parent_controller
parent controller
- Type:
- position_callback_traces
The position callback traces
- Type:
dict
- position_callbacks_bound
The position callbacks are bound
- Type:
bool
- position_max
The maximum stage positions.
- Type:
dict
- position_min
The minimum stage positions.
- Type:
dict
- stage_limits
The stage limits are on
- Type:
bool
- stage_setting_dict
The stage setting dictionary
- Type:
dict
- view
GUI view
- Type:
tkinter.Tk
- widget_vals
The widget values for the stage position and step sizes.
- Type:
dict