Override InstanceContainer::duplicate in XmlMAterialProfile

So that we can set a new GUID for the material on duplicate

Contributes to CURA-342
This commit is contained in:
Arjen Hiemstra 2016-06-30 01:55:53 +02:00
parent 419326132f
commit ee0160075e

View file

@ -5,6 +5,7 @@ import math
import copy
import io
import xml.etree.ElementTree as ET
import uuid
from UM.Logger import Logger
@ -22,6 +23,11 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer):
def __init__(self, container_id, *args, **kwargs):
super().__init__(container_id, *args, **kwargs)
def duplicate(self, new_id, new_name = None):
result = super().duplicate(self.getMetaDataEntry("brand") + "_" + new_id, new_name)
result.setMetaDataEntry("GUID", str(uuid.uuid4()))
return result
def serialize(self):
if self.getDefinition().id != "fdmprinter":
# Since we create an instance of XmlMaterialProfile for each machine and nozzle in the profile,