Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/toad/qt/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down
20 changes: 15 additions & 5 deletions src/toad/qt/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
)

from toad.client.application import ClientApplication
from toad.client.application_actions import ApplicationAction
from toad.client.connection import (
CoordinationAccess,
FailedObservation,
Expand Down Expand Up @@ -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."""

Expand Down Expand Up @@ -734,19 +739,24 @@ 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()
else:
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()))

Expand Down
Loading