Replace only user changed values

removed machine_settings and settable_per_extruder_check. Not needed.
This commit is contained in:
Guillem 2018-03-19 14:57:31 +01:00
parent 18fba5b529
commit faf8ed3ba6
2 changed files with 8 additions and 9 deletions

View file

@ -553,15 +553,14 @@ class MachineManager(QObject):
## Copy the value of all settings of the current extruder to all other extruders as well as the global container. ## Copy the value of all settings of the current extruder to all other extruders as well as the global container.
@pyqtSlot() @pyqtSlot()
def copyAllValuesToExtruders(self): def copyAllValuesToExtruders(self):
for key in self._active_container_stack.getAllKeys() - set([machine_setting.key for machine_setting in self._active_container_stack.getProperty("machine_settings", "children")]): for key in self._active_container_stack.userChanges.getAllKeys():
if self._active_container_stack.getProperty(key, "settable_per_extruder"): new_value = self._active_container_stack.getProperty(key, "value")
new_value = self._active_container_stack.getProperty(key, "value") extruder_stacks = [stack for stack in ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId())]
extruder_stacks = [stack for stack in ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId())]
# check in which stack the value has to be replaced # check in which stack the value has to be replaced
for extruder_stack in extruder_stacks: for extruder_stack in extruder_stacks:
if extruder_stack != self._active_container_stack and extruder_stack.getProperty(key, "value") != new_value: 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 extruder_stack.userChanges.setProperty(key, "value", new_value) # TODO: nested property access, should be improved
@pyqtProperty(str, notify = activeVariantChanged) @pyqtProperty(str, notify = activeVariantChanged)
def activeVariantName(self) -> str: def activeVariantName(self) -> str:

View file

@ -488,7 +488,7 @@ Item
MenuItem MenuItem
{ {
//: Settings context menu action //: Settings context menu action
text: catalog.i18nc("@action:menu", "Copy all values to all extruders") text: catalog.i18nc("@action:menu", "Copy all changed values to all extruders")
visible: machineExtruderCount.properties.value > 1 visible: machineExtruderCount.properties.value > 1
enabled: contextMenu.provider != undefined enabled: contextMenu.provider != undefined
onTriggered: Cura.MachineManager.copyAllValuesToExtruders() onTriggered: Cura.MachineManager.copyAllValuesToExtruders()