-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinput_dialog.py
42 lines (30 loc) · 1.38 KB
/
input_dialog.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
from PyQt5.QtWidgets import QDialog, QLabel, QPushButton, QLineEdit, QHBoxLayout
class MultiInputDialog(QDialog):
def __init__(self, old_data=None):
super().__init__()
self.layout = QHBoxLayout()
self.lbl_class_id = QLabel("Class ID")
self.layout.addWidget(self.lbl_class_id)
self.txt_class_id = QLineEdit(self)
self.layout.addWidget(self.txt_class_id)
self.lbl_class = QLabel("Class Name")
self.layout.addWidget(self.lbl_class)
self.txt_class = QLineEdit(self)
self.layout.addWidget(self.txt_class)
self.lbl_rgba = QLabel("RGBA")
self.layout.addWidget(self.lbl_rgba)
self.txt_rgba = QLineEdit(self)
self.layout.addWidget(self.txt_rgba)
if old_data: # If old_data is provided (in edit mode)
self.txt_class_id.setText(str(old_data[1]))
self.txt_class.setText(old_data[2])
self.txt_rgba.setText(old_data[3])
self.btn_ok = QPushButton('OK', self)
self.btn_ok.clicked.connect(self.accept)
self.layout.addWidget(self.btn_ok)
self.btn_cancel = QPushButton('Cancel', self)
self.btn_cancel.clicked.connect(self.reject)
self.layout.addWidget(self.btn_cancel)
self.setLayout(self.layout)
def get_values(self):
return self.txt_class_id.text(), self.txt_class.text(), self.txt_rgba.text()