From d8e7ac6f5dd10700d8a6b461a9a5c4bd1c889895 Mon Sep 17 00:00:00 2001 From: Tristan Simas Date: Mon, 16 Nov 2026 14:57:14 -0500 Subject: [PATCH] Qt menu lists Toad's application actions; Channels raises the sidebar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - The ☰ menu was a hand-written pair (Hide/Show sidebar, Quit). It now lists ApplicationAction.menu(app), the same family Textual's menu lists (#1812, #1814), and runs a choice as a MenuActionRun operation: New thread, Channels, Direct messages, Quit (last, by the family's declared menu place). - QtCommsHost.reveal_sidebar answered True as if "the window's thread list is always on screen", which stopped being true when the sidebar became a panel the bar raises and lowers; Channels did nothing. reveal_sidebar moves onto QtToadApp, which owns the sidebar, and raises it. Seen working: the offscreen Qt client on the live bus listed those four actions; Channels raised the sidebar. Direct messages still opens nothing on Qt (its navigation owner is NoNavigationOwner) and New thread needs Qt forms; both next. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016gZLdupVQyBzHTmHBC9Cyn --- src/toad/qt/host.py | 4 ---- src/toad/qt/window.py | 20 +++++++++++++++----- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/toad/qt/host.py b/src/toad/qt/host.py index 85612215b..2b261d407 100644 --- a/src/toad/qt/host.py +++ b/src/toad/qt/host.py @@ -126,10 +126,6 @@ def clear_focus(self) -> None: if (focused := QApplication.focusWidget()) is not None: focused.clearFocus() - async def reveal_sidebar(self) -> bool: - """The window's thread list is always on screen.""" - return True - def capture_command_origin(self) -> WindowCommandOrigin: return WindowCommandOrigin(QApplication.activeWindow()) diff --git a/src/toad/qt/window.py b/src/toad/qt/window.py index abf79cdff..982d45378 100644 --- a/src/toad/qt/window.py +++ b/src/toad/qt/window.py @@ -53,6 +53,7 @@ ) from toad.client.application import ClientApplication +from toad.client.application_actions import ApplicationAction from toad.client.connection import ( CoordinationAccess, FailedObservation, @@ -94,6 +95,10 @@ class MessageSend(OperationKind): """Sends one message; sends run side by side and are never superseded.""" +class MenuActionRun(OperationKind): + """One application action chosen from the menu.""" + + class TabClose(OperationKind): """Closes one tab; closes run side by side.""" @@ -734,6 +739,11 @@ def hide_sidebar(self) -> None: self.sidebar.hide() self.paint_sidebar_bar() + async def reveal_sidebar(self) -> bool: + """The sidebar comes up over the conversation, as its bar would bring it.""" + self.show_sidebar() + return True + def toggle_sidebar(self) -> None: if self.sidebar.isVisible(): self.hide_sidebar() @@ -741,12 +751,12 @@ def toggle_sidebar(self) -> None: self.show_sidebar() def show_menu(self) -> None: - """popup(), not exec(): exec's nested event loop under qasync showed nothing on - Android.""" + """Toad's application actions under their labels, as its menu lists them; a choice + runs as its own operation. popup(), not exec(): exec's nested event loop under qasync + showed nothing on Android.""" self.menu_popup = QMenu(self) - self.menu_popup.addAction("Hide sidebar" if self.sidebar.isVisible() else "Show sidebar", - self.toggle_sidebar) - self.menu_popup.addAction("Quit", self.close) + for command, label in ApplicationAction.menu(self): + self.menu_popup.addAction(label, partial(self.run_operation, MenuActionRun, partial(command.apply, self))) corner = self.menu.mapToGlobal(self.menu.rect().topLeft()) self.menu_popup.popup(corner - QPoint(0, self.menu_popup.sizeHint().height()))