Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Open Dashboard on double click
  • Loading branch information
Drarig29 committed Mar 13, 2021
1 parent 19f8719 commit 26580fe
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions aw_qt/trayicon.py
Expand Up @@ -87,20 +87,25 @@ def __init__(
self.manager = manager
self.testing = testing

self.root_url = "http://localhost:{port}".format(port=5666 if self.testing else 5600)
self.activated.connect(self.on_activated)

self._build_rootmenu()

def on_activated(self, reason: QSystemTrayIcon.ActivationReason):
if reason == QSystemTrayIcon.DoubleClick:
open_webui(self.root_url)

def _build_rootmenu(self) -> None:
menu = QMenu(self._parent)

root_url = "http://localhost:{port}".format(port=5666 if self.testing else 5600)

if self.testing:
menu.addAction("Running in testing mode") # .setEnabled(False)
menu.addSeparator()

# openWebUIIcon = QIcon.fromTheme("open")
menu.addAction("Open Dashboard", lambda: open_webui(root_url))
menu.addAction("Open API Browser", lambda: open_apibrowser(root_url))
menu.addAction("Open Dashboard", lambda: open_webui(self.root_url))
menu.addAction("Open API Browser", lambda: open_apibrowser(self.root_url))

menu.addSeparator()

Expand Down

0 comments on commit 26580fe

Please sign in to comment.