From 2135e30aadffd3832eea43dc16245490c331f436 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 2 Mar 2018 16:10:06 +0100 Subject: [PATCH] Simplify for loop in _calculateInformation() --- cura/PrintInformation.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cura/PrintInformation.py b/cura/PrintInformation.py index 279e7e0c03..50d80e11bb 100644 --- a/cura/PrintInformation.py +++ b/cura/PrintInformation.py @@ -212,14 +212,13 @@ class PrintInformation(QObject): material_preference_values = json.loads(Preferences.getInstance().getValue("cura/material_settings")) extruder_stacks = global_stack.extruders - for extruder_key in global_stack.extruders.keys(): - index = int(extruder_key) + for position, extruder_stack in extruder_stacks.keys(): + index = int(position) if index >= len(self._material_amounts): # Right now the _material_amounts is a list, where the index is the extruder number continue amount = self._material_amounts[index] ## Find the right extruder stack. As the list isn't sorted because it's a annoying generator, we do some # list comprehension filtering to solve this for us. - extruder_stack = extruder_stacks[str(index)] density = extruder_stack.getMetaDataEntry("properties", {}).get("density", 0) material = extruder_stack.findContainer({"type": "material"})