summaryrefslogtreecommitdiff
path: root/src/leap/baseapp
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/baseapp')
-rw-r--r--src/leap/baseapp/dialogs.py17
-rw-r--r--src/leap/baseapp/eip.py59
2 files changed, 48 insertions, 28 deletions
diff --git a/src/leap/baseapp/dialogs.py b/src/leap/baseapp/dialogs.py
index 4b1b5b62..d37a234c 100644
--- a/src/leap/baseapp/dialogs.py
+++ b/src/leap/baseapp/dialogs.py
@@ -4,7 +4,6 @@ from PyQt4.QtGui import (QDialog, QFrame, QPushButton, QLabel, QMessageBox)
class ErrorDialog(QDialog):
def __init__(self, parent=None):
super(ErrorDialog, self).__init__(parent)
-
frameStyle = QFrame.Sunken | QFrame.Panel
self.warningLabel = QLabel()
self.warningLabel.setFrameStyle(frameStyle)
@@ -15,19 +14,17 @@ class ErrorDialog(QDialog):
"QMessageBox.warning()", msg,
QMessageBox.NoButton, self)
msgBox.addButton("&Ok", QMessageBox.AcceptRole)
- msgBox.addButton("&Cancel", QMessageBox.RejectRole)
if msgBox.exec_() == QMessageBox.AcceptRole:
- self.warningLabel.setText("Save Again")
- else:
- self.warningLabel.setText("Continue")
+ pass
+ # do whatever we want to do after
+ # closing the dialog. we can pass that
+ # in the constructor
def criticalMessage(self, msg, label):
msgBox = QMessageBox(QMessageBox.Critical,
"QMessageBox.critical()", msg,
QMessageBox.NoButton, self)
msgBox.addButton("&Ok", QMessageBox.AcceptRole)
- msgBox.addButton("&Cancel", QMessageBox.RejectRole)
- if msgBox.exec_() == QMessageBox.AcceptRole:
- self.warningLabel.setText("Save Again")
- else:
- self.warningLabel.setText("Continue")
+ msgBox.exec_()
+ import sys
+ sys.exit()
diff --git a/src/leap/baseapp/eip.py b/src/leap/baseapp/eip.py
index 856cb197..dd88b7f5 100644
--- a/src/leap/baseapp/eip.py
+++ b/src/leap/baseapp/eip.py
@@ -12,6 +12,7 @@ logger = logging.getLogger(name=__name__)
class EIPConductorApp(object):
+ # XXX EIPConductorMixin ?
"""
initializes an instance of EIPConnection,
gathers errors, and passes status-change signals
@@ -51,8 +52,38 @@ class EIPConductorApp(object):
lambda: self.start_or_stopVPN())
def error_check(self):
-
- # XXX refactor (by #504)
+ logger.debug('error check')
+
+ #####################################
+ # XXX refactor in progress (by #504)
+ errq = self.conductor.error_queue
+ while errq.qsize() != 0:
+ logger.debug('%s errors left in conductor queue', errq.qsize())
+ error = errq.get()
+ logger.error('%s: %s', error.__class__.__name__, error.message)
+
+ if issubclass(error.__class__, eip_exceptions.EIPClientError):
+ if error.critical:
+ logger.critical(error.message)
+ logger.error('quitting')
+
+ # XXX
+ # check headless = False before
+ # launching dialog.
+ # (for Qt tests)
+
+ dialog = ErrorDialog()
+ if getattr(error, 'usermessage', None):
+ message = error.usermessage
+ else:
+ message = error.message
+ dialog.criticalMessage(message, 'error')
+ else:
+ logger.exception(error.message)
+ else:
+ import traceback
+ traceback.print_exc()
+ raise error
if self.conductor.missing_definition is True:
dialog = ErrorDialog()
@@ -78,12 +109,14 @@ class EIPConductorApp(object):
# os.kill of subprocess fails if we have
# some of this errors.
- if self.conductor.bad_provider is True:
- dialog = ErrorDialog()
- dialog.criticalMessage(
- 'Bad provider entry. Check that remote_ip entry '
- 'has an IP under section [provider] in eip.cfg',
- 'error')
+ # deprecated.
+ # get something alike.
+ #if self.conductor.bad_provider is True:
+ #dialog = ErrorDialog()
+ #dialog.criticalMessage(
+ #'Bad provider entry. Check that remote_ip entry '
+ #'has an IP under section [provider] in eip.cfg',
+ #'error')
if self.conductor.bad_keyfile_perms is True:
dialog = ErrorDialog()
@@ -91,16 +124,6 @@ class EIPConductorApp(object):
'The vpn keys file has bad permissions',
'error')
- if self.conductor.missing_auth_agent is True:
- dialog = ErrorDialog()
- dialog.warningMessage(
- 'We could not find any authentication '
- 'agent in your system.<br/>'
- 'Make sure you have '
- '<b>polkit-gnome-authentication-agent-1</b> '
- 'running and try again.',
- 'error')
-
if self.conductor.missing_pkexec is True:
dialog = ErrorDialog()
dialog.warningMessage(