summaryrefslogtreecommitdiff
path: root/src/leap
diff options
context:
space:
mode:
authorkali <kali@leap.se>2012-12-17 05:05:37 +0900
committerkali <kali@leap.se>2012-12-17 05:05:37 +0900
commit89694babd14a9b2ba76095911b6884e359a12282 (patch)
treec80c8f458e94d137be20060820abc51a89099a0a /src/leap
parent0c2275222cf77bf5975a25a75ab0e50ac752bc9e (diff)
network checker launched by signal
fixes problem with provider domain not being defined during first run.
Diffstat (limited to 'src/leap')
-rw-r--r--src/leap/baseapp/eip.py3
-rw-r--r--src/leap/baseapp/mainwindow.py3
-rw-r--r--src/leap/baseapp/network.py14
-rw-r--r--src/leap/baseapp/systray.py5
-rw-r--r--src/leap/gui/firstrun/last.py2
5 files changed, 19 insertions, 8 deletions
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)
diff --git a/src/leap/gui/firstrun/last.py b/src/leap/gui/firstrun/last.py
index d33d2e77..1d8caca4 100644
--- a/src/leap/gui/firstrun/last.py
+++ b/src/leap/gui/firstrun/last.py
@@ -58,6 +58,8 @@ class LastPage(QtGui.QWizardPage):
self.label.setText(
"Click '<i>%s</i>' to end the wizard and "
"save your settings." % finishText)
+ # XXX init network checker
+ # trigger signal
@coroutine
def eip_status_handler(self):