mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
Merge master into material marketplace
This commit is contained in:
commit
9a5fb47a6e
228 changed files with 125261 additions and 4020 deletions
|
@ -4,6 +4,8 @@
|
|||
import configparser #To parse preference files.
|
||||
import io #To serialise the preference files afterwards.
|
||||
import os
|
||||
import urllib.parse
|
||||
import re
|
||||
|
||||
from UM.VersionUpgrade import VersionUpgrade #We're inheriting from this.
|
||||
|
||||
|
@ -118,6 +120,12 @@ class VersionUpgrade27to30(VersionUpgrade):
|
|||
if not parser.has_section("general"):
|
||||
parser.add_section("general")
|
||||
|
||||
# Clean up the filename
|
||||
file_base_name = os.path.basename(filename)
|
||||
file_base_name = urllib.parse.unquote_plus(file_base_name)
|
||||
|
||||
um2_pattern = re.compile(r"^ultimaker[^a-zA-Z\\d\\s:]2_.*$")
|
||||
|
||||
# The ultimaker 2 family
|
||||
ultimaker2_prefix_list = ["ultimaker2_extended_",
|
||||
"ultimaker2_go_",
|
||||
|
@ -127,9 +135,8 @@ class VersionUpgrade27to30(VersionUpgrade):
|
|||
"ultimaker2_plus_"]
|
||||
|
||||
# set machine definition to "ultimaker2" for the custom quality profiles that can be for the ultimaker 2 family
|
||||
file_base_name = os.path.basename(filename)
|
||||
is_ultimaker2_family = False
|
||||
if not any(file_base_name.startswith(ep) for ep in exclude_prefix_list):
|
||||
is_ultimaker2_family = um2_pattern.match(file_base_name) is not None
|
||||
if not is_ultimaker2_family and not any(file_base_name.startswith(ep) for ep in exclude_prefix_list):
|
||||
is_ultimaker2_family = any(file_base_name.startswith(ep) for ep in ultimaker2_prefix_list)
|
||||
|
||||
# ultimaker2 family quality profiles used to set as "fdmprinter" profiles
|
||||
|
|
|
@ -85,6 +85,34 @@ class VersionUpgrade32to33(VersionUpgrade):
|
|||
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.
|
||||
#
|
||||
# \param serialised The serialised form of a preferences file.
|
||||
# \param filename The name of the file to upgrade.
|
||||
def upgradePreferences(self, serialised, filename):
|
||||
parser = configparser.ConfigParser(interpolation = None)
|
||||
parser.read_string(serialised)
|
||||
|
||||
# Update version numbers
|
||||
if "general" not in parser:
|
||||
parser["general"] = {}
|
||||
parser["general"]["version"] = "6"
|
||||
if "metadata" not in parser:
|
||||
parser["metadata"] = {}
|
||||
parser["metadata"]["setting_version"] = "4"
|
||||
|
||||
# The auto_slice preference changed its default value to "disabled" so if there is no value in previous versions,
|
||||
# then it means the desired value is auto_slice "enabled"
|
||||
if "auto_slice" not in parser["general"]:
|
||||
parser["general"]["auto_slice"] = "True"
|
||||
elif parser["general"]["auto_slice"] == "False": # If the value is False, then remove the entry
|
||||
del parser["general"]["auto_slice"]
|
||||
|
||||
# Re-serialise the file.
|
||||
output = io.StringIO()
|
||||
parser.write(output)
|
||||
return [filename], [output.getvalue()]
|
||||
|
||||
## Upgrades a container stack from version 3.2 to 3.3.
|
||||
#
|
||||
# \param serialised The serialised form of a container stack.
|
||||
|
|
|
@ -9,6 +9,8 @@ def getMetaData():
|
|||
return {
|
||||
"version_upgrade": {
|
||||
# From To Upgrade function
|
||||
("preferences", 5000004): ("preferences", 6000004, upgrade.upgradePreferences),
|
||||
|
||||
("machine_stack", 3000004): ("machine_stack", 4000004, upgrade.upgradeStack),
|
||||
("extruder_train", 3000004): ("extruder_train", 4000004, upgrade.upgradeStack),
|
||||
|
||||
|
@ -18,6 +20,10 @@ def getMetaData():
|
|||
("variant", 2000004): ("variant", 3000004, upgrade.upgradeVariants)
|
||||
},
|
||||
"sources": {
|
||||
"preferences": {
|
||||
"get_version": upgrade.getCfgVersion,
|
||||
"location": {"."}
|
||||
},
|
||||
"machine_stack": {
|
||||
"get_version": upgrade.getCfgVersion,
|
||||
"location": {"./machine_instances"}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue