Skip to content

Commit

Permalink
separate other stage changes from this branch
Browse files Browse the repository at this point in the history
  • Loading branch information
soham1202 committed Dec 31, 2024
1 parent d2f9f97 commit 8911aed
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions software/control/gui_hcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def do_update(self):
# In here, send all the signals that must be sent once per stop of movement. AKA once per arriving at a
# new position for a while.
self.sent_after_stopped = True

self.position_after_move.emit(pos.x_mm, pos.y_mm)
else:
self.sent_after_stopped = False
Expand Down Expand Up @@ -703,8 +704,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)
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))
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 @@ -907,13 +907,15 @@ def onWellplateChanged(self, format_):
# TODO(imo): Not sure why glass slide is so special here? It seems like it's just a "1 well plate". Also why is the objective forced to inverted for all non-glass slide, and not inverted for glass slide?
if format_ == 'glass slide':
self.toggleWellSelector(False)
self.multipointController.inverted_objective = False
if not self.is_live_scan_grid_on: # connect live scan grid for glass slide
self.movement_updater.position_after_move.connect(self.wellplateMultiPointWidget.update_live_coordinates)
self.is_live_scan_grid_on = True
self.log.debug("live scan grid connected.")
self.setupSlidePositionController(is_for_wellplate=False)
else:
self.toggleWellSelector(True)
self.multipointController.inverted_objective = True
if self.is_live_scan_grid_on: # disconnect live scan grid for wellplate
self.movement_updater.position_after_move.disconnect(self.wellplateMultiPointWidget.update_live_coordinates)
self.is_live_scan_grid_on = False
Expand Down Expand Up @@ -942,13 +944,17 @@ def setupSlidePositionController(self, is_for_wellplate):

def connectSlidePositionController(self):
self.slidePositionController.signal_slide_loading_position_reached.connect(self.navigationWidget.slot_slide_loading_position_reached)
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.navigationWidget.slot_slide_scanning_position_reached)
if ENABLE_FLEXIBLE_MULTIPOINT:
self.slidePositionController.signal_slide_scanning_position_reached.connect(self.flexibleMultiPointWidget.enable_the_start_aquisition_button)
if ENABLE_WELLPLATE_MULTIPOINT:
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 @@ -962,7 +968,7 @@ def replaceWellSelectionWidget(self, new_widget):
self.dock_wellSelection.addWidget(self.wellSelectionWidget)

def connectWellSelectionWidget(self):
self.wellSelectionWidget.signal_wellSelectedPos.connect(self.move_to_mm)
self.wellSelectionWidget.signal_wellSelectedPos.connect(self.navigationController.move_to)
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 @@ -1068,14 +1074,11 @@ 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.move_to_mm(x_mm, y_mm)
self.stage.move_x_to(x_mm)
self.stage.move_y_to(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 8911aed

Please sign in to comment.