From 08f114ee6e13f02d2cf00cd17383343248fb5ae6 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 5 Mar 2018 12:49:23 +0100 Subject: [PATCH 1/2] Don't make print estimates translateable This was very very confusing for our translators. And all of the translators basically came down to the same translation: Leave it untranslated. So let's make it a bit easier on them and don't allow this to be translated. If we really want the currency to be translated to the correct position, Qt has currency printing in its locale as an option too. --- resources/qml/Sidebar.qml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 57a8e8beaa..e04d8607da 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -515,15 +515,12 @@ Rectangle weights = ["0"]; costs = ["0.00"]; } + var result = lengths.join(" + ") + "m / ~ " + weights.join(" + ") + "g"; if(someCostsKnown) { - return catalog.i18nc("@label Print estimates: m for meters, g for grams, %4 is currency and %3 is print cost", "%1m / ~ %2g / ~ %4 %3").arg(lengths.join(" + ")) - .arg(weights.join(" + ")).arg(costs.join(" + ")).arg(UM.Preferences.getValue("cura/currency")); - } - else - { - return catalog.i18nc("@label Print estimates: m for meters, g for grams", "%1m / ~ %2g").arg(lengths.join(" + ")).arg(weights.join(" + ")); + result += " / ~ " + costs.join(" + ") + " " + UM.Preferences.getValue("cura/currency"); } + return result; } MouseArea { From 32fedf9559b8a9cf33e81dad8305e5c0dcf26d46 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 5 Mar 2018 13:01:32 +0100 Subject: [PATCH 2/2] Obtain filament diameter from stack for length calculation Otherwise we get it from the global stack which is always 2.85mm. Fixes #3284. --- cura/PrintInformation.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cura/PrintInformation.py b/cura/PrintInformation.py index 8b6fbb1f28..e71052023c 100644 --- a/cura/PrintInformation.py +++ b/cura/PrintInformation.py @@ -203,8 +203,6 @@ class PrintInformation(QObject): if Application.getInstance().getGlobalContainerStack() is None: return - # Material amount is sent as an amount of mm^3, so calculate length from that - radius = Application.getInstance().getGlobalContainerStack().getProperty("material_diameter", "value") / 2 self._material_lengths[build_plate_number] = [] self._material_weights[build_plate_number] = [] self._material_costs[build_plate_number] = [] @@ -216,14 +214,15 @@ class PrintInformation(QObject): for index, amount in enumerate(self._material_amounts): ## 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. - material = None if extruder_stacks: # Multi extrusion machine extruder_stack = [extruder for extruder in extruder_stacks if extruder.getMetaDataEntry("position") == str(index)][0] density = extruder_stack.getMetaDataEntry("properties", {}).get("density", 0) material = extruder_stack.findContainer({"type": "material"}) + radius = extruder_stack.getProperty("material_diameter", "value") / 2 else: # Machine with no extruder stacks density = Application.getInstance().getGlobalContainerStack().getMetaDataEntry("properties", {}).get("density", 0) material = Application.getInstance().getGlobalContainerStack().findContainer({"type": "material"}) + radius = Application.getInstance().getGlobalContainerStack().getProperty("material_diameter", "value") / 2 weight = float(amount) * float(density) / 1000 cost = 0 @@ -242,6 +241,7 @@ class PrintInformation(QObject): else: cost = 0 + # Material amount is sent as an amount of mm^3, so calculate length from that if radius != 0: length = round((amount / (math.pi * radius ** 2)) / 1000, 2) else: