47 lines
892 B
Python
47 lines
892 B
Python
# This Python file uses the following encoding: utf-8
|
|
import sys
|
|
from pathlib import Path
|
|
from PySide6.QtGui import QGuiApplication
|
|
from PySide6.QtQml import QQmlApplicationEngine
|
|
from lib.ConfigLoader import ConfigLoader
|
|
|
|
|
|
# [pyqcrm]
|
|
# program-name=""
|
|
# version=
|
|
|
|
# [database]
|
|
# server=""
|
|
# port=
|
|
# user=""
|
|
# password=""
|
|
# name=""
|
|
# type=""
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
app = QGuiApplication(sys.argv)
|
|
engine = QQmlApplicationEngine()
|
|
bad_config = False
|
|
|
|
|
|
|
|
qml_file = Path(__file__).resolve().parent / "gui/main.qml"
|
|
|
|
config = ConfigLoader()
|
|
|
|
|
|
if not config.getConfig():
|
|
bad_config = True
|
|
|
|
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)
|
|
sys.exit(app.exec())
|