-
Notifications
You must be signed in to change notification settings - Fork 0
/
msgbox.py
54 lines (50 loc) · 2.29 KB
/
msgbox.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from PyQt5.QtWidgets import QMessageBox
def showMessageBox(title, message, type = 'QMessageBox.Information', buttons = 'QMessageBox::Ok'):
msgBox = QMessageBox()
msgBox.setWindowTitle(title)
msgBox.setText(message)
if(type == 'QMessageBox.Question'):
msgBox.setIcon(QMessageBox.Question)
elif(type == 'QMessageBox.Information'):
msgBox.setIcon(QMessageBox.Information)
elif(type == 'QMessageBox.Warning'):
msgBox.setIcon(QMessageBox.Warning)
elif(type == 'QMessageBox.Critical'):
msgBox.setIcon(QMessageBox.Critical)
else:
msgBox.setIcon(QMessageBox.NoIcon)
if(buttons == 'QMessageBox::Ok'):
msgBox.setStandardButtons(QMessageBox.Ok)
elif(buttons == 'QMessageBox::Open'):
msgBox.setStandardButtons(QMessageBox.Open)
elif(buttons == 'QMessageBox::Save'):
msgBox.setStandardButtons(QMessageBox.Save)
elif(buttons == 'QMessageBox::Cancel'):
msgBox.setStandardButtons(QMessageBox.Cancel)
elif(buttons == 'QMessageBox::Close'):
msgBox.setStandardButtons(QMessageBox.Close)
elif(buttons == 'QMessageBox::Discard'):
msgBox.setStandardButtons(QMessageBox.Discard)
elif(buttons == 'QMessageBox::Apply'):
msgBox.setStandardButtons(QMessageBox.Apply)
elif(buttons == 'QMessageBox::Reset'):
msgBox.setStandardButtons(QMessageBox.Reset)
elif(buttons == 'QMessageBox::RestoreDefaults'):
msgBox.setStandardButtons(QMessageBox.RestoreDefaults)
elif(buttons == 'QMessageBox::Help'):
msgBox.setStandardButtons(QMessageBox.Help)
elif(buttons == 'QMessageBox::SaveAll'):
msgBox.setStandardButtons(QMessageBox.SaveAll)
elif(buttons == 'QMessageBox::Yes'):
msgBox.setStandardButtons(QMessageBox.Yes)
elif(buttons == 'QMessageBox::YesToAll'):
msgBox.setStandardButtons(QMessageBox.YesToAll)
elif(buttons == 'QMessageBox::Abort'):
msgBox.setStandardButtons(QMessageBox.Abort)
elif(buttons == 'QMessageBox::Retry'):
msgBox.setStandardButtons(QMessageBox.Retry)
elif(buttons == 'QMessageBox::Ignore'):
msgBox.setStandardButtons(QMessageBox.Ignore)
elif(buttons == 'QMessageBox::NoButton'):
msgBox.setStandardButtons(QMessageBox.NoButton)
msgBox.exec()