mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 05:55:53 +08:00
Added deepcopy function to settingOverrideDecorator
CURA-1636
This commit is contained in:
parent
51ea6779df
commit
4695862b49
@ -7,7 +7,7 @@ from UM.Settings.InstanceContainer import InstanceContainer
|
|||||||
from UM.Settings.ContainerRegistry import ContainerRegistry
|
from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||||
|
|
||||||
from UM.Application import Application
|
from UM.Application import Application
|
||||||
|
import copy
|
||||||
## A decorator that adds a container stack to a Node. This stack should be queried for all settings regarding
|
## A decorator that adds a container stack to a Node. This stack should be queried for all settings regarding
|
||||||
# the linked node. The Stack in question will refer to the global stack (so that settings that are not defined by
|
# the linked node. The Stack in question will refer to the global stack (so that settings that are not defined by
|
||||||
# this stack still resolve.
|
# this stack still resolve.
|
||||||
@ -25,6 +25,15 @@ class SettingOverrideDecorator(SceneNodeDecorator):
|
|||||||
Application.getInstance().globalContainerStackChanged.connect(self._onGlobalContainerStackChanged)
|
Application.getInstance().globalContainerStackChanged.connect(self._onGlobalContainerStackChanged)
|
||||||
self._onGlobalContainerStackChanged()
|
self._onGlobalContainerStackChanged()
|
||||||
|
|
||||||
|
def __deepcopy__(self, memo):
|
||||||
|
## Create a fresh decorator object
|
||||||
|
deep_copy = SettingOverrideDecorator()
|
||||||
|
## Copy the stack
|
||||||
|
deep_copy._stack = copy.deepcopy(self._stack, memo)
|
||||||
|
## Ensure that the id is unique.
|
||||||
|
deep_copy._stack._id = id(deep_copy)
|
||||||
|
return deep_copy
|
||||||
|
|
||||||
def _onSettingChanged(self, instance, property):
|
def _onSettingChanged(self, instance, property):
|
||||||
if property == "value": # Only reslice if the value has changed.
|
if property == "value": # Only reslice if the value has changed.
|
||||||
Application.getInstance().getBackend().forceSlice()
|
Application.getInstance().getBackend().forceSlice()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user