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:
authorGhostkeeper <rubend@tutanota.com>2017-05-11 18:31:37 +0300
committerGhostkeeper <rubend@tutanota.com>2017-05-11 18:31:37 +0300
commit0a84a181c466957a6c2980f694abb657b333c53f (patch)
tree339f00911ea76128cbbfb41525a4b21e35b23330 /plugins/VersionUpgrade/VersionUpgrade25to26
parent639e86ca597464eadf1826193c0c4adfd0ddb948 (diff)
Track cfg version numbers with major-minor, sorta
We now have a (format) version and a setting version. Ideally we'd like major-minor version numbers in our profiles. However, introducing major-minor version numbers requires substantial changes to the version upgrade manager to compare version numbers, find a path towards the current version, or even keeping track of the current version. Therefore we just collapse the two version numbers into one: Multiply the major version number by a million and you'll never exceed it in the minor versioning. The only problem is that we now have to update the versioning for all of our three upgrade plug-ins, because they all need to know locally how to find the version number of their file types (because the upgrade manager has no knowledge of the file types) and they have no access to each other because a plug-in may be disabled. Contributes to issue CURA-3427.
Diffstat (limited to 'plugins/VersionUpgrade/VersionUpgrade25to26')
-rw-r--r--plugins/VersionUpgrade/VersionUpgrade25to26/VersionUpgrade25to26.py4
-rw-r--r--plugins/VersionUpgrade/VersionUpgrade25to26/__init__.py10
2 files changed, 8 insertions, 6 deletions
diff --git a/plugins/VersionUpgrade/VersionUpgrade25to26/VersionUpgrade25to26.py b/plugins/VersionUpgrade/VersionUpgrade25to26/VersionUpgrade25to26.py
index 3e72fdddf9..da899b03e5 100644
--- a/plugins/VersionUpgrade/VersionUpgrade25to26/VersionUpgrade25to26.py
+++ b/plugins/VersionUpgrade/VersionUpgrade25to26/VersionUpgrade25to26.py
@@ -34,7 +34,9 @@ class VersionUpgrade25to26(VersionUpgrade):
def getCfgVersion(self, serialised):
parser = configparser.ConfigParser(interpolation = None)
parser.read_string(serialised)
- return int(parser.get("general", "version")) #Explicitly give an exception when this fails. That means that the file format is not recognised.
+ format_version = int(parser.get("general", "version")) #Explicitly give an exception when this fails. That means that the file format is not recognised.
+ setting_version = int(parser.get("general", "version", fallback = 0))
+ return format_version * 1000000 + setting_version
## Upgrades the preferences file from version 2.5 to 2.6.
#
diff --git a/plugins/VersionUpgrade/VersionUpgrade25to26/__init__.py b/plugins/VersionUpgrade/VersionUpgrade25to26/__init__.py
index e586d1758c..05e8e0e4cf 100644
--- a/plugins/VersionUpgrade/VersionUpgrade25to26/__init__.py
+++ b/plugins/VersionUpgrade/VersionUpgrade25to26/__init__.py
@@ -18,11 +18,11 @@ def getMetaData():
"api": 3
},
"version_upgrade": {
- # From To Upgrade function
- ("preferences", 4): ("preferences", 5, upgrade.upgradePreferences),
- ("quality", 2): ("quality", 3, upgrade.upgradeInstanceContainer),
- ("variant", 2): ("variant", 3, upgrade.upgradeInstanceContainer), #We can re-use upgradeContainerStack since there is nothing specific to quality, variant or user profiles being changed.
- ("user", 2): ("user", 3, upgrade.upgradeInstanceContainer)
+ # From To Upgrade function
+ ("preferences", 4000000): ("preferences", 4000001, upgrade.upgradePreferences),
+ ("quality", 2000000): ("quality", 2000001, upgrade.upgradeInstanceContainer),
+ ("variant", 2000000): ("variant", 2000001, upgrade.upgradeInstanceContainer), #We can re-use upgradeContainerStack since there is nothing specific to quality, variant or user profiles being changed.
+ ("user", 2000000): ("user", 2000001, upgrade.upgradeInstanceContainer)
},
"sources": {
"quality": {