diff options
author | fieldOfView <aldo@fieldofview.com> | 2020-05-14 12:38:30 +0300 |
---|---|---|
committer | fieldOfView <aldo@fieldofview.com> | 2020-05-14 12:38:30 +0300 |
commit | 321693d41023941f8fc5889ff42fbffbe0cb3fed (patch) | |
tree | 5d27c67299c75692d749d82c7c2ad0e8945727e0 /plugins/VersionUpgrade | |
parent | 172e6a0759b06ff2a628ae5d30f208c939bfbaa5 (diff) |
Add upgrade script to update instances of removed scripts to unified script
Diffstat (limited to 'plugins/VersionUpgrade')
-rw-r--r-- | plugins/VersionUpgrade/VersionUpgrade462to47/VersionUpgrade462to47.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/plugins/VersionUpgrade/VersionUpgrade462to47/VersionUpgrade462to47.py b/plugins/VersionUpgrade/VersionUpgrade462to47/VersionUpgrade462to47.py index c340fd0c72..62af43e9a8 100644 --- a/plugins/VersionUpgrade/VersionUpgrade462to47/VersionUpgrade462to47.py +++ b/plugins/VersionUpgrade/VersionUpgrade462to47/VersionUpgrade462to47.py @@ -88,6 +88,25 @@ class VersionUpgrade462to47(VersionUpgrade): 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) + + # Unify all Pause at Height + script_id = script_parser.sections()[0] + if script_id in ["BQ_PauseAtHeight", "PauseAtHeightRepRapFirmwareDuet", "PauseAtHeightforRepetier"]: + script_settings = script_parser.items(script_id) + script_settings.append(("pause_method", { + "BQ_PauseAtHeight": "bq", + "PauseAtHeightforRepetier": "repetier", + "PauseAtHeightRepRapFirmwareDuet": "reprap" + }[script_id])) + + # Since we cannot rename a section, we remove the original section and create a new section with the new script id. + script_parser.remove_section(script_id) + script_id = "PauseAtHeight" + script_parser.add_section(script_id) + for setting_tuple in script_settings: + script_parser.set(script_id, setting_tuple[0], setting_tuple[1]) + + # Update redo_layers to redo_layer if "PauseAtHeight" in script_parser: if "redo_layers" in script_parser["PauseAtHeight"]: script_parser["PauseAtHeight"]["redo_layer"] = str(int(script_parser["PauseAtHeight"]["redo_layers"]) > 0) |