Skip to content

Commit

Permalink
small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
annie-xd-wang committed Jul 24, 2023
1 parent 21f43b5 commit f92dd34
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
5 changes: 3 additions & 2 deletions src/aslm/controller/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def change_microscope(self, microscope_name):
] = microscope_name
if self.configuration_controller.change_microscope():
# update widgets
self.stage_controller.initialize(f"{microscope_name}")
self.stage_controller.initialize()
self.channels_tab_controller.initialize()

def initialize_cam_view(self):
Expand Down Expand Up @@ -334,6 +334,7 @@ def populate_experiment_setting(self, file_name=None, in_initialize=False):
microscope_name = self.configuration["experiment"]["MicroscopeState"][
"microscope_name"
]
self.configuration_controller.change_microscope()
self.menu_controller.resolution_value.set(
f"{microscope_name} "
f"{self.configuration['experiment']['MicroscopeState']['zoom']}"
Expand All @@ -353,7 +354,7 @@ def populate_experiment_setting(self, file_name=None, in_initialize=False):

# set widget modes
self.set_mode_of_sub("stop")
self.stage_controller.initialize(f"{microscope_name}")
self.stage_controller.initialize()

def update_experiment_setting(self):
"""Update model.experiment according to values in the GUI
Expand Down
15 changes: 4 additions & 11 deletions src/aslm/controller/sub_controllers/stage_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def __init__(self, view, main_view, canvas, parent_controller):
self.joystick_is_on = False
self.joystick_axes = self.parent_controller.configuration["configuration"][
"microscopes"
][self.default_microscope]["stage"]["joystick_axes"]
][self.default_microscope]["stage"].get("joystick_axes", [])

self.main_view = main_view
self.canvas = canvas
Expand Down Expand Up @@ -194,14 +194,9 @@ def stage_key_press(self, event):
current_position["x"] += xy_increment
self.set_position(current_position)

def initialize(self, microscope_name=None):
def initialize(self):
"""Initialize the Stage limits of steps and positions
Parameters
----------
microscope_name : str
Name of the microscope at the time of initialization
Returns
-------
None
Expand Down Expand Up @@ -230,13 +225,11 @@ def initialize(self, microscope_name=None):
widgets[step_axis + "_step"].set(step_dict[axis])

# Joystick

if microscope_name is None:
microscope_name = self.default_microscope
microscope_name = config.microscope_name

self.new_joystick_axes = self.parent_controller.configuration["configuration"][
"microscopes"
][f"{microscope_name}"]["stage"]["joystick_axes"]
][f"{microscope_name}"]["stage"].get("joystick_axes", [])

if self.view.stop_frame.joystick_btn.winfo_ismapped():
if self.new_joystick_axes is None or list(self.new_joystick_axes) == []:
Expand Down

0 comments on commit f92dd34

Please sign in to comment.