diff options
Diffstat (limited to 'plugins/VersionUpgrade')
21 files changed, 164 insertions, 18 deletions
diff --git a/plugins/VersionUpgrade/VersionUpgrade21to22/plugin.json b/plugins/VersionUpgrade/VersionUpgrade21to22/plugin.json index 355716da66..d073cab35d 100644 --- a/plugins/VersionUpgrade/VersionUpgrade21to22/plugin.json +++ b/plugins/VersionUpgrade/VersionUpgrade21to22/plugin.json @@ -3,6 +3,6 @@ "author": "Ultimaker B.V.", "version": "1.0.1", "description": "Upgrades configurations from Cura 2.1 to Cura 2.2.", - "api": "7.3.0", + "api": "7.4.0", "i18n-catalog": "cura" } diff --git a/plugins/VersionUpgrade/VersionUpgrade22to24/plugin.json b/plugins/VersionUpgrade/VersionUpgrade22to24/plugin.json index 160b786ff9..12deeb6633 100644 --- a/plugins/VersionUpgrade/VersionUpgrade22to24/plugin.json +++ b/plugins/VersionUpgrade/VersionUpgrade22to24/plugin.json @@ -3,6 +3,6 @@ "author": "Ultimaker B.V.", "version": "1.0.1", "description": "Upgrades configurations from Cura 2.2 to Cura 2.4.", - "api": "7.3.0", + "api": "7.4.0", "i18n-catalog": "cura" } diff --git a/plugins/VersionUpgrade/VersionUpgrade25to26/plugin.json b/plugins/VersionUpgrade/VersionUpgrade25to26/plugin.json index 4511ee98d8..e1845c35bd 100644 --- a/plugins/VersionUpgrade/VersionUpgrade25to26/plugin.json +++ b/plugins/VersionUpgrade/VersionUpgrade25to26/plugin.json @@ -3,6 +3,6 @@ "author": "Ultimaker B.V.", "version": "1.0.1", "description": "Upgrades configurations from Cura 2.5 to Cura 2.6.", - "api": "7.3.0", + "api": "7.4.0", "i18n-catalog": "cura" } diff --git a/plugins/VersionUpgrade/VersionUpgrade26to27/plugin.json b/plugins/VersionUpgrade/VersionUpgrade26to27/plugin.json index 2add265a40..dccb398331 100644 --- a/plugins/VersionUpgrade/VersionUpgrade26to27/plugin.json +++ b/plugins/VersionUpgrade/VersionUpgrade26to27/plugin.json @@ -3,6 +3,6 @@ "author": "Ultimaker B.V.", "version": "1.0.1", "description": "Upgrades configurations from Cura 2.6 to Cura 2.7.", - "api": "7.3.0", + "api": "7.4.0", "i18n-catalog": "cura" } diff --git a/plugins/VersionUpgrade/VersionUpgrade27to30/plugin.json b/plugins/VersionUpgrade/VersionUpgrade27to30/plugin.json index a793bd3f57..9cac20968e 100644 --- a/plugins/VersionUpgrade/VersionUpgrade27to30/plugin.json +++ b/plugins/VersionUpgrade/VersionUpgrade27to30/plugin.json @@ -3,6 +3,6 @@ "author": "Ultimaker B.V.", "version": "1.0.1", "description": "Upgrades configurations from Cura 2.7 to Cura 3.0.", - "api": "7.3.0", + "api": "7.4.0", "i18n-catalog": "cura" } diff --git a/plugins/VersionUpgrade/VersionUpgrade30to31/plugin.json b/plugins/VersionUpgrade/VersionUpgrade30to31/plugin.json index 91d1b33f45..0d5b15d236 100644 --- a/plugins/VersionUpgrade/VersionUpgrade30to31/plugin.json +++ b/plugins/VersionUpgrade/VersionUpgrade30to31/plugin.json @@ -3,6 +3,6 @@ "author": "Ultimaker B.V.", "version": "1.0.1", "description": "Upgrades configurations from Cura 3.0 to Cura 3.1.", - "api": "7.3.0", + "api": "7.4.0", "i18n-catalog": "cura" } diff --git a/plugins/VersionUpgrade/VersionUpgrade32to33/plugin.json b/plugins/VersionUpgrade/VersionUpgrade32to33/plugin.json index cd87db5363..1b2838a01b 100644 --- a/plugins/VersionUpgrade/VersionUpgrade32to33/plugin.json +++ b/plugins/VersionUpgrade/VersionUpgrade32to33/plugin.json @@ -3,6 +3,6 @@ "author": "Ultimaker B.V.", "version": "1.0.1", "description": "Upgrades configurations from Cura 3.2 to Cura 3.3.", - "api": "7.3.0", + "api": "7.4.0", "i18n-catalog": "cura" } diff --git a/plugins/VersionUpgrade/VersionUpgrade33to34/plugin.json b/plugins/VersionUpgrade/VersionUpgrade33to34/plugin.json index 78746b0557..445380ae09 100644 --- a/plugins/VersionUpgrade/VersionUpgrade33to34/plugin.json +++ b/plugins/VersionUpgrade/VersionUpgrade33to34/plugin.json @@ -3,6 +3,6 @@ "author": "Ultimaker B.V.", "version": "1.0.1", "description": "Upgrades configurations from Cura 3.3 to Cura 3.4.", - "api": "7.3.0", + "api": "7.4.0", "i18n-catalog": "cura" } diff --git a/plugins/VersionUpgrade/VersionUpgrade34to35/plugin.json b/plugins/VersionUpgrade/VersionUpgrade34to35/plugin.json index b2a6db9f00..b17ab0f95f 100644 --- a/plugins/VersionUpgrade/VersionUpgrade34to35/plugin.json +++ b/plugins/VersionUpgrade/VersionUpgrade34to35/plugin.json @@ -3,6 +3,6 @@ "author": "Ultimaker B.V.", "version": "1.0.1", "description": "Upgrades configurations from Cura 3.4 to Cura 3.5.", - "api": "7.3.0", + "api": "7.4.0", "i18n-catalog": "cura" } diff --git a/plugins/VersionUpgrade/VersionUpgrade35to40/plugin.json b/plugins/VersionUpgrade/VersionUpgrade35to40/plugin.json index dde8f39bcc..67ac5f852d 100644 --- a/plugins/VersionUpgrade/VersionUpgrade35to40/plugin.json +++ b/plugins/VersionUpgrade/VersionUpgrade35to40/plugin.json @@ -3,6 +3,6 @@ "author": "Ultimaker B.V.", "version": "1.0.0", "description": "Upgrades configurations from Cura 3.5 to Cura 4.0.", - "api": "7.3.0", + "api": "7.4.0", "i18n-catalog": "cura" } diff --git a/plugins/VersionUpgrade/VersionUpgrade40to41/plugin.json b/plugins/VersionUpgrade/VersionUpgrade40to41/plugin.json index 208696935c..15a52ba484 100644 --- a/plugins/VersionUpgrade/VersionUpgrade40to41/plugin.json +++ b/plugins/VersionUpgrade/VersionUpgrade40to41/plugin.json @@ -3,6 +3,6 @@ "author": "Ultimaker B.V.", "version": "1.0.1", "description": "Upgrades configurations from Cura 4.0 to Cura 4.1.", - "api": "7.3.0", + "api": "7.4.0", "i18n-catalog": "cura" } diff --git a/plugins/VersionUpgrade/VersionUpgrade41to42/plugin.json b/plugins/VersionUpgrade/VersionUpgrade41to42/plugin.json index 53cbe93ac0..87746e87fd 100644 --- a/plugins/VersionUpgrade/VersionUpgrade41to42/plugin.json +++ b/plugins/VersionUpgrade/VersionUpgrade41to42/plugin.json @@ -3,6 +3,6 @@ "author": "Ultimaker B.V.", "version": "1.0.0", "description": "Upgrades configurations from Cura 4.1 to Cura 4.2.", - "api": "7.3.0", + "api": "7.4.0", "i18n-catalog": "cura" } diff --git a/plugins/VersionUpgrade/VersionUpgrade42to43/plugin.json b/plugins/VersionUpgrade/VersionUpgrade42to43/plugin.json index 821a6c547f..36df1bc0c3 100644 --- a/plugins/VersionUpgrade/VersionUpgrade42to43/plugin.json +++ b/plugins/VersionUpgrade/VersionUpgrade42to43/plugin.json @@ -3,6 +3,6 @@ "author": "Ultimaker B.V.", "version": "1.0.0", "description": "Upgrades configurations from Cura 4.2 to Cura 4.3.", - "api": "7.3.0", + "api": "7.4.0", "i18n-catalog": "cura" } diff --git a/plugins/VersionUpgrade/VersionUpgrade43to44/plugin.json b/plugins/VersionUpgrade/VersionUpgrade43to44/plugin.json index b605d27271..ba3f4bacd2 100644 --- a/plugins/VersionUpgrade/VersionUpgrade43to44/plugin.json +++ b/plugins/VersionUpgrade/VersionUpgrade43to44/plugin.json @@ -3,6 +3,6 @@ "author": "Ultimaker B.V.", "version": "1.0.0", "description": "Upgrades configurations from Cura 4.3 to Cura 4.4.", - "api": "7.3.0", + "api": "7.4.0", "i18n-catalog": "cura" } diff --git a/plugins/VersionUpgrade/VersionUpgrade44to45/plugin.json b/plugins/VersionUpgrade/VersionUpgrade44to45/plugin.json index 2eab8bc00c..39f01247a0 100644 --- a/plugins/VersionUpgrade/VersionUpgrade44to45/plugin.json +++ b/plugins/VersionUpgrade/VersionUpgrade44to45/plugin.json @@ -3,6 +3,6 @@ "author": "Ultimaker B.V.", "version": "1.0.0", "description": "Upgrades configurations from Cura 4.4 to Cura 4.5.", - "api": "7.3.0", + "api": "7.4.0", "i18n-catalog": "cura" } diff --git a/plugins/VersionUpgrade/VersionUpgrade45to46/plugin.json b/plugins/VersionUpgrade/VersionUpgrade45to46/plugin.json index 16313bf42f..2276a1b09d 100644 --- a/plugins/VersionUpgrade/VersionUpgrade45to46/plugin.json +++ b/plugins/VersionUpgrade/VersionUpgrade45to46/plugin.json @@ -3,6 +3,6 @@ "author": "Ultimaker B.V.", "version": "1.0.0", "description": "Upgrades configurations from Cura 4.5 to Cura 4.6.", - "api": "7.3.0", + "api": "7.4.0", "i18n-catalog": "cura" } diff --git a/plugins/VersionUpgrade/VersionUpgrade460to462/plugin.json b/plugins/VersionUpgrade/VersionUpgrade460to462/plugin.json index 479f87a4ec..5dd4596f54 100644 --- a/plugins/VersionUpgrade/VersionUpgrade460to462/plugin.json +++ b/plugins/VersionUpgrade/VersionUpgrade460to462/plugin.json @@ -3,6 +3,6 @@ "author": "Ultimaker B.V.", "version": "1.0.0", "description": "Upgrades configurations from Cura 4.6.0 to Cura 4.6.2.", - "api": "7.3.0", + "api": "7.4.0", "i18n-catalog": "cura" } diff --git a/plugins/VersionUpgrade/VersionUpgrade462to47/plugin.json b/plugins/VersionUpgrade/VersionUpgrade462to47/plugin.json index c906b0470c..fa9a209e3a 100644 --- a/plugins/VersionUpgrade/VersionUpgrade462to47/plugin.json +++ b/plugins/VersionUpgrade/VersionUpgrade462to47/plugin.json @@ -3,6 +3,6 @@ "author": "Ultimaker B.V.", "version": "1.0.0", "description": "Upgrades configurations from Cura 4.6.2 to Cura 4.7.", - "api": "7.3.0", + "api": "7.4.0", "i18n-catalog": "cura" } diff --git a/plugins/VersionUpgrade/VersionUpgrade47to48/VersionUpgrade47to48.py b/plugins/VersionUpgrade/VersionUpgrade47to48/VersionUpgrade47to48.py new file mode 100644 index 0000000000..cd7cefc846 --- /dev/null +++ b/plugins/VersionUpgrade/VersionUpgrade47to48/VersionUpgrade47to48.py @@ -0,0 +1,79 @@ +# Copyright (c) 2020 Ultimaker B.V. +# Cura is released under the terms of the LGPLv3 or higher. + +import configparser +from typing import Tuple, List +import io + +from UM.VersionUpgrade import VersionUpgrade + + +class VersionUpgrade47to48(VersionUpgrade): + def upgradePreferences(self, serialized: str, filename: str) -> Tuple[List[str], List[str]]: + """ + Upgrades preferences to have the new version number. + :param serialized: The original contents of the preferences file. + :param filename: The file name of the preferences file. + :return: A list of new file names, and a list of the new contents for + those files. + """ + parser = configparser.ConfigParser(interpolation = None) + parser.read_string(serialized) + + # Update version number. + parser["metadata"]["setting_version"] = "16" + + result = io.StringIO() + parser.write(result) + return [filename], [result.getvalue()] + + def upgradeInstanceContainer(self, serialized: str, filename: str) -> Tuple[List[str], List[str]]: + """ + Upgrades instance containers to have the new version number. + + This this also changes the unit of the Scaling Factor Shrinkage + Compensation setting. + :param serialized: The original contents of the instance container. + :param filename: The original file name of the instance container. + :return: A list of new file names, and a list of the new contents for + those files. + """ + parser = configparser.ConfigParser(interpolation = None, comment_prefixes = ()) + parser.read_string(serialized) + + # Update version number. + parser["metadata"]["setting_version"] = "16" + + if "values" in parser: + # Shrinkage factor used to be a percentage based around 0% (where 0% meant that it doesn't shrink or expand). + # Since 4.8, it is a percentage based around 100% (where 100% means that it doesn't shrink or expand). + if "material_shrinkage_percentage" in parser["values"]: + shrinkage_percentage = parser["values"]["meshfix_maximum_deviation"] + if shrinkage_percentage.startswith("="): + shrinkage_percentage = shrinkage_percentage[1:] + shrinkage_percentage = "=(" + shrinkage_percentage + ") + 100" + parser["values"]["material_shrinkage_percentage"] = shrinkage_percentage + + result = io.StringIO() + parser.write(result) + return [filename], [result.getvalue()] + + def upgradeStack(self, serialized: str, filename: str) -> Tuple[List[str], List[str]]: + """ + Upgrades stacks to have the new version number. + :param serialized: The original contents of the stack. + :param filename: The original file name of the stack. + :return: A list of new file names, and a list of the new contents for + those files. + """ + parser = configparser.ConfigParser(interpolation = None) + parser.read_string(serialized) + + # Update version number. + if "metadata" not in parser: + parser["metadata"] = {} + parser["metadata"]["setting_version"] = "16" + + result = io.StringIO() + parser.write(result) + return [filename], [result.getvalue()] diff --git a/plugins/VersionUpgrade/VersionUpgrade47to48/__init__.py b/plugins/VersionUpgrade/VersionUpgrade47to48/__init__.py new file mode 100644 index 0000000000..2149b93798 --- /dev/null +++ b/plugins/VersionUpgrade/VersionUpgrade47to48/__init__.py @@ -0,0 +1,59 @@ +# Copyright (c) 2020 Ultimaker B.V. +# Cura is released under the terms of the LGPLv3 or higher. + +from typing import Any, Dict, TYPE_CHECKING + +from . import VersionUpgrade47to48 + +if TYPE_CHECKING: + from UM.Application import Application + +upgrade = VersionUpgrade47to48.VersionUpgrade47to48() + +def getMetaData() -> Dict[str, Any]: + return { + "version_upgrade": { + # From To Upgrade function + ("preferences", 6000015): ("preferences", 6000016, upgrade.upgradePreferences), + ("machine_stack", 4000015): ("machine_stack", 4000016, upgrade.upgradeStack), + ("extruder_train", 4000015): ("extruder_train", 4000016, upgrade.upgradeStack), + ("definition_changes", 4000015): ("definition_changes", 4000016, upgrade.upgradeInstanceContainer), + ("quality_changes", 4000015): ("quality_changes", 4000016, upgrade.upgradeInstanceContainer), + ("quality", 4000015): ("quality", 4000016, upgrade.upgradeInstanceContainer), + ("user", 4000015): ("user", 4000016, upgrade.upgradeInstanceContainer), + }, + "sources": { + "preferences": { + "get_version": upgrade.getCfgVersion, + "location": {"."} + }, + "machine_stack": { + "get_version": upgrade.getCfgVersion, + "location": {"./machine_instances"} + }, + "extruder_train": { + "get_version": upgrade.getCfgVersion, + "location": {"./extruders"} + }, + "definition_changes": { + "get_version": upgrade.getCfgVersion, + "location": {"./definition_changes"} + }, + "quality_changes": { + "get_version": upgrade.getCfgVersion, + "location": {"./quality_changes"} + }, + "quality": { + "get_version": upgrade.getCfgVersion, + "location": {"./quality"} + }, + "user": { + "get_version": upgrade.getCfgVersion, + "location": {"./user"} + } + } + } + + +def register(app: "Application") -> Dict[str, Any]: + return {"version_upgrade": upgrade} diff --git a/plugins/VersionUpgrade/VersionUpgrade47to48/plugin.json b/plugins/VersionUpgrade/VersionUpgrade47to48/plugin.json new file mode 100644 index 0000000000..674a25f8ad --- /dev/null +++ b/plugins/VersionUpgrade/VersionUpgrade47to48/plugin.json @@ -0,0 +1,8 @@ +{ + "name": "Version Upgrade 4.7 to 4.8", + "author": "Ultimaker B.V.", + "version": "1.0.0", + "description": "Upgrades configurations from Cura 4.7 to Cura 4.8.", + "api": "7.4.0", + "i18n-catalog": "cura" +} |