mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 21:19:01 +08:00
Fixed formating of documentation
CURA-1898
This commit is contained in:
parent
779f66967e
commit
b0137016f7
@ -95,21 +95,21 @@ class ExtruderManager(QObject):
|
|||||||
container_registry = UM.Settings.ContainerRegistry.getInstance()
|
container_registry = UM.Settings.ContainerRegistry.getInstance()
|
||||||
if container_registry:
|
if container_registry:
|
||||||
|
|
||||||
#Add the extruder trains that don't exist yet.
|
# Add the extruder trains that don't exist yet.
|
||||||
for extruder_definition in container_registry.findDefinitionContainers(machine = machine_definition.getId()):
|
for extruder_definition in container_registry.findDefinitionContainers(machine = machine_definition.getId()):
|
||||||
position = extruder_definition.getMetaDataEntry("position", None)
|
position = extruder_definition.getMetaDataEntry("position", None)
|
||||||
if not position:
|
if not position:
|
||||||
UM.Logger.log("w", "Extruder definition %s specifies no position metadata entry.", extruder_definition.getId())
|
UM.Logger.log("w", "Extruder definition %s specifies no position metadata entry.", extruder_definition.getId())
|
||||||
if not container_registry.findContainerStacks(machine = machine_id, position = position): #Doesn't exist yet.
|
if not container_registry.findContainerStacks(machine = machine_id, position = position): # Doesn't exist yet.
|
||||||
self.createExtruderTrain(extruder_definition, machine_definition, position)
|
self.createExtruderTrain(extruder_definition, machine_definition, position)
|
||||||
changed = True
|
changed = True
|
||||||
|
|
||||||
#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.
|
||||||
extruder_trains = container_registry.findContainerStacks(type = "extruder_train", machine = machine_definition.getId())
|
extruder_trains = container_registry.findContainerStacks(type = "extruder_train", machine = machine_definition.getId())
|
||||||
for extruder_train in extruder_trains:
|
for extruder_train in extruder_trains:
|
||||||
self._extruder_trains[machine_id][extruder_train.getMetaDataEntry("position")] = extruder_train
|
self._extruder_trains[machine_id][extruder_train.getMetaDataEntry("position")] = extruder_train
|
||||||
|
|
||||||
#Ensure that the extruder train stacks are linked to global stack.
|
# Ensure that the extruder train stacks are linked to global stack.
|
||||||
extruder_train.setNextStack(UM.Application.getInstance().getGlobalContainerStack())
|
extruder_train.setNextStack(UM.Application.getInstance().getGlobalContainerStack())
|
||||||
changed = True
|
changed = True
|
||||||
|
|
||||||
@ -124,30 +124,27 @@ class ExtruderManager(QObject):
|
|||||||
#
|
#
|
||||||
# The resulting container stack is added to the registry.
|
# The resulting container stack is added to the registry.
|
||||||
#
|
#
|
||||||
# \param extruder_definition The extruder to create the extruder train
|
# \param extruder_definition The extruder to create the extruder train for.
|
||||||
# for.
|
# \param machine_definition The machine that the extruder train belongs to.
|
||||||
# \param machine_definition The machine that the extruder train belongs
|
# \param position The position of this extruder train in the extruder slots of the machine.
|
||||||
# to.
|
|
||||||
# \param position The position of this extruder train in the extruder
|
|
||||||
# slots of the machine.
|
|
||||||
def createExtruderTrain(self, extruder_definition, machine_definition, position):
|
def createExtruderTrain(self, extruder_definition, machine_definition, position):
|
||||||
#Cache some things.
|
# Cache some things.
|
||||||
container_registry = UM.Settings.ContainerRegistry.getInstance()
|
container_registry = UM.Settings.ContainerRegistry.getInstance()
|
||||||
machine_id = machine_definition.getId()
|
machine_id = machine_definition.getId()
|
||||||
|
|
||||||
#Create a container stack for this extruder.
|
# Create a container stack for this extruder.
|
||||||
extruder_stack_id = container_registry.uniqueName(extruder_definition.getId())
|
extruder_stack_id = container_registry.uniqueName(extruder_definition.getId())
|
||||||
container_stack = UM.Settings.ContainerStack(extruder_stack_id)
|
container_stack = UM.Settings.ContainerStack(extruder_stack_id)
|
||||||
container_stack.setName(extruder_definition.getName()) #Take over the display name to display the stack with.
|
container_stack.setName(extruder_definition.getName()) # Take over the display name to display the stack with.
|
||||||
container_stack.addMetaDataEntry("type", "extruder_train")
|
container_stack.addMetaDataEntry("type", "extruder_train")
|
||||||
container_stack.addMetaDataEntry("machine", machine_definition.getId())
|
container_stack.addMetaDataEntry("machine", machine_definition.getId())
|
||||||
container_stack.addMetaDataEntry("position", position)
|
container_stack.addMetaDataEntry("position", position)
|
||||||
container_stack.addContainer(extruder_definition)
|
container_stack.addContainer(extruder_definition)
|
||||||
|
|
||||||
#Find the variant to use for this extruder.
|
# Find the variant to use for this extruder.
|
||||||
variant = container_registry.getEmptyInstanceContainer()
|
variant = container_registry.getEmptyInstanceContainer()
|
||||||
if machine_definition.getMetaDataEntry("has_variants"):
|
if machine_definition.getMetaDataEntry("has_variants"):
|
||||||
#First add any variant. Later, overwrite with preference if the preference is valid.
|
# First add any variant. Later, overwrite with preference if the preference is valid.
|
||||||
variants = container_registry.findInstanceContainers(definition = machine_id, type = "variant")
|
variants = container_registry.findInstanceContainers(definition = machine_id, type = "variant")
|
||||||
if len(variants) >= 1:
|
if len(variants) >= 1:
|
||||||
variant = variants[0]
|
variant = variants[0]
|
||||||
@ -158,13 +155,13 @@ class ExtruderManager(QObject):
|
|||||||
variant = preferred_variants[0]
|
variant = preferred_variants[0]
|
||||||
else:
|
else:
|
||||||
UM.Logger.log("w", "The preferred variant \"%s\" of machine %s doesn't exist or is not a variant profile.", preferred_variant_id, machine_id)
|
UM.Logger.log("w", "The preferred variant \"%s\" of machine %s doesn't exist or is not a variant profile.", preferred_variant_id, machine_id)
|
||||||
#And leave it at the default variant.
|
# And leave it at the default variant.
|
||||||
container_stack.addContainer(variant)
|
container_stack.addContainer(variant)
|
||||||
|
|
||||||
#Find a material to use for this variant.
|
# Find a material to use for this variant.
|
||||||
material = container_registry.getEmptyInstanceContainer()
|
material = container_registry.getEmptyInstanceContainer()
|
||||||
if machine_definition.getMetaDataEntry("has_materials"):
|
if machine_definition.getMetaDataEntry("has_materials"):
|
||||||
#First add any material. Later, overwrite with preference if the preference is valid.
|
# First add any material. Later, overwrite with preference if the preference is valid.
|
||||||
if machine_definition.getMetaDataEntry("has_variant_materials", default = "False") == "True":
|
if machine_definition.getMetaDataEntry("has_variant_materials", default = "False") == "True":
|
||||||
materials = container_registry.findInstanceContainers(type = "material", definition = machine_id, variant = variant.getId())
|
materials = container_registry.findInstanceContainers(type = "material", definition = machine_id, variant = variant.getId())
|
||||||
else:
|
else:
|
||||||
@ -187,13 +184,13 @@ class ExtruderManager(QObject):
|
|||||||
material = preferred_materials[0]
|
material = preferred_materials[0]
|
||||||
else:
|
else:
|
||||||
UM.Logger.log("w", "The preferred material \"%s\" of machine %s doesn't exist or is not a material profile.", preferred_material_id, machine_id)
|
UM.Logger.log("w", "The preferred material \"%s\" of machine %s doesn't exist or is not a material profile.", preferred_material_id, machine_id)
|
||||||
#And leave it at the default material.
|
# And leave it at the default material.
|
||||||
container_stack.addContainer(material)
|
container_stack.addContainer(material)
|
||||||
|
|
||||||
#Find a quality to use for this extruder.
|
# Find a quality to use for this extruder.
|
||||||
quality = container_registry.getEmptyInstanceContainer()
|
quality = container_registry.getEmptyInstanceContainer()
|
||||||
|
|
||||||
#First add any quality. Later, overwrite with preference if the preference is valid.
|
# First add any quality. Later, overwrite with preference if the preference is valid.
|
||||||
qualities = container_registry.findInstanceContainers(type = "quality")
|
qualities = container_registry.findInstanceContainers(type = "quality")
|
||||||
if len(qualities) >= 1:
|
if len(qualities) >= 1:
|
||||||
quality = qualities[0]
|
quality = qualities[0]
|
||||||
@ -204,14 +201,14 @@ class ExtruderManager(QObject):
|
|||||||
quality = preferred_quality[0]
|
quality = preferred_quality[0]
|
||||||
else:
|
else:
|
||||||
UM.Logger.log("w", "The preferred quality \"%s\" of machine %s doesn't exist or is not a quality profile.", preferred_quality_id, machine_id)
|
UM.Logger.log("w", "The preferred quality \"%s\" of machine %s doesn't exist or is not a quality profile.", preferred_quality_id, machine_id)
|
||||||
#And leave it at the default quality.
|
# And leave it at the default quality.
|
||||||
container_stack.addContainer(quality)
|
container_stack.addContainer(quality)
|
||||||
|
|
||||||
user_profile = container_registry.findInstanceContainers(type = "user", extruder = extruder_stack_id)
|
user_profile = container_registry.findInstanceContainers(type = "user", extruder = extruder_stack_id)
|
||||||
if user_profile: #There was already a user profile, loaded from settings.
|
if user_profile: # There was already a user profile, loaded from settings.
|
||||||
user_profile = user_profile[0]
|
user_profile = user_profile[0]
|
||||||
else:
|
else:
|
||||||
user_profile = UM.Settings.InstanceContainer(extruder_stack_id + "_current_settings") #Add an empty user profile.
|
user_profile = UM.Settings.InstanceContainer(extruder_stack_id + "_current_settings") # Add an empty user profile.
|
||||||
user_profile.addMetaDataEntry("type", "user")
|
user_profile.addMetaDataEntry("type", "user")
|
||||||
user_profile.addMetaDataEntry("extruder", extruder_stack_id)
|
user_profile.addMetaDataEntry("extruder", extruder_stack_id)
|
||||||
user_profile.setDefinition(machine_definition)
|
user_profile.setDefinition(machine_definition)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user