mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-19 12:47:49 -06:00
Don't create extruder tabs for "inactive" extruders
If a printer definition defines more extruders than machine_extruder_count, these are no longer shown as tabs in the sidebar.
This commit is contained in:
parent
e6121039d9
commit
0c74b4d108
1 changed files with 4 additions and 0 deletions
|
@ -136,6 +136,7 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel):
|
||||||
items.append(item)
|
items.append(item)
|
||||||
changed = True
|
changed = True
|
||||||
|
|
||||||
|
machine_extruder_count = global_container_stack.getProperty("machine_extruder_count", "value")
|
||||||
manager = ExtruderManager.getInstance()
|
manager = ExtruderManager.getInstance()
|
||||||
for extruder in manager.getMachineExtruders(global_container_stack.getId()):
|
for extruder in manager.getMachineExtruders(global_container_stack.getId()):
|
||||||
extruder_name = extruder.getName()
|
extruder_name = extruder.getName()
|
||||||
|
@ -145,6 +146,9 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel):
|
||||||
position = int(position)
|
position = int(position)
|
||||||
except ValueError: #Not a proper int.
|
except ValueError: #Not a proper int.
|
||||||
position = -1
|
position = -1
|
||||||
|
if position >= machine_extruder_count:
|
||||||
|
continue
|
||||||
|
|
||||||
default_color = self.defaultColors[position] if position >= 0 and position < len(self.defaultColors) else self.defaultColors[0]
|
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
|
color = material.getMetaDataEntry("color_code", default = default_color) if material else default_color
|
||||||
item = { #Construct an item with only the relevant information.
|
item = { #Construct an item with only the relevant information.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue