-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshow_messageboxes.py
55 lines (42 loc) · 1.77 KB
/
show_messageboxes.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
55
from PySide6.QtWidgets import QMessageBox
from PySide6.QtGui import QIcon
from PySide6.QtCore import QSize
import resources_rc
class MessageBoxShower():
appId = None
def __init__(self, appId: str):
# Set up the universal icon for this app
self.appId = appId
def ShowErrorMessageBox(self, error_msg: str) -> None:
appIcon = QIcon()
appIcon.addFile(u":/PrestoChangeO/images/magic-wand-64x64.png", QSize(), QIcon.Normal, QIcon.Off)
msgBox = QMessageBox()
msgBox.setWindowTitle(f"{self.appId}: Error")
msgBox.setWindowIcon(appIcon)
msgBox.setText(error_msg)
msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.setIcon(QMessageBox.Critical)
ret = msgBox.exec()
return
def ShowInformationMessageBox(self, info_msg: str, titlebarText: str) -> None:
appIcon = QIcon()
appIcon.addFile(u":/PrestoChangeO/images/magic-wand-64x64.png", QSize(), QIcon.Normal, QIcon.Off)
msgBox = QMessageBox()
msgBox.setWindowTitle(f"{self.appId}: {titlebarText}")
msgBox.setWindowIcon(appIcon)
msgBox.setText(info_msg)
msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.setIcon(QMessageBox.Information)
ret = msgBox.exec()
return
def ShowWarningMessageBox(self, info_msg: str, titlebarText: str) -> None:
appIcon = QIcon()
appIcon.addFile(u":/PrestoChangeO/images/magic-wand-64x64.png", QSize(), QIcon.Normal, QIcon.Off)
msgBox = QMessageBox()
msgBox.setWindowTitle(f"{self.appId}: {titlebarText}")
msgBox.setWindowIcon(appIcon)
msgBox.setText(info_msg)
msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.setIcon(QMessageBox.Warning)
ret = msgBox.exec()
return