mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-19 12:47:49 -06:00
Give default colour if there is no material
Otherwise it would try to call getMetaDataEntry on None. Contributes to issues CURA-340 and CURA-1278.
This commit is contained in:
parent
4aa495f9ef
commit
675a8c140e
1 changed files with 3 additions and 1 deletions
|
@ -52,9 +52,11 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel):
|
||||||
if not global_container_stack:
|
if not global_container_stack:
|
||||||
return #There is no machine to get the extruders of.
|
return #There is no machine to get the extruders of.
|
||||||
for index, extruder in manager.getMachineExtruders(global_container_stack.getBottom()):
|
for index, extruder in manager.getMachineExtruders(global_container_stack.getBottom()):
|
||||||
|
material = extruder.findContainer(type = "material")
|
||||||
|
colour = material.getMetaDataEntry("color_code", default = "#FFFF00") if material else "#FFFF00"
|
||||||
item = { #Construct an item with only the relevant information.
|
item = { #Construct an item with only the relevant information.
|
||||||
"name": extruder.getName(),
|
"name": extruder.getName(),
|
||||||
"colour": extruder.findContainer(type = "material").getMetaDataEntry("color_code", default = "#FFFF00"),
|
"colour": colour,
|
||||||
"index": index
|
"index": index
|
||||||
}
|
}
|
||||||
self.appendItem(item)
|
self.appendItem(item)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue