mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 12:49:10 +08:00
Merge branch 'master' of https://github.com/Ultimaker/Cura
This commit is contained in:
commit
f7e299a750
@ -4,7 +4,7 @@
|
|||||||
from PyQt5.QtCore import pyqtSignal, pyqtProperty, pyqtSlot, QObject #For communicating data and events to Qt.
|
from PyQt5.QtCore import pyqtSignal, pyqtProperty, pyqtSlot, QObject #For communicating data and events to Qt.
|
||||||
|
|
||||||
import UM.Application #To get the global container stack to find the current machine.
|
import UM.Application #To get the global container stack to find the current machine.
|
||||||
from UM.Logger import Logger
|
import UM.Logger
|
||||||
import UM.Settings.ContainerRegistry #Finding containers by ID.
|
import UM.Settings.ContainerRegistry #Finding containers by ID.
|
||||||
|
|
||||||
|
|
||||||
@ -65,15 +65,12 @@ class ExtruderManager(QObject):
|
|||||||
return
|
return
|
||||||
|
|
||||||
#Add the extruder trains that don't exist yet.
|
#Add the extruder trains that don't exist yet.
|
||||||
for position, extruder_definition_id in machine_definition.getMetaDataEntry("machine_extruder_trains", default = {}).items():
|
for extruder_definition in container_registry.findDefinitionContainers(machine = machine_definition.getId()):
|
||||||
extruder_definition = container_registry.findDefinitionContainers(machine = machine_definition.getId())
|
position = extruder_definition.getMetaDataEntry("position", None)
|
||||||
if extruder_definition:
|
if not position:
|
||||||
extruder_definition = extruder_definition[0]
|
UM.Logger.Log("w", "Extruder definition %s specifies no position metadata entry.", extruder_definition.getId())
|
||||||
else:
|
if not container_registry.findContainerStacks(machine = machine_id, position = position): #Doesn't exist yet.
|
||||||
Logger.log("w", "Machine %s references an extruder with ID %s, which doesn't exist.", machine_definition.getName(), extruder_definition_id)
|
name = container_registry.uniqueName(extruder_definition.getId()) #Make a name based on the ID of the definition.
|
||||||
continue
|
|
||||||
name = container_registry.uniqueName(extruder_definition_id) #Make a name based on the ID of the definition.
|
|
||||||
if not container_registry.findContainerStacks(id = name): #Doesn't exist yet.
|
|
||||||
self.createExtruderTrain(extruder_definition, machine_definition, name, position)
|
self.createExtruderTrain(extruder_definition, machine_definition, name, position)
|
||||||
|
|
||||||
#Gets the extruder trains that we just created as well as any that still existed.
|
#Gets the extruder trains that we just created as well as any that still existed.
|
||||||
|
@ -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.
|
||||||
@ -15,6 +15,7 @@ class SettingOverrideDecorator(SceneNodeDecorator):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self._stack = ContainerStack(stack_id = id(self))
|
self._stack = ContainerStack(stack_id = id(self))
|
||||||
|
self._stack.setDirty(False) # This stack does not need to be saved.
|
||||||
self._instance = InstanceContainer(container_id = "SettingOverrideInstanceContainer")
|
self._instance = InstanceContainer(container_id = "SettingOverrideInstanceContainer")
|
||||||
self._stack.addContainer(self._instance)
|
self._stack.addContainer(self._instance)
|
||||||
|
|
||||||
@ -25,6 +26,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 instance
|
||||||
|
deep_copy._instance = copy.deepcopy(self._instance, memo)
|
||||||
|
## Set the copied instance as the first (and only) instance container of the stack.
|
||||||
|
deep_copy._stack.replaceContainer(0, deep_copy._instance)
|
||||||
|
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()
|
||||||
|
@ -120,7 +120,7 @@ Item {
|
|||||||
|
|
||||||
containerStackId: UM.ActiveTool.properties.getValue("ContainerID")
|
containerStackId: UM.ActiveTool.properties.getValue("ContainerID")
|
||||||
key: model.key
|
key: model.key
|
||||||
watchedProperties: [ "value", "enabled", "state", "validationState" ]
|
watchedProperties: [ "value", "enabled", "validationState" ]
|
||||||
storeIndex: 0
|
storeIndex: 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user