From 6e7c4711e3dc935f3e111be52f8d392c79a35927 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 10 Feb 2017 14:58:22 +0100 Subject: [PATCH] When creating XML profiles, directly set the name The setName function is intended if the user changes the name (as by means of the edit material menu). For deserializing this simply gives too much overhead --- plugins/XmlMaterialProfile/XmlMaterialProfile.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py index 71ee719de1..999ddf19c3 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py @@ -397,9 +397,9 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): label = entry.find("./um:label", self.__namespaces) if label is not None: - self.setName(label.text) + self._name = label.text else: - self.setName(self._profile_name(material.text, color.text)) + self._name = self._profile_name(material.text, color.text) meta_data["brand"] = brand.text meta_data["material"] = material.text meta_data["color_name"] = color.text @@ -485,7 +485,8 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): else: new_material = XmlMaterialProfile(new_material_id) - new_material.setName(self.getName()) + # Update the private directly, as we want to prevent the lookup that is done when using setName + new_material._name = self.getName() new_material.setMetaData(copy.deepcopy(self.getMetaData())) new_material.setDefinition(definition) # Don't use setMetadata, as that overrides it for all materials with same base file @@ -534,7 +535,8 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): else: new_hotend_material = XmlMaterialProfile(new_hotend_id) - new_hotend_material.setName(self.getName()) + # Update the private directly, as we want to prevent the lookup that is done when using setName + new_hotend_material._name = self.getName() new_hotend_material.setMetaData(copy.deepcopy(self.getMetaData())) new_hotend_material.setDefinition(definition) new_hotend_material.addMetaDataEntry("variant", variant_containers[0].id)