Files
pyqcrm/main.py

47 lines
1013 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()
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 engine.rootObjects():
sys.exit(-1)
sys.exit(app.exec())