diff options
author | Ghostkeeper <rubend@tutanota.com> | 2017-08-11 12:13:23 +0300 |
---|---|---|
committer | Ghostkeeper <rubend@tutanota.com> | 2017-08-11 12:13:23 +0300 |
commit | b03847447fa697f0a45b8fe72644ea041d27b664 (patch) | |
tree | 02d23ae3d550fba2cb4c3d578edd5e3cf58b20f2 /plugins/XmlMaterialProfile | |
parent | e1266ceb1fd5832364b02b3d54ab4cb2df2c4df9 (diff) |
Take manufacturer from XML profile if available
Otherwise we fall back to the manufacturer in the machine definition. If that fails too, we fall back to Unknown (rather than an empty string).
Contributes to issue CURA-4157.
Diffstat (limited to 'plugins/XmlMaterialProfile')
-rw-r--r-- | plugins/XmlMaterialProfile/XmlMaterialProfile.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py index f920a6bd49..41d45cfc9b 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py @@ -229,7 +229,10 @@ class XmlMaterialProfile(InstanceContainer): product = definition_id builder.start("machine") - builder.start("machine_identifier", { "manufacturer": definition.getMetaDataEntry("manufacturer", ""), "product": product}) + builder.start("machine_identifier", { + "manufacturer": container.getMetaDataEntry("machine_manufacturer", definition.getMetaDataEntry("manufacturer", "Unknown")), + "product": product + }) builder.end("machine_identifier") for instance in container.findInstances(): @@ -540,6 +543,8 @@ class XmlMaterialProfile(InstanceContainer): definition = definitions[0] + machine_manufacturer = identifier.get("manufacturer", definition.getMetaDataEntry("manufacturer", "Unknown")) #If the XML material doesn't specify a manufacturer, use the one in the actual printer definition. + if machine_compatibility: new_material_id = self.id + "_" + machine_id @@ -551,6 +556,7 @@ class XmlMaterialProfile(InstanceContainer): new_material.setDefinition(definition) # Don't use setMetadata, as that overrides it for all materials with same base file new_material.getMetaData()["compatible"] = machine_compatibility + new_material.getMetaData()["machine_manufacturer"] = machine_manufacturer new_material.setCachedValues(cached_machine_setting_properties) @@ -597,6 +603,7 @@ class XmlMaterialProfile(InstanceContainer): new_hotend_material.addMetaDataEntry("variant", variant_containers[0].id) # Don't use setMetadata, as that overrides it for all materials with same base file new_hotend_material.getMetaData()["compatible"] = hotend_compatibility + new_hotend_material.getMetaData()["machine_manufacturer"] = machine_manufacturer cached_hotend_setting_properties = cached_machine_setting_properties.copy() cached_hotend_setting_properties.update(hotend_setting_values) |