mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-13 01:37:51 -06:00
Allow setting visibilities to be upgraded
CURA-8810_version_upgrade
This commit is contained in:
parent
85fa07f6dd
commit
77ea5e5e89
4 changed files with 49 additions and 9 deletions
|
@ -92,3 +92,35 @@ class VersionUpgrade48to49(VersionUpgrade):
|
|||
result = io.StringIO()
|
||||
parser.write(result)
|
||||
return [filename], [result.getvalue()]
|
||||
|
||||
def upgradeSettingVisibility(self, serialized: str, filename: str) -> Tuple[List[str], List[str]]:
|
||||
"""
|
||||
Upgrades setting visibility to have a version number and move moved settings to a different category
|
||||
|
||||
This updates the post-processing scripts with new parameters.
|
||||
:param serialized: The original contents of the stack.
|
||||
:param filename: The original file name of the stack.
|
||||
:return: A list of new file names, and a list of the new contents for
|
||||
those files.
|
||||
"""
|
||||
parser = configparser.ConfigParser(interpolation = None, allow_no_value=True)
|
||||
parser.read_string(serialized)
|
||||
|
||||
moved_settings = ["top_bottom_extruder_nr", "top_bottom_thickness", "top_thickness", "top_layers",
|
||||
"bottom_thickness", "bottom_layers", "ironing_enabled"]
|
||||
|
||||
# add version number for the first time
|
||||
parser["general"]["version"] = "2"
|
||||
|
||||
if "top_bottom" not in parser:
|
||||
parser["top_bottom"] = {}
|
||||
|
||||
if "shell" in parser:
|
||||
for setting in parser["shell"]:
|
||||
if setting in moved_settings:
|
||||
parser["top_bottom"][setting] = None
|
||||
del parser["shell"][setting]
|
||||
|
||||
result = io.StringIO()
|
||||
parser.write(result)
|
||||
return [filename], [result.getvalue()]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue