-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcb_message_boxes.py
33 lines (28 loc) · 997 Bytes
/
cb_message_boxes.py
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 QMessageBox
class CBMessageBoxes(object):
WARNING = QMessageBox.Warning
CRITICAL = QMessageBox.Critical
INFO = QMessageBox.Information
NO = QMessageBox.No
YES = QMessageBox.Yes
@staticmethod
def popup_message(icon, title, text, detailed_text=None, parent=None):
msg = QMessageBox(parent)
msg.setIcon(icon)
msg.setWindowTitle(title)
msg.setText(text)
if detailed_text:
msg.setDetailedText(detailed_text)
# needed to make close button enabled
msg.setStandardButtons(QMessageBox.Ok)
msg.setDefaultButton(QMessageBox.Ok)
msg.setEscapeButton(QMessageBox.Ok)
msg.exec_()
@staticmethod
def prompt_user(icon, title, text, parent=None):
msg = QMessageBox(parent)
msg.setIcon(icon)
msg.setWindowTitle(title)
msg.setText(text)
msg.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
return msg.exec_()