summaryrefslogtreecommitdiff
path: root/src/leap/baseapp/dialogs.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/baseapp/dialogs.py')
-rw-r--r--src/leap/baseapp/dialogs.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/leap/baseapp/dialogs.py b/src/leap/baseapp/dialogs.py
index d37a234c..d4acb09d 100644
--- a/src/leap/baseapp/dialogs.py
+++ b/src/leap/baseapp/dialogs.py
@@ -1,14 +1,25 @@
+import logging
+
from PyQt4.QtGui import (QDialog, QFrame, QPushButton, QLabel, QMessageBox)
+logger = logging.getLogger(name=__name__)
+
class ErrorDialog(QDialog):
- def __init__(self, parent=None):
+ def __init__(self, parent=None, errtype=None, msg=None, label=None):
super(ErrorDialog, self).__init__(parent)
frameStyle = QFrame.Sunken | QFrame.Panel
self.warningLabel = QLabel()
self.warningLabel.setFrameStyle(frameStyle)
self.warningButton = QPushButton("QMessageBox.&warning()")
+ if msg is not None:
+ self.msg = msg
+ if label is not None:
+ self.label = label
+ if errtype == "critical":
+ self.criticalMessage(self.msg, self.label)
+
def warningMessage(self, msg, label):
msgBox = QMessageBox(QMessageBox.Warning,
"QMessageBox.warning()", msg,
@@ -26,5 +37,11 @@ class ErrorDialog(QDialog):
QMessageBox.NoButton, self)
msgBox.addButton("&Ok", QMessageBox.AcceptRole)
msgBox.exec_()
+
+ # It's critical, so we exit.
+ # We should better emit a signal and connect it
+ # with the proper shutdownAndQuit method, but
+ # this suffices for now.
+ logger.info('Quitting')
import sys
sys.exit()