feat(bec_widgets): grey out Yes/No in ConsoleButtonsWidget when no message

Yes/No start disabled and are enabled only while a message is set; ABORT
stays always enabled. Clear visual cue that there's nothing to confirm.
This commit is contained in:
x12sa
2026-07-12 07:28:10 +02:00
committed by holler
co-authored by holler
parent c11cc24fcd
commit f583bb336b
@@ -67,6 +67,16 @@ class ConsoleButtonsWidget(BECWidget, QWidget):
self.no_button.clicked.connect(self._on_no)
self.abort_button.clicked.connect(self._on_abort)
# Start with Yes/No greyed out: with no message there is nothing to
# respond to, so there should be nothing clickable. ABORT is left
# always enabled -- it's an emergency stop and must work at any time,
# message or not.
self._set_yesno_enabled(False)
def _set_yesno_enabled(self, enabled: bool):
self.yes_button.setEnabled(enabled)
self.no_button.setEnabled(enabled)
@SafeSlot()
def _on_yes(self):
self._response = "yes"
@@ -88,6 +98,9 @@ class ConsoleButtonsWidget(BECWidget, QWidget):
@rpc_timeout(20)
def message(self, text: str):
self.message_label.setText(text)
# A non-empty message means there's something to respond to, so
# enable Yes/No; an empty message greys them out again.
self._set_yesno_enabled(bool(text))
def response(self) -> str:
"""