loader eingefügt
This commit is contained in:
31
main.py
31
main.py
@@ -24,22 +24,29 @@ from lib.ConfigLoader import ConfigLoader
|
||||
if __name__ == "__main__":
|
||||
app = QGuiApplication(sys.argv)
|
||||
engine = QQmlApplicationEngine()
|
||||
bad_config = False
|
||||
|
||||
|
||||
|
||||
qml_file = Path(__file__).resolve().parent / "gui/main.qml"
|
||||
|
||||
config = ConfigLoader()
|
||||
|
||||
|
||||
# if config.getConfig():
|
||||
try:
|
||||
print (config.getConfig()['database']['server'])
|
||||
qml_file = Path(__file__).resolve().parent / "gui/main.qml"
|
||||
engine.load(qml_file)
|
||||
except:
|
||||
print("Ausnahme")
|
||||
qml_file = Path(__file__).resolve().parent / "gui/Programmeinstellungen.qml"
|
||||
engine.rootContext().setContextProperty("config", config)
|
||||
engine.load(qml_file)
|
||||
# else:
|
||||
# config.createConfig()
|
||||
if not config.getConfig():
|
||||
|
||||
bad_config = False
|
||||
# try:
|
||||
# app_config = config.getConfig()
|
||||
# if not app_config:
|
||||
|
||||
|
||||
# except Exception as i:
|
||||
|
||||
engine.rootContext().setContextProperty("bad_config", bad_config) # print(f"Fehler: {i}")
|
||||
engine.rootContext().setContextProperty("config", config)
|
||||
engine.load(qml_file)
|
||||
|
||||
|
||||
if not engine.rootObjects():
|
||||
sys.exit(-1)
|
||||
|
||||
Reference in New Issue
Block a user