Interpret material compatible 'unknown' as 'yes'

We decide whether it is unknown (or unsupported) based on the availability of profiles for it.

Contributes to issue EM-1662.
This commit is contained in:
Ghostkeeper 2017-07-11 13:22:53 +02:00
parent 95b825a4c5
commit d6941fef2f
No known key found for this signature in database
GPG key ID: C5F96EE2BC0F7E75

View file

@ -8,7 +8,6 @@ import xml.etree.ElementTree as ET
from UM.Resources import Resources from UM.Resources import Resources
from UM.Logger import Logger from UM.Logger import Logger
from UM.Util import parseBool
from cura.CuraApplication import CuraApplication from cura.CuraApplication import CuraApplication
import UM.Dictionary import UM.Dictionary
@ -485,7 +484,7 @@ class XmlMaterialProfile(InstanceContainer):
common_setting_values[self.__material_settings_setting_map[key]] = entry.text common_setting_values[self.__material_settings_setting_map[key]] = entry.text
elif key in self.__unmapped_settings: elif key in self.__unmapped_settings:
if key == "hardware compatible": if key == "hardware compatible":
common_compatibility = parseBool(entry.text) common_compatibility = self._parseCompatibleValue(entry.text)
else: else:
Logger.log("d", "Unsupported material setting %s", key) Logger.log("d", "Unsupported material setting %s", key)
self._cached_values = common_setting_values # from InstanceContainer ancestor 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 machine_setting_values[self.__material_settings_setting_map[key]] = entry.text
elif key in self.__unmapped_settings: elif key in self.__unmapped_settings:
if key == "hardware compatible": if key == "hardware compatible":
machine_compatibility = parseBool(entry.text) machine_compatibility = self._parseCompatibleValue(entry.text)
else: else:
Logger.log("d", "Unsupported material setting %s", key) 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 hotend_setting_values[self.__material_settings_setting_map[key]] = entry.text
elif key in self.__unmapped_settings: elif key in self.__unmapped_settings:
if key == "hardware compatible": if key == "hardware compatible":
hotend_compatibility = parseBool(entry.text) hotend_compatibility = self._parseCompatibleValue(entry.text)
else: else:
Logger.log("d", "Unsupported material setting %s", key) Logger.log("d", "Unsupported material setting %s", key)
@ -609,6 +608,10 @@ class XmlMaterialProfile(InstanceContainer):
else: else:
return material_name 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 # Map XML file setting names to internal names
__material_settings_setting_map = { __material_settings_setting_map = {
"print temperature": "default_material_print_temperature", "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 # We are only interested in the actual tag name, so discard everything
# before the last } # before the last }
def _tag_without_namespace(element): def _tag_without_namespace(element):
return element.tag[element.tag.rfind("}") + 1:] return element.tag[element.tag.rfind("}") + 1:]