mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 22:54:01 -06:00
Only update ExtrudersModel when material changes
CURA-3780
This commit is contained in:
parent
42fc703516
commit
801c282c97
1 changed files with 7 additions and 7 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue