mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-07 22:13:58 -06:00
Add upgrade script for dagoma discoeasy
CURA-7517
This commit is contained in:
parent
8de981f33d
commit
daa6b4f28d
1 changed files with 15 additions and 2 deletions
|
@ -2,10 +2,17 @@
|
|||
# Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import configparser
|
||||
from typing import Tuple, List
|
||||
from typing import Tuple, List, Dict
|
||||
import io
|
||||
from UM.VersionUpgrade import VersionUpgrade
|
||||
|
||||
|
||||
# Renamed definition files
|
||||
_RENAMED_DEFINITION_DICT = {
|
||||
"dagoma_discoeasy200": "dagoma_discoeasy200_bicolor",
|
||||
} # type: Dict[str, str]
|
||||
|
||||
|
||||
class VersionUpgrade462to47(VersionUpgrade):
|
||||
def upgradePreferences(self, serialized: str, filename: str) -> Tuple[List[str], List[str]]:
|
||||
"""
|
||||
|
@ -71,6 +78,10 @@ class VersionUpgrade462to47(VersionUpgrade):
|
|||
ironing_inset = "=(" + ironing_inset + ")" + correction
|
||||
parser["values"]["ironing_inset"] = ironing_inset
|
||||
|
||||
# Check renamed definitions
|
||||
if "definition" in parser["general"] and parser["general"]["definition"] in _RENAMED_DEFINITION_DICT:
|
||||
parser["general"]["definition"] = _RENAMED_DEFINITION_DICT[parser["general"]["definition"]]
|
||||
|
||||
result = io.StringIO()
|
||||
parser.write(result)
|
||||
return [filename], [result.getvalue()]
|
||||
|
@ -130,7 +141,9 @@ class VersionUpgrade462to47(VersionUpgrade):
|
|||
script_str = script_str.replace("\\\\", r"\\\\").replace("\n", r"\\\n") # Escape newlines because configparser sees those as section delimiters.
|
||||
new_scripts_entries.append(script_str)
|
||||
parser["metadata"]["post_processing_scripts"] = "\n".join(new_scripts_entries)
|
||||
|
||||
# check renamed definition
|
||||
if parser.has_option("containers", "7") and parser["containers"]["7"] in _RENAMED_DEFINITION_DICT:
|
||||
parser["containers"]["7"] = _RENAMED_DEFINITION_DICT[parser["containers"]["7"]]
|
||||
result = io.StringIO()
|
||||
parser.write(result)
|
||||
return [filename], [result.getvalue()]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue