From 0a8a34879a701a2d045f628403c6a0f8be21dc82 Mon Sep 17 00:00:00 2001 From: kali Date: Fri, 26 Oct 2012 05:16:44 +0900 Subject: stop eip connection when first run wizard started Closes #716 --- src/leap/baseapp/leap_app.py | 19 ++++++++++++------- src/leap/baseapp/mainwindow.py | 23 ++++++++++++++--------- src/leap/baseapp/systray.py | 5 +---- 3 files changed, 27 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/leap/baseapp/leap_app.py b/src/leap/baseapp/leap_app.py index d1acb8ba..4b63dd2f 100644 --- a/src/leap/baseapp/leap_app.py +++ b/src/leap/baseapp/leap_app.py @@ -52,7 +52,7 @@ class MainWindowMixin(object): self.firstRunWizardAct = QtGui.QAction( "&First run wizard...", self, - triggered=self.launch_first_run_wizard) + triggered=self.stop_connection_and_launch_first_run_wizard) self.aboutAct = QtGui.QAction("&About", self, triggered=self.about) #self.aboutQtAct = QtGui.QAction("About &Qt", self, @@ -74,16 +74,21 @@ class MainWindowMixin(object): self.menuBar().addMenu(self.settingsMenu) self.menuBar().addMenu(self.helpMenu) - def launch_first_run_wizard(self): + def stop_connection_and_launch_first_run_wizard(self): settings = QtCore.QSettings() settings.setValue('FirstRunWizardDone', False) logger.debug('should run first run wizard again...') - from leap.gui.firstrunwizard import FirstRunWizard - wizard = FirstRunWizard( - parent=self, - success_cb=self.initReady.emit) - wizard.show() + status = self.conductor.get_icon_name() + if status != "disconnected": + self.start_or_stopVPN() + + self.launch_first_run_wizard() + #from leap.gui.firstrunwizard import FirstRunWizard + #wizard = FirstRunWizard( + #parent=self, + #success_cb=self.initReady.emit) + #wizard.show() def set_app_icon(self): icon = QtGui.QIcon(APP_LOGO) diff --git a/src/leap/baseapp/mainwindow.py b/src/leap/baseapp/mainwindow.py index 38fa4a45..8f359dbf 100644 --- a/src/leap/baseapp/mainwindow.py +++ b/src/leap/baseapp/mainwindow.py @@ -125,18 +125,23 @@ class LeapWindow(QtGui.QMainWindow, # launch wizard if needed if need_wizard: - from leap.gui.firstrunwizard import FirstRunWizard - wizard = FirstRunWizard( - self.conductor, - parent=self, - eip_username=self.eip_username, - start_eipconnection_signal=self.start_eipconnection, - eip_statuschange_signal=self.eipStatusChange) - wizard.show() + self.launch_first_run_wizard() else: # no wizard needed logger.debug('running first run wizard') self.initReady.emit() - return + + def launch_first_run_wizard(self): + """ + launches wizard and blocks + """ + from leap.gui.firstrunwizard import FirstRunWizard + wizard = FirstRunWizard( + self.conductor, + parent=self, + eip_username=self.eip_username, + start_eipconnection_signal=self.start_eipconnection, + eip_statuschange_signal=self.eipStatusChange) + wizard.show() def runchecks_and_eipconnect(self): self.initchecks.begin() diff --git a/src/leap/baseapp/systray.py b/src/leap/baseapp/systray.py index 8777207c..06be2975 100644 --- a/src/leap/baseapp/systray.py +++ b/src/leap/baseapp/systray.py @@ -129,12 +129,9 @@ class StatusAwareTrayIconMixin(object): def toggleEIPAct(self): # this is too simple by now. - # XXX We need to get the REAL info for Encryption state. - # (now is ON as soon as vpn launched) - # XXX get STATUS CONSTANTS INSTEAD - icon_status = self.conductor.status.get_state_icon() + icon_status = self.conductor.get_icon_name() if icon_status == "connected": self.connAct.setEnabled(True) self.connAct.setText('Encryption ON turn o&ff') -- cgit v1.2.3