fix(bec_widgets): require sample owner in sample-storage widget
Read the Docs Deploy Trigger / trigger-rtd-webhook (push) Successful in 2s
CI for csaxs_bec / test (push) Successful in 2m3s

The owner prompt was labeled and treated as optional, but an occupied
slot must always have an owner recorded. Both the rename and new-sample
dialogs now validate the owner the same way the name field already is:
cancelling or leaving it empty aborts the write instead of silently
falling back to a blank/previous owner.
This commit was merged in pull request #263.
This commit is contained in:
x01dc
2026-07-16 16:28:12 +02:00
committed by holler
parent d6c0c85a60
commit 2863cd51c4
@@ -428,10 +428,17 @@ class SampleStorageWidget(BECWidget, QWidget):
owner, ok = QInputDialog.getText(
self,
"Sample owner",
f"Owner for slot {self._slot_title(slot)} (optional):",
f"Owner for slot {self._slot_title(slot)}:",
text=current_owner,
)
owner = owner.strip() if ok else current_owner
if not ok:
return
owner = owner.strip()
if not owner:
QMessageBox.warning(
self, "Invalid owner", "An occupied slot needs a non-empty owner."
)
return
if self._write_slot(slot, 1, name, owner):
self.refresh()
@@ -447,9 +454,16 @@ class SampleStorageWidget(BECWidget, QWidget):
QMessageBox.warning(self, "Invalid name", "Please enter a non-empty sample name.")
return
owner, ok = QInputDialog.getText(
self, "Sample owner", f"Owner for slot {self._slot_title(slot)} (optional):"
self, "Sample owner", f"Owner for slot {self._slot_title(slot)}:"
)
owner = owner.strip() if ok else ""
if not ok:
return
owner = owner.strip()
if not owner:
QMessageBox.warning(
self, "Invalid owner", "An occupied slot needs a non-empty owner."
)
return
if self._write_slot(slot, 1, name, owner):
self.refresh()