From c3f3f8f24fea2d0b7e6880fdfeb40888b5c34f8c Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Fri, 1 Apr 2016 17:09:45 +0300 Subject: [PATCH] tray menu #1 --- src/main.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main.py b/src/main.py index 6721aa5..3f896b1 100644 --- a/src/main.py +++ b/src/main.py @@ -62,12 +62,18 @@ class Toxygen(object): data = ProfileHelper.open_profile(path, name) self.tox = tox_factory(data, settings) + self.ms = MainWindow(self.tox, self.reset) + # tray icon self.tray = QtGui.QSystemTrayIcon(QtGui.QIcon(curr_directory() + '/images/icon.png')) - self.tray.setContextMenu(QtGui.QMenu()) + m = QtGui.QMenu() + show = m.addAction('Open Toxygen') + exit = m.addAction('Exit') + m.connect(show, QtCore.SIGNAL("triggered()"), lambda: self.ms.activateWindow()) + m.connect(exit, QtCore.SIGNAL("triggered()"), lambda: app.exit()) + self.tray.setContextMenu(m) self.tray.show() - self.ms = MainWindow(self.tox, self.reset) self.ms.show() QtGui.QApplication.setStyle(get_style(settings['theme'])) # set application style