diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py index b6b3e0671c..7f41fac0c5 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py @@ -8,7 +8,6 @@ import xml.etree.ElementTree as ET from UM.Resources import Resources from UM.Logger import Logger -from UM.Util import parseBool from cura.CuraApplication import CuraApplication import UM.Dictionary @@ -485,7 +484,7 @@ class XmlMaterialProfile(InstanceContainer): common_setting_values[self.__material_settings_setting_map[key]] = entry.text elif key in self.__unmapped_settings: if key == "hardware compatible": - common_compatibility = parseBool(entry.text) + common_compatibility = self._parseCompatibleValue(entry.text) else: Logger.log("d", "Unsupported material setting %s", key) self._cached_values = common_setting_values # from InstanceContainer ancestor @@ -505,7 +504,7 @@ class XmlMaterialProfile(InstanceContainer): machine_setting_values[self.__material_settings_setting_map[key]] = entry.text elif key in self.__unmapped_settings: if key == "hardware compatible": - machine_compatibility = parseBool(entry.text) + machine_compatibility = self._parseCompatibleValue(entry.text) else: Logger.log("d", "Unsupported material setting %s", key) @@ -568,7 +567,7 @@ class XmlMaterialProfile(InstanceContainer): hotend_setting_values[self.__material_settings_setting_map[key]] = entry.text elif key in self.__unmapped_settings: if key == "hardware compatible": - hotend_compatibility = parseBool(entry.text) + hotend_compatibility = self._parseCompatibleValue(entry.text) else: Logger.log("d", "Unsupported material setting %s", key) @@ -609,6 +608,10 @@ class XmlMaterialProfile(InstanceContainer): else: return material_name + ## Parse the value of the "material compatible" property. + def _parseCompatibleValue(self, value: str): + return value in {"yes", "unknown"} + # Map XML file setting names to internal names __material_settings_setting_map = { "print temperature": "default_material_print_temperature", @@ -670,4 +673,4 @@ def _indent(elem, level = 0): # We are only interested in the actual tag name, so discard everything # before the last } def _tag_without_namespace(element): - return element.tag[element.tag.rfind("}") + 1:] + return element.tag[element.tag.rfind("}") + 1:] \ No newline at end of file