diff --git a/gui/Programmeinstellungen.qml b/gui/firststart.qml similarity index 99% rename from gui/Programmeinstellungen.qml rename to gui/firststart.qml index 2c67ced..6c752c4 100644 --- a/gui/Programmeinstellungen.qml +++ b/gui/firststart.qml @@ -19,12 +19,12 @@ import QtQuick.Controls.Material // } -ApplicationWindow +Item { width: 640 height: 480 visible: true - title: qsTr("PYQCRM - Einstellungen") + Material.theme: Material.Dark Material.accent: Material.BlueGrey diff --git a/gui/main.qml b/gui/main.qml index c7945d3..f3b9933 100644 --- a/gui/main.qml +++ b/gui/main.qml @@ -1,9 +1,25 @@ import QtQuick -import QtQuick.Window +import QtQuick.Controls +import QtQuick.Controls.Material -Window { + +ApplicationWindow +{ + id: window width: 640 height: 480 visible: true - title: qsTr("Hello World") + Material.theme: Material.Dark + Material.accent: Material.BlueGrey + title: bad_config? "Pyqcrm Einstellungen":"Pyqcrm" + Loader + { + id: mainWindow + + + source: bad_config? "firststart.qml":"start.qml" + } + + + } diff --git a/gui/start.qml b/gui/start.qml new file mode 100644 index 0000000..a312de7 --- /dev/null +++ b/gui/start.qml @@ -0,0 +1,13 @@ +import QtQuick + +Item +{ + + + anchors.fill: parent + + window.width: 1080 + parent.height: 1920 + + +} diff --git a/main.py b/main.py index 2976baa..d3cdfd4 100644 --- a/main.py +++ b/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) diff --git a/pyqcrm.pyproject b/pyqcrm.pyproject index 3b5a040..99d9a73 100644 --- a/pyqcrm.pyproject +++ b/pyqcrm.pyproject @@ -1,9 +1,10 @@ { "files": [ - "gui/Programmeinstellungen.qml", + "gui/firststart.qml", "lib/ConfigLoader.py", "lib/__init__.py", "main.py", - "gui/main.qml" + "gui/main.qml", + "gui/start.qml" ] } diff --git a/qtlogging.ini b/qtlogging.ini new file mode 100644 index 0000000..5a7f176 --- /dev/null +++ b/qtlogging.ini @@ -0,0 +1,2 @@ +[Rules] +*.debug=true \ No newline at end of file