Fix checking if an extruder train already exists

Contributes to issues CURA-340 and CURA-1278.
This commit is contained in:
Ghostkeeper 2016-06-07 13:59:58 +02:00
parent a9376cffd1
commit 499a0557bd
No known key found for this signature in database
GPG key ID: 701948C5954A7385

View file

@ -65,15 +65,12 @@ class ExtruderManager(QObject):
return return
#Add the extruder trains that don't exist yet. #Add the extruder trains that don't exist yet.
for position, extruder_definition_id in machine_definition.getMetaDataEntry("machine_extruder_trains", default = {}).items(): for extruder_definition in container_registry.findDefinitionContainers(machine = machine_definition.getId()):
extruder_definition = container_registry.findDefinitionContainers(machine = machine_definition.getId()) position = extruder_definition.getMetaDataEntry("position", None)
if extruder_definition: if not position:
extruder_definition = extruder_definition[0] UM.Logger.Log("w", "Extruder definition %s specifies no position metadata entry.", extruder_definition.getId())
else: if not container_registry.findContainerStacks(machine = machine_id, position = position): #Doesn't exist yet.
UM.Logger.log("w", "Machine %s references an extruder with ID %s, which doesn't exist.", machine_definition.getName(), extruder_definition_id) name = container_registry.uniqueName(extruder_definition.getId()) #Make a name based on the ID of the definition.
continue
name = container_registry.uniqueName(extruder_definition_id) #Make a name based on the ID of the definition.
if not container_registry.findContainerStacks(id = name): #Doesn't exist yet.
self.createExtruderTrain(extruder_definition, machine_definition, name, position) self.createExtruderTrain(extruder_definition, machine_definition, name, position)
#Gets the extruder trains that we just created as well as any that still existed. #Gets the extruder trains that we just created as well as any that still existed.