From 9aeacefbf08bd007cf31e0e122f3c08a7de4d7ad Mon Sep 17 00:00:00 2001 From: x01dc Date: Tue, 14 Jul 2026 13:15:27 +0200 Subject: [PATCH] fix(bec_widgets): warn before "Add current params to queue" during an edit Real footgun: edit a value in the params panel but don't click its own "Add to queue" (or Submit) -- then use the *separate* Queue control window's "Add current params to queue" button, expecting it to queue what was just typed. It doesn't: that button reads live global vars (TOMO_QUEUE_COMMAND_JOBS_PLAN.md section 6.1's rule -- only the panel's own Add-to-queue reads the form), so it silently queues the stale, pre-edit values with no indication anything's off. Now checks the parent params panel's edit-mode state and, if an edit is in progress, warns explicitly and points at the correct button before proceeding -- a warning rather than a hard block, since queuing the live params alongside an unrelated in-progress edit elsewhere is still a legitimate thing to want. Co-Authored-By: Claude Sonnet 5 --- .../widgets/tomo_params/tomo_params.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/csaxs_bec/bec_widgets/widgets/tomo_params/tomo_params.py b/csaxs_bec/bec_widgets/widgets/tomo_params/tomo_params.py index e21b791..55ee053 100644 --- a/csaxs_bec/bec_widgets/widgets/tomo_params/tomo_params.py +++ b/csaxs_bec/bec_widgets/widgets/tomo_params/tomo_params.py @@ -1318,6 +1318,25 @@ class TomoQueueDialog(QDialog): # ── queue actions ───────────────────────────────────────────────────────── def add_to_queue(self) -> None: + # "Current params" here means the *live* global vars -- if the + # params panel has an unsubmitted edit open, that edit is NOT what + # gets queued (the panel's own "Add to queue" button is the one + # that reads the form; see TOMO_QUEUE_COMMAND_JOBS_PLAN.md section + # 6.1). Warn rather than silently queuing something other than + # what the operator is looking at. + if getattr(self.parent(), "_edit_mode", False): + reply = QMessageBox.warning( + self, + "Unsaved edit in progress", + "The tomo parameters panel has an edit in progress. This button " + "queues the current LIVE parameters -- not your unsaved edit. Use " + "\"Add to queue\" in the params panel itself if you want to queue " + "what you just typed.\n\n" + "Queue the live (unedited) parameters anyway?", + QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.Cancel, + ) + if reply != QMessageBox.StandardButton.Yes: + return label, ok = QInputDialog.getText(self, "Add to queue", "Job label (leave blank for auto):") if not ok: return