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 <noreply@anthropic.com>
This commit is contained in:
x01dc
2026-07-14 13:15:27 +02:00
co-authored by Claude Sonnet 5
parent d8b7737cc7
commit 9aeacefbf0
@@ -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