fix(gui): skip mount auto-centering during queue automation
CI / lint (push) Skipped
CI / test (3.12) (push) Skipped
CI / test (3.13) (push) Skipped
CI / test-with-beamline-plugins (pxi_bec) (push) Skipped
CI / test-with-beamline-plugins (pxii_bec) (push) Skipped
CI / test-with-beamline-plugins (pxiii_bec) (push) Skipped
CI / lint (pull_request) Successful in 1m18s
CI / test-with-beamline-plugins (pxi_bec) (pull_request) Successful in 1m41s
CI / test-with-beamline-plugins (pxii_bec) (pull_request) Successful in 1m44s
CI / test (3.12) (pull_request) Successful in 1m46s
CI / test (3.13) (pull_request) Successful in 1m45s
CI / test (3.14) (pull_request) Failing after 1m45s
CI / test-with-beamline-plugins (pxiii_bec) (pull_request) Successful in 1m49s
CI / test-with-coverage (pull_request) Successful in 1m58s
CI / coverage-analysis (pull_request) Successful in 4s

Automation centers each sample itself and frees the hw lock between
samples; waiting for idle made the GUI fire center_loop in that gap,
which could steal the lock from the next /scan/auto and stop the queue.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
duan_jandClaude Opus 5.5 committed 2026-09-29 11:19:24 +02:00
1 parent 43054dc0e8
commit f49f34cd27
3 files changed
+35 -1

No files matched your search

+3
View File
@@ -745,6 +745,9 @@ class MainWindow(QMainWindow):
self.automation_progress_panel.set_running
)
self.job_list_panel.automation_running_changed.connect(self._on_automation_running_changed)
self.job_list_panel.automation_running_changed.connect(
self.data_collection.set_automation_running
)
self.automation_progress_panel.set_samples_in_queue(
len(self.job_list_panel.table_model.samples)
@@ -197,6 +197,7 @@ class DataCollectionSettings(QFrame):
self._status_seen = False
# Set on mount, fired once the hw lock frees (see _track_sample).
self._center_after_mount_pending = False
self._automation_running = False
self._tab_bar.currentChanged.connect(self._stack.setCurrentIndex)
self._tab_bar.currentChanged.connect(self._on_tab_changed)
@@ -258,7 +259,9 @@ class DataCollectionSettings(QFrame):
self._sample_id = db_id
self._tab_bar.setCurrentIndex(0)
self._center_after_mount_pending = (
self._status_seen and self.auto_center_after_mount.isChecked()
self._status_seen
and self.auto_center_after_mount.isChecked()
and not self._automation_running
)
self._status_seen = True
# The server publishes the new sample while the mount still holds the
@@ -270,6 +273,15 @@ class DataCollectionSettings(QFrame):
# main_window) instead of a second signal path.
self.find_tip.click()
@Slot(bool)
def set_automation_running(self, running: bool):
# Queue automation centers each sample itself and frees the hw lock
# between samples; a GUI centering in that gap could steal the lock
# from the next /scan/auto and stop the queue.
self._automation_running = running
if running:
self._center_after_mount_pending = False
@Slot(int)
def _on_tab_changed(self, idx: int):
self.bounding_box.setVisible(idx == 0)
@@ -376,6 +376,25 @@ def test_auto_center_waits_for_mount_to_release_hw_lock(settings_panel):
assert len(clicks) == 1
def test_auto_center_skipped_during_queue_automation(settings_panel):
# Automation centers itself and frees the lock between samples; a GUI
# centering there could steal the lock from the next /scan/auto.
clicks = []
settings_panel.find_tip.clicked.connect(lambda: clicks.append(1))
settings_panel.auto_center_after_mount.setChecked(True)
settings_panel._track_sample(1)
settings_panel.set_automation_running(True)
settings_panel._track_sample(2, busy=True)
settings_panel._track_sample(2, busy=False)
assert not clicks
settings_panel.set_automation_running(False)
settings_panel._track_sample(3, busy=True)
settings_panel._track_sample(3, busy=False)
assert len(clicks) == 1
# ---------------------------------------------------------------------------
# Pending color while typing (movestate property, committed on Enter/focus-out)
# ---------------------------------------------------------------------------