From b622738ae3c18b38d60fc60fa5299b0d642a26ec Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Fri, 22 Apr 2022 22:33:14 +0200 Subject: [PATCH 01/10] Fix missing icons since move to PyQt6 --- plugins/CuraDrive/src/qml/pages/WelcomePage.qml | 2 +- .../DigitalLibrary/resources/qml/LoadMoreProjectsCard.qml | 8 ++++---- .../DigitalLibrary/resources/qml/SelectProjectPage.qml | 2 +- plugins/ModelChecker/ModelChecker.qml | 2 +- plugins/PostProcessingPlugin/PostProcessingPlugin.qml | 2 +- .../resources/qml/MonitorIconExtruder.qml | 2 +- .../resources/qml/MonitorPrintJobPreview.qml | 2 +- .../resources/qml/MonitorPrinterCard.qml | 2 +- resources/qml/Settings/SettingView.qml | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/plugins/CuraDrive/src/qml/pages/WelcomePage.qml b/plugins/CuraDrive/src/qml/pages/WelcomePage.qml index 01fbca2229..3e050b0482 100644 --- a/plugins/CuraDrive/src/qml/pages/WelcomePage.qml +++ b/plugins/CuraDrive/src/qml/pages/WelcomePage.qml @@ -23,7 +23,7 @@ Column { id: profileImage fillMode: Image.PreserveAspectFit - source: "../images/backup.svg" + source: Qt.resolvedUrl("../images/backup.svg") anchors.horizontalCenter: parent.horizontalCenter width: Math.round(parent.width / 4) } diff --git a/plugins/DigitalLibrary/resources/qml/LoadMoreProjectsCard.qml b/plugins/DigitalLibrary/resources/qml/LoadMoreProjectsCard.qml index 6a0706bd00..abc978be4a 100644 --- a/plugins/DigitalLibrary/resources/qml/LoadMoreProjectsCard.qml +++ b/plugins/DigitalLibrary/resources/qml/LoadMoreProjectsCard.qml @@ -37,7 +37,7 @@ Cura.RoundedRectangle width: UM.Theme.getSize("section").height height: width color: UM.Theme.getColor("text_link") - source: "../images/arrow_down.svg" + source: Qt.resolvedUrl("../images/arrow_down.svg") } Label @@ -65,7 +65,7 @@ Cura.RoundedRectangle { target: projectImage color: UM.Theme.getColor("text_link") - source: "../images/arrow_down.svg" + source: Qt.resolvedUrl("../images/arrow_down.svg") } PropertyChanges { @@ -88,7 +88,7 @@ Cura.RoundedRectangle { target: projectImage color: UM.Theme.getColor("text_link") - source: "../images/arrow_down.svg" + source: Qt.resolvedUrl("../images/arrow_down.svg") } PropertyChanges { @@ -111,7 +111,7 @@ Cura.RoundedRectangle { target: projectImage color: UM.Theme.getColor("action_button_disabled_text") - source: "../images/update.svg" + source: Qt.resolvedUrl("../images/update.svg") } PropertyChanges { diff --git a/plugins/DigitalLibrary/resources/qml/SelectProjectPage.qml b/plugins/DigitalLibrary/resources/qml/SelectProjectPage.qml index 60beb66e11..5a98fcb975 100644 --- a/plugins/DigitalLibrary/resources/qml/SelectProjectPage.qml +++ b/plugins/DigitalLibrary/resources/qml/SelectProjectPage.qml @@ -99,7 +99,7 @@ Item { id: digitalFactoryImage anchors.horizontalCenter: parent.horizontalCenter - source: searchBar.text === "" ? "../images/digital_factory.svg" : "../images/projects_not_found.svg" + source: Qt.resolvedUrl(searchBar.text === "" ? "../images/digital_factory.svg" : "../images/projects_not_found.svg") fillMode: Image.PreserveAspectFit width: parent.width - 2 * UM.Theme.getSize("thick_margin").width } diff --git a/plugins/ModelChecker/ModelChecker.qml b/plugins/ModelChecker/ModelChecker.qml index 85ee774a8b..f734aff2b1 100644 --- a/plugins/ModelChecker/ModelChecker.qml +++ b/plugins/ModelChecker/ModelChecker.qml @@ -14,7 +14,7 @@ UM.SimpleButton width: UM.Theme.getSize("save_button_specs_icons").width height: UM.Theme.getSize("save_button_specs_icons").height - iconSource: "model_checker.svg" + iconSource: Qt.resolvedUrl("model_checker.svg") anchors.verticalCenter: parent ? parent.verticalCenter : undefined color: UM.Theme.getColor("text_scene") hoverColor: UM.Theme.getColor("text_scene_hover") diff --git a/plugins/PostProcessingPlugin/PostProcessingPlugin.qml b/plugins/PostProcessingPlugin/PostProcessingPlugin.qml index d4cba61496..90d47f12ae 100644 --- a/plugins/PostProcessingPlugin/PostProcessingPlugin.qml +++ b/plugins/PostProcessingPlugin/PostProcessingPlugin.qml @@ -475,7 +475,7 @@ UM.Dialog } toolTipContentAlignment: UM.Enums.ContentAlignment.AlignLeft onClicked: dialog.show() -// iconSource: "Script.svg" +// iconSource: Qt.resolvedUrl("Script.svg") fixedWidthMode: false } diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorIconExtruder.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorIconExtruder.qml index 4b1a7df607..0467e2b753 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorIconExtruder.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorIconExtruder.qml @@ -22,7 +22,7 @@ Item property int size: 32 * screenScaleFactor // TODO: Theme! // THe extruder icon source; NOTE: This shouldn't need to be changed - property string iconSource: "../svg/icons/Extruder.svg" + property string iconSource: Qt.resolvedUrl("../svg/icons/Extruder.svg") height: size width: size diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml index 4b4b7a2a3a..18d3a44ef1 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobPreview.qml @@ -45,7 +45,7 @@ Item anchors.centerIn: printJobPreview color: UM.Theme.getColor("monitor_placeholder_image") height: printJobPreview.height - source: "../svg/ultibot.svg" + source: Qt.resolvedUrl("../svg/ultibot.svg") /* Since print jobs ALWAYS have an image url, we have to check if that image URL errors or not in order to determine if we show the placeholder (ultibot) image instead. */ visible: printJob && previewImage.status == Image.Error diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml index 2bc20ae462..0069d017f6 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml @@ -252,7 +252,7 @@ Item bottom: parent.bottom bottomMargin: 20 * screenScaleFactor // TODO: Theme! } - iconSource: "../svg/icons/CameraPhoto.svg" + iconSource: Qt.resolvedUrl("../svg/icons/CameraPhoto.svg") enabled: !cloudConnection visible: printer } diff --git a/resources/qml/Settings/SettingView.qml b/resources/qml/Settings/SettingView.qml index cf24997b12..cefa8b61d6 100644 --- a/resources/qml/Settings/SettingView.qml +++ b/resources/qml/Settings/SettingView.qml @@ -61,7 +61,7 @@ Item left: parent.left leftMargin: UM.Theme.getSize("default_margin").width } - source: UM.Theme.getIcon("search") + source: UM.Theme.getIcon("Magnifier") height: UM.Theme.getSize("small_button_icon").height width: height color: UM.Theme.getColor("text") From 2af1d0a5140e1787b9c41de7a222385b3bded3f4 Mon Sep 17 00:00:00 2001 From: Aldo Hoeben Date: Sat, 23 Apr 2022 10:16:14 +0200 Subject: [PATCH 02/10] Reenable script(s) active indicator icon --- plugins/PostProcessingPlugin/PostProcessingPlugin.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/PostProcessingPlugin/PostProcessingPlugin.qml b/plugins/PostProcessingPlugin/PostProcessingPlugin.qml index 90d47f12ae..af9e67b46a 100644 --- a/plugins/PostProcessingPlugin/PostProcessingPlugin.qml +++ b/plugins/PostProcessingPlugin/PostProcessingPlugin.qml @@ -475,7 +475,7 @@ UM.Dialog } toolTipContentAlignment: UM.Enums.ContentAlignment.AlignLeft onClicked: dialog.show() -// iconSource: Qt.resolvedUrl("Script.svg") + iconSource: Qt.resolvedUrl("Script.svg") fixedWidthMode: false } From 698adc45db3b9b20b5dcb1c8fa0dc6bea7f43c11 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 25 Apr 2022 13:45:05 +0200 Subject: [PATCH 03/10] Fix crash if 3mf writer could not be imported Fixes CURA-3NM (Sentry) --- plugins/3MFWriter/__init__.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/3MFWriter/__init__.py b/plugins/3MFWriter/__init__.py index eff1648489..eb8a596afe 100644 --- a/plugins/3MFWriter/__init__.py +++ b/plugins/3MFWriter/__init__.py @@ -5,21 +5,23 @@ import sys from UM.Logger import Logger try: from . import ThreeMFWriter + threemf_writer_was_imported = True except ImportError: Logger.log("w", "Could not import ThreeMFWriter; libSavitar may be missing") -from . import ThreeMFWorkspaceWriter + threemf_writer_was_imported = False +from . import ThreeMFWorkspaceWriter from UM.i18n import i18nCatalog -from UM.Platform import Platform i18n_catalog = i18nCatalog("cura") + def getMetaData(): workspace_extension = "3mf" metaData = {} - if "3MFWriter.ThreeMFWriter" in sys.modules: + if threemf_writer_was_imported: metaData["mesh_writer"] = { "output": [{ "extension": "3mf", @@ -39,6 +41,7 @@ def getMetaData(): return metaData + def register(app): if "3MFWriter.ThreeMFWriter" in sys.modules: return {"mesh_writer": ThreeMFWriter.ThreeMFWriter(), From 0213a3833c83879ced7aedf1c629c906e955d449 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 26 Apr 2022 10:50:29 +0200 Subject: [PATCH 04/10] Fix the tooltip not re-sizing I'm not entirely sure if this fixes it on windows, but it does at least fix things on Linux. There are a few important changes to note here: 1. Increased the time of the fade timer to 200ms 2. Removed the mousearea, instead using the hover of scrollview So why are these important? Nr 1 seems to be because updates seem to be faster? If I set it to 100 I could get it to work reasonably well on qt5, but in qt6, it's about 50% of the times that i'm too slow. So we need the extra time. As for the mouse area, it seems that the scrollview was eating up all the hover / containsMouse events. As scrollview has the same properties that we need, we can just get rid of the mouseArea CURA-9112 --- resources/qml/PrintSetupTooltip.qml | 47 ++++++++++++----------------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/resources/qml/PrintSetupTooltip.qml b/resources/qml/PrintSetupTooltip.qml index 5e5b1dce73..58fb86d764 100644 --- a/resources/qml/PrintSetupTooltip.qml +++ b/resources/qml/PrintSetupTooltip.qml @@ -11,7 +11,7 @@ UM.PointingRectangle id: base property real sourceWidth: 0 width: UM.Theme.getSize("tooltip").width - height: UM.Theme.getSize("tooltip").height + height: textScroll.height + UM.Theme.getSize("tooltip_margins").height * 2 color: UM.Theme.getColor("tooltip") arrowSize: UM.Theme.getSize("default_arrow").width @@ -20,7 +20,7 @@ UM.PointingRectangle Behavior on opacity { - NumberAnimation { duration: 100; } + NumberAnimation { duration: 200; } } property alias text: label.text @@ -59,16 +59,19 @@ UM.PointingRectangle base.opacity = 0; } - MouseArea + ScrollView { - enabled: parent.opacity > 0 - visible: enabled - anchors.fill: parent - acceptedButtons: Qt.NoButton - hoverEnabled: true + id: textScroll + width: parent.width + height: Math.min(label.height, base.parent.height) + + ScrollBar.horizontal.policy: ScrollBar.AlwaysOff + ScrollBar.vertical.policy: ScrollBar.AsNeeded + + hoverEnabled: parent.opacity > 0 onHoveredChanged: { - if(containsMouse && base.opacity > 0) + if(hovered && base.opacity > 0) { base.show(Qt.point(target.x - 1, target.y - UM.Theme.getSize("tooltip_arrow_margins").height / 2)); //Same arrow position as before. } @@ -78,26 +81,16 @@ UM.PointingRectangle } } - ScrollView + UM.Label { - id: textScroll - width: base.width - height: base.height + id: label + x: UM.Theme.getSize("tooltip_margins").width + y: UM.Theme.getSize("tooltip_margins").height + width: textScroll.width - 2 * UM.Theme.getSize("tooltip_margins").width - ScrollBar.horizontal.policy: ScrollBar.AlwaysOff - ScrollBar.vertical.policy: ScrollBar.AsNeeded - - UM.Label - { - id: label - x: UM.Theme.getSize("tooltip_margins").width - y: UM.Theme.getSize("tooltip_margins").height - width: base.width - UM.Theme.getSize("tooltip_margins").width * 2 - - wrapMode: Text.Wrap - textFormat: Text.RichText - color: UM.Theme.getColor("tooltip_text") - } + wrapMode: Text.Wrap + textFormat: Text.RichText + color: UM.Theme.getColor("tooltip_text") } } } From 3ecad03aee77261cfefb0bd69dc9a495361fe6dd Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 26 Apr 2022 13:21:36 +0200 Subject: [PATCH 05/10] Use screenscale factor for maximumFlickVelocity Not sure if it fixes it for all OSes, but the documentation says that this is a platform specific setting and it increases it by 1.25 for me. Since the velocity is in pixels/s, it makes sense to have it depend on the screenscale factor CURA-9182 --- resources/qml/Settings/SettingView.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Settings/SettingView.qml b/resources/qml/Settings/SettingView.qml index cf24997b12..cc8a04ad1e 100644 --- a/resources/qml/Settings/SettingView.qml +++ b/resources/qml/Settings/SettingView.qml @@ -178,7 +178,7 @@ Item ListView { id: contents - maximumFlickVelocity: 1000 + maximumFlickVelocity: 1000 * screenScaleFactor anchors { top: filterContainer.bottom From 049ab09119bb1f684d3d856085466528d1d79549 Mon Sep 17 00:00:00 2001 From: "j.delarago" Date: Tue, 26 Apr 2022 14:59:24 +0200 Subject: [PATCH 06/10] I've changed the dot radius so they are circles again. I've simplified the dot spacing logic a bit. For some reason the background does not line up perfectly with the slider. So when it is set to 0 there is still a slight offset on the slider handle. CURA-9203 --- .../Recommended/RecommendedInfillDensitySelector.qml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml index 863e8c3900..625629c810 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml @@ -101,7 +101,8 @@ Item { id: backgroundLine height: UM.Theme.getSize("print_setup_slider_groove").height - width: infillSlider.width - UM.Theme.getSize("print_setup_slider_handle").width + width: parent.width - UM.Theme.getSize("print_setup_slider_handle").width + implicitWidth: width anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter color: infillSlider.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable") @@ -120,8 +121,10 @@ Item anchors.verticalCenter: parent.verticalCenter // Do not use Math.round otherwise the tickmarks won't be aligned - x: ((handleButton.width / 2) - (backgroundLine.implicitWidth / 2) + (index * ((repeater.width - handleButton.width) / (repeater.count-1)))) - radius: Math.round(backgroundLine.implicitWidth / 2) + // (space between steps) * index of step + x: (backgroundLine.width / (repeater.count - 1)) * index + + radius: Math.round(implicitWidth / 2) visible: (index % 10) == 0 // Only show steps of 10% UM.Label From 15d1ded3658f3ed8bfee1134922e8a38833c259c Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 26 Apr 2022 15:11:19 +0200 Subject: [PATCH 07/10] Change selectedTextColor for textfield CURA-9199 --- resources/qml/Widgets/TextField.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/Widgets/TextField.qml b/resources/qml/Widgets/TextField.qml index 5e19f65149..95d5caa4ef 100644 --- a/resources/qml/Widgets/TextField.qml +++ b/resources/qml/Widgets/TextField.qml @@ -23,6 +23,7 @@ TextField selectByMouse: true font: UM.Theme.getFont("default") color: UM.Theme.getColor("text_field_text") + selectedTextColor: UM.Theme.getColor("text_field_text") renderType: Text.NativeRendering selectionColor: UM.Theme.getColor("text_selection") leftPadding: iconLeft.visible ? iconLeft.width + UM.Theme.getSize("default_margin").width * 2 : UM.Theme.getSize("thin_margin").width From 854921c00288836a822bc4cae0e891ceaebc8b2a Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Tue, 26 Apr 2022 16:52:23 +0200 Subject: [PATCH 08/10] Fix typo in property. Not sure why this didn't crash tbh. done while investigating CURA-9196 --- plugins/RemovableDriveOutputDevice/RemovableDrivePlugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/RemovableDriveOutputDevice/RemovableDrivePlugin.py b/plugins/RemovableDriveOutputDevice/RemovableDrivePlugin.py index 873076ea71..bb3f5e0019 100644 --- a/plugins/RemovableDriveOutputDevice/RemovableDrivePlugin.py +++ b/plugins/RemovableDriveOutputDevice/RemovableDrivePlugin.py @@ -21,7 +21,7 @@ class RemovableDrivePlugin(OutputDevicePlugin): super().__init__() self._update_thread = threading.Thread(target = self._updateThread) - self._update_thread.deamon = True + self._update_thread.daemon = True self._check_updates = True From a2d721b6ac914cd14b15f06d62e508610f94b14c Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Tue, 26 Apr 2022 16:54:46 +0200 Subject: [PATCH 09/10] Always return int's. The problem was probably 'max', but cast the others just to be sure. (This would cause the C++ part of Qt to think it wasbeing given a float from Pyton somehow.) should fix CURA-9196 --- cura/PrinterOutput/Models/PrintJobOutputModel.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cura/PrinterOutput/Models/PrintJobOutputModel.py b/cura/PrinterOutput/Models/PrintJobOutputModel.py index b6a12cb183..164dc5cb67 100644 --- a/cura/PrinterOutput/Models/PrintJobOutputModel.py +++ b/cura/PrinterOutput/Models/PrintJobOutputModel.py @@ -119,16 +119,16 @@ class PrintJobOutputModel(QObject): @pyqtProperty(int, notify = timeTotalChanged) def timeTotal(self) -> int: - return self._time_total + return int(self._time_total) @pyqtProperty(int, notify = timeElapsedChanged) def timeElapsed(self) -> int: - return self._time_elapsed + return int(self._time_elapsed) @pyqtProperty(int, notify = timeElapsedChanged) def timeRemaining(self) -> int: # Never get a negative time remaining - return max(self.timeTotal - self.timeElapsed, 0) + return int(max(self.timeTotal - self.timeElapsed, 0)) @pyqtProperty(float, notify = timeElapsedChanged) def progress(self) -> float: From 2ecec1fa379c17cc6b975d36ec88f4fc80b09659 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 28 Apr 2022 13:23:41 +0200 Subject: [PATCH 10/10] Prevent last line of popup to be cut off We didn't take the y offset into account CURA-9112 --- resources/qml/PrintSetupTooltip.qml | 2 +- resources/qml/Settings/SettingItem.qml | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/resources/qml/PrintSetupTooltip.qml b/resources/qml/PrintSetupTooltip.qml index 58fb86d764..20b9ac8981 100644 --- a/resources/qml/PrintSetupTooltip.qml +++ b/resources/qml/PrintSetupTooltip.qml @@ -63,7 +63,7 @@ UM.PointingRectangle { id: textScroll width: parent.width - height: Math.min(label.height, base.parent.height) + height: Math.min(label.height + UM.Theme.getSize("tooltip_margins").height, base.parent.height) ScrollBar.horizontal.policy: ScrollBar.AlwaysOff ScrollBar.vertical.policy: ScrollBar.AsNeeded diff --git a/resources/qml/Settings/SettingItem.qml b/resources/qml/Settings/SettingItem.qml index 6787855775..e975f1a2b9 100644 --- a/resources/qml/Settings/SettingItem.qml +++ b/resources/qml/Settings/SettingItem.qml @@ -62,13 +62,19 @@ Item var affected_by_list = "" for (var i in affected_by) { - affected_by_list += "
  • %1
  • \n".arg(affected_by[i].label) + if(affected_by[i].label != "") + { + affected_by_list += "
  • %1
  • \n".arg(affected_by[i].label) + } } var affects_list = "" for (var i in affects) { - affects_list += "
  • %1
  • \n".arg(affects[i].label) + if(affects[i].label != "") + { + affects_list += "
  • %1
  • \n".arg(affects[i].label) + } } var tooltip = "%1\n

    %2

    ".arg(definition.label).arg(definition.description)