mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 06:33:55 -06:00
Move the getCfgVersion to base version upgrade
They can still be overridden, but in the current situation they were all the same...
This commit is contained in:
parent
ad6f837f44
commit
de7e3f824d
15 changed files with 7 additions and 209 deletions
|
@ -213,27 +213,10 @@ _creality_limited_quality_type = {
|
|||
"extra_coarse": "draft"
|
||||
}
|
||||
|
||||
|
||||
## Upgrades configurations from the state they were in at version 4.1 to the
|
||||
# state they should be in at version 4.2.
|
||||
class VersionUpgrade41to42(VersionUpgrade):
|
||||
## Gets the version number from a CFG file in Uranium's 4.1 format.
|
||||
#
|
||||
# Since the format may change, this is implemented for the 4.1 format only
|
||||
# and needs to be included in the version upgrade system rather than
|
||||
# globally in Uranium.
|
||||
#
|
||||
# \param serialised The serialised form of a CFG file.
|
||||
# \return The version number stored in the CFG file.
|
||||
# \raises ValueError The format of the version number in the file is
|
||||
# incorrect.
|
||||
# \raises KeyError The format of the file is incorrect.
|
||||
def getCfgVersion(self, serialised: str) -> int:
|
||||
parser = configparser.ConfigParser(interpolation = None)
|
||||
parser.read_string(serialised)
|
||||
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("metadata", "setting_version", fallback = "0"))
|
||||
return format_version * 1000000 + setting_version
|
||||
|
||||
## Upgrades instance containers to have the new version
|
||||
# number.
|
||||
#
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue