summaryrefslogtreecommitdiff
path: root/src/leap/baseapp/network.py
diff options
context:
space:
mode:
authorkali <kali@leap.se>2012-10-08 07:50:24 +0900
committerkali <kali@leap.se>2012-10-08 07:50:24 +0900
commit6728eb9afb21bad867e4052a6190a9bdb34c928a (patch)
treef648189df27c8531991001a1ce25845ffe3b9e41 /src/leap/baseapp/network.py
parent6cd947041b3352bebddf3863a86b0a15f8222bcf (diff)
popup dialog error when network error happens
we are shutting down for now. we should be acting upon failures in the near future. lowered the recurrent checks interval to 10 seconds.
Diffstat (limited to 'src/leap/baseapp/network.py')
-rw-r--r--src/leap/baseapp/network.py25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/leap/baseapp/network.py b/src/leap/baseapp/network.py
index fbf9376f..077d5164 100644
--- a/src/leap/baseapp/network.py
+++ b/src/leap/baseapp/network.py
@@ -1,10 +1,13 @@
from __future__ import print_function
import logging
+
logger = logging.getLogger(name=__name__)
+from PyQt4 import QtCore
+
+from leap.baseapp.dialogs import ErrorDialog
from leap.base.network import NetworkCheckerThread
-#from leap.baseapp.dialogs import ErrorDialog
class NetworkCheckerAppMixin(object):
@@ -15,11 +18,23 @@ class NetworkCheckerAppMixin(object):
def __init__(self, *args, **kwargs):
self.network_checker = NetworkCheckerThread(
- # XXX watcher? remove -----
- watcher_cb=self.newLogLine.emit,
- # XXX what callback? ------
- error_cb=None,
+ error_cb=self.networkError.emit,
debug=self.debugmode)
# XXX move run_checks to slot
self.network_checker.run_checks()
+
+ @QtCore.pyqtSlot(object)
+ def onNetworkError(self, exc):
+ """
+ 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)
+
+ if exc.critical:
+ dialog.criticalMessage(exc.usermessage, "network error")
+ else:
+ dialog.warningMessage(exc.usermessage, "network error")