feat: queue controls live only in the Queued view
CI / lint (push) Skipped
CI / test (3.11) (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 / test (3.11) (pull_request) Successful in 1m6s
CI / test (3.12) (pull_request) Successful in 1m7s
CI / lint (pull_request) Successful in 1m15s
CI / test-with-beamline-plugins (pxi_bec) (pull_request) Successful in 1m24s
CI / test-with-beamline-plugins (pxiii_bec) (pull_request) Successful in 1m24s
CI / test (3.13) (pull_request) Successful in 1m32s
CI / test-with-beamline-plugins (pxii_bec) (pull_request) Successful in 1m28s
CI / test-with-coverage (pull_request) Successful in 1m48s
CI / coverage-analysis (pull_request) Successful in 4s

Run/Remove selected/Clear list act on the queue, whose order only the
Queued chip view shows - in other views they are greyed out with a
tooltip pointing at the chip. Run stays enabled while automation runs
so pausing is always possible. Applies to the docked trio and the
pop-out clones alike.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
duan_jandClaude Fable 5 committed 2026-08-17 16:24:09 +02:00
1 parent 344888dac0
commit 6ace1fcbcf
1 file changed
+40
+40
View File
@@ -608,6 +608,23 @@ class MainWindow(QMainWindow):
self.job_list_panel.remove_button.clicked.connect(self._remove_selected_from_queue)
self.job_list_panel.hide()
# Queue controls act on the queue, whose order only the Queued chip
# view shows — so they are live there and greyed out elsewhere. The
# pop-out clones register themselves in _clone_automation_row. "run"
# kind stays enabled while automation runs: pausing is always allowed.
self._queue_action_buttons: list[tuple[QPushButton, str]] = [
(self.job_list_panel.play_button, "run"),
(self.job_list_panel.remove_button, "queue"),
(self.job_list_panel.clear_button, "queue"),
]
self.tell_samples.status_chips.buttonClicked.connect(
lambda _chip: self._update_queue_buttons_enabled()
)
self.job_list_panel.automation_running_changed.connect(
lambda _running: self._update_queue_buttons_enabled()
)
self._update_queue_buttons_enabled()
self.sample_lists_tabs = QTabWidget()
self.sample_lists_tabs.addTab(dewar_tab, "Dewar samples")
self.sample_lists_tabs.addTab(self.ref_tools_panel, "Auxiliary puck")
@@ -1297,6 +1314,16 @@ class MainWindow(QMainWindow):
sample.db_id for sample in self.job_list_panel.table_model.samples
)
@Slot()
def _update_queue_buttons_enabled(self) -> None:
queued_view = self.tell_samples.table_model.status_filter == "queued"
running = self.job_list_panel.is_running()
tip = "Active in the Queued view — click the Queued chip above the table"
for button, kind in self._queue_action_buttons:
enabled = queued_view or (kind == "run" and running)
button.setEnabled(enabled)
button.setToolTip("" if enabled else tip)
@Slot()
def _remove_selected_from_queue(self) -> None:
self._unqueue_panel_selection(self.tell_samples)
@@ -1341,6 +1368,11 @@ class MainWindow(QMainWindow):
dewar_panel.status_chips.buttonClicked.connect(
lambda chip: self.tell_samples.set_status_chip(chip.property("status_key"))
)
# Pop-out chips drive the same shared filter — regate the queue
# buttons from here too.
dewar_panel.status_chips.buttonClicked.connect(
lambda _chip: self._update_queue_buttons_enabled()
)
dewar_panel.set_status_chip(self.tell_samples.table_model.status_filter)
dewar_tab = QWidget()
@@ -1408,6 +1440,14 @@ class MainWindow(QMainWindow):
unmount_button = QPushButton("⏏ Unmount")
unmount_button.clicked.connect(lambda: self._on_manual_unmount_requested())
# Same Queued-view gating as the docked trio.
self._queue_action_buttons += [
(run_button, "run"),
(remove_button, "queue"),
(clear_button, "queue"),
]
self._update_queue_buttons_enabled()
row = QHBoxLayout()
for button in (run_button, remove_button, clear_button, unmount_button):
row.addWidget(button)