mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 14:37:29 -06:00
Update the flsun quality_changes profiles during version upgrade
So that they are also mapped from the global qualities to the flsun_sr-specific ones. This way they will be able to still be used in the newer Cura versions. CURA-8510
This commit is contained in:
parent
3e143a012a
commit
b322edfa53
1 changed files with 20 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
|||
|
||||
import configparser
|
||||
import io
|
||||
import os.path
|
||||
from typing import List, Tuple
|
||||
|
||||
from UM.VersionUpgrade import VersionUpgrade
|
||||
|
@ -24,6 +25,16 @@ class VersionUpgrade411to412(VersionUpgrade):
|
|||
"high": "flsun_sr_fine"
|
||||
}
|
||||
|
||||
_flsun_quality_type_mapping = {
|
||||
"extra coarse": "normal",
|
||||
"coarse" : "normal",
|
||||
"verydraft" : "normal",
|
||||
"draft" : "normal",
|
||||
"fast" : "normal",
|
||||
"normal" : "normal",
|
||||
"high" : "fine"
|
||||
}
|
||||
|
||||
def upgradePreferences(self, serialized: str, filename: str) -> Tuple[List[str], List[str]]:
|
||||
"""
|
||||
Upgrades preferences to have the new version number.
|
||||
|
@ -59,6 +70,15 @@ class VersionUpgrade411to412(VersionUpgrade):
|
|||
parser["metadata"] = {}
|
||||
parser["metadata"]["setting_version"] = "19"
|
||||
|
||||
# Update user-made quality profiles of flsun_sr printers to use the flsun_sr-specific qualities instead of the
|
||||
# global ones as their base
|
||||
file_base_name = os.path.basename(filename) # Remove any path-related characters from the filename
|
||||
old_definition = parser["general"]["definition"]
|
||||
old_quality_type = parser["metadata"]["quality_type"]
|
||||
if file_base_name.startswith("flsun_sr") and old_definition == "fdmprinter" and parser["metadata"]["type"] == "quality_changes":
|
||||
parser["general"]["definition"] = "flsun_sr"
|
||||
parser["metadata"]["quality_type"] = self._flsun_quality_type_mapping.get(old_quality_type, "normal")
|
||||
|
||||
result = io.StringIO()
|
||||
parser.write(result)
|
||||
return [filename], [result.getvalue()]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue