Merge branch 'main' into CURA-12138-Export_for_support_option

This commit is contained in:
Erwan MATHIEU 2024-09-27 15:48:02 +02:00 committed by GitHub
commit 4d2c879d1d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 182 additions and 27 deletions

View file

@ -11,6 +11,7 @@ import xml.etree.ElementTree as ET
from UM.PluginRegistry import PluginRegistry
from UM.Resources import Resources
from UM.Logger import Logger
from UM.Decorators import CachedMemberFunctions
import UM.Dictionary
from UM.Settings.InstanceContainer import InstanceContainer
from UM.Settings.ContainerRegistry import ContainerRegistry
@ -71,6 +72,8 @@ class XmlMaterialProfile(InstanceContainer):
Logger.log("w", "Can't change metadata {key} of material {material_id} because it's read-only.".format(key = key, material_id = self.getId()))
return
CachedMemberFunctions.clearInstanceCache(self)
# Some metadata such as diameter should also be instantiated to be a setting. Go though all values for the
# "properties" field and apply the new values to SettingInstances as well.
new_setting_values_dict = {}
@ -480,6 +483,7 @@ class XmlMaterialProfile(InstanceContainer):
first.append(element)
def clearData(self):
CachedMemberFunctions.clearInstanceCache(self)
self._metadata = {
"id": self.getId(),
"name": ""
@ -519,6 +523,8 @@ class XmlMaterialProfile(InstanceContainer):
def deserialize(self, serialized, file_name = None):
"""Overridden from InstanceContainer"""
CachedMemberFunctions.clearInstanceCache(self)
containers_to_add = []
# update the serialized data first
from UM.Settings.Interfaces import ContainerInterface