From 0e23930bfefd7ac4df5de6a0db917200b08816d4 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 22 Jun 2017 14:43:45 +0200 Subject: [PATCH] Fix checking whether the old material diameter was the same Getting the old material diameter wasn't working properly. Contributes to issue CURA-2822. --- cura/Settings/GlobalStack.py | 4 ++-- resources/qml/Preferences/MaterialView.qml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cura/Settings/GlobalStack.py b/cura/Settings/GlobalStack.py index 964551f263..4e7bcdf486 100755 --- a/cura/Settings/GlobalStack.py +++ b/cura/Settings/GlobalStack.py @@ -117,10 +117,10 @@ class GlobalStack(CuraContainerStack): # \return The approximate filament diameter for the printer, as a string. @pyqtProperty(str) def approximateMaterialDiameter(self) -> str: - material_diameter = self.definition.getMetaDataEntry("material_diameter") + material_diameter = self.definition.getProperty("material_diameter", "value") if material_diameter is None: return "-1" - return str(round(float(self.definition.getMetaDataEntry("material_diameter")))) #Round, then convert back to string. + return str(round(float(material_diameter))) #Round, then convert back to string. # protected: diff --git a/resources/qml/Preferences/MaterialView.qml b/resources/qml/Preferences/MaterialView.qml index 990f03b5cc..39f2db0695 100644 --- a/resources/qml/Preferences/MaterialView.qml +++ b/resources/qml/Preferences/MaterialView.qml @@ -171,7 +171,7 @@ TabView var old_diameter = Cura.ContainerManager.getContainerProperty(base.containerId, "material_diameter", "value").toString(); base.setMetaDataEntry("approximate_diameter", properties.approximate_diameter, Math.round(value).toString()); base.setMetaDataEntry("properties/diameter", properties.diameter, value); - if (Cura.MachineManager.filterMaterialsByMachine && properties.approximate_diameter != Math.round(Cura.MachineManager.activeMachine.approximateMaterialDiameter).toString()) + if (Cura.MachineManager.filterMaterialsByMachine && properties.approximate_diameter != Cura.MachineManager.activeMachine.approximateMaterialDiameter) { Cura.MaterialManager.showMaterialWarningMessage(base.containerId, old_diameter); }