-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwarningui.py
More file actions
21 lines (17 loc) · 855 Bytes
/
warningui.py
File metadata and controls
21 lines (17 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from PyQt6.QtWidgets import QLabel, QVBoxLayout, QDialog, QDialogButtonBox
class WarningWindow(QDialog):
def __init__(self, parent=None, title="ERROR", warning_text="Undefined error, process may continue with weird behavior or fail entirely. Good luck."):
super().__init__(parent)
# Used for any error popups that can occur, or general information
self.setWindowTitle(title)
QBtn = (
QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel
)
self.buttonBox = QDialogButtonBox(QBtn)
self.buttonBox.accepted.connect(self.accept)
self.buttonBox.rejected.connect(self.reject)
layout = QVBoxLayout()
message = QLabel(warning_text)
layout.addWidget(message)
layout.addWidget(self.buttonBox)
self.setLayout(layout)