mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 22:54:01 -06:00
Merge branch 'master' into feature_local_container_server
Contributes to issue CURA-4243.
This commit is contained in:
commit
dad99f5292
542 changed files with 35309 additions and 16367 deletions
|
@ -39,7 +39,7 @@ class XmlMaterialProfile(InstanceContainer):
|
|||
@classmethod
|
||||
def xmlVersionToSettingVersion(cls, xml_version: str) -> int:
|
||||
if xml_version == "1.3":
|
||||
return 3
|
||||
return CuraApplication.SettingVersion
|
||||
return 0 #Older than 1.3.
|
||||
|
||||
def getInheritedFiles(self):
|
||||
|
@ -399,7 +399,7 @@ class XmlMaterialProfile(InstanceContainer):
|
|||
def getVersionFromSerialized(cls, serialized: str) -> Optional[int]:
|
||||
data = ET.fromstring(serialized)
|
||||
|
||||
version = 1
|
||||
version = XmlMaterialProfile.Version
|
||||
# get setting version
|
||||
if "version" in data.attrib:
|
||||
setting_version = cls.xmlVersionToSettingVersion(data.attrib["version"])
|
||||
|
@ -409,11 +409,11 @@ class XmlMaterialProfile(InstanceContainer):
|
|||
return version * 1000000 + setting_version
|
||||
|
||||
## Overridden from InstanceContainer
|
||||
def deserialize(self, serialized):
|
||||
def deserialize(self, serialized, file_name = None):
|
||||
containers_to_add = []
|
||||
# update the serialized data first
|
||||
from UM.Settings.Interfaces import ContainerInterface
|
||||
serialized = ContainerInterface.deserialize(self, serialized)
|
||||
serialized = ContainerInterface.deserialize(self, serialized, file_name)
|
||||
|
||||
try:
|
||||
data = ET.fromstring(serialized)
|
||||
|
@ -502,8 +502,6 @@ class XmlMaterialProfile(InstanceContainer):
|
|||
elif key in self.__unmapped_settings:
|
||||
if key == "hardware compatible":
|
||||
common_compatibility = self._parseCompatibleValue(entry.text)
|
||||
else:
|
||||
Logger.log("d", "Unsupported material setting %s", key)
|
||||
self._cached_values = common_setting_values # from InstanceContainer ancestor
|
||||
|
||||
meta_data["compatible"] = common_compatibility
|
||||
|
|
|
@ -5,24 +5,16 @@ import xml.etree.ElementTree as ET
|
|||
|
||||
from UM.VersionUpgrade import VersionUpgrade
|
||||
|
||||
from cura.CuraApplication import CuraApplication
|
||||
from .XmlMaterialProfile import XmlMaterialProfile
|
||||
|
||||
|
||||
class XmlMaterialUpgrader(VersionUpgrade):
|
||||
def getXmlVersion(self, serialized):
|
||||
data = ET.fromstring(serialized)
|
||||
|
||||
version = 1
|
||||
# get setting version
|
||||
if "version" in data.attrib:
|
||||
setting_version = self._xmlVersionToSettingVersion(data.attrib["version"])
|
||||
else:
|
||||
setting_version = self._xmlVersionToSettingVersion("1.2")
|
||||
|
||||
return version * 1000000 + setting_version
|
||||
return XmlMaterialProfile.getVersionFromSerialized(serialized)
|
||||
|
||||
def _xmlVersionToSettingVersion(self, xml_version: str) -> int:
|
||||
if xml_version == "1.3":
|
||||
return 2
|
||||
return 0 #Older than 1.3.
|
||||
return XmlMaterialProfile.xmlVersionToSettingVersion(xml_version)
|
||||
|
||||
def upgradeMaterial(self, serialised, filename):
|
||||
data = ET.fromstring(serialised)
|
||||
|
|
|
@ -19,7 +19,7 @@ def getMetaData():
|
|||
"mimetype": "application/x-ultimaker-material-profile"
|
||||
},
|
||||
"version_upgrade": {
|
||||
("materials", 1000000): ("materials", 1000003, upgrader.upgradeMaterial),
|
||||
("materials", 1000000): ("materials", 1000004, upgrader.upgradeMaterial),
|
||||
},
|
||||
"sources": {
|
||||
"materials": {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue