mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
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.
This commit is contained in:
parent
639e86ca59
commit
0a84a181c4
6 changed files with 22 additions and 16 deletions
|
@ -249,7 +249,9 @@ class VersionUpgrade21to22(VersionUpgrade):
|
||||||
def getCfgVersion(self, serialised):
|
def getCfgVersion(self, serialised):
|
||||||
parser = configparser.ConfigParser(interpolation = None)
|
parser = configparser.ConfigParser(interpolation = None)
|
||||||
parser.read_string(serialised)
|
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
|
||||||
|
|
||||||
## Gets the fallback quality to use for a specific machine-variant-material
|
## Gets the fallback quality to use for a specific machine-variant-material
|
||||||
# combination.
|
# combination.
|
||||||
|
|
|
@ -19,9 +19,9 @@ def getMetaData():
|
||||||
},
|
},
|
||||||
"version_upgrade": {
|
"version_upgrade": {
|
||||||
# From To Upgrade function
|
# From To Upgrade function
|
||||||
("profile", 1): ("quality", 2, upgrade.upgradeProfile),
|
("profile", 1000000): ("quality", 2000000, upgrade.upgradeProfile),
|
||||||
("machine_instance", 1): ("machine_stack", 2, upgrade.upgradeMachineInstance),
|
("machine_instance", 1000000): ("machine_stack", 2000000, upgrade.upgradeMachineInstance),
|
||||||
("preferences", 2): ("preferences", 3, upgrade.upgradePreferences)
|
("preferences", 2000000): ("preferences", 3000000, upgrade.upgradePreferences)
|
||||||
},
|
},
|
||||||
"sources": {
|
"sources": {
|
||||||
"profile": {
|
"profile": {
|
||||||
|
|
|
@ -144,4 +144,6 @@ class VersionUpgrade22to24(VersionUpgrade):
|
||||||
def getCfgVersion(self, serialised):
|
def getCfgVersion(self, serialised):
|
||||||
parser = configparser.ConfigParser(interpolation = None)
|
parser = configparser.ConfigParser(interpolation = None)
|
||||||
parser.read_string(serialised)
|
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
|
||||||
|
|
|
@ -19,9 +19,9 @@ def getMetaData():
|
||||||
},
|
},
|
||||||
"version_upgrade": {
|
"version_upgrade": {
|
||||||
# From To Upgrade function
|
# From To Upgrade function
|
||||||
("machine_instance", 2): ("machine_stack", 3, upgrade.upgradeMachineInstance),
|
("machine_instance", 2000000): ("machine_stack", 3000000, upgrade.upgradeMachineInstance),
|
||||||
("extruder_train", 2): ("extruder_train", 3, upgrade.upgradeExtruderTrain),
|
("extruder_train", 2000000): ("extruder_train", 3000000, upgrade.upgradeExtruderTrain),
|
||||||
("preferences", 3): ("preferences", 4, upgrade.upgradePreferences)
|
("preferences", 3000000): ("preferences", 4000000, upgrade.upgradePreferences)
|
||||||
|
|
||||||
},
|
},
|
||||||
"sources": {
|
"sources": {
|
||||||
|
|
|
@ -34,7 +34,9 @@ class VersionUpgrade25to26(VersionUpgrade):
|
||||||
def getCfgVersion(self, serialised):
|
def getCfgVersion(self, serialised):
|
||||||
parser = configparser.ConfigParser(interpolation = None)
|
parser = configparser.ConfigParser(interpolation = None)
|
||||||
parser.read_string(serialised)
|
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.
|
## Upgrades the preferences file from version 2.5 to 2.6.
|
||||||
#
|
#
|
||||||
|
|
|
@ -19,10 +19,10 @@ def getMetaData():
|
||||||
},
|
},
|
||||||
"version_upgrade": {
|
"version_upgrade": {
|
||||||
# From To Upgrade function
|
# From To Upgrade function
|
||||||
("preferences", 4): ("preferences", 5, upgrade.upgradePreferences),
|
("preferences", 4000000): ("preferences", 4000001, upgrade.upgradePreferences),
|
||||||
("quality", 2): ("quality", 3, upgrade.upgradeInstanceContainer),
|
("quality", 2000000): ("quality", 2000001, 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.
|
("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", 2): ("user", 3, upgrade.upgradeInstanceContainer)
|
("user", 2000000): ("user", 2000001, upgrade.upgradeInstanceContainer)
|
||||||
},
|
},
|
||||||
"sources": {
|
"sources": {
|
||||||
"quality": {
|
"quality": {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue