-
Notifications
You must be signed in to change notification settings - Fork 0
/
MessageForm.py
executable file
·36 lines (26 loc) · 1.05 KB
/
MessageForm.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
#!/usr/bin/env python3
# Copyright © 2015-20 Qtrac Ltd. All rights reserved.
from PySide.QtCore import Qt
from PySide.QtGui import (
QDialog, QDialogButtonBox, QTextBrowser, QVBoxLayout)
class Form(QDialog):
def __init__(self, title, message, parent=None):
super().__init__(parent)
self.setAttribute(Qt.WA_DeleteOnClose, True)
self.setWindowTitle("{} — XindeX".format(title))
self.create_widgets(message)
self.layout_widgets()
self.create_connections()
def create_widgets(self, message):
self.label = QTextBrowser()
self.label.setStyleSheet("QTextBrowser { background: #eee; }")
self.label.setText(message)
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok)
def layout_widgets(self):
layout = QVBoxLayout()
layout.addWidget(self.label, 2)
layout.addWidget(self.buttonBox)
self.setLayout(layout)
def create_connections(self):
self.buttonBox.rejected.connect(self.close)
self.buttonBox.accepted.connect(self.close)