diff --git a/.gitignore b/.gitignore index 45cf4400f6..048bb915c7 100644 --- a/.gitignore +++ b/.gitignore @@ -101,3 +101,4 @@ graph_info.json Ultimaker-Cura.spec .run/ /printer-linter/src/printerlinter.egg-info/ +/resources/qml/Dialogs/AboutDialogVersionsList.qml diff --git a/AboutDialogVersionsList.qml.jinja b/AboutDialogVersionsList.qml.jinja new file mode 100644 index 0000000000..0503469660 --- /dev/null +++ b/AboutDialogVersionsList.qml.jinja @@ -0,0 +1,61 @@ +import QtQuick 2.2 +import QtQuick.Controls 2.9 + +import UM 1.6 as UM +import Cura 1.5 as Cura + + +ListView +{ + id: projectBuildInfoList + visible: false + anchors.top: creditsNotes.bottom + anchors.topMargin: UM.Theme.getSize("default_margin").height + width: parent.width + height: base.height - y - (2 * UM.Theme.getSize("default_margin").height + closeButton.height) + + ScrollBar.vertical: UM.ScrollBar + { + id: projectBuildInfoListScrollBar + } + + delegate: Row + { + spacing: UM.Theme.getSize("narrow_margin").width + UM.Label + { + text: (model.name) + width: (projectBuildInfoList.width* 0.4) | 0 + elide: Text.ElideRight + } + UM.Label + { + text: (model.version) + width: (projectBuildInfoList.width *0.6) | 0 + elide: Text.ElideRight + } + + } + model: ListModel + { + id: developerInfo + } + Component.onCompleted: + { + var conan_installs = {{ conan_installs }}; + var python_installs = {{ python_installs }}; + developerInfo.append({ name : "

Conan Installs

", version : '' }); + for (var n in conan_installs) + { + developerInfo.append({ name : conan_installs[n][0], version : conan_installs[n][1] }); + } + developerInfo.append({ name : '', version : '' }); + developerInfo.append({ name : "

Python Installs

", version : '' }); + for (var n in python_installs) + { + developerInfo.append({ name : python_installs[n][0], version : python_installs[n][1] }); + } + + } +} + diff --git a/conanfile.py b/conanfile.py index 46e143cc10..d75b2bc6bf 100644 --- a/conanfile.py +++ b/conanfile.py @@ -138,6 +138,29 @@ class CuraConan(ConanFile): return "'x86_64'" return "None" + def _generate_about_versions(self, location): + with open(os.path.join(self.recipe_folder, "AboutDialogVersionsList.qml.jinja"), "r") as f: + cura_version_py = Template(f.read()) + + conan_installs = [] + python_installs = [] + + # list of conan installs + for _, dependency in self.dependencies.host.items(): + conan_installs.append([dependency.ref.name,dependency.ref.version]) + + #list of python installs + import pkg_resources + for package in pkg_resources.working_set: + python_installs.append([package.key, package.version]) + + with open(os.path.join(location, "AboutDialogVersionsList.qml"), "w") as f: + f.write(cura_version_py.render( + conan_installs = conan_installs, + python_installs = python_installs + )) + + def _generate_cura_version(self, location): with open(os.path.join(self.recipe_folder, "CuraVersion.py.jinja"), "r") as f: cura_version_py = Template(f.read()) @@ -307,6 +330,7 @@ class CuraConan(ConanFile): vr.generate() self._generate_cura_version(os.path.join(self.source_folder, "cura")) + self._generate_about_versions(os.path.join(self.source_folder, "resources/qml/Dialogs")) if self.options.devtools: entitlements_file = "'{}'".format(os.path.join(self.source_folder, "packaging", "MacOS", "cura.entitlements")) diff --git a/resources/qml/Dialogs/AboutDialog.qml b/resources/qml/Dialogs/AboutDialog.qml index 4ccf58d0b4..361e19a45d 100644 --- a/resources/qml/Dialogs/AboutDialog.qml +++ b/resources/qml/Dialogs/AboutDialog.qml @@ -1,10 +1,10 @@ // Copyright (c) 2022 UltiMaker // Cura is released under the terms of the LGPLv3 or higher. -import QtQuick 2.2 +import QtQuick 2.4 import QtQuick.Controls 2.9 -import UM 1.5 as UM +import UM 1.6 as UM import Cura 1.5 as Cura UM.Dialog @@ -21,6 +21,22 @@ UM.Dialog backgroundColor: UM.Theme.getColor("main_background") + property real dialogX: base.x + property real dialogY: base.y + property int shakeDetected: (shakeDetector.shakeIsdetected) + property UM.ShakeDetector shakeDetector: UM.ShakeDetector{ } + + readonly property Timer timer : Timer + { + interval: 100 // Update interval in milliseconds (adjust as needed) + running: onDialogXChanged || onDialogYChanged + repeat: true + onTriggered: + { + shakeDetector.checkForShake(dialogX, dialogY) + } + } + Rectangle { id: header @@ -181,6 +197,31 @@ UM.Dialog } } + AboutDialogVersionsList{ + id: projectBuildInfoList + + } + + onShakeDetectedChanged: + { + if (!projectBuildInfoList.visible) + { + projectsList.visible= false; + projectBuildInfoList.visible = true; + } + else + { + projectsList.visible = true; + projectBuildInfoList.visible = false; + } + } + + onVisibleChanged: + { + projectsList.visible = true; + projectBuildInfoList.visible = false; + } + rightButtons: Cura.TertiaryButton { //: Close about dialog button