Skip to content

Commit

Permalink
fix current fov updates and move from well slector double click
Browse files Browse the repository at this point in the history
code cleanup
  • Loading branch information
soham1202 committed Dec 31, 2024
1 parent e0a5bbe commit 82422aa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
6 changes: 2 additions & 4 deletions software/control/core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3024,14 +3024,12 @@ def update_wellplate_settings(self, sample_format, a1_x_mm, a1_y_mm, a1_x_pixel,
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):
if not pos:
def draw_fov_current_location(self, x_mm, y_mm):
if x_mm is None and y_mm is None:
if self.x_mm is None and 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
Expand Down
22 changes: 11 additions & 11 deletions software/control/gui_hcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
SINGLE_WINDOW = True # set to False if use separate windows for display and control

class MovementUpdater(QObject):
position_after_move = Signal(squid.abc.Pos)
position_after_move = Signal(float, float)
position = Signal(squid.abc.Pos)

def __init__(self, stage: squid.abc.AbstractStage, movement_threshhold_mm=0.0001, *args, **kwargs):
Expand Down Expand Up @@ -702,7 +702,7 @@ def makeConnections(self):
self.wellplateFormatWidget.signalWellplateSettings.connect(self.wellSelectionWidget.onWellplateChanged)
self.wellplateFormatWidget.signalWellplateSettings.connect(lambda format_, *args: self.onWellplateChanged(format_))

self.wellSelectionWidget.signal_wellSelectedPos.connect(lambda well_x, well_y: self.stage.move_x_to(well_x) and self.stage.move_y_to(well_y))
self.wellSelectionWidget.signal_wellSelectedPos.connect(self.move_to_mm)
if ENABLE_WELLPLATE_MULTIPOINT:
self.wellSelectionWidget.signal_wellSelected.connect(self.wellplateMultiPointWidget.update_well_coordinates)
self.objectivesWidget.signal_objective_changed.connect(self.wellplateMultiPointWidget.update_coordinates)
Expand Down Expand Up @@ -730,6 +730,7 @@ def setup_movement_updater(self):
self.movement_update_timer = QTimer()
self.movement_update_timer.setInterval(100)
self.movement_update_timer.timeout.connect(self.movement_updater.do_update)
self.movement_update_timer.start()

def makeNapariConnections(self):
"""Initialize all Napari connections in one place"""
Expand Down Expand Up @@ -942,17 +943,13 @@ def setupSlidePositionController(self, is_for_wellplate):

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):
Expand All @@ -966,7 +963,7 @@ def replaceWellSelectionWidget(self, new_widget):
self.dock_wellSelection.addWidget(self.wellSelectionWidget)

def connectWellSelectionWidget(self):
self.wellSelectionWidget.signal_wellSelectedPos.connect(self.navigationController.move_to)
self.wellSelectionWidget.signal_wellSelectedPos.connect(self.move_to_mm)
self.wellplateFormatWidget.signalWellplateSettings.connect(self.wellSelectionWidget.onWellplateChanged)
if ENABLE_WELLPLATE_MULTIPOINT:
self.wellSelectionWidget.signal_wellSelected.connect(self.wellplateMultiPointWidget.update_well_coordinates)
Expand Down Expand Up @@ -1072,11 +1069,14 @@ def move_from_click_image(self, click_x, click_y, image_width, image_height):
def move_from_click_mm(self, x_mm, y_mm):
if self.navigationWidget.get_click_to_move_enabled():
self.log.debug(f"Click to move enabled, moving to {x_mm=}, {y_mm=}")
self.stage.move_x_to(x_mm)
self.stage.move_y_to(y_mm)
self.move_to_mm(x_mm, y_mm)
else:
self.log.debug(f"Click to move disabled, ignoring click request for {x_mm=}, {y_mm=}")

def move_to_mm(self, x_mm, y_mm):
self.stage.move_x_to(x_mm)
self.stage.move_y_to(y_mm)

def closeEvent(self, event):
try:
squid.stage.utils.cache_position(pos=self.stage.get_pos(), stage_config=self.stage.get_config())
Expand Down

0 comments on commit 82422aa

Please sign in to comment.