mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-12 17:27:51 -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
|
@ -236,23 +236,11 @@ _variant_translations_materials = {
|
||||||
}
|
}
|
||||||
} # type: Dict[str, Dict[str, str]]
|
} # type: Dict[str, Dict[str, str]]
|
||||||
|
|
||||||
|
|
||||||
## Converts configuration from Cura 2.1's file formats to Cura 2.2's.
|
## Converts configuration from Cura 2.1's file formats to Cura 2.2's.
|
||||||
#
|
#
|
||||||
# It converts the machine instances and profiles.
|
# It converts the machine instances and profiles.
|
||||||
class VersionUpgrade21to22(VersionUpgrade):
|
class VersionUpgrade21to22(VersionUpgrade):
|
||||||
## Gets the version number from a config file.
|
|
||||||
#
|
|
||||||
# In all config files that concern this version upgrade, the version
|
|
||||||
# number is stored in general/version, so get the data from that key.
|
|
||||||
#
|
|
||||||
# \param serialised The contents of a config file.
|
|
||||||
# \return The version number of that config file.
|
|
||||||
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
|
|
||||||
|
|
||||||
## 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,6 +19,7 @@ _split_settings = { #These settings should be copied to all settings it was spli
|
||||||
"support_interface_line_distance": {"support_roof_line_distance", "support_bottom_line_distance"}
|
"support_interface_line_distance": {"support_roof_line_distance", "support_bottom_line_distance"}
|
||||||
} # type: Dict[str, Set[str]]
|
} # type: Dict[str, Set[str]]
|
||||||
|
|
||||||
|
|
||||||
## A collection of functions that convert the configuration of the user in Cura
|
## A collection of functions that convert the configuration of the user in Cura
|
||||||
# 2.5 to a configuration for Cura 2.6.
|
# 2.5 to a configuration for Cura 2.6.
|
||||||
#
|
#
|
||||||
|
@ -28,24 +29,6 @@ class VersionUpgrade25to26(VersionUpgrade):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self._current_fdm_printer_count = 2
|
self._current_fdm_printer_count = 2
|
||||||
|
|
||||||
## Gets the version number from a CFG file in Uranium's 2.5 format.
|
|
||||||
#
|
|
||||||
# Since the format may change, this is implemented for the 2.5 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 the preferences file from version 2.5 to 2.6.
|
## Upgrades the preferences file from version 2.5 to 2.6.
|
||||||
#
|
#
|
||||||
# \param serialised The serialised form of a preferences file.
|
# \param serialised The serialised form of a preferences file.
|
||||||
|
|
|
@ -64,29 +64,12 @@ _renamed_quality_profiles = {
|
||||||
"um3_bb0.8_TPU_Not_Supported_Superdraft_Quality": "um3_bb0.8_TPU_Superdraft_Print",
|
"um3_bb0.8_TPU_Not_Supported_Superdraft_Quality": "um3_bb0.8_TPU_Superdraft_Print",
|
||||||
} # type: Dict[str, str]
|
} # type: Dict[str, str]
|
||||||
|
|
||||||
|
|
||||||
## A collection of functions that convert the configuration of the user in Cura
|
## A collection of functions that convert the configuration of the user in Cura
|
||||||
# 2.6 to a configuration for Cura 2.7.
|
# 2.6 to a configuration for Cura 2.7.
|
||||||
#
|
#
|
||||||
# All of these methods are essentially stateless.
|
# All of these methods are essentially stateless.
|
||||||
class VersionUpgrade26to27(VersionUpgrade):
|
class VersionUpgrade26to27(VersionUpgrade):
|
||||||
## Gets the version number from a CFG file in Uranium's 2.6 format.
|
|
||||||
#
|
|
||||||
# Since the format may change, this is implemented for the 2.6 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 a preferences file from version 2.6 to 2.7.
|
## Upgrades a preferences file from version 2.6 to 2.7.
|
||||||
#
|
#
|
||||||
# \param serialised The serialised form of a preferences file.
|
# \param serialised The serialised form of a preferences file.
|
||||||
|
|
|
@ -62,24 +62,6 @@ _RENAMED_DEFINITION_DICT = {
|
||||||
|
|
||||||
|
|
||||||
class VersionUpgrade30to31(VersionUpgrade):
|
class VersionUpgrade30to31(VersionUpgrade):
|
||||||
## Gets the version number from a CFG file in Uranium's 3.0 format.
|
|
||||||
#
|
|
||||||
# Since the format may change, this is implemented for the 3.0 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 a preferences file from version 3.0 to 3.1.
|
## Upgrades a preferences file from version 3.0 to 3.1.
|
||||||
#
|
#
|
||||||
# \param serialised The serialised form of a preferences file.
|
# \param serialised The serialised form of a preferences file.
|
||||||
|
|
|
@ -68,24 +68,6 @@ _RENAMED_QUALITY_TYPES = {
|
||||||
class VersionUpgrade32to33(VersionUpgrade):
|
class VersionUpgrade32to33(VersionUpgrade):
|
||||||
temporary_group_name_counter = 1
|
temporary_group_name_counter = 1
|
||||||
|
|
||||||
## Gets the version number from a CFG file in Uranium's 3.2 format.
|
|
||||||
#
|
|
||||||
# Since the format may change, this is implemented for the 3.2 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 a preferences file from version 3.2 to 3.3.
|
## Upgrades a preferences file from version 3.2 to 3.3.
|
||||||
#
|
#
|
||||||
# \param serialised The serialised form of a preferences file.
|
# \param serialised The serialised form of a preferences file.
|
||||||
|
|
|
@ -14,24 +14,6 @@ _renamed_settings = {
|
||||||
## Upgrades configurations from the state they were in at version 3.3 to the
|
## Upgrades configurations from the state they were in at version 3.3 to the
|
||||||
# state they should be in at version 3.4.
|
# state they should be in at version 3.4.
|
||||||
class VersionUpgrade33to34(VersionUpgrade):
|
class VersionUpgrade33to34(VersionUpgrade):
|
||||||
## Gets the version number from a CFG file in Uranium's 3.3 format.
|
|
||||||
#
|
|
||||||
# Since the format may change, this is implemented for the 3.3 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
|
## Upgrades instance containers to have the new version
|
||||||
# number.
|
# number.
|
||||||
def upgradeInstanceContainer(self, serialized: str, filename: str) -> Tuple[List[str], List[str]]:
|
def upgradeInstanceContainer(self, serialized: str, filename: str) -> Tuple[List[str], List[str]]:
|
||||||
|
|
|
@ -63,24 +63,6 @@ _RENAMED_MATERIAL_PROFILES = {
|
||||||
## Upgrades configurations from the state they were in at version 3.4 to the
|
## Upgrades configurations from the state they were in at version 3.4 to the
|
||||||
# state they should be in at version 3.5.
|
# state they should be in at version 3.5.
|
||||||
class VersionUpgrade34to35(VersionUpgrade):
|
class VersionUpgrade34to35(VersionUpgrade):
|
||||||
## Gets the version number from a CFG file in Uranium's 3.4 format.
|
|
||||||
#
|
|
||||||
# Since the format may change, this is implemented for the 3.4 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 Preferences to have the new version number.
|
## Upgrades Preferences to have the new version number.
|
||||||
def upgradePreferences(self, serialized: str, filename: str) -> Tuple[List[str], List[str]]:
|
def upgradePreferences(self, serialized: str, filename: str) -> Tuple[List[str], List[str]]:
|
||||||
parser = configparser.ConfigParser(interpolation = None)
|
parser = configparser.ConfigParser(interpolation = None)
|
||||||
|
|
|
@ -34,13 +34,6 @@ class VersionUpgrade35to40(VersionUpgrade):
|
||||||
parser.write(result)
|
parser.write(result)
|
||||||
return [filename], [result.getvalue()]
|
return [filename], [result.getvalue()]
|
||||||
|
|
||||||
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 Preferences to have the new version number.
|
## Upgrades Preferences to have the new version number.
|
||||||
def upgradePreferences(self, serialized: str, filename: str) -> Tuple[List[str], List[str]]:
|
def upgradePreferences(self, serialized: str, filename: str) -> Tuple[List[str], List[str]]:
|
||||||
parser = configparser.ConfigParser(interpolation=None)
|
parser = configparser.ConfigParser(interpolation=None)
|
||||||
|
|
|
@ -23,24 +23,6 @@ _renamed_quality_profiles = {
|
||||||
## Upgrades configurations from the state they were in at version 4.0 to the
|
## Upgrades configurations from the state they were in at version 4.0 to the
|
||||||
# state they should be in at version 4.1.
|
# state they should be in at version 4.1.
|
||||||
class VersionUpgrade40to41(VersionUpgrade):
|
class VersionUpgrade40to41(VersionUpgrade):
|
||||||
## Gets the version number from a CFG file in Uranium's 4.0 format.
|
|
||||||
#
|
|
||||||
# Since the format may change, this is implemented for the 4.0 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
|
## Upgrades instance containers to have the new version
|
||||||
# number.
|
# number.
|
||||||
def upgradeInstanceContainer(self, serialized: str, filename: str) -> Tuple[List[str], List[str]]:
|
def upgradeInstanceContainer(self, serialized: str, filename: str) -> Tuple[List[str], List[str]]:
|
||||||
|
|
|
@ -213,27 +213,10 @@ _creality_limited_quality_type = {
|
||||||
"extra_coarse": "draft"
|
"extra_coarse": "draft"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
## Upgrades configurations from the state they were in at version 4.1 to the
|
## Upgrades configurations from the state they were in at version 4.1 to the
|
||||||
# state they should be in at version 4.2.
|
# state they should be in at version 4.2.
|
||||||
class VersionUpgrade41to42(VersionUpgrade):
|
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
|
## Upgrades instance containers to have the new version
|
||||||
# number.
|
# number.
|
||||||
#
|
#
|
||||||
|
|
|
@ -56,27 +56,10 @@ _renamed_settings = {
|
||||||
"support_infill_angle": "support_infill_angles"
|
"support_infill_angle": "support_infill_angles"
|
||||||
} # type: Dict[str, str]
|
} # type: Dict[str, str]
|
||||||
|
|
||||||
|
|
||||||
## Upgrades configurations from the state they were in at version 4.2 to the
|
## Upgrades configurations from the state they were in at version 4.2 to the
|
||||||
# state they should be in at version 4.3.
|
# state they should be in at version 4.3.
|
||||||
class VersionUpgrade42to43(VersionUpgrade):
|
class VersionUpgrade42to43(VersionUpgrade):
|
||||||
## Gets the version number from a CFG file in Uranium's 4.2 format.
|
|
||||||
#
|
|
||||||
# Since the format may change, this is implemented for the 4.2 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
|
|
||||||
|
|
||||||
def upgradePreferences(self, serialized: str, filename: str):
|
def upgradePreferences(self, serialized: str, filename: str):
|
||||||
parser = configparser.ConfigParser(interpolation = None)
|
parser = configparser.ConfigParser(interpolation = None)
|
||||||
parser.read_string(serialized)
|
parser.read_string(serialized)
|
||||||
|
|
|
@ -26,12 +26,6 @@ _renamed_container_id_map = {
|
||||||
|
|
||||||
|
|
||||||
class VersionUpgrade43to44(VersionUpgrade):
|
class VersionUpgrade43to44(VersionUpgrade):
|
||||||
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 Preferences to have the new version number.
|
## Upgrades Preferences to have the new version number.
|
||||||
#
|
#
|
||||||
|
|
|
@ -122,13 +122,6 @@ class VersionUpgrade44to45(VersionUpgrade):
|
||||||
except OSError: # Is a directory, file not found, or insufficient rights.
|
except OSError: # Is a directory, file not found, or insufficient rights.
|
||||||
continue
|
continue
|
||||||
|
|
||||||
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 Preferences to have the new version number.
|
## Upgrades Preferences to have the new version number.
|
||||||
#
|
#
|
||||||
# This renames the renamed settings in the list of visible settings.
|
# This renames the renamed settings in the list of visible settings.
|
||||||
|
|
|
@ -10,14 +10,8 @@ _removed_settings = {
|
||||||
"machine_filament_park_distance",
|
"machine_filament_park_distance",
|
||||||
}
|
}
|
||||||
|
|
||||||
class VersionUpgrade45to46(VersionUpgrade):
|
|
||||||
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
|
|
||||||
|
|
||||||
|
class VersionUpgrade45to46(VersionUpgrade):
|
||||||
def upgradePreferences(self, serialized: str, filename: str) -> Tuple[List[str], List[str]]:
|
def upgradePreferences(self, serialized: str, filename: str) -> Tuple[List[str], List[str]]:
|
||||||
"""
|
"""
|
||||||
Upgrades preferences to have the new version number.
|
Upgrades preferences to have the new version number.
|
||||||
|
|
|
@ -6,14 +6,8 @@ from typing import Tuple, List
|
||||||
import io
|
import io
|
||||||
from UM.VersionUpgrade import VersionUpgrade
|
from UM.VersionUpgrade import VersionUpgrade
|
||||||
|
|
||||||
class VersionUpgrade46to47(VersionUpgrade):
|
|
||||||
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
|
|
||||||
|
|
||||||
|
class VersionUpgrade46to47(VersionUpgrade):
|
||||||
def upgradePreferences(self, serialized: str, filename: str) -> Tuple[List[str], List[str]]:
|
def upgradePreferences(self, serialized: str, filename: str) -> Tuple[List[str], List[str]]:
|
||||||
"""
|
"""
|
||||||
Upgrades preferences to have the new version number.
|
Upgrades preferences to have the new version number.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue