mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-04 11:14:21 +08:00
Cura about dialog when shaked gives extra info
CURA-10770
This commit is contained in:
parent
56b8205ce0
commit
0c7d0540b9
1
.gitignore
vendored
1
.gitignore
vendored
@ -101,3 +101,4 @@ graph_info.json
|
|||||||
Ultimaker-Cura.spec
|
Ultimaker-Cura.spec
|
||||||
.run/
|
.run/
|
||||||
/printer-linter/src/printerlinter.egg-info/
|
/printer-linter/src/printerlinter.egg-info/
|
||||||
|
/resources/qml/Dialogs/AboutDialogVersionsList.qml
|
||||||
|
61
AboutDialogVersionsList.qml.jinja
Normal file
61
AboutDialogVersionsList.qml.jinja
Normal file
@ -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 : "<H1>Conan Installs</H1>", 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 : "<H1>Python Installs</H1>", version : '' });
|
||||||
|
for (var n in python_installs)
|
||||||
|
{
|
||||||
|
developerInfo.append({ name : python_installs[n][0], version : python_installs[n][1] });
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
24
conanfile.py
24
conanfile.py
@ -138,6 +138,29 @@ class CuraConan(ConanFile):
|
|||||||
return "'x86_64'"
|
return "'x86_64'"
|
||||||
return "None"
|
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):
|
def _generate_cura_version(self, location):
|
||||||
with open(os.path.join(self.recipe_folder, "CuraVersion.py.jinja"), "r") as f:
|
with open(os.path.join(self.recipe_folder, "CuraVersion.py.jinja"), "r") as f:
|
||||||
cura_version_py = Template(f.read())
|
cura_version_py = Template(f.read())
|
||||||
@ -307,6 +330,7 @@ class CuraConan(ConanFile):
|
|||||||
vr.generate()
|
vr.generate()
|
||||||
|
|
||||||
self._generate_cura_version(os.path.join(self.source_folder, "cura"))
|
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:
|
if self.options.devtools:
|
||||||
entitlements_file = "'{}'".format(os.path.join(self.source_folder, "packaging", "MacOS", "cura.entitlements"))
|
entitlements_file = "'{}'".format(os.path.join(self.source_folder, "packaging", "MacOS", "cura.entitlements"))
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
// Copyright (c) 2022 UltiMaker
|
// Copyright (c) 2022 UltiMaker
|
||||||
// Cura is released under the terms of the LGPLv3 or higher.
|
// 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 QtQuick.Controls 2.9
|
||||||
|
|
||||||
import UM 1.5 as UM
|
import UM 1.6 as UM
|
||||||
import Cura 1.5 as Cura
|
import Cura 1.5 as Cura
|
||||||
|
|
||||||
UM.Dialog
|
UM.Dialog
|
||||||
@ -21,6 +21,22 @@ UM.Dialog
|
|||||||
|
|
||||||
backgroundColor: UM.Theme.getColor("main_background")
|
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
|
Rectangle
|
||||||
{
|
{
|
||||||
id: header
|
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
|
rightButtons: Cura.TertiaryButton
|
||||||
{
|
{
|
||||||
//: Close about dialog button
|
//: Close about dialog button
|
||||||
|
Loading…
x
Reference in New Issue
Block a user