-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathInputDialogs.py
39 lines (27 loc) · 1.22 KB
/
InputDialogs.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
from PyQt5.QtWidgets import QDialog, QLineEdit, QDialogButtonBox, QFormLayout
class FunctionInputDialog(QDialog):
def __init__(self, parent=None):
super().__init__(parent)
self.name_input = QLineEdit(self)
button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel, self)
layout = QFormLayout(self)
layout.addRow("Name", self.name_input)
layout.addWidget(button_box)
button_box.accepted.connect(self.accept)
button_box.rejected.connect(self.reject)
def get_entry(self):
return self.name_input.text()
class VariableInputDialog(QDialog):
def __init__(self, parent=None):
super().__init__(parent)
self.name_input = QLineEdit(self)
self.value_input = QLineEdit(self)
button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel, self)
layout = QFormLayout(self)
layout.addRow("Name", self.name_input)
layout.addRow("Value", self.value_input)
layout.addWidget(button_box)
button_box.accepted.connect(self.accept)
button_box.rejected.connect(self.reject)
def get_entries(self):
return self.name_input.text(), self.value_input.text()