diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index eb720000bf..557fd97b43 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -550,6 +550,18 @@ class MachineManager(QObject): if extruder_stack != self._active_container_stack and extruder_stack.getProperty(key, "value") != new_value: extruder_stack.userChanges.setProperty(key, "value", new_value) # TODO: nested property access, should be improved + ## Copy the value of all settings of the current extruder to all other extruders as well as the global container. + @pyqtSlot() + def copyAllValuesToExtruders(self): + for key in self._active_container_stack.getAllKeys(): + new_value = self._active_container_stack.getProperty(key, "value") + extruder_stacks = [stack for stack in ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId())] + + # check in which stack the value has to be replaced + for extruder_stack in extruder_stacks: + if extruder_stack != self._active_container_stack and extruder_stack.getProperty(key, "value") != new_value: + extruder_stack.userChanges.setProperty(key, "value", new_value) # TODO: nested property access, should be improved + @pyqtProperty(str, notify = activeVariantChanged) def activeVariantName(self) -> str: if self._active_container_stack: diff --git a/resources/qml/Settings/SettingView.qml b/resources/qml/Settings/SettingView.qml index 615e66277b..5865ed5182 100644 --- a/resources/qml/Settings/SettingView.qml +++ b/resources/qml/Settings/SettingView.qml @@ -485,6 +485,15 @@ Item onTriggered: Cura.MachineManager.copyValueToExtruders(contextMenu.key) } + MenuItem + { + //: Settings context menu action + text: catalog.i18nc("@action:menu", "Copy all values to all extruders") + visible: machineExtruderCount.properties.value > 1 + enabled: contextMenu.provider != undefined + onTriggered: Cura.MachineManager.copyAllValuesToExtruders() + } + MenuSeparator { visible: machineExtruderCount.properties.value > 1