From 38a2245d74e70f50d21841043dc2c3bc8810500b Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 28 Sep 2017 16:07:03 +0200 Subject: [PATCH] XML materials are now added in one batch --- plugins/XmlMaterialProfile/XmlMaterialProfile.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py index 12fa1c9ef4..41953d9250 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py @@ -416,6 +416,7 @@ class XmlMaterialProfile(InstanceContainer): ## Overridden from InstanceContainer def deserialize(self, serialized): + containers_to_add = [] # update the serialized data first from UM.Settings.Interfaces import ContainerInterface serialized = ContainerInterface.deserialize(self, serialized) @@ -573,7 +574,7 @@ class XmlMaterialProfile(InstanceContainer): new_material._dirty = False if is_new_material: - ContainerRegistry.getInstance().addContainer(new_material) + containers_to_add.append(new_material) hotends = machine.iterfind("./um:hotend", self.__namespaces) for hotend in hotends: @@ -632,7 +633,10 @@ class XmlMaterialProfile(InstanceContainer): new_hotend_material._dirty = False if is_new_material: - ContainerRegistry.getInstance().addContainer(new_hotend_material) + containers_to_add.append(new_hotend_material) + + for container_to_add in containers_to_add: + ContainerRegistry.getInstance().addContainer(container_to_add) def _addSettingElement(self, builder, instance): try: