diff options
author | Kali Kaneko <kali@leap.se> | 2017-10-17 01:53:55 +0200 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2017-11-01 01:39:36 +0100 |
commit | ec908bfeec712fc5e65025392c1604f0d95212db (patch) | |
tree | 94acf5b5575e30e3f6efa7ee19085b869d63479b | |
parent | 7bb6db86ae94d9b459de010812c7f03568299aed (diff) |
[feature] first stub for the systray
-rw-r--r-- | src/leap/bitmask/gui/app.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/leap/bitmask/gui/app.py b/src/leap/bitmask/gui/app.py index 38a37c47..8ec15b2a 100644 --- a/src/leap/bitmask/gui/app.py +++ b/src/leap/bitmask/gui/app.py @@ -47,6 +47,11 @@ else: from PyQt5.QtCore import QSize from PyQt5.QtCore import QObject, pyqtSlot from PyQt5.QtWidgets import QApplication + from PyQt5.QtGui import QIcon + from PyQt5.QtWidgets import QMenu + from PyQt5.QtWidgets import QSystemTrayIcon + from PyQt5.QtWidgets import QDialog + try: from PyQt5.QtWebKitWidgets import QWebView from PyQt5.QtWebKit import QWebSettings @@ -66,7 +71,14 @@ bitmaskd = None browser = None -class BrowserWindow(QWebView): +class WithTrayIcon(QDialog): + + def createTrayIcon(self): + self.trayIcon = QSystemTrayIcon(self) + self.trayIcon.setContextMenu(self.trayIconMenu) + + +class BrowserWindow(QWebView, WithTrayIcon): """ This qt-webkit window exposes a couple of callable objects through the python-js bridge: @@ -216,6 +228,9 @@ def launch_gui(): print('ERROR: ' + e.message) sys.exit(1) + browser.createTrayIcon() + browser.trayIcon.show() + qApp.setQuitOnLastWindowClosed(True) qApp.lastWindowClosed.connect(browser.shutdown) |