mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-10 00:07:51 -06:00
add Copy all values to all extruders
context menu option
This commit is contained in:
parent
73517cd176
commit
1bb5b8ff3e
2 changed files with 21 additions and 0 deletions
|
@ -550,6 +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.
|
||||||
|
@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)
|
@pyqtProperty(str, notify = activeVariantChanged)
|
||||||
def activeVariantName(self) -> str:
|
def activeVariantName(self) -> str:
|
||||||
if self._active_container_stack:
|
if self._active_container_stack:
|
||||||
|
|
|
@ -485,6 +485,15 @@ Item
|
||||||
onTriggered: Cura.MachineManager.copyValueToExtruders(contextMenu.key)
|
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
|
MenuSeparator
|
||||||
{
|
{
|
||||||
visible: machineExtruderCount.properties.value > 1
|
visible: machineExtruderCount.properties.value > 1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue