mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-18 20:28:01 -06:00
Also rename setting in list of visible settings
Yeah, that's why the preferences file had a setting version number... Contributes to issue CURA-6311.
This commit is contained in:
parent
a38984dcec
commit
5fcb59d9fc
3 changed files with 31 additions and 1 deletions
|
@ -34,6 +34,8 @@ class VersionUpgrade41to42(VersionUpgrade):
|
|||
|
||||
## Upgrades instance containers to have the new version
|
||||
# number.
|
||||
#
|
||||
# This renames the renamed settings in the containers.
|
||||
def upgradeInstanceContainer(self, serialized: str, filename: str) -> Tuple[List[str], List[str]]:
|
||||
parser = configparser.ConfigParser(interpolation = None)
|
||||
parser.read_string(serialized)
|
||||
|
@ -52,6 +54,29 @@ class VersionUpgrade41to42(VersionUpgrade):
|
|||
parser.write(result)
|
||||
return [filename], [result.getvalue()]
|
||||
|
||||
## Upgrades Preferences to have the new version number.
|
||||
#
|
||||
# This renames the renamed settings in the list of visible settings.
|
||||
def upgradePreferences(self, serialized: str, filename: str) -> Tuple[List[str], List[str]]:
|
||||
parser = configparser.ConfigParser(interpolation = None)
|
||||
parser.read_string(serialized)
|
||||
|
||||
#Update version number.
|
||||
parser["metadata"]["setting_version"] = "8"
|
||||
|
||||
#Renamed settings.
|
||||
if "visible_settings" in parser["general"]:
|
||||
visible_settings = parser["general"]["visible_settings"]
|
||||
visible_settings = set(visible_settings.split(";"))
|
||||
for old_name, new_name in _renamed_settings.items():
|
||||
if old_name in visible_settings:
|
||||
visible_settings.remove(old_name)
|
||||
visible_settings.add(new_name)
|
||||
|
||||
result = io.StringIO()
|
||||
parser.write(result)
|
||||
return [filename], [result.getvalue()]
|
||||
|
||||
## Upgrades stacks to have the new version number.
|
||||
def upgradeStack(self, serialized: str, filename: str) -> Tuple[List[str], List[str]]:
|
||||
parser = configparser.ConfigParser(interpolation = None)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue