From 58bde9379bd09b6c22bf0409b829894b753e59c9 Mon Sep 17 00:00:00 2001 From: Dawn Date: Thu, 13 Aug 2026 15:42:00 +0200 Subject: [PATCH] feat: switch to Beamline combined view while busy Generalize the robot-mount auto-switch: any busy period now brings up the combined view so the motion can be watched, and the sample camera returns when busy clears. Edge-triggered, so manual tab choices survive between transitions; _mounting renamed to _watching_motion. Co-Authored-By: Claude Fable 5 --- src/aare/gui/main_window.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/aare/gui/main_window.py b/src/aare/gui/main_window.py index b6090f42..183934e1 100644 --- a/src/aare/gui/main_window.py +++ b/src/aare/gui/main_window.py @@ -199,7 +199,7 @@ class MainWindow(QMainWindow): self._base_url = base_url self._token = token - self._mounting = False + self._watching_motion = False self._samcam_feed_banner_active = False self._samcam_feed_banner_message = "Sample camera feed unavailable" @@ -2707,11 +2707,16 @@ class MainWindow(QMainWindow): if self._remote_close_deadline_ts is not None: self._clear_remote_close_request() - if not self._mounting and s.state == BeamlineStateEnum.RobotSampleExchange: - self._mounting = True + # Busy (or the robot station) means something is physically moving: + # show the Beamline combined view so the motion can be watched, and + # return to the sample camera once it is done. Edge-triggered so a + # manual tab choice survives between transitions. + moving = bool(s.busy) or s.state == BeamlineStateEnum.RobotSampleExchange + if moving and not self._watching_motion: + self._watching_motion = True self.video_tab.setCurrentWidget(self.beamline_combined_panel) - elif self._mounting and s.state != BeamlineStateEnum.RobotSampleExchange: - self._mounting = False + elif not moving and self._watching_motion: + self._watching_motion = False self.video_tab.setCurrentWidget(self.sample_camera) # ========== BATON DIALOG HANDLING ==========