|
@@ -116,10 +116,10 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel):
|
|
|
active_extruder_stack.containersChanged.connect(self._onExtruderStackContainersChanged)
|
|
|
self._active_extruder_stack = active_extruder_stack
|
|
|
|
|
|
-
|
|
|
def _onExtruderStackContainersChanged(self, container):
|
|
|
- # The ExtrudersModel needs to be updated when the material-name or -color changes, because the user identifies extruders by material-name
|
|
|
- self._updateExtruders()
|
|
|
+ if container.getMetaDataEntry("type") == "material":
|
|
|
+ # The ExtrudersModel needs to be updated when the material-name or -color changes, because the user identifies extruders by material-name
|
|
|
+ self._updateExtruders()
|
|
|
|
|
|
modelChanged = pyqtSignal()
|
|
|
|
|
@@ -141,7 +141,7 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel):
|
|
|
global_container_stack = Application.getInstance().getGlobalContainerStack()
|
|
|
if global_container_stack:
|
|
|
if self._add_global:
|
|
|
- material = global_container_stack.findContainer({ "type": "material" })
|
|
|
+ material = global_container_stack.material
|
|
|
color = material.getMetaDataEntry("color_code", default = self.defaultColors[0]) if material else self.defaultColors[0]
|
|
|
item = {
|
|
|
"id": global_container_stack.getId(),
|
|
@@ -156,9 +156,6 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel):
|
|
|
machine_extruder_count = global_container_stack.getProperty("machine_extruder_count", "value")
|
|
|
manager = ExtruderManager.getInstance()
|
|
|
for extruder in manager.getMachineExtruders(global_container_stack.getId()):
|
|
|
- extruder_name = extruder.getName()
|
|
|
- material = extruder.findContainer({ "type": "material" })
|
|
|
- variant = extruder.findContainer({"type": "variant"})
|
|
|
position = extruder.getMetaDataEntry("position", default = "0") # Get the position
|
|
|
try:
|
|
|
position = int(position)
|
|
@@ -166,6 +163,9 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel):
|
|
|
position = -1
|
|
|
if position >= machine_extruder_count:
|
|
|
continue
|
|
|
+ extruder_name = extruder.getName()
|
|
|
+ material = extruder.material
|
|
|
+ variant = extruder.variant
|
|
|
|
|
|
default_color = self.defaultColors[position] if position >= 0 and position < len(self.defaultColors) else self.defaultColors[0]
|
|
|
color = material.getMetaDataEntry("color_code", default = default_color) if material else default_color
|