From 64d4fa3305a83e7858268007dbacf73d71a13845dc843ee84f23ba1d71d84ac6 Mon Sep 17 00:00:00 2001 From: linuxero Date: Mon, 4 Nov 2024 15:51:51 +0100 Subject: [PATCH] Styling test --- ...ILL0_wght400_GRAD0_opsz24.png => menu.png} | Bin gui/TopBar.qml | 62 +++++++++++++++++- lib/ConfigLoader.py | 4 -- lib/Vermasseln.py | 2 +- main.py | 7 -- pyqcrm.pyproject | 3 +- pyqcrm.qrc | 5 ++ qtquickcontrols2.conf | 2 + rc_pyqcrm.py | 36 ++++++++++ 9 files changed, 105 insertions(+), 16 deletions(-) rename doc/icons/{menu_24dp_000000_FILL0_wght400_GRAD0_opsz24.png => menu.png} (100%) create mode 100644 pyqcrm.qrc create mode 100644 qtquickcontrols2.conf create mode 100644 rc_pyqcrm.py diff --git a/doc/icons/menu_24dp_000000_FILL0_wght400_GRAD0_opsz24.png b/doc/icons/menu.png similarity index 100% rename from doc/icons/menu_24dp_000000_FILL0_wght400_GRAD0_opsz24.png rename to doc/icons/menu.png diff --git a/gui/TopBar.qml b/gui/TopBar.qml index 5b33f8b..3be3cbd 100644 --- a/gui/TopBar.qml +++ b/gui/TopBar.qml @@ -2,7 +2,6 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts - // Item // { // id: topBar @@ -14,11 +13,13 @@ import QtQuick.Layouts // } // height: 30 + RowLayout { id: topBar + height: 35 - width: parent.width / 8 + width: parent.width @@ -26,11 +27,19 @@ import QtQuick.Layouts { top: parent.top left: parent.left - } + } Button { id: dashBoard + // implicitWidth: 65 + // implicitHeight: 25 + // background: Rectangle + // { + // border.color: "#f6f6f6" + // border.width: 1 + // radius: 4 + // } Text { text: "Dashboard" @@ -40,6 +49,14 @@ import QtQuick.Layouts Button { id: kunden + // implicitWidth: 65 + // implicitHeight: 25 + // background: Rectangle + // { + // border.color: "#f6f6f6" + // border.width: 1 + // radius: 4 + // } Text { text: "Kunden" @@ -49,6 +66,14 @@ import QtQuick.Layouts Button { id: objekt + // implicitWidth: 65 + // implicitHeight: 25 + // background: Rectangle + // { + // border.color: "#f6f6f6" + // border.width: 1 + // radius: 4 + // } Text { text: "Objekt" @@ -58,6 +83,14 @@ import QtQuick.Layouts Button { id: mitarbeiter + // implicitWidth: 65 + // implicitHeight: 25 + // background: Rectangle + // { + // border.color: "#f6f6f6" + // border.width: 1 + // radius: 4 + // } Text { text: "Mitarbeiter" @@ -67,15 +100,38 @@ import QtQuick.Layouts Button { id: abrechnung + // implicitWidth: 79 + // implicitHeight: 25 + // //color: button.down ? "#d6d6d6" : "#f6f6f6" + // background: Rectangle + // { + // border.color: "#f6f6f6" + // border.width: 1 + // radius: 4 + // } Text { text: "Abrechnung" anchors.centerIn: parent } } + + Item + { + id: hspacer + Layout.fillWidth: true + } + + Image + { + id: atajos + source: "../doc/icons/menu.png" + sourceSize.height: 35 + } } + diff --git a/lib/ConfigLoader.py b/lib/ConfigLoader.py index ca682bd..b7548c6 100644 --- a/lib/ConfigLoader.py +++ b/lib/ConfigLoader.py @@ -21,8 +21,6 @@ class ConfigLoader(QObject): @Slot(dict) def setConfig(self, app_config): - - try: with open (self.config_dir + '/pyqcrm.toml', 'w') as f: config = Vermasseln().oscarVermasseln(toml.dumps(app_config)) @@ -32,12 +30,10 @@ class ConfigLoader(QObject): def __configLoad(self): - try: with open (self.config_dir + '/pyqcrm.toml', 'r') as f: config = f.read() self.__config = toml.loads(Vermasseln().entschluesseln(config)) - print(self.__config) except FileNotFoundError: print("Konnte die Konfiguration nicht laden.") diff --git a/lib/Vermasseln.py b/lib/Vermasseln.py index 5628c7d..c261f67 100644 --- a/lib/Vermasseln.py +++ b/lib/Vermasseln.py @@ -23,6 +23,7 @@ class Vermasseln: cipher = self.__vermasslungsKobold() decrypted_data = cipher.decrypt_and_verify(encoded_data[0], encoded_data[1]) decrypted_data = decrypted_data.decode("utf-8") + return decrypted_data def __vermasslungsKobold(self): @@ -34,7 +35,6 @@ class Vermasseln: cipher = AES.new(hashed, AES.MODE_SIV, nonce = nonce) return cipher -print(Vermasseln().oscarVermasseln("irgendeinenText")) diff --git a/main.py b/main.py index a748a2f..96982fb 100644 --- a/main.py +++ b/main.py @@ -34,14 +34,7 @@ if __name__ == "__main__": if not config.getConfig(): - bad_config = True - # 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) diff --git a/pyqcrm.pyproject b/pyqcrm.pyproject index 9068891..1821b67 100644 --- a/pyqcrm.pyproject +++ b/pyqcrm.pyproject @@ -8,6 +8,7 @@ "gui/Start.qml", "js/qmldict.js", "lib/Vermasseln.py", - "gui/TopBar.qml" + "gui/TopBar.qml", + "pyqcrm.qrc" ] } diff --git a/pyqcrm.qrc b/pyqcrm.qrc new file mode 100644 index 0000000..5d49050 --- /dev/null +++ b/pyqcrm.qrc @@ -0,0 +1,5 @@ + + + qtquickcontrols2.conf + + diff --git a/qtquickcontrols2.conf b/qtquickcontrols2.conf new file mode 100644 index 0000000..6ee40e2 --- /dev/null +++ b/qtquickcontrols2.conf @@ -0,0 +1,2 @@ +[Controls] +Style=Material diff --git a/rc_pyqcrm.py b/rc_pyqcrm.py new file mode 100644 index 0000000..0151128 --- /dev/null +++ b/rc_pyqcrm.py @@ -0,0 +1,36 @@ +# Resource object code (Python 3) +# Created by: object code +# Created by: The Resource Compiler for Qt version 6.8.0 +# WARNING! All changes made in this file will be lost! + +from PySide6 import QtCore + +qt_resource_data = b"\ +\x00\x00\x00\x1a\ +[\ +Controls]\x0aStyle=\ +Material\x0a\ +" + +qt_resource_name = b"\ +\x00\x15\ +\x08\x1e\x16f\ +\x00q\ +\x00t\x00q\x00u\x00i\x00c\x00k\x00c\x00o\x00n\x00t\x00r\x00o\x00l\x00s\x002\x00.\ +\x00c\x00o\x00n\x00f\ +" + +qt_resource_struct = b"\ +\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\ +\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ +\x00\x00\x01\x92\xf7\xa7y\xc2\ +" + +def qInitResources(): + QtCore.qRegisterResourceData(0x03, qt_resource_struct, qt_resource_name, qt_resource_data) + +def qCleanupResources(): + QtCore.qUnregisterResourceData(0x03, qt_resource_struct, qt_resource_name, qt_resource_data) + +qInitResources()