summaryrefslogtreecommitdiff
path: root/src/leap/baseapp
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/baseapp')
-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
4 files changed, 17 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)