mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
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:
parent
419326132f
commit
ee0160075e
1 changed files with 6 additions and 0 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue