from PyQt4 import QtGui
from leap.gui import mainwindow_rc
class MainWindow(object):
def createWindowHeader(self):
"""
description lines for main window
"""
self.headerBox = QtGui.QGroupBox()
self.headerLabel = QtGui.QLabel("Encryption \
Internet Proxy")
self.headerLabelSub = QtGui.QLabel("trust your \
technolust")
pixmap = QtGui.QPixmap(':/images/leapfrog.jpg')
frog_lbl = QtGui.QLabel()
frog_lbl.setPixmap(pixmap)
headerLayout = QtGui.QHBoxLayout()
headerLayout.addWidget(frog_lbl)
headerLayout.addWidget(self.headerLabel)
headerLayout.addWidget(self.headerLabelSub)
headerLayout.addStretch()
self.headerBox.setLayout(headerLayout)
def set_statusbarMessage(self, msg):
self.statusBar().showMessage(msg)
def closeEvent(self, event):
"""
redefines close event (persistent window behaviour)
"""
if self.trayIcon.isVisible() and not self.debugmode:
QtGui.QMessageBox.information(
self, "Systray",
"The program will keep running "
"in the system tray. To "
"terminate the program, choose "
"Quit in the "
"context menu of the system tray entry.")
self.hide()
event.ignore()
if self.debugmode:
self.cleanupAndQuit()
def cleanupAndQuit(self):
"""
cleans state before shutting down app.
"""
# TODO:make sure to shutdown all child process / threads
# in conductor
# XXX send signal instead?
self.conductor.cleanup()
QtGui.qApp.quit()