Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaime van Kessel <nallath@gmail.com>2021-08-30 11:51:27 +0300
committerJaime van Kessel <nallath@gmail.com>2021-08-30 11:51:27 +0300
commit9bdeb823142469cc78766e686704908fe94bb3fe (patch)
treea75f905b646c05fe05073cee744c4c88b69d12a9 /plugins/VersionUpgrade
parent8de5e1e5b9db9a916d550401befd5ff75a90bacb (diff)
Add the missing preference upgrade for 4.9 to 4.10
This could break backups in certain cases CURA-8521
Diffstat (limited to 'plugins/VersionUpgrade')
-rw-r--r--plugins/VersionUpgrade/VersionUpgrade49to410/VersionUpgrade49to410.py19
-rw-r--r--plugins/VersionUpgrade/VersionUpgrade49to410/__init__.py1
2 files changed, 20 insertions, 0 deletions
diff --git a/plugins/VersionUpgrade/VersionUpgrade49to410/VersionUpgrade49to410.py b/plugins/VersionUpgrade/VersionUpgrade49to410/VersionUpgrade49to410.py
index 7d9186e06b..b04c396a00 100644
--- a/plugins/VersionUpgrade/VersionUpgrade49to410/VersionUpgrade49to410.py
+++ b/plugins/VersionUpgrade/VersionUpgrade49to410/VersionUpgrade49to410.py
@@ -104,6 +104,25 @@ class VersionUpgrade49to410(VersionUpgrade):
"g" : "D060"
}
+ 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"] = "17"
+
+ 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.
diff --git a/plugins/VersionUpgrade/VersionUpgrade49to410/__init__.py b/plugins/VersionUpgrade/VersionUpgrade49to410/__init__.py
index 0d5128473f..7c8dd424d1 100644
--- a/plugins/VersionUpgrade/VersionUpgrade49to410/__init__.py
+++ b/plugins/VersionUpgrade/VersionUpgrade49to410/__init__.py
@@ -21,6 +21,7 @@ def getMetaData() -> Dict[str, Any]:
("quality_changes", 4000016): ("quality_changes", 4000017, upgrade.upgradeInstanceContainer),
("quality", 4000016): ("quality", 4000017, upgrade.upgradeInstanceContainer),
("user", 4000016): ("user", 4000017, upgrade.upgradeInstanceContainer),
+ ("preferences", 7000016): ("preferences", 7000017, upgrade.upgradePreferences),
},
"sources": {
"machine_stack": {