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..bc4581b749 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,10 +358,13 @@ 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 + @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 878b80db17..febd082a4c 100644 --- a/plugins/3MFReader/WorkspaceDialog.qml +++ b/plugins/3MFReader/WorkspaceDialog.qml @@ -184,8 +184,9 @@ 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()) + 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 } diff --git a/plugins/3MFReader/WorkspaceSection.qml b/plugins/3MFReader/WorkspaceSection.qml index 7c8b01be7a..b72fed47ef 100644 --- a/plugins/3MFReader/WorkspaceSection.qml +++ b/plugins/3MFReader/WorkspaceSection.qml @@ -91,11 +91,11 @@ Item } } - Loader { width: parent.width height: content.height + z: -1 anchors.top: sectionTitleRow.bottom sourceComponent: content } 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.