diff options
author | Jaime van Kessel <nallath@gmail.com> | 2020-06-17 11:46:09 +0300 |
---|---|---|
committer | Jaime van Kessel <nallath@gmail.com> | 2020-06-17 11:46:09 +0300 |
commit | daa6b4f28da22c3bab9899bb9db4e4259d64ef21 (patch) | |
tree | 4d204fb10d3ee4a9edd370a93c7b97e40924e82b /plugins/VersionUpgrade | |
parent | 8de981f33d23eb94d9e473ce2effd438e683b74d (diff) |
Add upgrade script for dagoma discoeasy
CURA-7517
Diffstat (limited to 'plugins/VersionUpgrade')
-rw-r--r-- | plugins/VersionUpgrade/VersionUpgrade462to47/VersionUpgrade462to47.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/plugins/VersionUpgrade/VersionUpgrade462to47/VersionUpgrade462to47.py b/plugins/VersionUpgrade/VersionUpgrade462to47/VersionUpgrade462to47.py index 70de42ab3b..7bee545c16 100644 --- a/plugins/VersionUpgrade/VersionUpgrade462to47/VersionUpgrade462to47.py +++ b/plugins/VersionUpgrade/VersionUpgrade462to47/VersionUpgrade462to47.py @@ -2,10 +2,17 @@ # Cura is released under the terms of the LGPLv3 or higher. import configparser -from typing import Tuple, List +from typing import Tuple, List, Dict import io from UM.VersionUpgrade import VersionUpgrade + +# Renamed definition files +_RENAMED_DEFINITION_DICT = { + "dagoma_discoeasy200": "dagoma_discoeasy200_bicolor", +} # type: Dict[str, str] + + class VersionUpgrade462to47(VersionUpgrade): def upgradePreferences(self, serialized: str, filename: str) -> Tuple[List[str], List[str]]: """ @@ -71,6 +78,10 @@ class VersionUpgrade462to47(VersionUpgrade): ironing_inset = "=(" + ironing_inset + ")" + correction parser["values"]["ironing_inset"] = ironing_inset + # Check renamed definitions + if "definition" in parser["general"] and parser["general"]["definition"] in _RENAMED_DEFINITION_DICT: + parser["general"]["definition"] = _RENAMED_DEFINITION_DICT[parser["general"]["definition"]] + result = io.StringIO() parser.write(result) return [filename], [result.getvalue()] @@ -130,7 +141,9 @@ class VersionUpgrade462to47(VersionUpgrade): 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) - + # check renamed definition + if parser.has_option("containers", "7") and parser["containers"]["7"] in _RENAMED_DEFINITION_DICT: + parser["containers"]["7"] = _RENAMED_DEFINITION_DICT[parser["containers"]["7"]] result = io.StringIO() parser.write(result) return [filename], [result.getvalue()] |