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.
This commit is contained in:
jelle Spijker 2021-04-02 14:03:37 +02:00 committed by Jelle Spijker
parent 67e03e8763
commit 4707560dcb
No known key found for this signature in database
GPG key ID: 6662DC033BE6B99A
2 changed files with 0 additions and 55 deletions

View file

@ -36,51 +36,6 @@ class VersionUpgrade48to49(VersionUpgrade):
parser.write(result) parser.write(result)
return [filename], [result.getvalue()] 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]]: 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 Upgrades setting visibility to have a version number and move moved settings to a different category

View file

@ -15,8 +15,6 @@ def getMetaData() -> Dict[str, Any]:
"version_upgrade": { "version_upgrade": {
# From To Upgrade function # From To Upgrade function
("preferences", 6000016): ("preferences", 6000017, upgrade.upgradePreferences), ("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), ("setting_visibility", 1000000): ("setting_visibility", 2000017, upgrade.upgradeSettingVisibility),
}, },
"sources": { "sources": {
@ -24,14 +22,6 @@ def getMetaData() -> Dict[str, Any]:
"get_version": upgrade.getCfgVersion, "get_version": upgrade.getCfgVersion,
"location": {"."} "location": {"."}
}, },
"machine_stack": {
"get_version": upgrade.getCfgVersion,
"location": {"./machine_instances"}
},
"extruder_train": {
"get_version": upgrade.getCfgVersion,
"location": {"./extruders"}
},
"setting_visibility": { "setting_visibility": {
"get_version": upgrade.getCfgVersion, "get_version": upgrade.getCfgVersion,
"location": {"./setting_visibility"} "location": {"./setting_visibility"}