First ask the printer which profiles it already has

Only let the printer have one profile per GUID and make sure it's the one with the highest version.

Contributes to issue CURA-5034.
This commit is contained in:
Ghostkeeper 2018-06-12 12:50:33 +02:00
parent 0da7ad3946
commit 2dcb185a32
No known key found for this signature in database
GPG key ID: 5252B696FB5E7C7A
2 changed files with 57 additions and 13 deletions

View file

@ -331,9 +331,9 @@ class XmlMaterialProfile(InstanceContainer):
stream = io.BytesIO()
tree = ET.ElementTree(root)
# this makes sure that the XML header states encoding="utf-8"
tree.write(stream, encoding="utf-8", xml_declaration=True)
tree.write(stream, encoding = "utf-8", xml_declaration=True)
return stream.getvalue().decode('utf-8')
return stream.getvalue().decode("utf-8")
# Recursively resolve loading inherited files
def _resolveInheritance(self, file_name):
@ -349,7 +349,7 @@ class XmlMaterialProfile(InstanceContainer):
def _loadFile(self, file_name):
path = Resources.getPath(CuraApplication.getInstance().ResourceTypes.MaterialInstanceContainer, file_name + ".xml.fdm_material")
with open(path, encoding="utf-8") as f:
with open(path, encoding = "utf-8") as f:
contents = f.read()
self._inherited_files.append(path)
@ -955,7 +955,7 @@ class XmlMaterialProfile(InstanceContainer):
def _addSettingElement(self, builder, instance):
key = instance.definition.key
if key in self.__material_settings_setting_map.values():
# Setting has a key in the stabndard namespace
# Setting has a key in the standard namespace
key = UM.Dictionary.findKey(self.__material_settings_setting_map, instance.definition.key)
tag_name = "setting"
elif key not in self.__material_properties_setting_map.values() and key not in self.__material_metadata_setting_map.values():