From 28c6e35dd676ae831dc6de4a9f113c6d6c0a9970f60c2a32d1bc2b399af47168 Mon Sep 17 00:00:00 2001 From: linuxero Date: Fri, 15 Nov 2024 14:57:52 +0100 Subject: [PATCH] Resources for QML assets --- gui/TopBar.qml => assets/TopBar.qml_ | 0 assets/qml.qrc | 6 ++++++ {gui => assets}/qmldir | 2 +- rc_qml.py => assets/rc_qml.py | 10 +++++----- gui/CustomerTables.qml | 25 +++++++++++++------------ gui/Dashboard.qml | 1 + gui/main.qml | 1 + main.py | 8 ++++---- pyqcrm.pyproject | 6 +++--- qml.qrc | 7 ------- 10 files changed, 34 insertions(+), 32 deletions(-) rename gui/TopBar.qml => assets/TopBar.qml_ (100%) create mode 100644 assets/qml.qrc rename {gui => assets}/qmldir (59%) rename rc_qml.py => assets/rc_qml.py (96%) delete mode 100644 qml.qrc diff --git a/gui/TopBar.qml b/assets/TopBar.qml_ similarity index 100% rename from gui/TopBar.qml rename to assets/TopBar.qml_ diff --git a/assets/qml.qrc b/assets/qml.qrc new file mode 100644 index 0000000..3066ba0 --- /dev/null +++ b/assets/qml.qrc @@ -0,0 +1,6 @@ + + + qmldir + TopBar.qml + + diff --git a/gui/qmldir b/assets/qmldir similarity index 59% rename from gui/qmldir rename to assets/qmldir index 3822178..ce353cb 100644 --- a/gui/qmldir +++ b/assets/qmldir @@ -1,2 +1,2 @@ -module TopBar +module PyqMenu TopBar 1.0 TopBar.qml diff --git a/rc_qml.py b/assets/rc_qml.py similarity index 96% rename from rc_qml.py rename to assets/rc_qml.py index 47adc72..79f4190 100644 --- a/rc_qml.py +++ b/assets/rc_qml.py @@ -36,11 +36,11 @@ R\xc2\x99\x15\xe6\xba7\xf5\xb1\x85]\xd9d4\xe6\x0c\ 6\x9e\x93%!~\x0d`\x01_\xdb(\x5c\xa0\xa7\x82\ \x03\xf0\xd6\xb8\x0d\x97\xd8n\x056\x87\xb4\xaf%\xb4\x0d\ \x83\xfb\x1b\xe6\x8aD\x22w*\ -\x00\x00\x00$\ +\x00\x00\x00%\ m\ -odule TopBar\x0aTop\ -Bar 1.0 TopBar.q\ -ml\x0a\ +odule PyqMenu\x0aTo\ +pBar 1.0 TopBar.\ +qml\x0a\ " qt_resource_name = b"\ @@ -64,7 +64,7 @@ qt_resource_struct = b"\ \x00\x00\x00\x00\x00\x02\x00\x00\x00\x02\x00\x00\x00\x02\ \x00\x00\x00\x00\x00\x00\x00\x00\ \x00\x00\x00&\x00\x00\x00\x00\x00\x01\x00\x00\x01\xbe\ -\x00\x00\x01\x93'\x9ft\xf1\ +\x00\x00\x01\x93+\x0f\xdbn\ \x00\x00\x00\x0c\x00\x04\x00\x00\x00\x01\x00\x00\x00\x00\ \x00\x00\x01\x93'4I\xe1\ " diff --git a/gui/CustomerTables.qml b/gui/CustomerTables.qml index 9d2dcf6..f534430 100644 --- a/gui/CustomerTables.qml +++ b/gui/CustomerTables.qml @@ -22,6 +22,7 @@ Item { //icon.source: "../images/addbusiness.svg" icon.source: "qrc:/images/addbusiness.svg" icon.color: "olive" + //width: icon.width anchors.right: parent.right flat: true onClicked: appLoader.source = "AddCustomer.qml" @@ -132,18 +133,18 @@ Item { // return newWidth // } - Timer - { - running: true - interval: 3000 - repeat: true - onTriggered: - { - //testTable.columnWidths[2] = 150 - console.log("Timing..") - testTable.forceLayout(); - } - } + // Timer + // { + // running: true + // interval: 3000 + // repeat: true + // onTriggered: + // { + // //testTable.columnWidths[2] = 150 + // console.log("Timing..") + // testTable.forceLayout(); + // } + // } diff --git a/gui/Dashboard.qml b/gui/Dashboard.qml index f633c1e..20c8b14 100644 --- a/gui/Dashboard.qml +++ b/gui/Dashboard.qml @@ -1,6 +1,7 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts +import "qrc:/gui" ColumnLayout { diff --git a/gui/main.qml b/gui/main.qml index d9765c7..3eb7b9b 100644 --- a/gui/main.qml +++ b/gui/main.qml @@ -1,6 +1,7 @@ import QtQuick import QtQuick.Layouts import QtQuick.Controls +import "qrc:/gui" ApplicationWindow { diff --git a/main.py b/main.py index ac63f9d..3c2e9e6 100644 --- a/main.py +++ b/main.py @@ -7,7 +7,7 @@ from PySide6.QtCore import QResource from lib.ConfigLoader import ConfigLoader from lib.DataBase import DataBase import rc_pyqcrm -import rc_qml +import assets.rc_qml import sqlite3 # [pyqcrm] @@ -37,10 +37,10 @@ def testConnection(): if __name__ == "__main__": - # QResource.registerResource("qml.qrc") + #QResource.registerResource("rc_qml.py") app = QGuiApplication(sys.argv) engine = QQmlApplicationEngine() - engine.addImportPath("qrc:/gui"); + engine.addImportPath("qrc:/gui") bad_config = False @@ -48,7 +48,7 @@ if __name__ == "__main__": qml_file = Path(__file__).resolve().parent / "gui/main.qml" - # qml_file = ":/gui/TopBar.qml" + #qml_file = ":/gui/main.qml" config = ConfigLoader() diff --git a/pyqcrm.pyproject b/pyqcrm.pyproject index 8974769..f6cd150 100644 --- a/pyqcrm.pyproject +++ b/pyqcrm.pyproject @@ -15,8 +15,8 @@ "gui/EmployeTables.qml", "gui/AddCustomer.qml", "pyqcrm.qrc", - "qml.qrc", - "gui/qmldir", - "gui/TopBar.qml" + "assets/qml.qrc", + "assets/qmldir", + "assets/TopBar.qml" ] } diff --git a/qml.qrc b/qml.qrc deleted file mode 100644 index db0fb5a..0000000 --- a/qml.qrc +++ /dev/null @@ -1,7 +0,0 @@ - - - gui/qmldir - gui/TopBar.qml - - -