STill trying random AI fixes.. I should stop doing this haha
This commit is contained in:
+15
-10
@@ -830,11 +830,18 @@ class MainWindow(QMainWindow):
|
||||
|
||||
@Slot(dict)
|
||||
def _show_baton_request_dialog(self, payload: dict):
|
||||
logger.info(f"Showing baton request dialog with payload: {payload}")
|
||||
requester = str(payload.get("requester") or "Another user")
|
||||
timeout = int(payload.get("timeout") or 30)
|
||||
|
||||
if self._baton_request_dialog is not None and self._baton_request_dialog.isVisible():
|
||||
return
|
||||
if self._baton_request_dialog is not None:
|
||||
if self._baton_request_dialog.isVisible():
|
||||
logger.debug("Baton request dialog already visible, skipping")
|
||||
return
|
||||
else:
|
||||
logger.debug("Baton request dialog exists but not visible, recreating")
|
||||
self._baton_request_dialog.close()
|
||||
self._baton_request_dialog = None
|
||||
|
||||
self._baton_request_dialog = BatonRequestDialog(
|
||||
requester=requester,
|
||||
@@ -846,14 +853,7 @@ class MainWindow(QMainWindow):
|
||||
self._baton_request_dialog.show()
|
||||
self._baton_request_dialog.raise_()
|
||||
self._baton_request_dialog.activateWindow()
|
||||
|
||||
@Slot()
|
||||
def _accept_baton_request(self):
|
||||
self.daq.respond_to_baton_request(True)
|
||||
|
||||
@Slot()
|
||||
def _refuse_baton_request(self):
|
||||
self.daq.respond_to_baton_request(False)
|
||||
logger.info("Baton request dialog shown")
|
||||
|
||||
@Slot()
|
||||
def _accept_baton_request(self):
|
||||
@@ -875,6 +875,11 @@ class MainWindow(QMainWindow):
|
||||
else:
|
||||
self.alert_banner.show_message("Request declined or cancelled", False, auto_clear_ms=10000)
|
||||
|
||||
# Manage incoming request dialog
|
||||
if not status.incoming_request and self._baton_request_dialog is not None:
|
||||
logger.info("Incoming baton request no longer active, closing request dialog")
|
||||
self._close_baton_dialog()
|
||||
|
||||
@Slot(dict)
|
||||
def _on_baton_request_result(self, result: dict):
|
||||
"""Handle result of our baton request - show waiting banner with countdown."""
|
||||
|
||||
@@ -237,12 +237,15 @@ class StatusBar(QStatusBar):
|
||||
|
||||
incoming = bool(status and status.incoming_request)
|
||||
if incoming and not prev_incoming:
|
||||
logger.info(f"Incoming baton request detected: {status.pending_request}")
|
||||
self._emit_incoming_baton_request(status)
|
||||
|
||||
if self._baton_request_dialog is not None and self._baton_request_dialog.isVisible():
|
||||
if not incoming:
|
||||
elif not incoming and self._baton_request_dialog is not None:
|
||||
logger.info("Baton request no longer incoming, closing local dialog reference")
|
||||
try:
|
||||
self._baton_request_dialog.close()
|
||||
self._baton_request_dialog = None
|
||||
except Exception as e:
|
||||
logger.error(f"Error closing baton request dialog: {e}")
|
||||
self._baton_request_dialog = None
|
||||
|
||||
def _emit_incoming_baton_request(self, status: BatonStatus) -> None:
|
||||
requester = "Another user"
|
||||
|
||||
Reference in New Issue
Block a user