Make name of extruder a property

This stores the name for later use, for instance when displaying the extruder.

Contributes to issues CURA-1278 and CURA-351.
This commit is contained in:
Ghostkeeper 2016-06-02 13:15:33 +02:00
parent 8a8de95969
commit 25a6a99286
No known key found for this signature in database
GPG Key ID: 701948C5954A7385

View File

@ -25,8 +25,8 @@ class Extruder:
self._nozzles += container_registry.findInstanceContainers(type = "nozzle", definitions = self._definition.getId()) self._nozzles += container_registry.findInstanceContainers(type = "nozzle", definitions = self._definition.getId())
#Create a container stack for this extruder. #Create a container stack for this extruder.
name = self._uniqueName(self._definition.getId()) self._name = self._uniqueName(self._definition.getId())
self._container_stack = UM.Settings.ContainerStack(name) self._container_stack = UM.Settings.ContainerStack(self._name)
self._container_stack.addMetaDataEntry("type", "extruder_train") self._container_stack.addMetaDataEntry("type", "extruder_train")
self._container_stack.addContainer(self._definition) self._container_stack.addContainer(self._definition)
@ -73,15 +73,16 @@ class Extruder:
self._container_stack.addContainer(self._quality) self._container_stack.addContainer(self._quality)
#Add an empty user profile. #Add an empty user profile.
self._user_profile = UM.Settings.InstanceContainer(name + "_current_settings") self._user_profile = UM.Settings.InstanceContainer(self._name + "_current_settings")
self._user_profile.addMetaDataEntry("type", "user") self._user_profile.addMetaDataEntry("type", "user")
self._container_stack.addContainer(self._user_profile) self._container_stack.addContainer(self._user_profile)
self._container_stack.setNextStack(UM.Application.getInstance().getGlobalContainerStack()) self._container_stack.setNextStack(UM.Application.getInstance().getGlobalContainerStack())
nozzle_changed = UM.Signal.Signal() material_changed = UM.Signal()
material_changed = UM.Signal.Signal() name_changed = UM.Signal()
quality_changed = UM.Signal.Signal() nozzle_changed = UM.Signal()
quality_changed = UM.Signal()
## Gets the currently active material on this extruder. ## Gets the currently active material on this extruder.
# #
@ -104,6 +105,19 @@ class Extruder:
self._material = value self._material = value
self.material_changed.emit() self.material_changed.emit()
## Gets the name of this extruder.
#
# \return The name of this extruder.
@property
def name(self):
return self._name
## Changes the name of this extruder.
@name.setter
def name(self, value):
self._name = value
self.name_changed.emit()
## Gets the currently active nozzle on this extruder. ## Gets the currently active nozzle on this extruder.
# #
# \return The currently active nozzle on this extruder. # \return The currently active nozzle on this extruder.