forked from Ultrawipf/OpenFFBoard-configurator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
optionsdialog.py
64 lines (51 loc) · 1.68 KB
/
optionsdialog.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
56
57
58
59
60
61
62
63
64
from PyQt5.QtWidgets import QMainWindow
from PyQt5.QtWidgets import QDialog
from PyQt5.QtWidgets import QWidget,QGroupBox
from PyQt5.QtWidgets import QMessageBox,QVBoxLayout,QCheckBox,QButtonGroup,QPushButton,QLabel,QSpinBox,QComboBox
from PyQt5 import uic
import main
from helper import res_path,classlistToIds
class OptionsDialog(QDialog):
def __init__(self,dialog, parent):
QDialog.__init__(self, parent)
self.initialized = False
self.main = parent #type: main.MainUi
self.layout = QVBoxLayout()
self.setWindowTitle(dialog.name)
self.setDialog(dialog)
def initBaseUI(self):
self.initialized = True
self.conf_ui.initUI()
self.layout.addWidget(self.conf_ui)
okbtn = QPushButton("OK")
okbtn.clicked.connect(self.apply)
self.layout.addWidget(okbtn)
self.setLayout(self.layout)
def apply(self):
self.conf_ui.apply()
self.close()
def showEvent(self,event):
try:
if not self.initialized:
self.initBaseUI()
self.conf_ui.readValues()
except Exception as e:
self.main.log("Error getting info")
print(e)
return
def setDialog(self,dialog):
self.conf_ui = dialog
class OptionsDialogGroupBox(QGroupBox):
name = "Options"
def __init__(self,name,main):
self.name = name
self.main = main
QGroupBox.__init__(self,name)
def initUI(self):
vbox = QVBoxLayout()
vbox.addWidget(QLabel("Error. No dialog for\n" + self.name))
self.setLayout(vbox)
def apply(self):
pass
def readValues(self):
pass