Use Pythonic way of creating list of N elements

Contributes to issue CURA-6600.
This commit is contained in:
Ghostkeeper 2019-08-28 14:17:17 +02:00
parent 619adcb5b3
commit 35907e5228
No known key found for this signature in database
GPG key ID: 86BEF881AE2CF276

View file

@ -62,7 +62,7 @@ class MachineNode(ContainerNode):
Logger.log("e", "The number of extruders in the list of variants (" + str(len(variant_names)) + ") is not equal to the number of extruders in the list of materials (" + str(len(material_bases)) + ") or the list of enabled extruders (" + str(len(extruder_enabled)) + ").") Logger.log("e", "The number of extruders in the list of variants (" + str(len(variant_names)) + ") is not equal to the number of extruders in the list of materials (" + str(len(material_bases)) + ") or the list of enabled extruders (" + str(len(extruder_enabled)) + ").")
return {} return {}
# For each extruder, find which quality profiles are available. Later we'll intersect the quality types. # For each extruder, find which quality profiles are available. Later we'll intersect the quality types.
qualities_per_type_per_extruder = [{} for _ in range(len(variant_names))] # type: List[Dict[str, QualityNode]] qualities_per_type_per_extruder = [{}] * len(variant_names) # type: List[Dict[str, QualityNode]]
for extruder_nr, variant_name in enumerate(variant_names): for extruder_nr, variant_name in enumerate(variant_names):
if not extruder_enabled[extruder_nr]: if not extruder_enabled[extruder_nr]:
continue # No qualities are available in this extruder. It'll get skipped when calculating the available quality types. continue # No qualities are available in this extruder. It'll get skipped when calculating the available quality types.