diff options
Diffstat (limited to 'src/leap/baseapp/network.py')
-rw-r--r-- | src/leap/baseapp/network.py | 21 |
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) |