summaryrefslogtreecommitdiff
path: root/src/leap/baseapp/dialogs.py
blob: 4b1b5b62f76cac4db191be31326ac48f72135069 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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)
        self.warningButton = QPushButton("QMessageBox.&warning()")

    def warningMessage(self, msg, label):
        msgBox = QMessageBox(QMessageBox.Warning,
                             "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")

    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")