From bc775969e2db31b892526b65a5037470a86b3882 Mon Sep 17 00:00:00 2001 From: kali Date: Fri, 19 Oct 2012 06:12:14 +0900 Subject: logic for cert validation widgets in wizard --- src/leap/baseapp/eip.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/eip.py b/src/leap/baseapp/eip.py index 93dce3ac..ca2e03c3 100644 --- a/src/leap/baseapp/eip.py +++ b/src/leap/baseapp/eip.py @@ -137,14 +137,14 @@ class EIPConductorAppMixin(object): # is not ready yet. return - if self.conductor.with_errors: + #if self.conductor.with_errors: #XXX how to wait on pkexec??? #something better that this workaround, plz!! #I removed the pkexec pass authentication at all. #time.sleep(5) #logger.debug('timeout') - logger.error('errors. disconnect') - self.start_or_stopVPN() # is stop + #logger.error('errors. disconnect') + #self.start_or_stopVPN() # is stop state = self.conductor.poll_connection_state() if not state: -- cgit v1.2.3 From ac67079632fb96d9da463e0cc9f2367b0ba6886e Mon Sep 17 00:00:00 2001 From: kali Date: Wed, 24 Oct 2012 01:16:05 +0900 Subject: save geometry (was badly merged) --- src/leap/baseapp/leap_app.py | 4 ++-- src/leap/baseapp/mainwindow.py | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/leap_app.py b/src/leap/baseapp/leap_app.py index 6ffb08a8..d1acb8ba 100644 --- a/src/leap/baseapp/leap_app.py +++ b/src/leap/baseapp/leap_app.py @@ -127,8 +127,8 @@ class MainWindowMixin(object): "context menu of the system tray entry.") self.hide() event.ignore() - if self.debugmode: - self.cleanupAndQuit() + return + self.cleanupAndQuit() def cleanupAndQuit(self): """ diff --git a/src/leap/baseapp/mainwindow.py b/src/leap/baseapp/mainwindow.py index 3b6cb544..df7159ce 100644 --- a/src/leap/baseapp/mainwindow.py +++ b/src/leap/baseapp/mainwindow.py @@ -48,17 +48,18 @@ class LeapWindow(QtGui.QMainWindow, if self.debugmode: self.createLogBrowser() - EIPConductorAppMixin.__init__(self, opts=opts) + settings = QtCore.QSettings() + provider_domain = settings.value("provider_domain", None) + logger.debug('provider: %s', provider_domain) + + EIPConductorAppMixin.__init__( + self, opts=opts, provider=provider_domain) StatusAwareTrayIconMixin.__init__(self) NetworkCheckerAppMixin.__init__(self) MainWindowMixin.__init__(self) - settings = QtCore.QSettings() - geom_key = "DebugGeometry" if self.debugmode else "Geometry" geom = settings.value(geom_key) - - geom = settings.value("Geometry") if geom: self.restoreGeometry(geom) self.wizard_done = settings.value("FirstRunWizardDone") -- cgit v1.2.3 From 0060d3c74adce19fab7215b3788c5197cc05a9ae Mon Sep 17 00:00:00 2001 From: kali Date: Wed, 24 Oct 2012 04:05:19 +0900 Subject: sign up branch ends by triggering eip connection still need to bind signals properly, and block on the validation process until we receive the "connected" signal. but the basic flow is working again, i.e, user should be able to remove the .config/leap folder and get all the needed info from the provider. --- src/leap/baseapp/eip.py | 4 +++- src/leap/baseapp/mainwindow.py | 52 +++++++++++++++++++++++++++++++----------- 2 files changed, 42 insertions(+), 14 deletions(-) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/eip.py b/src/leap/baseapp/eip.py index ca2e03c3..26a2a1fb 100644 --- a/src/leap/baseapp/eip.py +++ b/src/leap/baseapp/eip.py @@ -25,6 +25,7 @@ class EIPConductorAppMixin(object): def __init__(self, *args, **kwargs): opts = kwargs.pop('opts') config_file = getattr(opts, 'config_file', None) + provider = kwargs.pop('provider') self.eip_service_started = False @@ -39,7 +40,8 @@ class EIPConductorAppMixin(object): checker_signals=(self.changeLeapStatus.emit, ), status_signals=(self.statusChange.emit, ), debug=self.debugmode, - ovpn_verbosity=opts.openvpn_verb) + ovpn_verbosity=opts.openvpn_verb, + provider=provider) self.skip_download = opts.no_provider_checks self.skip_verify = opts.no_ca_verify diff --git a/src/leap/baseapp/mainwindow.py b/src/leap/baseapp/mainwindow.py index df7159ce..752dba51 100644 --- a/src/leap/baseapp/mainwindow.py +++ b/src/leap/baseapp/mainwindow.py @@ -35,7 +35,8 @@ class LeapWindow(QtGui.QMainWindow, triggerEIPError = QtCore.pyqtSignal([object]) start_eipconnection = QtCore.pyqtSignal([]) - # XXX fix nomenclature here + # XXX fix nomenclature here: + # eipStatusChange vs. leapStatusChange # this is eip status change got from vpn management statusChange = QtCore.pyqtSignal([object]) # this is global leap status @@ -49,11 +50,14 @@ class LeapWindow(QtGui.QMainWindow, self.createLogBrowser() settings = QtCore.QSettings() - provider_domain = settings.value("provider_domain", None) - logger.debug('provider: %s', provider_domain) + self.provider_domain = settings.value("provider_domain", None) + self.eip_username = settings.value("eip_username", None) + + logger.debug('provider: %s', self.provider_domain) + logger.debug('eip_username: %s', self.eip_username) EIPConductorAppMixin.__init__( - self, opts=opts, provider=provider_domain) + self, opts=opts, provider=self.provider_domain) StatusAwareTrayIconMixin.__init__(self) NetworkCheckerAppMixin.__init__(self) MainWindowMixin.__init__(self) @@ -62,13 +66,15 @@ class LeapWindow(QtGui.QMainWindow, geom = settings.value(geom_key) if geom: self.restoreGeometry(geom) + + # XXX check for wizard self.wizard_done = settings.value("FirstRunWizardDone") self.initchecks = InitChecksThread(self.run_eip_checks) # bind signals self.initchecks.finished.connect( - lambda: logger.debug('Initial checks finished')) + lambda: logger.debug('Initial checks thread finished')) self.trayIcon.activated.connect(self.iconActivated) self.newLogLine.connect( lambda line: self.onLoggerNewLine(line)) @@ -92,32 +98,52 @@ class LeapWindow(QtGui.QMainWindow, self.changeLeapStatus.connect( lambda newstatus: self.onChangeLeapConnStatus(newstatus)) - # do frwizard and init signals + # do first run wizard and init signals self.mainappReady.connect(self.do_first_run_wizard_check) self.initReady.connect(self.runchecks_and_eipconnect) # ... all ready. go! - # calls do_first_run_wizard_check + # connected to do_first_run_wizard_check self.mainappReady.emit() def do_first_run_wizard_check(self): + """ + checks whether first run wizard needs to be run + launches it if needed (with initReady signal as a success callback) + and emits initReady signal if not. + """ + # XXX change DOC string after I remove the success callbac!!! + logger.debug('first run wizard check...') - if self.wizard_done: - self.initReady.emit() - else: - # need to run first-run-wizard - logger.debug('running first run wizard') + need_wizard = False + + # do checks (can overlap if wizard was interrupted) + if not self.wizard_done: + need_wizard = True + if not self.provider_domain: + need_wizard = True + + # launch wizard if needed + if need_wizard: from leap.gui.firstrunwizard import FirstRunWizard wizard = FirstRunWizard( + self.conductor, parent=self, - success_cb=self.initReady.emit) + eip_username=self.eip_username, + start_eipconnection_signal=self.start_eipconnection) wizard.show() + else: # no wizard needed + logger.debug('running first run wizard') + self.initReady.emit() + return def runchecks_and_eipconnect(self): self.initchecks.begin() class InitChecksThread(QtCore.QThread): + # XXX rename as a generic QThread class, + # has nothing specific to initchecks def __init__(self, fun, parent=None): QtCore.QThread.__init__(self, parent) -- cgit v1.2.3 From ff02a21ed6ef879c054b01134744068bdfeda664 Mon Sep 17 00:00:00 2001 From: kali Date: Wed, 24 Oct 2012 06:49:51 +0900 Subject: last page of wizard displays the connection steps --- src/leap/baseapp/eip.py | 4 ++-- src/leap/baseapp/mainwindow.py | 24 +++++++++++------------- src/leap/baseapp/systray.py | 14 +++++++------- 3 files changed, 20 insertions(+), 22 deletions(-) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/eip.py b/src/leap/baseapp/eip.py index 26a2a1fb..54acbc0e 100644 --- a/src/leap/baseapp/eip.py +++ b/src/leap/baseapp/eip.py @@ -37,8 +37,8 @@ class EIPConductorAppMixin(object): self.conductor = EIPConnection( watcher_cb=self.newLogLine.emit, config_file=config_file, - checker_signals=(self.changeLeapStatus.emit, ), - status_signals=(self.statusChange.emit, ), + checker_signals=(self.eipStatusChange.emit, ), + status_signals=(self.openvpnStatusChange.emit, ), debug=self.debugmode, ovpn_verbosity=opts.openvpn_verb, provider=provider) diff --git a/src/leap/baseapp/mainwindow.py b/src/leap/baseapp/mainwindow.py index 752dba51..c5f956fb 100644 --- a/src/leap/baseapp/mainwindow.py +++ b/src/leap/baseapp/mainwindow.py @@ -35,12 +35,10 @@ class LeapWindow(QtGui.QMainWindow, triggerEIPError = QtCore.pyqtSignal([object]) start_eipconnection = QtCore.pyqtSignal([]) - # XXX fix nomenclature here: - # eipStatusChange vs. leapStatusChange - # this is eip status change got from vpn management - statusChange = QtCore.pyqtSignal([object]) - # this is global leap status - changeLeapStatus = QtCore.pyqtSignal([str]) + # this is status change got from openvpn management + openvpnStatusChange = QtCore.pyqtSignal([object]) + # this is global eip status + eipStatusChange = QtCore.pyqtSignal([str]) def __init__(self, opts): logger.debug('init leap window') @@ -93,10 +91,10 @@ class LeapWindow(QtGui.QMainWindow, # status change. # TODO unify - self.statusChange.connect( - lambda status: self.onStatusChange(status)) - self.changeLeapStatus.connect( - lambda newstatus: self.onChangeLeapConnStatus(newstatus)) + self.openvpnStatusChange.connect( + lambda status: self.onOpenVPNStatusChange(status)) + self.eipStatusChange.connect( + lambda newstatus: self.onEIPConnStatusChange(newstatus)) # do first run wizard and init signals self.mainappReady.connect(self.do_first_run_wizard_check) @@ -109,10 +107,9 @@ class LeapWindow(QtGui.QMainWindow, def do_first_run_wizard_check(self): """ checks whether first run wizard needs to be run - launches it if needed (with initReady signal as a success callback) + launches it if needed and emits initReady signal if not. """ - # XXX change DOC string after I remove the success callbac!!! logger.debug('first run wizard check...') need_wizard = False @@ -130,7 +127,8 @@ class LeapWindow(QtGui.QMainWindow, self.conductor, parent=self, eip_username=self.eip_username, - start_eipconnection_signal=self.start_eipconnection) + start_eipconnection_signal=self.start_eipconnection, + eip_statuschange_signal=self.eipStatusChange) wizard.show() else: # no wizard needed logger.debug('running first run wizard') diff --git a/src/leap/baseapp/systray.py b/src/leap/baseapp/systray.py index cc5d89df..061de98e 100644 --- a/src/leap/baseapp/systray.py +++ b/src/leap/baseapp/systray.py @@ -196,31 +196,31 @@ class StatusAwareTrayIconMixin(object): self.statusUpdate() @QtCore.pyqtSlot(object) - def onStatusChange(self, status): + def onOpenVPNStatusChange(self, status): """ - updates icon + updates icon, according to the openvpn status change. """ icon_name = self.conductor.get_icon_name() # XXX refactor. Use QStateMachine if icon_name in ("disconnected", "connected"): - self.changeLeapStatus.emit(icon_name) + self.eipStatusChange.emit(icon_name) if icon_name in ("connecting"): # let's see how it matches leap_status_name = self.conductor.get_leap_status() - self.changeLeapStatus.emit(leap_status_name) + self.eipStatusChange.emit(leap_status_name) self.setIcon(icon_name) # change connection pixmap widget self.setConnWidget(icon_name) @QtCore.pyqtSlot(str) - def onChangeLeapConnStatus(self, newstatus): + def onEIPConnStatusChange(self, newstatus): """ - slot for LEAP status changes - not to be confused with onStatusChange. + slot for EIP status changes + not to be confused with onOpenVPNStatusChange. this only updates the non-debug LEAP Status line next to the connection icon. """ -- cgit v1.2.3 From 593e4ba1ddf185d14f27c96ffb970fde7a3271fa Mon Sep 17 00:00:00 2001 From: kali Date: Fri, 26 Oct 2012 02:04:34 +0900 Subject: fix systray context menu. Closes #761 --- src/leap/baseapp/mainwindow.py | 3 +++ src/leap/baseapp/systray.py | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/mainwindow.py b/src/leap/baseapp/mainwindow.py index c5f956fb..38fa4a45 100644 --- a/src/leap/baseapp/mainwindow.py +++ b/src/leap/baseapp/mainwindow.py @@ -95,6 +95,9 @@ class LeapWindow(QtGui.QMainWindow, lambda status: self.onOpenVPNStatusChange(status)) self.eipStatusChange.connect( lambda newstatus: self.onEIPConnStatusChange(newstatus)) + # can I connect 2 signals? + self.eipStatusChange.connect( + lambda newstatus: self.toggleEIPAct()) # do first run wizard and init signals self.mainappReady.connect(self.do_first_run_wizard_check) diff --git a/src/leap/baseapp/systray.py b/src/leap/baseapp/systray.py index 061de98e..bf57c0f8 100644 --- a/src/leap/baseapp/systray.py +++ b/src/leap/baseapp/systray.py @@ -129,10 +129,22 @@ class StatusAwareTrayIconMixin(object): # 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) - if self.eip_service_started is True: + + # XXX get STATUS CONSTANTS INSTEAD + + icon_status = self.conductor.status.get_state_icon() + if icon_status == "connected": + self.connAct.setEnabled(True) self.connAct.setText('Encryption ON turn o&ff') - else: + return + if icon_status == "disconnected": + self.connAct.setEnabled(True) self.connAct.setText('Encryption OFF turn &on') + return + if icon_status == "connecting": + self.connAct.setDisabled(True) + self.connAct.setText('connecting...') + return def detailsWin(self): visible = self.isVisible() -- cgit v1.2.3 From b66f946c9e7bbdf4bfb7ceb7ffcf340257b2165e Mon Sep 17 00:00:00 2001 From: kali Date: Fri, 26 Oct 2012 05:02:04 +0900 Subject: hide aboutQt menu entry --- src/leap/baseapp/systray.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/systray.py b/src/leap/baseapp/systray.py index bf57c0f8..8777207c 100644 --- a/src/leap/baseapp/systray.py +++ b/src/leap/baseapp/systray.py @@ -92,7 +92,9 @@ class StatusAwareTrayIconMixin(object): self.trayIconMenu.addAction(self.detailsAct) self.trayIconMenu.addSeparator() self.trayIconMenu.addAction(self.aboutAct) - self.trayIconMenu.addAction(self.aboutQtAct) + # we should get this hidden inside the "about" dialog + # (as a little button maybe) + #self.trayIconMenu.addAction(self.aboutQtAct) self.trayIconMenu.addSeparator() self.trayIconMenu.addAction(self.quitAction) -- cgit v1.2.3 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/leap/baseapp') 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 From c387a52f841e8933ed7282d198ed1ece863979fc Mon Sep 17 00:00:00 2001 From: kali Date: Tue, 6 Nov 2012 01:26:05 +0900 Subject: new validation pages in a reusable MVC style using progress indicators inside QTableWidget --- src/leap/baseapp/mainwindow.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/mainwindow.py b/src/leap/baseapp/mainwindow.py index 8f359dbf..8e12b5f6 100644 --- a/src/leap/baseapp/mainwindow.py +++ b/src/leap/baseapp/mainwindow.py @@ -147,16 +147,15 @@ class LeapWindow(QtGui.QMainWindow, self.initchecks.begin() -class InitChecksThread(QtCore.QThread): - # XXX rename as a generic QThread class, - # has nothing specific to initchecks +class FunThread(QtCore.QThread): def __init__(self, fun, parent=None): QtCore.QThread.__init__(self, parent) self.fun = fun def run(self): - self.fun() + if self.fun: + self.fun() def begin(self): self.start() -- cgit v1.2.3 From ad16a72f60ecc84524c22e8912df4eb8a48a2a42 Mon Sep 17 00:00:00 2001 From: kali Date: Tue, 6 Nov 2012 16:26:10 +0900 Subject: split wizard into separate files so we don't go nuts yet. --- src/leap/baseapp/mainwindow.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/mainwindow.py b/src/leap/baseapp/mainwindow.py index 8e12b5f6..8188f819 100644 --- a/src/leap/baseapp/mainwindow.py +++ b/src/leap/baseapp/mainwindow.py @@ -68,7 +68,7 @@ class LeapWindow(QtGui.QMainWindow, # XXX check for wizard self.wizard_done = settings.value("FirstRunWizardDone") - self.initchecks = InitChecksThread(self.run_eip_checks) + self.initchecks = FunThread(self.run_eip_checks) # bind signals self.initchecks.finished.connect( @@ -148,6 +148,8 @@ class LeapWindow(QtGui.QMainWindow, class FunThread(QtCore.QThread): + # XXX move to gui/threads + # for code consistence def __init__(self, fun, parent=None): QtCore.QThread.__init__(self, parent) -- cgit v1.2.3 From 57bd393492fde434a1e3af60b607e8e9d757b9b3 Mon Sep 17 00:00:00 2001 From: kali Date: Mon, 12 Nov 2012 21:48:22 +0900 Subject: moved thread code to gui/threads --- src/leap/baseapp/mainwindow.py | 21 +++++---------------- src/leap/baseapp/systray.py | 3 +++ 2 files changed, 8 insertions(+), 16 deletions(-) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/mainwindow.py b/src/leap/baseapp/mainwindow.py index 8188f819..2df99074 100644 --- a/src/leap/baseapp/mainwindow.py +++ b/src/leap/baseapp/mainwindow.py @@ -2,6 +2,10 @@ #!/usr/bin/env python import logging +import sip +sip.setapi('QString', 2) +sip.setapi('QVariant', 2) + from PyQt4 import QtCore from PyQt4 import QtGui @@ -10,6 +14,7 @@ from leap.baseapp.log import LogPaneMixin from leap.baseapp.systray import StatusAwareTrayIconMixin from leap.baseapp.network import NetworkCheckerAppMixin from leap.baseapp.leap_app import MainWindowMixin +from leap.gui.threads import FunThread logger = logging.getLogger(name=__name__) @@ -145,19 +150,3 @@ class LeapWindow(QtGui.QMainWindow, def runchecks_and_eipconnect(self): self.initchecks.begin() - - -class FunThread(QtCore.QThread): - # XXX move to gui/threads - # for code consistence - - def __init__(self, fun, parent=None): - QtCore.QThread.__init__(self, parent) - self.fun = fun - - def run(self): - if self.fun: - self.fun() - - def begin(self): - self.start() diff --git a/src/leap/baseapp/systray.py b/src/leap/baseapp/systray.py index 06be2975..94a7a8f2 100644 --- a/src/leap/baseapp/systray.py +++ b/src/leap/baseapp/systray.py @@ -1,4 +1,7 @@ import logging +import sip +sip.setapi('QString', 2) +sip.setapi('QVariant', 2) from PyQt4 import QtCore from PyQt4 import QtGui -- cgit v1.2.3 From 654f3158707e6b89d1dfc15745a1b9f525ee81b9 Mon Sep 17 00:00:00 2001 From: kali Date: Mon, 12 Nov 2012 22:01:44 +0900 Subject: fix import path --- src/leap/baseapp/mainwindow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/mainwindow.py b/src/leap/baseapp/mainwindow.py index 2df99074..bd29e608 100644 --- a/src/leap/baseapp/mainwindow.py +++ b/src/leap/baseapp/mainwindow.py @@ -139,7 +139,7 @@ class LeapWindow(QtGui.QMainWindow, """ launches wizard and blocks """ - from leap.gui.firstrunwizard import FirstRunWizard + from leap.gui.firstrun.wizard import FirstRunWizard wizard = FirstRunWizard( self.conductor, parent=self, -- cgit v1.2.3 From 72f3ef94f0d7deffa9adfba6bde57ae3d9c8d165 Mon Sep 17 00:00:00 2001 From: kali Date: Mon, 12 Nov 2012 23:03:12 +0900 Subject: connect wizard cancel button with shutdown --- src/leap/baseapp/mainwindow.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/mainwindow.py b/src/leap/baseapp/mainwindow.py index bd29e608..918f1568 100644 --- a/src/leap/baseapp/mainwindow.py +++ b/src/leap/baseapp/mainwindow.py @@ -145,8 +145,16 @@ class LeapWindow(QtGui.QMainWindow, parent=self, eip_username=self.eip_username, start_eipconnection_signal=self.start_eipconnection, - eip_statuschange_signal=self.eipStatusChange) + eip_statuschange_signal=self.eipStatusChange, + quitcallback=self.onWizardCancel) wizard.show() + def onWizardCancel(self): + if not self.wizard_done: + logger.debug( + 'clicked on Cancel during first ' + 'run wizard. shutting down') + self.cleanupAndQuit() + def runchecks_and_eipconnect(self): self.initchecks.begin() -- cgit v1.2.3 From bd33a6bf8e6b56b4cfa5e2b008edc18d5f6a0c3a Mon Sep 17 00:00:00 2001 From: kali Date: Wed, 14 Nov 2012 02:41:07 +0900 Subject: make the check for valid client cert the trigger for first-run-wizard Closes #803 And with this we've completed all features blocking the release goal: generic client. --- src/leap/baseapp/mainwindow.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/mainwindow.py b/src/leap/baseapp/mainwindow.py index 918f1568..41130852 100644 --- a/src/leap/baseapp/mainwindow.py +++ b/src/leap/baseapp/mainwindow.py @@ -14,6 +14,7 @@ from leap.baseapp.log import LogPaneMixin from leap.baseapp.systray import StatusAwareTrayIconMixin from leap.baseapp.network import NetworkCheckerAppMixin from leap.baseapp.leap_app import MainWindowMixin +from leap.eip.checks import ProviderCertChecker from leap.gui.threads import FunThread logger = logging.getLogger(name=__name__) @@ -125,8 +126,14 @@ class LeapWindow(QtGui.QMainWindow, # do checks (can overlap if wizard was interrupted) if not self.wizard_done: need_wizard = True + if not self.provider_domain: need_wizard = True + else: + pcertchecker = ProviderCertChecker(domain=self.provider_domain) + if not pcertchecker.is_cert_valid(do_raise=False): + logger.warning('missing valid client cert. need wizard') + need_wizard = True # launch wizard if needed if need_wizard: -- cgit v1.2.3 From e111e9de0d33d12503233e754e2e4b01133acec9 Mon Sep 17 00:00:00 2001 From: kali Date: Wed, 14 Nov 2012 02:53:28 +0900 Subject: hide the systray icon until the firstrun wizard is complete Closes #762 --- src/leap/baseapp/mainwindow.py | 1 + src/leap/baseapp/systray.py | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/mainwindow.py b/src/leap/baseapp/mainwindow.py index 41130852..f07ebb7d 100644 --- a/src/leap/baseapp/mainwindow.py +++ b/src/leap/baseapp/mainwindow.py @@ -164,4 +164,5 @@ class LeapWindow(QtGui.QMainWindow, self.cleanupAndQuit() def runchecks_and_eipconnect(self): + self.show_systray_icon() self.initchecks.begin() diff --git a/src/leap/baseapp/systray.py b/src/leap/baseapp/systray.py index 94a7a8f2..49f044aa 100644 --- a/src/leap/baseapp/systray.py +++ b/src/leap/baseapp/systray.py @@ -44,12 +44,14 @@ class StatusAwareTrayIconMixin(object): self.createIconGroupBox() self.createActions() self.createTrayIcon() - #logger.debug('showing tray icon................') - self.trayIcon.show() # not sure if this really belongs here, but... self.timer = QtCore.QTimer() + def show_systray_icon(self): + #logger.debug('showing tray icon................') + self.trayIcon.show() + def createIconGroupBox(self): """ dummy icongroupbox -- cgit v1.2.3 From c7dec38062e433cd1f098b6f1457acc87b4e6aaf Mon Sep 17 00:00:00 2001 From: antialias Date: Wed, 21 Nov 2012 15:34:32 -0800 Subject: successfully catching ctrl-c but for not quitting in the correct order. --- src/leap/baseapp/mainwindow.py | 1 + 1 file changed, 1 insertion(+) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/mainwindow.py b/src/leap/baseapp/mainwindow.py index f07ebb7d..85185ca6 100644 --- a/src/leap/baseapp/mainwindow.py +++ b/src/leap/baseapp/mainwindow.py @@ -40,6 +40,7 @@ class LeapWindow(QtGui.QMainWindow, networkError = QtCore.pyqtSignal([object]) triggerEIPError = QtCore.pyqtSignal([object]) start_eipconnection = QtCore.pyqtSignal([]) + shutdownSignal = QtCore.pyqtSignal([]) # this is status change got from openvpn management openvpnStatusChange = QtCore.pyqtSignal([object]) -- cgit v1.2.3 From a3ce61ea54b0b0f5c1ecd5904379e27cfec885b5 Mon Sep 17 00:00:00 2001 From: kali Date: Wed, 28 Nov 2012 02:43:25 +0900 Subject: call shutdown signal from sigint_handler --- src/leap/baseapp/mainwindow.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/mainwindow.py b/src/leap/baseapp/mainwindow.py index 85185ca6..8d61bf5c 100644 --- a/src/leap/baseapp/mainwindow.py +++ b/src/leap/baseapp/mainwindow.py @@ -95,6 +95,8 @@ class LeapWindow(QtGui.QMainWindow, lambda: self.start_or_stopVPN()) self.start_eipconnection.connect( lambda: self.start_or_stopVPN()) + self.shutdownSignal.connect( + self.cleanupAndQuit) # status change. # TODO unify @@ -102,7 +104,6 @@ class LeapWindow(QtGui.QMainWindow, lambda status: self.onOpenVPNStatusChange(status)) self.eipStatusChange.connect( lambda newstatus: self.onEIPConnStatusChange(newstatus)) - # can I connect 2 signals? self.eipStatusChange.connect( lambda newstatus: self.toggleEIPAct()) -- cgit v1.2.3 From cd78d9d552977e8f8fb12b6a2ff56fda9c37bf35 Mon Sep 17 00:00:00 2001 From: kali Date: Fri, 7 Dec 2012 05:32:50 +0900 Subject: only remove management socket when shutting down Closes #1090 --- src/leap/baseapp/leap_app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/leap_app.py b/src/leap/baseapp/leap_app.py index 4b63dd2f..e41cff40 100644 --- a/src/leap/baseapp/leap_app.py +++ b/src/leap/baseapp/leap_app.py @@ -148,6 +148,6 @@ class MainWindowMixin(object): # in conductor # XXX send signal instead? logger.info('Shutting down') - self.conductor.cleanup() + self.conductor.cleanup(shutdown=True) logger.info('Exiting. Bye.') QtGui.qApp.quit() -- cgit v1.2.3 From 38cc1758240a3c64db387b0437dcf1517b52da15 Mon Sep 17 00:00:00 2001 From: kali Date: Mon, 10 Dec 2012 19:51:53 +0900 Subject: cleanup and rewrite eipconnection/openvpnconnection classes --- src/leap/baseapp/leap_app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/leap_app.py b/src/leap/baseapp/leap_app.py index e41cff40..4d3aebd6 100644 --- a/src/leap/baseapp/leap_app.py +++ b/src/leap/baseapp/leap_app.py @@ -148,6 +148,6 @@ class MainWindowMixin(object): # in conductor # XXX send signal instead? logger.info('Shutting down') - self.conductor.cleanup(shutdown=True) + self.conductor.disconnect(shutdown=True) logger.info('Exiting. Bye.') QtGui.qApp.quit() -- cgit v1.2.3 From 53fa2c134ab2c96376276aa1c0ed74db0aaba218 Mon Sep 17 00:00:00 2001 From: kali Date: Mon, 10 Dec 2012 23:20:09 +0900 Subject: get cipher config from eip-service --- src/leap/baseapp/mainwindow.py | 9 +++++++-- src/leap/baseapp/network.py | 7 +++++-- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/mainwindow.py b/src/leap/baseapp/mainwindow.py index 8d61bf5c..65c30bff 100644 --- a/src/leap/baseapp/mainwindow.py +++ b/src/leap/baseapp/mainwindow.py @@ -61,10 +61,15 @@ class LeapWindow(QtGui.QMainWindow, logger.debug('provider: %s', self.provider_domain) logger.debug('eip_username: %s', self.eip_username) + provider = self.provider_domain EIPConductorAppMixin.__init__( - self, opts=opts, provider=self.provider_domain) + self, opts=opts, provider=provider) StatusAwareTrayIconMixin.__init__(self) - NetworkCheckerAppMixin.__init__(self) + + # XXX network checker should probably not + # trigger run_checks on init... but wait + # for ready signal instead... + NetworkCheckerAppMixin.__init__(self, provider=provider) MainWindowMixin.__init__(self) geom_key = "DebugGeometry" if self.debugmode else "Geometry" diff --git a/src/leap/baseapp/network.py b/src/leap/baseapp/network.py index 077d5164..3e57490d 100644 --- a/src/leap/baseapp/network.py +++ b/src/leap/baseapp/network.py @@ -17,11 +17,14 @@ class NetworkCheckerAppMixin(object): """ def __init__(self, *args, **kwargs): + provider = kwargs.pop('provider', None) self.network_checker = NetworkCheckerThread( error_cb=self.networkError.emit, - debug=self.debugmode) + debug=self.debugmode, + provider=provider) - # XXX move run_checks to slot + # XXX move run_checks to slot -- this definitely + # cannot start on init!!! self.network_checker.run_checks() @QtCore.pyqtSlot(object) -- cgit v1.2.3 From 04d423e2a89034dfb86fe305108162fd2a696079 Mon Sep 17 00:00:00 2001 From: kali Date: Wed, 12 Dec 2012 03:29:31 +0900 Subject: tests for openvpn options and make the rest of tests pass after some changes in this branch (dirtyness in config files) --- src/leap/baseapp/systray.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/systray.py b/src/leap/baseapp/systray.py index 49f044aa..52060ae2 100644 --- a/src/leap/baseapp/systray.py +++ b/src/leap/baseapp/systray.py @@ -217,6 +217,8 @@ class StatusAwareTrayIconMixin(object): updates icon, according to the openvpn status change. """ icon_name = self.conductor.get_icon_name() + if not icon_name: + return # XXX refactor. Use QStateMachine -- cgit v1.2.3 From 4984f2c966d11f529a2a8b722814b748b6a524d2 Mon Sep 17 00:00:00 2001 From: kali Date: Wed, 12 Dec 2012 09:16:53 +0900 Subject: changed some values in new style eipconfig --- src/leap/baseapp/eip.py | 2 ++ src/leap/baseapp/network.py | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/eip.py b/src/leap/baseapp/eip.py index 54acbc0e..0d7506b3 100644 --- a/src/leap/baseapp/eip.py +++ b/src/leap/baseapp/eip.py @@ -203,6 +203,8 @@ class EIPConductorAppMixin(object): # we could bring Timer Init to this Mixin # or to its own Mixin. self.timer.start(constants.TIMER_MILLISECONDS) + # XXX EMIT SIGNAL INSTEAD (when first run, + # network checker does not exist...) self.network_checker.start() return diff --git a/src/leap/baseapp/network.py b/src/leap/baseapp/network.py index 3e57490d..7363cfaa 100644 --- a/src/leap/baseapp/network.py +++ b/src/leap/baseapp/network.py @@ -18,13 +18,17 @@ class NetworkCheckerAppMixin(object): def __init__(self, *args, **kwargs): provider = kwargs.pop('provider', None) + if provider: + self.init_network_checker(provider) + + def init_network_checker(self, provider): self.network_checker = NetworkCheckerThread( error_cb=self.networkError.emit, debug=self.debugmode, provider=provider) - # XXX move run_checks to slot -- this definitely - # cannot start on init!!! + @QtCore.pyqtSlot(object) + def runNetworkChecks(self): self.network_checker.run_checks() @QtCore.pyqtSlot(object) -- cgit v1.2.3 From 89694babd14a9b2ba76095911b6884e359a12282 Mon Sep 17 00:00:00 2001 From: kali Date: Mon, 17 Dec 2012 05:05:37 +0900 Subject: network checker launched by signal fixes problem with provider domain not being defined during first run. --- src/leap/baseapp/eip.py | 3 --- src/leap/baseapp/mainwindow.py | 3 +++ src/leap/baseapp/network.py | 14 +++++++++----- src/leap/baseapp/systray.py | 5 +++++ 4 files changed, 17 insertions(+), 8 deletions(-) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/eip.py b/src/leap/baseapp/eip.py index 0d7506b3..55ecfa79 100644 --- a/src/leap/baseapp/eip.py +++ b/src/leap/baseapp/eip.py @@ -203,9 +203,6 @@ class EIPConductorAppMixin(object): # we could bring Timer Init to this Mixin # or to its own Mixin. self.timer.start(constants.TIMER_MILLISECONDS) - # XXX EMIT SIGNAL INSTEAD (when first run, - # network checker does not exist...) - self.network_checker.start() return if self.eip_service_started is True: diff --git a/src/leap/baseapp/mainwindow.py b/src/leap/baseapp/mainwindow.py index 65c30bff..02adab65 100644 --- a/src/leap/baseapp/mainwindow.py +++ b/src/leap/baseapp/mainwindow.py @@ -41,6 +41,7 @@ class LeapWindow(QtGui.QMainWindow, triggerEIPError = QtCore.pyqtSignal([object]) start_eipconnection = QtCore.pyqtSignal([]) shutdownSignal = QtCore.pyqtSignal([]) + initNetworkChecker = QtCore.pyqtSignal([]) # this is status change got from openvpn management openvpnStatusChange = QtCore.pyqtSignal([object]) @@ -102,6 +103,8 @@ class LeapWindow(QtGui.QMainWindow, lambda: self.start_or_stopVPN()) self.shutdownSignal.connect( self.cleanupAndQuit) + self.initNetworkChecker.connect( + lambda: self.init_network_checker(self.provider_domain)) # status change. # TODO unify diff --git a/src/leap/baseapp/network.py b/src/leap/baseapp/network.py index 7363cfaa..a33265e5 100644 --- a/src/leap/baseapp/network.py +++ b/src/leap/baseapp/network.py @@ -9,23 +9,27 @@ from PyQt4 import QtCore from leap.baseapp.dialogs import ErrorDialog from leap.base.network import NetworkCheckerThread +from leap.util.misc import null_check + class NetworkCheckerAppMixin(object): """ initialize an instance of the Network Checker, which gathers error and passes them on. """ - def __init__(self, *args, **kwargs): provider = kwargs.pop('provider', None) if provider: self.init_network_checker(provider) def init_network_checker(self, provider): - self.network_checker = NetworkCheckerThread( - error_cb=self.networkError.emit, - debug=self.debugmode, - provider=provider) + null_check(provider, "provider_domain") + if not hasattr(self, 'network_checker'): + self.network_checker = NetworkCheckerThread( + error_cb=self.networkError.emit, + debug=self.debugmode, + provider=provider) + self.network_checker.start() @QtCore.pyqtSlot(object) def runNetworkChecks(self): diff --git a/src/leap/baseapp/systray.py b/src/leap/baseapp/systray.py index 52060ae2..0dd0f195 100644 --- a/src/leap/baseapp/systray.py +++ b/src/leap/baseapp/systray.py @@ -230,6 +230,11 @@ class StatusAwareTrayIconMixin(object): leap_status_name = self.conductor.get_leap_status() self.eipStatusChange.emit(leap_status_name) + if icon_name == "connected": + # When we change to "connected', we launch + # the network checker. + self.initNetworkChecker.emit() + self.setIcon(icon_name) # change connection pixmap widget self.setConnWidget(icon_name) -- cgit v1.2.3 From b2e1e26e182bc86e01440ab3a93d3953f1fbcb4b Mon Sep 17 00:00:00 2001 From: kali Date: Thu, 27 Dec 2012 07:08:10 +0900 Subject: fix window not raising to front in osx --- src/leap/baseapp/systray.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/systray.py b/src/leap/baseapp/systray.py index 0dd0f195..93fab716 100644 --- a/src/leap/baseapp/systray.py +++ b/src/leap/baseapp/systray.py @@ -1,4 +1,6 @@ import logging +import sys + import sip sip.setapi('QString', 2) sip.setapi('QVariant', 2) @@ -156,6 +158,8 @@ class StatusAwareTrayIconMixin(object): self.hide() else: self.show() + if sys.platform == "darwin": + self.raise_() def about(self): # move to widget -- cgit v1.2.3 From f82f81b6766905269d51e08632b42ed2e92c249b Mon Sep 17 00:00:00 2001 From: kali Date: Wed, 9 Jan 2013 00:00:42 +0900 Subject: rename username var --- src/leap/baseapp/mainwindow.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/mainwindow.py b/src/leap/baseapp/mainwindow.py index 02adab65..dd2ecdf0 100644 --- a/src/leap/baseapp/mainwindow.py +++ b/src/leap/baseapp/mainwindow.py @@ -57,10 +57,10 @@ class LeapWindow(QtGui.QMainWindow, settings = QtCore.QSettings() self.provider_domain = settings.value("provider_domain", None) - self.eip_username = settings.value("eip_username", None) + self.username = settings.value("username", None) logger.debug('provider: %s', self.provider_domain) - logger.debug('eip_username: %s', self.eip_username) + logger.debug('username: %s', self.username) provider = self.provider_domain EIPConductorAppMixin.__init__( @@ -160,7 +160,7 @@ class LeapWindow(QtGui.QMainWindow, wizard = FirstRunWizard( self.conductor, parent=self, - eip_username=self.eip_username, + username=self.username, start_eipconnection_signal=self.start_eipconnection, eip_statuschange_signal=self.eipStatusChange, quitcallback=self.onWizardCancel) -- cgit v1.2.3 From 3c19346b5189e993e982aabe8ded2d20c0e0bcd6 Mon Sep 17 00:00:00 2001 From: kali Date: Wed, 9 Jan 2013 00:45:20 +0900 Subject: fix provider parameter passed to network check --- src/leap/baseapp/mainwindow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/mainwindow.py b/src/leap/baseapp/mainwindow.py index dd2ecdf0..b9a451ac 100644 --- a/src/leap/baseapp/mainwindow.py +++ b/src/leap/baseapp/mainwindow.py @@ -104,7 +104,7 @@ class LeapWindow(QtGui.QMainWindow, self.shutdownSignal.connect( self.cleanupAndQuit) self.initNetworkChecker.connect( - lambda: self.init_network_checker(self.provider_domain)) + lambda: self.init_network_checker(self.conductor.provider)) # status change. # TODO unify -- cgit v1.2.3 From c6ab7134f69eea59b0f2f44016d7fc4f2fbfe359 Mon Sep 17 00:00:00 2001 From: kali Date: Wed, 9 Jan 2013 01:02:28 +0900 Subject: icon shows when wizard ends --- src/leap/baseapp/mainwindow.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/mainwindow.py b/src/leap/baseapp/mainwindow.py index b9a451ac..b1e5bccf 100644 --- a/src/leap/baseapp/mainwindow.py +++ b/src/leap/baseapp/mainwindow.py @@ -100,7 +100,7 @@ class LeapWindow(QtGui.QMainWindow, self.startStopButton.clicked.connect( lambda: self.start_or_stopVPN()) self.start_eipconnection.connect( - lambda: self.start_or_stopVPN()) + self.do_start_eipconnection) self.shutdownSignal.connect( self.cleanupAndQuit) self.initNetworkChecker.connect( @@ -147,9 +147,9 @@ class LeapWindow(QtGui.QMainWindow, # launch wizard if needed if need_wizard: + logger.debug('running first run wizard') self.launch_first_run_wizard() else: # no wizard needed - logger.debug('running first run wizard') self.initReady.emit() def launch_first_run_wizard(self): @@ -174,5 +174,16 @@ class LeapWindow(QtGui.QMainWindow, self.cleanupAndQuit() def runchecks_and_eipconnect(self): + """ + shows icon and run init checks + """ self.show_systray_icon() self.initchecks.begin() + + def do_start_eipconnection(self): + """ + shows icon and init eip connection + called from the end of wizard + """ + self.show_systray_icon() + self.start_or_stopVPN() -- cgit v1.2.3 From a5b4b7020daebbcb25c016cf1821818b71a2e457 Mon Sep 17 00:00:00 2001 From: kali Date: Wed, 9 Jan 2013 06:23:45 +0900 Subject: more missed strings to be translated plus initial translation. --- src/leap/baseapp/eip.py | 4 ++-- src/leap/baseapp/log.py | 4 ++-- src/leap/baseapp/systray.py | 56 +++++++++++++++++++++++++++------------------ 3 files changed, 38 insertions(+), 26 deletions(-) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/eip.py b/src/leap/baseapp/eip.py index 55ecfa79..41f4c541 100644 --- a/src/leap/baseapp/eip.py +++ b/src/leap/baseapp/eip.py @@ -195,7 +195,7 @@ class EIPConductorAppMixin(object): else: # no errors, so go on. if self.debugmode: - self.startStopButton.setText('&Disconnect') + self.startStopButton.setText(self.tr('&Disconnect')) self.eip_service_started = True self.toggleEIPAct() @@ -209,7 +209,7 @@ class EIPConductorAppMixin(object): self.network_checker.stop() self.conductor.disconnect() if self.debugmode: - self.startStopButton.setText('&Connect') + self.startStopButton.setText(self.tr('&Connect')) self.eip_service_started = False self.toggleEIPAct() self.timer.stop() diff --git a/src/leap/baseapp/log.py b/src/leap/baseapp/log.py index 8a7f81c3..95cfc918 100644 --- a/src/leap/baseapp/log.py +++ b/src/leap/baseapp/log.py @@ -21,7 +21,7 @@ class LogPaneMixin(object): logging_layout = QtGui.QVBoxLayout() self.logbrowser = QtGui.QTextBrowser() - startStopButton = QtGui.QPushButton("&Connect") + startStopButton = QtGui.QPushButton(self.tr("&Connect")) self.startStopButton = startStopButton logging_layout.addWidget(self.logbrowser) @@ -34,7 +34,7 @@ class LogPaneMixin(object): grid = QtGui.QGridLayout() self.updateTS = QtGui.QLabel('') - self.status_label = QtGui.QLabel('Disconnected') + self.status_label = QtGui.QLabel(self.tr('Disconnected')) self.ip_label = QtGui.QLabel('') self.remote_label = QtGui.QLabel('') diff --git a/src/leap/baseapp/systray.py b/src/leap/baseapp/systray.py index 93fab716..77eb3fe9 100644 --- a/src/leap/baseapp/systray.py +++ b/src/leap/baseapp/systray.py @@ -75,7 +75,8 @@ class StatusAwareTrayIconMixin(object): self.iconpath['connected'])), self.ConnectionWidgets = con_widgets - self.statusIconBox = QtGui.QGroupBox("EIP Connection Status") + self.statusIconBox = QtGui.QGroupBox( + self.tr("EIP Connection Status")) statusIconLayout = QtGui.QHBoxLayout() statusIconLayout.addWidget(self.ConnectionWidgets['disconnected']) statusIconLayout.addWidget(self.ConnectionWidgets['connecting']) @@ -83,7 +84,8 @@ class StatusAwareTrayIconMixin(object): statusIconLayout.itemAt(1).widget().hide() statusIconLayout.itemAt(2).widget().hide() - self.leapConnStatus = QtGui.QLabel("disconnected") + self.leapConnStatus = QtGui.QLabel( + self.tr("disconnected")) statusIconLayout.addWidget(self.leapConnStatus) self.statusIconBox.setLayout(statusIconLayout) @@ -113,26 +115,32 @@ class StatusAwareTrayIconMixin(object): #self.trayIconMenu.customContextMenuRequested.connect( #self.on_context_menu) - def bad(self): - logger.error('this should not be called') + #def bad(self): + #logger.error('this should not be called') def createActions(self): """ creates actions to be binded to tray icon """ # XXX change action name on (dis)connect - self.connAct = QtGui.QAction("Encryption ON turn &off", self, - triggered=lambda: self.start_or_stopVPN()) - - self.detailsAct = QtGui.QAction("&Details...", - self, - triggered=self.detailsWin) - self.aboutAct = QtGui.QAction("&About", self, - triggered=self.about) - self.aboutQtAct = QtGui.QAction("About Q&t", self, - triggered=QtGui.qApp.aboutQt) - self.quitAction = QtGui.QAction("&Quit", self, - triggered=self.cleanupAndQuit) + self.connAct = QtGui.QAction( + self.tr("Encryption ON turn &off"), + self, + triggered=lambda: self.start_or_stopVPN()) + + self.detailsAct = QtGui.QAction( + self.tr("&Details..."), + self, + triggered=self.detailsWin) + self.aboutAct = QtGui.QAction( + self.tr("&About"), self, + triggered=self.about) + self.aboutQtAct = QtGui.QAction( + self.tr("About Q&t"), self, + triggered=QtGui.qApp.aboutQt) + self.quitAction = QtGui.QAction( + self.tr("&Quit"), self, + triggered=self.cleanupAndQuit) def toggleEIPAct(self): # this is too simple by now. @@ -141,15 +149,17 @@ class StatusAwareTrayIconMixin(object): icon_status = self.conductor.get_icon_name() if icon_status == "connected": self.connAct.setEnabled(True) - self.connAct.setText('Encryption ON turn o&ff') + self.connAct.setText( + self.tr('Encryption ON turn o&ff')) return if icon_status == "disconnected": self.connAct.setEnabled(True) - self.connAct.setText('Encryption OFF turn &on') + self.connAct.setText( + self.tr('Encryption OFF turn &on')) return if icon_status == "connecting": self.connAct.setDisabled(True) - self.connAct.setText('connecting...') + self.connAct.setText(self.tr('connecting...')) return def detailsWin(self): @@ -164,14 +174,15 @@ class StatusAwareTrayIconMixin(object): def about(self): # move to widget flavor = BRANDING.get('short_name', None) - content = ("LEAP client
" - "(version %s)
" % VERSION) + content = self.tr( + ("LEAP client
" + "(version %s)
" % VERSION)) if flavor: content = content + ('
Flavor: %s
' % flavor) content = content + ( "
" "https://leap.se") - QtGui.QMessageBox.about(self, "About", content) + QtGui.QMessageBox.about(self, self.tr("About"), content) def setConnWidget(self, icon_name): oldlayout = self.statusIconBox.layout() @@ -209,6 +220,7 @@ class StatusAwareTrayIconMixin(object): # is failing in a way beyond my understanding. # (not working the first time it's clicked). # this works however. + # XXX in osx it shows some glitches. context_menu.exec_(self.trayIcon.geometry().center()) @QtCore.pyqtSlot() -- cgit v1.2.3 From 348eb0852d6f1b8b2b72baba8a236bc30a6f2a4e Mon Sep 17 00:00:00 2001 From: antialias Date: Fri, 16 Nov 2012 17:38:46 -0800 Subject: reads and searches for strings from openvpn logs via the management interface. --- src/leap/baseapp/eip.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/eip.py b/src/leap/baseapp/eip.py index 41f4c541..f18a62e7 100644 --- a/src/leap/baseapp/eip.py +++ b/src/leap/baseapp/eip.py @@ -174,6 +174,10 @@ class EIPConductorAppMixin(object): self.tun_read_bytes.setText(tun_read) self.tun_write_bytes.setText(tun_write) + # connection information via management interface + log = self.conductor.get_log() + self.network_checker.parse_log(log) + @QtCore.pyqtSlot() def start_or_stopVPN(self): """ -- cgit v1.2.3 From 14f433c16de60753d122d5946df68e8e82285ca3 Mon Sep 17 00:00:00 2001 From: antialias Date: Mon, 19 Nov 2012 16:16:01 -0800 Subject: implemented abstracted layer with matching and passed callback. tests as well. --- src/leap/baseapp/eip.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/eip.py b/src/leap/baseapp/eip.py index f18a62e7..4fcbee3f 100644 --- a/src/leap/baseapp/eip.py +++ b/src/leap/baseapp/eip.py @@ -9,6 +9,7 @@ from leap.baseapp.dialogs import ErrorDialog from leap.baseapp import constants from leap.eip import exceptions as eip_exceptions from leap.eip.eipconnection import EIPConnection +from leap.base.checks import EVENT_CONNECT_REFUSED logger = logging.getLogger(name=__name__) @@ -176,7 +177,8 @@ class EIPConductorAppMixin(object): # connection information via management interface log = self.conductor.get_log() - self.network_checker.parse_log(log) + error_matrix = [(EVENT_CONNECT_REFUSED, (self.start_or_stopVPN, ))] + self.network_checker.checker.parse_log_and_react(log, error_matrix) @QtCore.pyqtSlot() def start_or_stopVPN(self): -- cgit v1.2.3 From bf39c45eddc62733fdb72b4f46cdb81ec649cb30 Mon Sep 17 00:00:00 2001 From: kali Date: Wed, 16 Jan 2013 00:58:22 +0900 Subject: handle loss of tun iface trigger only one dialog and disconnect. additional cleanup of log handling. --- src/leap/baseapp/log.py | 6 ++++-- src/leap/baseapp/network.py | 24 +++++++++++++++++------- 2 files changed, 21 insertions(+), 9 deletions(-) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/log.py b/src/leap/baseapp/log.py index 95cfc918..e6a767fb 100644 --- a/src/leap/baseapp/log.py +++ b/src/leap/baseapp/log.py @@ -11,6 +11,7 @@ class LogPaneMixin(object): a simple log pane that writes new lines as they come """ + EXCLUDES = ('MANAGEMENT',) def createLogBrowser(self): """ @@ -60,6 +61,7 @@ class LogPaneMixin(object): simple slot: writes new line to logger Pane. """ msg = line[:-1] - if self.debugmode: + if self.debugmode and all(map(lambda w: w not in msg, + LogPaneMixin.EXCLUDES)): self.logbrowser.append(msg) - vpnlogger.info(msg) + vpnlogger.info(msg) diff --git a/src/leap/baseapp/network.py b/src/leap/baseapp/network.py index a33265e5..a67f6340 100644 --- a/src/leap/baseapp/network.py +++ b/src/leap/baseapp/network.py @@ -17,6 +17,8 @@ class NetworkCheckerAppMixin(object): initialize an instance of the Network Checker, which gathers error and passes them on. """ + ERR_NETERR = False + def __init__(self, *args, **kwargs): provider = kwargs.pop('provider', None) if provider: @@ -41,11 +43,19 @@ class NetworkCheckerAppMixin(object): slot that receives a network exceptions and raises a user error message """ - logger.debug('handling network exception') - logger.error(exc.message) - dialog = ErrorDialog(parent=self) + # FIXME this should not HANDLE anything after + # the network check thread has been stopped. - if exc.critical: - dialog.criticalMessage(exc.usermessage, "network error") - else: - dialog.warningMessage(exc.usermessage, "network error") + logger.debug('handling network exception') + if not self.ERR_NETERR: + self.ERR_NETERR = True + + logger.error(exc.message) + dialog = ErrorDialog(parent=self) + if exc.critical: + dialog.criticalMessage(exc.usermessage, "network error") + else: + dialog.warningMessage(exc.usermessage, "network error") + + self.start_or_stopVPN() + self.network_checker.stop() -- cgit v1.2.3 From 6e9c63f47b98fbfcd3a5104fbfa5cc9d9ffe5143 Mon Sep 17 00:00:00 2001 From: kali Date: Thu, 17 Jan 2013 07:31:59 +0900 Subject: osx fixed already running instance check --- src/leap/baseapp/dialogs.py | 9 ++++++--- src/leap/baseapp/eip.py | 12 ++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/dialogs.py b/src/leap/baseapp/dialogs.py index 3cb539cf..d256fc99 100644 --- a/src/leap/baseapp/dialogs.py +++ b/src/leap/baseapp/dialogs.py @@ -23,7 +23,8 @@ class ErrorDialog(QDialog): def warningMessage(self, msg, label): msgBox = QMessageBox(QMessageBox.Warning, - "QMessageBox.warning()", msg, + "LEAP Client Error", + msg, QMessageBox.NoButton, self) msgBox.addButton("&Ok", QMessageBox.AcceptRole) if msgBox.exec_() == QMessageBox.AcceptRole: @@ -34,7 +35,8 @@ class ErrorDialog(QDialog): def criticalMessage(self, msg, label): msgBox = QMessageBox(QMessageBox.Critical, - "QMessageBox.critical()", msg, + "LEAP Client Error", + msg, QMessageBox.NoButton, self) msgBox.addButton("&Ok", QMessageBox.AcceptRole) msgBox.exec_() @@ -49,7 +51,8 @@ class ErrorDialog(QDialog): def confirmMessage(self, msg, label, action): msgBox = QMessageBox(QMessageBox.Critical, - "QMessageBox.critical()", msg, + self.tr("LEAP Client Error"), + msg, QMessageBox.NoButton, self) msgBox.addButton("&Ok", QMessageBox.AcceptRole) msgBox.addButton("&Cancel", QMessageBox.RejectRole) diff --git a/src/leap/baseapp/eip.py b/src/leap/baseapp/eip.py index 4fcbee3f..03a1d6c7 100644 --- a/src/leap/baseapp/eip.py +++ b/src/leap/baseapp/eip.py @@ -22,6 +22,7 @@ class EIPConductorAppMixin(object): Connects the eip connect/disconnect logic to the switches in the app (buttons/menu items). """ + ERR_DIALOG = False def __init__(self, *args, **kwargs): opts = kwargs.pop('opts') @@ -94,6 +95,15 @@ class EIPConductorAppMixin(object): in the future we plan to derive errors to our log viewer. """ + if self.ERR_DIALOG: + logger.warning('another error dialog suppressed') + return + + # XXX this is actually a one-shot. + # On the dialog there should be + # a reset signal binded to the ok button + # or something like that. + self.ERR_DIALOG = True if getattr(error, 'usermessage', None): message = error.usermessage @@ -105,6 +115,7 @@ class EIPConductorAppMixin(object): # launching dialog. # (so Qt tests can assert stuff) + if error.critical: logger.critical(error.message) #critical error (non recoverable), @@ -113,6 +124,7 @@ class EIPConductorAppMixin(object): ErrorDialog(errtype="critical", msg=message, label="critical error") + elif error.warning: logger.warning(error.message) -- cgit v1.2.3 From 6fb952397573f4bc90f4cd9e72b49fcf6256e95c Mon Sep 17 00:00:00 2001 From: kali Date: Thu, 17 Jan 2013 08:07:45 +0900 Subject: localize exit country if we can only if we can find the geoip database, which comes with geoip-database in debian. we will have to think more about this in the future but it's nice to have now for testing. --- src/leap/baseapp/eip.py | 3 +++ src/leap/baseapp/log.py | 10 ++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/eip.py b/src/leap/baseapp/eip.py index 03a1d6c7..4c1fb32d 100644 --- a/src/leap/baseapp/eip.py +++ b/src/leap/baseapp/eip.py @@ -10,6 +10,7 @@ from leap.baseapp import constants from leap.eip import exceptions as eip_exceptions from leap.eip.eipconnection import EIPConnection from leap.base.checks import EVENT_CONNECT_REFUSED +from leap.util import geo logger = logging.getLogger(name=__name__) @@ -175,6 +176,8 @@ class EIPConductorAppMixin(object): self.status_label.setText(con_status) self.ip_label.setText(ip) self.remote_label.setText(remote) + self.remote_country.setText( + geo.get_country_name(remote)) # status i/o diff --git a/src/leap/baseapp/log.py b/src/leap/baseapp/log.py index e6a767fb..636e5bae 100644 --- a/src/leap/baseapp/log.py +++ b/src/leap/baseapp/log.py @@ -38,6 +38,7 @@ class LogPaneMixin(object): self.status_label = QtGui.QLabel(self.tr('Disconnected')) self.ip_label = QtGui.QLabel('') self.remote_label = QtGui.QLabel('') + self.remote_country = QtGui.QLabel('') tun_read_label = QtGui.QLabel("tun read") self.tun_read_bytes = QtGui.QLabel("0") @@ -48,10 +49,11 @@ class LogPaneMixin(object): grid.addWidget(self.status_label, 0, 1) grid.addWidget(self.ip_label, 1, 0) grid.addWidget(self.remote_label, 1, 1) - grid.addWidget(tun_read_label, 2, 0) - grid.addWidget(self.tun_read_bytes, 2, 1) - grid.addWidget(tun_write_label, 3, 0) - grid.addWidget(self.tun_write_bytes, 3, 1) + grid.addWidget(self.remote_country, 2, 1) + grid.addWidget(tun_read_label, 3, 0) + grid.addWidget(self.tun_read_bytes, 3, 1) + grid.addWidget(tun_write_label, 4, 0) + grid.addWidget(self.tun_write_bytes, 4, 1) self.statusBox.setLayout(grid) -- cgit v1.2.3 From 54802bf9c53fc32cfcceb23045c5aeb313c19829 Mon Sep 17 00:00:00 2001 From: kali Date: Fri, 18 Jan 2013 08:45:35 +0900 Subject: fix network checker attr in wizard --- src/leap/baseapp/network.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/network.py b/src/leap/baseapp/network.py index a67f6340..d5685504 100644 --- a/src/leap/baseapp/network.py +++ b/src/leap/baseapp/network.py @@ -21,12 +21,13 @@ class NetworkCheckerAppMixin(object): def __init__(self, *args, **kwargs): provider = kwargs.pop('provider', None) + self.network_checker = None if provider: self.init_network_checker(provider) def init_network_checker(self, provider): null_check(provider, "provider_domain") - if not hasattr(self, 'network_checker'): + if not self.network_checker: self.network_checker = NetworkCheckerThread( error_cb=self.networkError.emit, debug=self.debugmode, -- cgit v1.2.3 From 407b030bb7d27b797fb27254710a358c9c69f8be Mon Sep 17 00:00:00 2001 From: kali Date: Thu, 24 Jan 2013 01:57:28 +0900 Subject: catch missing messages on last page of wizard --- src/leap/baseapp/eip.py | 7 +++++-- src/leap/baseapp/mainwindow.py | 2 ++ src/leap/baseapp/network.py | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/eip.py b/src/leap/baseapp/eip.py index 4c1fb32d..2f215f00 100644 --- a/src/leap/baseapp/eip.py +++ b/src/leap/baseapp/eip.py @@ -193,21 +193,24 @@ class EIPConductorAppMixin(object): # connection information via management interface log = self.conductor.get_log() error_matrix = [(EVENT_CONNECT_REFUSED, (self.start_or_stopVPN, ))] - self.network_checker.checker.parse_log_and_react(log, error_matrix) + if hasattr(self.network_checker, 'checker'): + self.network_checker.checker.parse_log_and_react(log, error_matrix) @QtCore.pyqtSlot() - def start_or_stopVPN(self): + def start_or_stopVPN(self, **kwargs): """ stub for running child process with vpn """ if self.conductor.has_errors(): logger.debug('not starting vpn; conductor has errors') + return if self.eip_service_started is False: try: self.conductor.connect() except eip_exceptions.EIPNoCommandError as exc: + logger.error('tried to run openvpn but no command is set') self.triggerEIPError.emit(exc) except Exception as err: diff --git a/src/leap/baseapp/mainwindow.py b/src/leap/baseapp/mainwindow.py index b1e5bccf..91b0dc61 100644 --- a/src/leap/baseapp/mainwindow.py +++ b/src/leap/baseapp/mainwindow.py @@ -186,4 +186,6 @@ class LeapWindow(QtGui.QMainWindow, called from the end of wizard """ self.show_systray_icon() + # this will setup the command + self.conductor.run_openvpn_checks() self.start_or_stopVPN() diff --git a/src/leap/baseapp/network.py b/src/leap/baseapp/network.py index d5685504..dc5182a4 100644 --- a/src/leap/baseapp/network.py +++ b/src/leap/baseapp/network.py @@ -36,6 +36,7 @@ class NetworkCheckerAppMixin(object): @QtCore.pyqtSlot(object) def runNetworkChecks(self): + logger.debug('running checks (from NetworkChecker Mixin slot)') self.network_checker.run_checks() @QtCore.pyqtSlot(object) -- cgit v1.2.3 From 9cdc193c587631986e579c1ba37a8b982be01238 Mon Sep 17 00:00:00 2001 From: kali Date: Thu, 24 Jan 2013 18:47:41 +0900 Subject: all tests green again plus: * added soledad test requirements * removed soledad from run_tests run (+1K tests failing) * added option to run All tests to run_tests script * pep8 cleanup --- src/leap/baseapp/eip.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/eip.py b/src/leap/baseapp/eip.py index 2f215f00..adc9ba68 100644 --- a/src/leap/baseapp/eip.py +++ b/src/leap/baseapp/eip.py @@ -101,7 +101,7 @@ class EIPConductorAppMixin(object): return # XXX this is actually a one-shot. - # On the dialog there should be + # On the dialog there should be # a reset signal binded to the ok button # or something like that. self.ERR_DIALOG = True @@ -116,7 +116,6 @@ class EIPConductorAppMixin(object): # launching dialog. # (so Qt tests can assert stuff) - if error.critical: logger.critical(error.message) #critical error (non recoverable), -- cgit v1.2.3 From b3f30d14d8a8e728d904b78e9235d63d25e475d1 Mon Sep 17 00:00:00 2001 From: kali Date: Wed, 30 Jan 2013 06:15:35 +0900 Subject: fix option not in use --- src/leap/baseapp/eip.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/leap/baseapp') diff --git a/src/leap/baseapp/eip.py b/src/leap/baseapp/eip.py index adc9ba68..b34cc82e 100644 --- a/src/leap/baseapp/eip.py +++ b/src/leap/baseapp/eip.py @@ -46,8 +46,12 @@ class EIPConductorAppMixin(object): ovpn_verbosity=opts.openvpn_verb, provider=provider) - self.skip_download = opts.no_provider_checks - self.skip_verify = opts.no_ca_verify + # Do we want to enable the skip checks w/o being + # in debug mode?? + #self.skip_download = opts.no_provider_checks + #self.skip_verify = opts.no_ca_verify + self.skip_download = False + self.skip_verify = False def run_eip_checks(self): """ -- cgit v1.2.3