Fixed docs, removed todo, changed way to get extruder stacks, slightly faster

This commit is contained in:
Guillem 2018-03-22 11:39:42 +01:00
parent faf8ed3ba6
commit 01ec20f5ce

View File

@ -550,17 +550,18 @@ class MachineManager(QObject):
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
## 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 manually changed settings of the current extruder to all other extruders.
@pyqtSlot() @pyqtSlot()
def copyAllValuesToExtruders(self): def copyAllValuesToExtruders(self):
for key in self._active_container_stack.userChanges.getAllKeys(): extruder_stacks = list(self._global_container_stack.extruders.values())
new_value = self._active_container_stack.getProperty(key, "value") for extruder_stack in extruder_stacks:
extruder_stacks = [stack for stack in ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId())] if extruder_stack != self._active_container_stack:
for key in self._active_container_stack.userChanges.getAllKeys():
new_value = self._active_container_stack.getProperty(key, "value")
# check in which stack the value has to be replaced # check if the value has to be replaced
for extruder_stack in extruder_stacks: if 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)
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: