diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/leap/baseapp/leap_app.py | 24 | ||||
-rw-r--r-- | src/leap/baseapp/systray.py | 68 |
2 files changed, 65 insertions, 27 deletions
diff --git a/src/leap/baseapp/leap_app.py b/src/leap/baseapp/leap_app.py index 18b5084b..208c4e7c 100644 --- a/src/leap/baseapp/leap_app.py +++ b/src/leap/baseapp/leap_app.py @@ -7,6 +7,9 @@ from leap.gui import mainwindow_rc logger = logging.getLogger(name=__name__) +APP_LOGO = ':/images/leap-color-small.png' + + class MainWindowMixin(object): """ create the main window @@ -32,25 +35,30 @@ class MainWindowMixin(object): widget.setLayout(mainLayout) self.setWindowTitle("LEAP Client") + self.set_app_icon() self.resize(400, 300) self.set_statusbarMessage('ready') + def set_app_icon(self): + icon = QtGui.QIcon(APP_LOGO) + self.setWindowIcon(icon) + def createWindowHeader(self): """ description lines for main window """ self.headerBox = QtGui.QGroupBox() - self.headerLabel = QtGui.QLabel("<font size=40><b>E</b>ncryption \ -<b>I</b>nternet <b>P</b>roxy</font>") - self.headerLabelSub = QtGui.QLabel("<i>trust your \ -technolust</i>") + self.headerLabel = QtGui.QLabel( + "<font size=40>LEAP Encryption Access Project</font>") + self.headerLabelSub = QtGui.QLabel( + "<br><i>your internet encryption toolkit</i>") - pixmap = QtGui.QPixmap(':/images/leap-color-small.png') - frog_lbl = QtGui.QLabel() - frog_lbl.setPixmap(pixmap) + pixmap = QtGui.QPixmap(APP_LOGO) + leap_lbl = QtGui.QLabel() + leap_lbl.setPixmap(pixmap) headerLayout = QtGui.QHBoxLayout() - headerLayout.addWidget(frog_lbl) + headerLayout.addWidget(leap_lbl) headerLayout.addWidget(self.headerLabel) headerLayout.addWidget(self.headerLabelSub) headerLayout.addStretch() diff --git a/src/leap/baseapp/systray.py b/src/leap/baseapp/systray.py index 67448ba0..dd872de0 100644 --- a/src/leap/baseapp/systray.py +++ b/src/leap/baseapp/systray.py @@ -1,9 +1,18 @@ +import logging + from PyQt4 import QtCore from PyQt4 import QtGui from leap import __version__ as VERSION from leap.gui import mainwindow_rc +logger = logging.getLogger(__name__) + + +class PseudoAction(QtGui.QAction): + def isSeparator(self): + return True + class StatusAwareTrayIconMixin(object): """ @@ -76,12 +85,15 @@ class StatusAwareTrayIconMixin(object): """ self.trayIconMenu = QtGui.QMenu(self) - self.trayIconMenu.addAction(self.connectVPNAction) - self.trayIconMenu.addAction(self.dis_connectAction) + self.trayIconMenu.addAction(self.statusAct) + self.trayIconMenu.addAction(self.connAct) + #self.trayIconMenu.addAction(self.dis_connectAction) + #self.trayIconMenu.addSeparator() + #self.trayIconMenu.addAction(self.minimizeAction) + #self.trayIconMenu.addAction(self.maximizeAction) + #self.trayIconMenu.addAction(self.restoreAction) self.trayIconMenu.addSeparator() - self.trayIconMenu.addAction(self.minimizeAction) - self.trayIconMenu.addAction(self.maximizeAction) - self.trayIconMenu.addAction(self.restoreAction) + self.trayIconMenu.addAction(self.detailsAct) self.trayIconMenu.addSeparator() self.trayIconMenu.addAction(self.aboutAct) self.trayIconMenu.addAction(self.aboutQtAct) @@ -92,22 +104,32 @@ class StatusAwareTrayIconMixin(object): self.setIcon('disconnected') self.trayIcon.setContextMenu(self.trayIconMenu) + def bad(self): + logger.error('this should not be called') + def createActions(self): """ creates actions to be binded to tray icon """ - self.connectVPNAction = QtGui.QAction("Connect to &VPN", self, - triggered=self.hide) # XXX change action name on (dis)connect - self.dis_connectAction = QtGui.QAction( - "&(Dis)connect", self, - triggered=lambda: self.start_or_stopVPN()) - self.minimizeAction = QtGui.QAction("Mi&nimize", self, - triggered=self.hide) - self.maximizeAction = QtGui.QAction("Ma&ximize", self, - triggered=self.showMaximized) - self.restoreAction = QtGui.QAction("&Restore", self, - triggered=self.showNormal) + statusAct = PseudoAction( + "Encryption OFF", self) # , + statusAct.setSeparator(True) + self.statusAct = statusAct + self.statusAct.isSeparator = lambda: True + #triggered=self.bad) + self.connAct = QtGui.QAction(" turn &on", self, + triggered=lambda: self.start_or_stopVPN()) + + self.detailsAct = QtGui.QAction("&Details...", + self, + triggered=self.detailsWin) + #self.minimizeAction = QtGui.QAction("Mi&nimize", self, + #triggered=self.hide) + #self.maximizeAction = QtGui.QAction("Ma&ximize", self, + #triggered=self.showMaximized) + #self.restoreAction = QtGui.QAction("&Restore", self, + #triggered=self.showNormal) self.aboutAct = QtGui.QAction("&About", self, triggered=self.about) self.aboutQtAct = QtGui.QAction("About Q&t", self, @@ -115,11 +137,19 @@ class StatusAwareTrayIconMixin(object): self.quitAction = QtGui.QAction("&Quit", self, triggered=self.cleanupAndQuit) + def detailsWin(self): + logger.debug('details win toggle') + # XXX toggle main window visibility + # if visible: self.hide + # if hidden: self.show + def about(self): # move to widget QtGui.QMessageBox.about(self, "About", - "Running LEAP client<br>" - "version <b>%s</b>" % VERSION) + "LEAP client<br>" + "(version <b>%s</b>)<br>" + "<a href='https://leap.se/'>" + "https://leap.se</a>" % VERSION) def setConnWidget(self, icon_name): oldlayout = self.statusIconBox.layout() @@ -132,7 +162,7 @@ class StatusAwareTrayIconMixin(object): def setIcon(self, name): icon = self.Icons.get(name)(self) self.trayIcon.setIcon(icon) - self.setWindowIcon(icon) + #self.setWindowIcon(icon) def getIcon(self, icon_name): return self.states.get(icon_name, None) |