From 589de99819adc91a15461a9ed4339a7ff85e6a69 Mon Sep 17 00:00:00 2001 From: Soham Mukherjee Date: Tue, 31 Dec 2024 11:59:42 -0800 Subject: [PATCH] fix draw_fov_current_position (position signal) and update_live_coordinates (position_after_move signal) fix move from well selector double click move to cached position on startup no longer hidden behind HOMING flags --- software/control/core/core.py | 13 +++++-------- software/control/gui_hcs.py | 35 +++++++++++++++-------------------- software/control/widgets.py | 4 ++-- 3 files changed, 22 insertions(+), 30 deletions(-) diff --git a/software/control/core/core.py b/software/control/core/core.py index 76ff551c..8642ecd2 100644 --- a/software/control/core/core.py +++ b/software/control/core/core.py @@ -3377,17 +3377,14 @@ def update_wellplate_settings( self.update_display_properties(sample) self.draw_current_fov(self.x_mm, self.y_mm) - def draw_fov_current_location(self, pos: squid.abc.Pos): + def draw_fov_current_position(self, pos: squid.abc.Pos): if not pos: - if self.x_mm is None and self.y_mm is None: + if self.x_mm is None or self.y_mm is None: return - self.draw_current_fov(self.x_mm, self.y_mm) else: - x_mm = pos.x_mm - y_mm = pos.y_mm - self.draw_current_fov(x_mm, y_mm) - self.x_mm = x_mm - self.y_mm = y_mm + self.x_mm = pos.x_mm + self.y_mm = pos.y_mm + self.draw_current_fov(self.x_mm, self.y_mm) def get_FOV_pixel_coordinates(self, x_mm, y_mm): if self.sample == "glass slide": diff --git a/software/control/gui_hcs.py b/software/control/gui_hcs.py index ac024c55..99293b94 100644 --- a/software/control/gui_hcs.py +++ b/software/control/gui_hcs.py @@ -161,15 +161,14 @@ def __init__(self, is_simulation=False, live_only_mode=False, *args, **kwargs): self.microscope = control.microscope.Microscope(self.stage, self, is_simulation=is_simulation) - # TODO(imo): Why is moving to the cached position after boot hidden behind homing? - if HOMING_ENABLED_X and HOMING_ENABLED_Y and HOMING_ENABLED_Z: - if cached_pos := squid.stage.utils.get_cached_position(): - self.stage.move_x_to(cached_pos.x_mm) - self.stage.move_y_to(cached_pos.y_mm) - self.stage.move_z_to(cached_pos.z_mm) - - if ENABLE_WELLPLATE_MULTIPOINT: - self.wellplateMultiPointWidget.init_z() + if cached_pos := squid.stage.utils.get_cached_position(): + self.stage.move_x_to(cached_pos.x_mm) + self.stage.move_y_to(cached_pos.y_mm) + self.stage.move_z_to(cached_pos.z_mm) + + if ENABLE_WELLPLATE_MULTIPOINT: + self.wellplateMultiPointWidget.init_z() + if ENABLE_FLEXIBLE_MULTIPOINT: self.flexibleMultiPointWidget.init_z() # Create the menu bar @@ -850,7 +849,7 @@ def makeConnections(self): if ENABLE_FLEXIBLE_MULTIPOINT: self.objectivesWidget.signal_objective_changed.connect(self.flexibleMultiPointWidget.update_fov_positions) # TODO(imo): Fix position updates after removal of navigation controller - self.movement_updater.position_after_move.connect(self.navigationViewer.draw_fov_current_location) + self.movement_updater.position.connect(self.navigationViewer.draw_fov_current_position) if WELLPLATE_FORMAT == "glass slide": # TODO(imo): This well place logic is duplicated below in onWellPlateChanged. We should change it to only exist in 1 location. self.movement_updater.sent_after_stopped.connect(self.wellplateMultiPointWidget.set_live_scan_coordinates) @@ -1211,27 +1210,23 @@ def connectSlidePositionController(self): self.slidePositionController.signal_slide_loading_position_reached.connect( self.navigationWidget.slot_slide_loading_position_reached ) - if ENABLE_FLEXIBLE_MULTIPOINT: - self.slidePositionController.signal_slide_loading_position_reached.connect( - self.flexibleMultiPointWidget.disable_the_start_aquisition_button - ) - if ENABLE_WELLPLATE_MULTIPOINT: - self.slidePositionController.signal_slide_loading_position_reached.connect( - self.wellplateMultiPointWidget.disable_the_start_aquisition_button - ) - self.slidePositionController.signal_slide_scanning_position_reached.connect( self.navigationWidget.slot_slide_scanning_position_reached ) if ENABLE_FLEXIBLE_MULTIPOINT: + self.slidePositionController.signal_slide_loading_position_reached.connect( + self.flexibleMultiPointWidget.disable_the_start_aquisition_button + ) self.slidePositionController.signal_slide_scanning_position_reached.connect( self.flexibleMultiPointWidget.enable_the_start_aquisition_button ) if ENABLE_WELLPLATE_MULTIPOINT: + self.slidePositionController.signal_slide_loading_position_reached.connect( + self.wellplateMultiPointWidget.disable_the_start_aquisition_button + ) self.slidePositionController.signal_slide_scanning_position_reached.connect( self.wellplateMultiPointWidget.enable_the_start_aquisition_button ) - self.slidePositionController.signal_clear_slide.connect(self.navigationViewer.clear_slide) def replaceWellSelectionWidget(self, new_widget): diff --git a/software/control/widgets.py b/software/control/widgets.py index a9b3e2eb..6f45fef2 100644 --- a/software/control/widgets.py +++ b/software/control/widgets.py @@ -3636,13 +3636,13 @@ def update_well_coordinates(self, selected): elif self.scanCoordinates.has_regions(): self.scanCoordinates.clear_regions() - def update_live_coordinates(self, x, y): + def update_live_coordinates(self, pos: squid.abc.Pos): if hasattr(self.parent, "recordTabWidget") and self.parent.recordTabWidget.currentWidget() != self: return scan_size_mm = self.entry_scan_size.value() overlap_percent = self.entry_overlap.value() shape = self.combobox_shape.currentText() - self.scanCoordinates.set_live_scan_coordinates(x, y, scan_size_mm, overlap_percent, shape) + self.scanCoordinates.set_live_scan_coordinates(pos.x_mm, pos.y_mm, scan_size_mm, overlap_percent, shape) def toggle_acquisition(self, pressed): if not self.base_path_is_set: