mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-07-03 13:25:13 +08:00
Fix extruder number attached to extruders
It reads that from position in the extruder definition file. Contributes to issues CURA-1278 and CURA-340.
This commit is contained in:
parent
5da3665832
commit
4bdd5713f1
@ -51,13 +51,18 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel):
|
||||
global_container_stack = UM.Application.getInstance().getGlobalContainerStack()
|
||||
if not global_container_stack:
|
||||
return #There is no machine to get the extruders of.
|
||||
for index, extruder in enumerate(manager.getMachineExtruders(global_container_stack.getBottom())):
|
||||
for extruder in manager.getMachineExtruders(global_container_stack.getBottom()):
|
||||
material = extruder.findContainer({ "type": "material" })
|
||||
colour = material.getMetaDataEntry("color_code", default = "#FFFF00") if material else "#FFFF00"
|
||||
position = extruder.getBottom().getMetaDataEntry("position", default = "0") #Position in the definition.
|
||||
try:
|
||||
position = int(position)
|
||||
except ValueError: #Not a proper int.
|
||||
position = -1
|
||||
item = { #Construct an item with only the relevant information.
|
||||
"name": extruder.getName(),
|
||||
"colour": colour,
|
||||
"index": index
|
||||
"index": position
|
||||
}
|
||||
self.appendItem(item)
|
||||
self.sort(lambda item: item["index"])
|
Loading…
x
Reference in New Issue
Block a user