summaryrefslogtreecommitdiff
path: root/src/leap/baseapp/eip.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/baseapp/eip.py')
-rw-r--r--src/leap/baseapp/eip.py25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/leap/baseapp/eip.py b/src/leap/baseapp/eip.py
index 55ecfa79..4c1fb32d 100644
--- a/src/leap/baseapp/eip.py
+++ b/src/leap/baseapp/eip.py
@@ -9,6 +9,8 @@ from leap.baseapp.dialogs import ErrorDialog
from leap.baseapp import constants
from leap.eip import exceptions as eip_exceptions
from leap.eip.eipconnection import EIPConnection
+from leap.base.checks import EVENT_CONNECT_REFUSED
+from leap.util import geo
logger = logging.getLogger(name=__name__)
@@ -21,6 +23,7 @@ class EIPConductorAppMixin(object):
Connects the eip connect/disconnect logic
to the switches in the app (buttons/menu items).
"""
+ ERR_DIALOG = False
def __init__(self, *args, **kwargs):
opts = kwargs.pop('opts')
@@ -93,6 +96,15 @@ class EIPConductorAppMixin(object):
in the future we plan to derive errors to
our log viewer.
"""
+ if self.ERR_DIALOG:
+ logger.warning('another error dialog suppressed')
+ return
+
+ # XXX this is actually a one-shot.
+ # On the dialog there should be
+ # a reset signal binded to the ok button
+ # or something like that.
+ self.ERR_DIALOG = True
if getattr(error, 'usermessage', None):
message = error.usermessage
@@ -104,6 +116,7 @@ class EIPConductorAppMixin(object):
# launching dialog.
# (so Qt tests can assert stuff)
+
if error.critical:
logger.critical(error.message)
#critical error (non recoverable),
@@ -112,6 +125,7 @@ class EIPConductorAppMixin(object):
ErrorDialog(errtype="critical",
msg=message,
label="critical error")
+
elif error.warning:
logger.warning(error.message)
@@ -162,6 +176,8 @@ class EIPConductorAppMixin(object):
self.status_label.setText(con_status)
self.ip_label.setText(ip)
self.remote_label.setText(remote)
+ self.remote_country.setText(
+ geo.get_country_name(remote))
# status i/o
@@ -174,6 +190,11 @@ class EIPConductorAppMixin(object):
self.tun_read_bytes.setText(tun_read)
self.tun_write_bytes.setText(tun_write)
+ # connection information via management interface
+ log = self.conductor.get_log()
+ error_matrix = [(EVENT_CONNECT_REFUSED, (self.start_or_stopVPN, ))]
+ self.network_checker.checker.parse_log_and_react(log, error_matrix)
+
@QtCore.pyqtSlot()
def start_or_stopVPN(self):
"""
@@ -195,7 +216,7 @@ class EIPConductorAppMixin(object):
else:
# no errors, so go on.
if self.debugmode:
- self.startStopButton.setText('&Disconnect')
+ self.startStopButton.setText(self.tr('&Disconnect'))
self.eip_service_started = True
self.toggleEIPAct()
@@ -209,7 +230,7 @@ class EIPConductorAppMixin(object):
self.network_checker.stop()
self.conductor.disconnect()
if self.debugmode:
- self.startStopButton.setText('&Connect')
+ self.startStopButton.setText(self.tr('&Connect'))
self.eip_service_started = False
self.toggleEIPAct()
self.timer.stop()