summaryrefslogtreecommitdiff
path: root/src/leap/baseapp/network.py
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2012-12-24 10:14:58 -0200
committerdrebs <drebs@leap.se>2012-12-24 10:14:58 -0200
commit319e279b59ac080779d0a3375ae4d6582f5ee6a3 (patch)
tree118dd0f495c0d54f2b2c66ea235e4e4e6b8cefd5 /src/leap/baseapp/network.py
parentca5fb41a55e1292005ed186baf3710831d9ad678 (diff)
parenta7b091a0553e6120f3e0eb6d4e73a89732c589b2 (diff)
Merge branch 'develop' of ssh://code.leap.se/leap_client into develop
Diffstat (limited to 'src/leap/baseapp/network.py')
-rw-r--r--src/leap/baseapp/network.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/leap/baseapp/network.py b/src/leap/baseapp/network.py
index 077d5164..a33265e5 100644
--- a/src/leap/baseapp/network.py
+++ b/src/leap/baseapp/network.py
@@ -9,19 +9,30 @@ 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):
- self.network_checker = NetworkCheckerThread(
- error_cb=self.networkError.emit,
- debug=self.debugmode)
+ provider = kwargs.pop('provider', 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'):
+ self.network_checker = NetworkCheckerThread(
+ error_cb=self.networkError.emit,
+ debug=self.debugmode,
+ provider=provider)
+ self.network_checker.start()
- # XXX move run_checks to slot
+ @QtCore.pyqtSlot(object)
+ def runNetworkChecks(self):
self.network_checker.run_checks()
@QtCore.pyqtSlot(object)