From 071005541c4174e0eaea0a9a22d3e29825eeb13e Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 6 Jul 2017 14:47:56 +0200 Subject: [PATCH] Use XMLMaterialProfile version tag to determine its version CURA-2724 --- plugins/XmlMaterialProfile/XmlMaterialProfile.py | 9 ++------- plugins/XmlMaterialProfile/XmlMaterialUpgrader.py | 6 +----- plugins/XmlMaterialProfile/__init__.py | 4 +--- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py index 9319280119..b6b3e0671c 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py @@ -12,9 +12,8 @@ from UM.Util import parseBool from cura.CuraApplication import CuraApplication import UM.Dictionary -from UM.Settings.InstanceContainer import InstanceContainer, InvalidInstanceError +from UM.Settings.InstanceContainer import InstanceContainer from UM.Settings.ContainerRegistry import ContainerRegistry -from cura.Settings.CuraContainerRegistry import CuraContainerRegistry ## Handles serializing and deserializing material containers from an XML file @@ -37,11 +36,7 @@ class XmlMaterialProfile(InstanceContainer): # \return The corresponding setting_version. def xmlVersionToSettingVersion(self, xml_version: str) -> int: if xml_version == "1.3": - return 2 # FIXME & HACK: This is temporary hack. The setting_version has been increased in CuraApplication, - # but we haven't decided on how to determine the versions of an XMLMaterialProfile yet. - # This MUST be fixed after the decision has been made. - if xml_version == "1.3": - return 1 + return 2 return 0 #Older than 1.3. def getInheritedFiles(self): diff --git a/plugins/XmlMaterialProfile/XmlMaterialUpgrader.py b/plugins/XmlMaterialProfile/XmlMaterialUpgrader.py index 140c0712a3..c93c476c2e 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialUpgrader.py +++ b/plugins/XmlMaterialProfile/XmlMaterialUpgrader.py @@ -21,11 +21,7 @@ class XmlMaterialUpgrader(VersionUpgrade): def _xmlVersionToSettingVersion(self, xml_version: str) -> int: if xml_version == "1.3": - return 2 # FIXME & HACK: This is temporary hack. The setting_version has been increased in CuraApplication, - # but we haven't decided on how to determine the versions of an XMLMaterialProfile yet. - # This MUST be fixed after the decision has been made. - if xml_version == "1.3": - return 1 + return 2 return 0 #Older than 1.3. def upgradeMaterial(self, serialised, filename): diff --git a/plugins/XmlMaterialProfile/__init__.py b/plugins/XmlMaterialProfile/__init__.py index 3effe702be..6ad4a279d0 100644 --- a/plugins/XmlMaterialProfile/__init__.py +++ b/plugins/XmlMaterialProfile/__init__.py @@ -19,9 +19,7 @@ def getMetaData(): "mimetype": "application/x-ultimaker-material-profile" }, "version_upgrade": { - ("materials", 1000000): ("materials", 1000001, upgrader.upgradeMaterial), - # FIXME: This needs to be changed once we have decided on how to determine the versions - ("materials", 1000001): ("materials", 1000002, upgrader.upgradeMaterial), + ("materials", 1000000): ("materials", 1000002, upgrader.upgradeMaterial), }, "sources": { "materials": {