diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/leap/baseapp/eip.py | 13 | ||||
-rw-r--r-- | src/leap/baseapp/leap_app.py | 22 | ||||
-rw-r--r-- | src/leap/baseapp/mainwindow.py | 66 | ||||
-rw-r--r-- | src/leap/baseapp/systray.py | 11 |
4 files changed, 60 insertions, 52 deletions
diff --git a/src/leap/baseapp/eip.py b/src/leap/baseapp/eip.py index e8b9fe53..a67fd916 100644 --- a/src/leap/baseapp/eip.py +++ b/src/leap/baseapp/eip.py @@ -19,6 +19,8 @@ class EIPConductorApp(object): opts = kwargs.pop('opts') config_file = getattr(opts, 'config_file', None) + self.eip_service_started = False + self.conductor = EIPConnection( watcher_cb=self.newLogLine.emit, config_file=config_file, @@ -28,8 +30,15 @@ class EIPConductorApp(object): # XXX remove skip download when sample service is ready self.conductor.run_checks(skip_download=True) self.error_check() - if self.conductor.autostart: - self.start_or_stopVPN() + + # XXX should receive "ready" signal + #if self.conductor.autostart: + #self.start_or_stopVPN() + + # move to eipconductor init? + if self.debugmode: + self.startStopButton.clicked.connect( + lambda: self.start_or_stopVPN()) def error_check(self): ####### error checking ################ diff --git a/src/leap/baseapp/leap_app.py b/src/leap/baseapp/leap_app.py index fb736ee3..1b4d7747 100644 --- a/src/leap/baseapp/leap_app.py +++ b/src/leap/baseapp/leap_app.py @@ -5,6 +5,28 @@ from leap.gui import mainwindow_rc class MainWindow(object): + def __init__(self, *args, **kwargs): + # XXX set initial visibility + # debug = no visible + + widget = QtGui.QWidget() + self.setCentralWidget(widget) + + self.createWindowHeader() + + # add widgets to layout + mainLayout = QtGui.QVBoxLayout() + mainLayout.addWidget(self.headerBox) + mainLayout.addWidget(self.statusIconBox) + if self.debugmode: + mainLayout.addWidget(self.statusBox) + mainLayout.addWidget(self.loggerBox) + widget.setLayout(mainLayout) + + self.setWindowTitle("LEAP Client") + self.resize(400, 300) + self.set_statusbarMessage('ready') + def createWindowHeader(self): """ description lines for main window diff --git a/src/leap/baseapp/mainwindow.py b/src/leap/baseapp/mainwindow.py index 917fc184..7cd02979 100644 --- a/src/leap/baseapp/mainwindow.py +++ b/src/leap/baseapp/mainwindow.py @@ -13,73 +13,39 @@ from leap.baseapp.log import LogPane from leap.baseapp.systray import StatusAwareTrayIcon from leap.baseapp.leap_app import MainWindow -from leap.gui import mainwindow_rc - class LeapWindow(QtGui.QMainWindow, MainWindow, EIPConductorApp, StatusAwareTrayIcon, LogPane): - # move to log newLogLine = QtCore.pyqtSignal([str]) - - # move to icons statusChange = QtCore.pyqtSignal([object]) def __init__(self, opts): logger.debug('init leap window') - super(LeapWindow, self).__init__() - self.debugmode = getattr(opts, 'debug', False) - self.eip_service_started = False - - # create timer ############################## - # move to Icons init?? - self.timer = QtCore.QTimer() - ############################################# + super(LeapWindow, self).__init__() if self.debugmode: self.createLogBrowser() EIPConductorApp.__init__(self, opts=opts) - - # LeapWindow init - self.createWindowHeader() - - # StatusAwareTrayIcon init ################### - self.createIconGroupBox() - self.createActions() - self.createTrayIcon() - ############################################## - - # move to MainWindow init #################### - widget = QtGui.QWidget() - self.setCentralWidget(widget) - - # add widgets to layout - mainLayout = QtGui.QVBoxLayout() - mainLayout.addWidget(self.headerBox) - mainLayout.addWidget(self.statusIconBox) - if self.debugmode: - mainLayout.addWidget(self.statusBox) - mainLayout.addWidget(self.loggerBox) - widget.setLayout(mainLayout) - ############################################### - - # move to icons? - self.trayIcon.show() - self.setWindowTitle("LEAP Client") - self.resize(400, 300) - self.set_statusbarMessage('ready') + StatusAwareTrayIcon.__init__(self) + MainWindow.__init__(self) # bind signals # XXX move to parent classes init?? self.trayIcon.activated.connect(self.iconActivated) - self.newLogLine.connect(lambda line: self.onLoggerNewLine(line)) - self.statusChange.connect(lambda status: self.onStatusChange(status)) - self.timer.timeout.connect(lambda: self.onTimerTick()) - - # move to eipconductor init? - if self.debugmode: - self.startStopButton.clicked.connect( - lambda: self.start_or_stopVPN()) + self.newLogLine.connect( + lambda line: self.onLoggerNewLine(line)) + self.statusChange.connect( + lambda status: self.onStatusChange(status)) + self.timer.timeout.connect( + lambda: self.onTimerTick()) + + # ... all ready. go! + + # could send "ready" signal instead + # eipapp should catch that + if self.conductor.autostart: + self.start_or_stopVPN() diff --git a/src/leap/baseapp/systray.py b/src/leap/baseapp/systray.py index 7ef5cb01..249a4f7e 100644 --- a/src/leap/baseapp/systray.py +++ b/src/leap/baseapp/systray.py @@ -6,6 +6,17 @@ from leap.gui import mainwindow_rc class StatusAwareTrayIcon(object): + def __init__(self, *args, **kwargs): + # StatusAwareTrayIcon init ################### + self.createIconGroupBox() + self.createActions() + self.createTrayIcon() + + self.trayIcon.show() + ############################################## + + self.timer = QtCore.QTimer() + def createIconGroupBox(self): """ dummy icongroupbox |