Fix/stop cbview in motion #164

Merged
duan_j merged 3 commits from fix/stop-cbview-in-motion into main 2026-08-24 13:39:29 +02:00
2 changed files with 13 additions and 12 deletions
+6 -6
View File
@@ -2795,13 +2795,13 @@ 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 in (BeamlineStateEnum.Moving, BeamlineStateEnum.RobotSampleExchange)
moving = s.state == BeamlineStateEnum.RobotSampleExchange
if moving and not self._watching_motion:
self._watching_motion = True
self.video_tab.setCurrentWidget(self.beamline_combined_panel)
+7 -6
View File
@@ -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)
)