From 1046b24ee5880279953bb87801fcf144ed8babf1 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Wed, 20 Mar 2024 11:14:16 +0100 Subject: [PATCH 1/4] Fix crash in similation view CURA-11758 --- plugins/SimulationView/SimulationPass.py | 3 ++- plugins/SimulationView/SimulationView.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/SimulationView/SimulationPass.py b/plugins/SimulationView/SimulationPass.py index f779224203..080b02bd9e 100644 --- a/plugins/SimulationView/SimulationPass.py +++ b/plugins/SimulationView/SimulationPass.py @@ -153,7 +153,8 @@ 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()) if self._layer_view.getCurrentPath() else 0 + index = int(self._layer_view.getCurrentPath()) if not math.isnan( + 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. diff --git a/plugins/SimulationView/SimulationView.py b/plugins/SimulationView/SimulationView.py index 2573c84cb9..10b68edaa0 100644 --- a/plugins/SimulationView/SimulationView.py +++ b/plugins/SimulationView/SimulationView.py @@ -1,5 +1,6 @@ # Copyright (c) 2021 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. +import math import sys from PyQt6.QtCore import Qt @@ -216,7 +217,8 @@ class SimulationView(CuraView): Logger.warn( f"Binary search error (out of bounds): index {i}: left value {left_value} right value {right_value} and current time is {self._current_time}") - fractional_value = (self._current_time - left_value) / (right_value - left_value) + segment_duration = right_value - left_value + fractional_value = 0.0 if segment_duration == 0.0 else (self._current_time - left_value) / segment_duration self.setPath(i + fractional_value) From 9662aefa37b749b0725007240dc524e1b63eccda Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Wed, 20 Mar 2024 13:34:41 +0100 Subject: [PATCH 2/4] Revert "Update model data handling in 3MFReader plugin" This reverts commit 4da17d643d91cb10b0185770c550dfc0f147e38f. --- plugins/3MFReader/WorkspaceDialog.py | 4 ++++ plugins/3MFReader/WorkspaceDialog.qml | 9 +-------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/plugins/3MFReader/WorkspaceDialog.py b/plugins/3MFReader/WorkspaceDialog.py index bc4581b749..c3e4187652 100644 --- a/plugins/3MFReader/WorkspaceDialog.py +++ b/plugins/3MFReader/WorkspaceDialog.py @@ -362,6 +362,10 @@ 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 febd082a4c..d7e776411f 100644 --- a/plugins/3MFReader/WorkspaceDialog.qml +++ b/plugins/3MFReader/WorkspaceDialog.qml @@ -209,16 +209,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 35d3ff2b5c23dcc92c72fcb1fdeacbfcf4ece870 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Wed, 20 Mar 2024 13:35:24 +0100 Subject: [PATCH 3/4] Only emit model once when all items have been added CURA-11720 --- plugins/3MFReader/SpecificSettingsModel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/3MFReader/SpecificSettingsModel.py b/plugins/3MFReader/SpecificSettingsModel.py index ec4a68e337..af203ad759 100644 --- a/plugins/3MFReader/SpecificSettingsModel.py +++ b/plugins/3MFReader/SpecificSettingsModel.py @@ -41,7 +41,7 @@ class SpecificSettingsModel(ListModel): "label": stack.getProperty(setting, "label"), "value": value }) - self.modelChanged.emit() + self.modelChanged.emit() def _update(self): Logger.debug(f"Updating {self.__class__.__name__}") From bc64d8fa4ed5e2de0fa31a926b4c020ed65fb119 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 20 Mar 2024 13:51:09 +0100 Subject: [PATCH 4/4] Fetch support extruder instead of the default. The (main) problem here was that the 'active extruder' was queried for the value, which isn't the same as the support-extruder. CURA-11725 --- .../Recommended/RecommendedSupportSelector.qml | 13 +++++++++++++ resources/qml/Widgets/SingleSettingComboBox.qml | 5 +++-- resources/qml/Widgets/SingleSettingSlider.qml | 3 ++- resources/qml/Widgets/SingleSettingTextField.qml | 1 + 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml index 16f1e7cccd..b3249bc5c0 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedSupportSelector.qml @@ -34,6 +34,15 @@ RecommendedSettingSection storeIndex: 0 } + UM.SettingPropertyProvider + { + id: supportExtruderProvider + key: "support_extruder_nr" + containerStack: Cura.MachineManager.activeMachine + watchedProperties: [ "value" ] + storeIndex: 0 + } + contents: [ RecommendedSettingItem { @@ -47,6 +56,8 @@ RecommendedSettingSection width: parent.width settingName: "support_structure" propertyRemoveUnusedValue: false + updateAllExtruders: true + defaultExtruderIndex: supportExtruderProvider.properties.value } }, RecommendedSettingItem @@ -75,6 +86,8 @@ RecommendedSettingSection { width: parent.width settingName: "support_type" + updateAllExtruders: true + defaultExtruderIndex: supportExtruderProvider.properties.value } } ] diff --git a/resources/qml/Widgets/SingleSettingComboBox.qml b/resources/qml/Widgets/SingleSettingComboBox.qml index fa150894f8..d917dc2753 100644 --- a/resources/qml/Widgets/SingleSettingComboBox.qml +++ b/resources/qml/Widgets/SingleSettingComboBox.qml @@ -28,7 +28,7 @@ Cura.ComboBox { id: comboboxModel // The propertyProvider has not loaded the setting when this components onComplete triggers. Populating the model - // is defered until propertyProvider signals "onIsValueUsedChanged". The defered upate is triggered with this function. + // is deferred until propertyProvider signals "onIsValueUsedChanged". The deferred update is triggered with this function. function updateModel() { clear() @@ -68,7 +68,8 @@ Cura.ComboBox { { id: propertyProvider containerStackId: updateAllExtruders ? Cura.ExtruderManager.extruderIds[defaultExtruderIndex] : Cura.MachineManager.activeMachine.id - watchedProperties: ["value" , "options"] + removeUnusedValue: false + watchedProperties: ["value", "validationState", "resolve", "options"] } Connections diff --git a/resources/qml/Widgets/SingleSettingSlider.qml b/resources/qml/Widgets/SingleSettingSlider.qml index aac204970e..638688186a 100644 --- a/resources/qml/Widgets/SingleSettingSlider.qml +++ b/resources/qml/Widgets/SingleSettingSlider.qml @@ -34,7 +34,8 @@ UM.Slider { id: propertyProvider containerStackId: updateAllExtruders ? Cura.ExtruderManager.extruderIds[defaultExtruderIndex] : Cura.MachineManager.activeMachine.id - watchedProperties: ["value"] + watchedProperties: ["value", "validationState", "resolve"] + removeUnusedValue: false storeIndex: 0 } diff --git a/resources/qml/Widgets/SingleSettingTextField.qml b/resources/qml/Widgets/SingleSettingTextField.qml index 22c080ebf4..35bd6d1064 100644 --- a/resources/qml/Widgets/SingleSettingTextField.qml +++ b/resources/qml/Widgets/SingleSettingTextField.qml @@ -53,6 +53,7 @@ UM.TextField { id: propertyProvider watchedProperties: ["value", "validationState", "resolve"] + removeUnusedValue: false containerStackId: updateAllExtruders ? Cura.ExtruderManager.extruderIds[defaultExtruderIndex] : Cura.MachineManager.activeMachine.id }