From 9604674c8bf624ff287d95c4d95bfdead2d2abbd Mon Sep 17 00:00:00 2001 From: Saumya Jain Date: Thu, 14 Mar 2024 11:45:15 +0100 Subject: [PATCH 01/10] Added Cura.MachineSelector in place of combobox combobox seemed to be tampering with the mouse area of machineselector CURA-11700 --- plugins/3MFReader/WorkspaceDialog.qml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/3MFReader/WorkspaceDialog.qml b/plugins/3MFReader/WorkspaceDialog.qml index a8cdad92bd..e617764700 100644 --- a/plugins/3MFReader/WorkspaceDialog.qml +++ b/plugins/3MFReader/WorkspaceDialog.qml @@ -103,12 +103,17 @@ UM.Dialog comboboxTitle: catalog.i18nc("@action:label", "Open With") comboboxTooltipText: catalog.i18nc("@info:tooltip", "Printer settings will be updated to match the settings saved with the project.") comboboxVisible: workspaceDialog.visible && manager.updatableMachinesModel.count > 1 - combobox: Cura.MachineSelector + Cura.MachineSelector { id: machineSelector + visible: comboboxVisible headerCornerSide: Cura.RoundedRectangle.Direction.All - width: parent.width - height: parent.height + anchors.top: parent.top + anchors.topMargin: UM.Theme.getSize("default_margin").width * 3 + anchors.right: parent.right + anchors.rightMargin: UM.Theme.getSize("default_margin").width + width: UM.Theme.getSize("machine_selector_widget").width + height: UM.Theme.getSize("machine_selector_widget").height machineListModel: manager.updatableMachinesModel machineName: manager.machineName From b5940a54f4e9951433660570d1fdd903d5a36d6c Mon Sep 17 00:00:00 2001 From: Saumya Jain Date: Thu, 14 Mar 2024 16:17:24 +0100 Subject: [PATCH 02/10] fixing size of drop down CURA-11700 --- plugins/3MFReader/WorkspaceDialog.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/3MFReader/WorkspaceDialog.qml b/plugins/3MFReader/WorkspaceDialog.qml index e617764700..acc4ced404 100644 --- a/plugins/3MFReader/WorkspaceDialog.qml +++ b/plugins/3MFReader/WorkspaceDialog.qml @@ -112,8 +112,8 @@ UM.Dialog anchors.topMargin: UM.Theme.getSize("default_margin").width * 3 anchors.right: parent.right anchors.rightMargin: UM.Theme.getSize("default_margin").width - width: UM.Theme.getSize("machine_selector_widget").width - height: UM.Theme.getSize("machine_selector_widget").height + width: Math.round(parent.width / 2.5) + height: UM.Theme.getSize("button").height machineListModel: manager.updatableMachinesModel machineName: manager.machineName From 40bc08f482bd9529be1a8f00f41b9b3fbf5a8109 Mon Sep 17 00:00:00 2001 From: Saumya Jain Date: Thu, 14 Mar 2024 17:09:11 +0100 Subject: [PATCH 03/10] Apparantly the first time override is written it is not overriden by next upload. Now, it does CURA-11720 --- plugins/3MFReader/WorkspaceDialog.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/3MFReader/WorkspaceDialog.qml b/plugins/3MFReader/WorkspaceDialog.qml index a8cdad92bd..f0f74b60b7 100644 --- a/plugins/3MFReader/WorkspaceDialog.qml +++ b/plugins/3MFReader/WorkspaceDialog.qml @@ -171,6 +171,7 @@ UM.Dialog WorkspaceRow { + id: numberOfOverrides leftLabelText: catalog.i18nc("@action:label", "Settings Loaded from UCP file") rightLabelText: catalog.i18ncp("@action:label", "%1 override", "%1 overrides", manager.exportedSettingModel.rowCount()).arg(manager.exportedSettingModel.rowCount()) buttonText: tableViewSpecificSettings.shouldBeVisible ? catalog.i18nc("@action:button", "Hide settings") : catalog.i18nc("@action:button", "Show settings") @@ -204,6 +205,7 @@ UM.Dialog { tableModel.clear() tableModel.rows = modelRows + numberOfOverrides.rightLabelText = catalog.i18ncp("@action:label", "%1 override", "%1 overrides", manager.exportedSettingModel.rowCount()).arg(manager.exportedSettingModel.rowCount()) } } From a58cd69b394d4f81d94644b1d2cb2ecea9b6d97d Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Mon, 18 Mar 2024 11:54:23 +0100 Subject: [PATCH 04/10] use notify to update `exportedSettingModel` --- plugins/3MFReader/SpecificSettingsModel.py | 6 +++++- plugins/3MFReader/WorkspaceDialog.py | 4 +++- plugins/3MFReader/WorkspaceDialog.qml | 1 - 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/3MFReader/SpecificSettingsModel.py b/plugins/3MFReader/SpecificSettingsModel.py index ac8e7af3ef..ec4a68e337 100644 --- a/plugins/3MFReader/SpecificSettingsModel.py +++ b/plugins/3MFReader/SpecificSettingsModel.py @@ -1,7 +1,7 @@ # Copyright (c) 2024 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from PyQt6.QtCore import Qt +from PyQt6.QtCore import Qt, pyqtSignal from UM.Logger import Logger from UM.Settings.SettingDefinition import SettingDefinition @@ -22,6 +22,8 @@ class SpecificSettingsModel(ListModel): self._i18n_catalog = None self._update() + modelChanged = pyqtSignal() + def addSettingsFromStack(self, stack, category, settings): for setting, value in settings.items(): @@ -39,8 +41,10 @@ class SpecificSettingsModel(ListModel): "label": stack.getProperty(setting, "label"), "value": value }) + self.modelChanged.emit() def _update(self): Logger.debug(f"Updating {self.__class__.__name__}") self.setItems([]) + self.modelChanged.emit() return diff --git a/plugins/3MFReader/WorkspaceDialog.py b/plugins/3MFReader/WorkspaceDialog.py index 4b9f1eaa6f..13851c041d 100644 --- a/plugins/3MFReader/WorkspaceDialog.py +++ b/plugins/3MFReader/WorkspaceDialog.py @@ -77,6 +77,7 @@ class WorkspaceDialog(QObject): self._is_compatible_machine = False self._allow_create_machine = True self._exported_settings_model = SpecificSettingsModel() + self._exported_settings_model.modelChanged.connect(self.exportedSettingModelChanged.emit) self._current_machine_pos_index = 0 self._is_ucp = False @@ -104,6 +105,7 @@ class WorkspaceDialog(QObject): missingPackagesChanged = pyqtSignal() isCompatibleMachineChanged = pyqtSignal() isUcpChanged = pyqtSignal() + exportedSettingModelChanged = pyqtSignal() @pyqtProperty(bool, notify = isPrinterGroupChanged) def isPrinterGroup(self) -> bool: @@ -356,7 +358,7 @@ class WorkspaceDialog(QObject): def allowCreateMachine(self): return self._allow_create_machine - @pyqtProperty(QObject) + @pyqtProperty(QObject, notify=exportedSettingModelChanged) def exportedSettingModel(self): return self._exported_settings_model diff --git a/plugins/3MFReader/WorkspaceDialog.qml b/plugins/3MFReader/WorkspaceDialog.qml index f0f74b60b7..95dce875c1 100644 --- a/plugins/3MFReader/WorkspaceDialog.qml +++ b/plugins/3MFReader/WorkspaceDialog.qml @@ -205,7 +205,6 @@ UM.Dialog { tableModel.clear() tableModel.rows = modelRows - numberOfOverrides.rightLabelText = catalog.i18ncp("@action:label", "%1 override", "%1 overrides", manager.exportedSettingModel.rowCount()).arg(manager.exportedSettingModel.rowCount()) } } From 4dd0113a784687c0fd0ed5397acb9a4bf01d428c Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Mon, 18 Mar 2024 12:14:58 +0100 Subject: [PATCH 05/10] Add dedicate functions for `exportedSettingModelItems` and `exportedSettingModelRowCount` --- plugins/3MFReader/WorkspaceDialog.py | 7 +++++++ plugins/3MFReader/WorkspaceDialog.qml | 11 ++--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/3MFReader/WorkspaceDialog.py b/plugins/3MFReader/WorkspaceDialog.py index 13851c041d..c3e4187652 100644 --- a/plugins/3MFReader/WorkspaceDialog.py +++ b/plugins/3MFReader/WorkspaceDialog.py @@ -362,6 +362,13 @@ class WorkspaceDialog(QObject): def exportedSettingModel(self): return self._exported_settings_model + @pyqtProperty("QVariantList", notify=exportedSettingModelChanged) + def exportedSettingModelItems(self): + return self._exported_settings_model.items + + @pyqtProperty(int, notify=exportedSettingModelChanged) + def exportedSettingModelRowCount(self): + return self._exported_settings_model.rowCount() @pyqtSlot() def closeBackend(self) -> None: """Close the backend: otherwise one could end up with "Slicing...""" diff --git a/plugins/3MFReader/WorkspaceDialog.qml b/plugins/3MFReader/WorkspaceDialog.qml index 95dce875c1..950c72a3d6 100644 --- a/plugins/3MFReader/WorkspaceDialog.qml +++ b/plugins/3MFReader/WorkspaceDialog.qml @@ -173,7 +173,7 @@ UM.Dialog { id: numberOfOverrides leftLabelText: catalog.i18nc("@action:label", "Settings Loaded from UCP file") - rightLabelText: catalog.i18ncp("@action:label", "%1 override", "%1 overrides", manager.exportedSettingModel.rowCount()).arg(manager.exportedSettingModel.rowCount()) + rightLabelText: catalog.i18ncp("@action:label", "%1 override", "%1 overrides", manager.exportedSettingModelRowCount).arg(manager.exportedSettingModelRowCount) buttonText: tableViewSpecificSettings.shouldBeVisible ? catalog.i18nc("@action:button", "Hide settings") : catalog.i18nc("@action:button", "Show settings") onButtonClicked: tableViewSpecificSettings.shouldBeVisible = !tableViewSpecificSettings.shouldBeVisible } @@ -196,16 +196,9 @@ UM.Dialog { id: tableModel headers: ["category", "label", "value"] - rows: manager.exportedSettingModel.items + rows: manager.exportedSettingModelItems } } - - property var modelRows: manager.exportedSettingModel.items - onModelRowsChanged: - { - tableModel.clear() - tableModel.rows = modelRows - } } comboboxVisible: manager.qualityChangesConflict From 5eeee37f0ec2a2e3c0c716b96426fb9cc7b9c8d0 Mon Sep 17 00:00:00 2001 From: Saumya Jain Date: Mon, 18 Mar 2024 12:32:20 +0100 Subject: [PATCH 06/10] Update visibility condition in WorkspaceDialog CURA-11700 --- plugins/3MFReader/WorkspaceDialog.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/3MFReader/WorkspaceDialog.qml b/plugins/3MFReader/WorkspaceDialog.qml index 19ed31a149..ac72f92187 100644 --- a/plugins/3MFReader/WorkspaceDialog.qml +++ b/plugins/3MFReader/WorkspaceDialog.qml @@ -119,7 +119,7 @@ UM.Dialog Cura.MachineSelector { id: machineSelector - visible: comboboxVisible + visible: workspaceDialog.visible && manager.updatableMachinesModel.count > 1 headerCornerSide: Cura.RoundedRectangle.Direction.All anchors.top: parent.top anchors.topMargin: UM.Theme.getSize("default_margin").width * 3 From 4da17d643d91cb10b0185770c550dfc0f147e38f Mon Sep 17 00:00:00 2001 From: Saumya Jain Date: Mon, 18 Mar 2024 12:46:10 +0100 Subject: [PATCH 07/10] Update model data handling in 3MFReader plugin partially revert 4dd0113a784687c0fd0ed5397acb9a4bf01d428c CURA-11720 --- plugins/3MFReader/WorkspaceDialog.py | 4 ---- plugins/3MFReader/WorkspaceDialog.qml | 9 ++++++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/plugins/3MFReader/WorkspaceDialog.py b/plugins/3MFReader/WorkspaceDialog.py index c3e4187652..bc4581b749 100644 --- a/plugins/3MFReader/WorkspaceDialog.py +++ b/plugins/3MFReader/WorkspaceDialog.py @@ -362,10 +362,6 @@ class WorkspaceDialog(QObject): def exportedSettingModel(self): return self._exported_settings_model - @pyqtProperty("QVariantList", notify=exportedSettingModelChanged) - def exportedSettingModelItems(self): - return self._exported_settings_model.items - @pyqtProperty(int, notify=exportedSettingModelChanged) def exportedSettingModelRowCount(self): return self._exported_settings_model.rowCount() diff --git a/plugins/3MFReader/WorkspaceDialog.qml b/plugins/3MFReader/WorkspaceDialog.qml index d7e776411f..febd082a4c 100644 --- a/plugins/3MFReader/WorkspaceDialog.qml +++ b/plugins/3MFReader/WorkspaceDialog.qml @@ -209,9 +209,16 @@ UM.Dialog { id: tableModel headers: ["category", "label", "value"] - rows: manager.exportedSettingModelItems + rows: manager.exportedSettingModel.items } } + + property var modelRows: manager.exportedSettingModel.items + onModelRowsChanged: + { + tableModel.clear() + tableModel.rows = modelRows + } } comboboxVisible: manager.qualityChangesConflict From 37dc9e5dcb7b37c9959eb91af6945cfc644511f9 Mon Sep 17 00:00:00 2001 From: Saumya Jain Date: Mon, 18 Mar 2024 14:47:24 +0100 Subject: [PATCH 08/10] Update UI layering and MachineSelector properties in 3MFReader The z-index property of combobox and Loader elements in WorkspaceSection.qml was adjusted to ensure proper layering. CURA-11700 --- plugins/3MFReader/WorkspaceDialog.qml | 11 +++-------- plugins/3MFReader/WorkspaceSection.qml | 8 ++++++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/plugins/3MFReader/WorkspaceDialog.qml b/plugins/3MFReader/WorkspaceDialog.qml index ac72f92187..878b80db17 100644 --- a/plugins/3MFReader/WorkspaceDialog.qml +++ b/plugins/3MFReader/WorkspaceDialog.qml @@ -116,17 +116,12 @@ UM.Dialog comboboxTitle: catalog.i18nc("@action:label", "Open With") comboboxTooltipText: catalog.i18nc("@info:tooltip", "Printer settings will be updated to match the settings saved with the project.") comboboxVisible: workspaceDialog.visible && manager.updatableMachinesModel.count > 1 - Cura.MachineSelector + combobox: Cura.MachineSelector { id: machineSelector - visible: workspaceDialog.visible && manager.updatableMachinesModel.count > 1 headerCornerSide: Cura.RoundedRectangle.Direction.All - anchors.top: parent.top - anchors.topMargin: UM.Theme.getSize("default_margin").width * 3 - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_margin").width - width: Math.round(parent.width / 2.5) - height: UM.Theme.getSize("button").height + width: parent.width + height: parent.height machineListModel: manager.updatableMachinesModel machineName: manager.machineName diff --git a/plugins/3MFReader/WorkspaceSection.qml b/plugins/3MFReader/WorkspaceSection.qml index 7c8b01be7a..83c96fa94a 100644 --- a/plugins/3MFReader/WorkspaceSection.qml +++ b/plugins/3MFReader/WorkspaceSection.qml @@ -15,7 +15,11 @@ Item property Component content: Item { visible: false } property alias comboboxTitle: comboboxLabel.text - property Component combobox: Item { visible: false } + property Component combobox: Item + { + z: -1 + visible: false + } property string comboboxTooltipText: "" property bool comboboxVisible: false @@ -91,11 +95,11 @@ Item } } - Loader { width: parent.width height: content.height + z: -1 anchors.top: sectionTitleRow.bottom sourceComponent: content } From eac2d3b173e0819bddd8fd68e132932e9ad5617e Mon Sep 17 00:00:00 2001 From: Saumya Jain Date: Mon, 18 Mar 2024 14:51:55 +0100 Subject: [PATCH 09/10] removes the unnecessary 'z' attribute CURA-11700 --- plugins/3MFReader/WorkspaceSection.qml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/plugins/3MFReader/WorkspaceSection.qml b/plugins/3MFReader/WorkspaceSection.qml index 83c96fa94a..b72fed47ef 100644 --- a/plugins/3MFReader/WorkspaceSection.qml +++ b/plugins/3MFReader/WorkspaceSection.qml @@ -15,11 +15,7 @@ Item property Component content: Item { visible: false } property alias comboboxTitle: comboboxLabel.text - property Component combobox: Item - { - z: -1 - visible: false - } + property Component combobox: Item { visible: false } property string comboboxTooltipText: "" property bool comboboxVisible: false From d441130e3bbf3004434e4819ad16c553e298f1be Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Tue, 19 Mar 2024 10:43:11 +0100 Subject: [PATCH 10/10] Defensive programming: Fix current path can be None. should fix CURA-11741 (sentry cura '708') --- plugins/SimulationView/SimulationPass.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/SimulationView/SimulationPass.py b/plugins/SimulationView/SimulationPass.py index efe80162b5..f779224203 100644 --- a/plugins/SimulationView/SimulationPass.py +++ b/plugins/SimulationView/SimulationPass.py @@ -153,7 +153,7 @@ class SimulationPass(RenderPass): # In the current layer, we show just the indicated paths if layer == self._layer_view._current_layer_num: # We look for the position of the head, searching the point of the current path - index = int(self._layer_view.getCurrentPath()) + index = int(self._layer_view.getCurrentPath()) if self._layer_view.getCurrentPath() else 0 for polygon in layer_data.getLayer(layer).polygons: # The size indicates all values in the two-dimension array, and the second dimension is # always size 3 because we have 3D points.