From 4707560dcbf6ea85c9ff04ee5998e173cc63fe86 Mon Sep 17 00:00:00 2001 From: jelle Spijker Date: Fri, 2 Apr 2021 14:03:37 +0200 Subject: [PATCH] Removed the upgrader for the machine and extruder stack It is known that will cause some user scripts to default behaviour. But this is accepted behaviour, and the benefits of not upgrading the Cura Application version outweigh this. --- .../VersionUpgrade48to49.py | 45 ------------------- .../VersionUpgrade48to49/__init__.py | 10 ----- 2 files changed, 55 deletions(-) diff --git a/plugins/VersionUpgrade/VersionUpgrade48to49/VersionUpgrade48to49.py b/plugins/VersionUpgrade/VersionUpgrade48to49/VersionUpgrade48to49.py index c0a61b1014..50e2bc09fa 100644 --- a/plugins/VersionUpgrade/VersionUpgrade48to49/VersionUpgrade48to49.py +++ b/plugins/VersionUpgrade/VersionUpgrade48to49/VersionUpgrade48to49.py @@ -36,51 +36,6 @@ class VersionUpgrade48to49(VersionUpgrade): 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. - - This updates the post-processing scripts with new parameters. - :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"] = "17" - - # Update Display Progress on LCD script parameters if present. - if "post_processing_scripts" in parser["metadata"]: - new_scripts_entries = [] - for script_str in parser["metadata"]["post_processing_scripts"].split("\n"): - if not script_str: - continue - script_str = script_str.replace(r"\\\n", "\n").replace(r"\\\\", "\\\\") # Unescape escape sequences. - script_parser = configparser.ConfigParser(interpolation=None) - script_parser.optionxform = str # type: ignore # Don't transform the setting keys as they are case-sensitive. - script_parser.read_string(script_str) - - # Update Display Progress on LCD parameters. - script_id = script_parser.sections()[0] - if script_id == "DisplayProgressOnLCD": - script_parser[script_id]["time_remaining"] = "m117" if script_parser[script_id]["time_remaining"] == "True" else "none" - - script_io = io.StringIO() - script_parser.write(script_io) - script_str = script_io.getvalue() - script_str = script_str.replace("\\\\", r"\\\\").replace("\n", r"\\\n") # Escape newlines because configparser sees those as section delimiters. - new_scripts_entries.append(script_str) - parser["metadata"]["post_processing_scripts"] = "\n".join(new_scripts_entries) - - result = io.StringIO() - parser.write(result) - return [filename], [result.getvalue()] - def upgradeSettingVisibility(self, serialized: str, filename: str) -> Tuple[List[str], List[str]]: """ Upgrades setting visibility to have a version number and move moved settings to a different category diff --git a/plugins/VersionUpgrade/VersionUpgrade48to49/__init__.py b/plugins/VersionUpgrade/VersionUpgrade48to49/__init__.py index a9ee18befc..808ca6c1ae 100644 --- a/plugins/VersionUpgrade/VersionUpgrade48to49/__init__.py +++ b/plugins/VersionUpgrade/VersionUpgrade48to49/__init__.py @@ -15,8 +15,6 @@ def getMetaData() -> Dict[str, Any]: "version_upgrade": { # From To Upgrade function ("preferences", 6000016): ("preferences", 6000017, upgrade.upgradePreferences), - ("machine_stack", 4000016): ("machine_stack", 4000017, upgrade.upgradeStack), - ("extruder_train", 4000016): ("extruder_train", 4000017, upgrade.upgradeStack), ("setting_visibility", 1000000): ("setting_visibility", 2000017, upgrade.upgradeSettingVisibility), }, "sources": { @@ -24,14 +22,6 @@ def getMetaData() -> Dict[str, Any]: "get_version": upgrade.getCfgVersion, "location": {"."} }, - "machine_stack": { - "get_version": upgrade.getCfgVersion, - "location": {"./machine_instances"} - }, - "extruder_train": { - "get_version": upgrade.getCfgVersion, - "location": {"./extruders"} - }, "setting_visibility": { "get_version": upgrade.getCfgVersion, "location": {"./setting_visibility"}