aboutsummaryrefslogtreecommitdiff
path: root/eindopdracht
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-10-09 14:22:35 +0200
committerlonkaars <loek@pipeframe.xyz>2022-10-09 14:22:35 +0200
commit61646ba1b0894b31510bc73bb284b5506828330e (patch)
tree6becd36e4f50dabb3b13b7e9019e8c77904f26a7 /eindopdracht
parent94bcc5b83fa451ac851aea19a8956f3531a44d67 (diff)
main window layout done
Diffstat (limited to 'eindopdracht')
-rwxr-xr-xeindopdracht/applicatie/main.py79
1 files changed, 79 insertions, 0 deletions
diff --git a/eindopdracht/applicatie/main.py b/eindopdracht/applicatie/main.py
new file mode 100755
index 0000000..222d785
--- /dev/null
+++ b/eindopdracht/applicatie/main.py
@@ -0,0 +1,79 @@
+#!/bin/python3
+
+import sys
+import json
+from PyQt6.QtCore import QDateTime, Qt, QTimer
+from PyQt6.QtWidgets import *
+
+def get_car_brands():
+ return ["brand a", "brand b"]
+
+def get_brand_info(brand):
+ return { "key": "value", "models": ["model a", "model b"] }
+
+def get_model_info(model):
+ return { "power": 123 }
+
+class MainWindow(QDialog):
+ def __init__(self, parent=None):
+ super(MainWindow, self).__init__(parent)
+
+ self.brand = None
+ self.brand_info = get_brand_info(self.brand)
+ self.model = None
+ self.model_info = get_model_info(self.model)
+
+ brand_dropdown = QComboBox()
+ brand_dropdown.addItems(get_car_brands())
+ brand_dropdown_label = QLabel("Merk:")
+ brand_dropdown_label.setBuddy(brand_dropdown)
+
+ brand_facts = QPlainTextEdit()
+ brand_facts.setReadOnly(True)
+ brand_facts.setPlainText(json.dumps(self.brand_info))
+ brand_facts_label = QLabel("Merkinfo:")
+ brand_facts_label.setBuddy(brand_facts)
+
+ model_dropdown = QComboBox()
+ model_dropdown.addItems(self.brand_info["models"])
+ model_dropdown_label = QLabel("Model:")
+ model_dropdown_label.setBuddy(model_dropdown)
+
+ model_facts = QPlainTextEdit()
+ model_facts.setPlainText(json.dumps(self.model_info))
+ model_facts.setReadOnly(True)
+ model_facts_label = QLabel("Modelinfo:")
+ model_facts_label.setBuddy(model_facts)
+ model_facts_units_kw = QRadioButton("kW")
+ model_facts_units_hp = QRadioButton("PK")
+ model_facts_units_label = QLabel("Eenheden:")
+ model_facts_units_layout = QHBoxLayout()
+ model_facts_units_layout.addWidget(model_facts_units_label)
+ model_facts_units_layout.addWidget(model_facts_units_hp)
+ model_facts_units_layout.addWidget(model_facts_units_kw)
+
+ select_layout = QVBoxLayout()
+ select_layout.addWidget(brand_dropdown_label)
+ select_layout.addWidget(brand_dropdown)
+ select_layout.addWidget(brand_facts_label)
+ select_layout.addWidget(brand_facts)
+ select_layout.addWidget(model_dropdown_label)
+ select_layout.addWidget(model_dropdown)
+ select_layout.addLayout(model_facts_units_layout)
+ select_layout.addWidget(model_facts_label)
+ select_layout.addWidget(model_facts)
+
+ viewer_layout = QVBoxLayout()
+
+ layout = QHBoxLayout()
+ layout.addLayout(select_layout)
+ layout.addLayout(viewer_layout)
+ layout.setStretch(1, 2)
+
+ self.setLayout(layout)
+
+if __name__ == '__main__':
+ app = QApplication(sys.argv)
+ win = MainWindow()
+ win.show()
+ app.exec()