From 1a9f4d8709d479ea35ffb31c8a3b9220d967b8b2 Mon Sep 17 00:00:00 2001 From: Dawn Date: Mon, 24 Aug 2026 13:30:20 +0200 Subject: [PATCH] test: Moving state no longer flips to combined view The fix removed Moving from the motion-watch trigger but the unit test and code comment still described the old behavior, so pre-push failed. Co-Authored-By: Claude Fable 5 --- src/aare/gui/main_window.py | 10 +++++----- tests/unit/gui/test_main_window.py | 13 +++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/aare/gui/main_window.py b/src/aare/gui/main_window.py index fa823a63..ea6a1bc7 100644 --- a/src/aare/gui/main_window.py +++ b/src/aare/gui/main_window.py @@ -2795,11 +2795,11 @@ class MainWindow(QMainWindow): if self._remote_close_deadline_ts is not None: self._clear_remote_close_request() - # Only robot-scale motion flips to the Beamline combined view: state - # transitions (the server parks in Moving while driving motors) and - # the robot station. Busy alone no longer triggers it — Sample - # alignment, Beam location, Beamstop alignment, Flux measurement - # etc. run busy while the user watches the sample camera itself. + # Only the robot station flips to the Beamline combined view. Moving + # no longer triggers it (short gonio moves kept stealing the sample + # camera), and busy alone never did — Sample alignment, Beam + # location, Beamstop alignment, Flux measurement etc. run busy while + # the user watches the sample camera itself. # Edge-triggered so a manual tab choice survives between transitions. moving = s.state == BeamlineStateEnum.RobotSampleExchange if moving and not self._watching_motion: diff --git a/tests/unit/gui/test_main_window.py b/tests/unit/gui/test_main_window.py index 1f8c2262..4020f28a 100644 --- a/tests/unit/gui/test_main_window.py +++ b/tests/unit/gui/test_main_window.py @@ -71,10 +71,11 @@ def test_main_window_init(qtbot, mock_ui_state, daq_status_factory): win.data_collection._emit_change_energy() assert sent and abs(sent[0] - 12400.0) < 1e-6 - # Motion watch: only a state transition (Moving) or the robot station - # switches to the combined beamline view. Busy alone never does — - # Sample alignment, Beam location etc. run busy while the user - # watches the sample camera itself. + # Motion watch: only the robot station switches to the combined + # beamline view. Moving no longer does (users kept losing the sample + # camera on short gonio moves), and busy alone never does — Sample + # alignment, Beam location etc. run busy while the user watches the + # sample camera itself. win.update_daq_status( daq_status_factory(state=BeamlineStateEnum.RobotSampleExchange, busy=True) ) @@ -88,8 +89,8 @@ def test_main_window_init(qtbot, mock_ui_state, daq_status_factory): win.update_daq_status(daq_status_factory(state=BeamlineStateEnum.BeamLocation, busy=True)) assert not win._watching_motion win.update_daq_status(daq_status_factory(state=BeamlineStateEnum.Moving, busy=True)) - assert win._watching_motion - assert win.video_tab.currentWidget() is win.beamline_combined_panel + assert not win._watching_motion + assert win.video_tab.currentWidget() is win.sample_camera win.update_daq_status( daq_status_factory(state=BeamlineStateEnum.DataCollection, busy=False) )