Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorc.lamboo <casperlamboo@gmail.com>2022-08-26 14:12:37 +0300
committerc.lamboo <casperlamboo@gmail.com>2022-08-26 14:12:37 +0300
commit4d437b1f3deb4611041aca865e40663aaf3eac1a (patch)
tree0961dca707a64cd2227814fc00559174d9d62384
parent255fcfae56383e5a9f1333505a58438a05bd4587 (diff)
Also export original machine in update script
In the update script we create abstract machine for each of the machine stacks. In addition to this AbstractMachine we also want to keep the original machine. In this commit the machin is re-exported with a version bump. CURA-9289
-rw-r--r--plugins/VersionUpgrade/VersionUpgrade50to52/VersionUpgrade50to52.py20
-rw-r--r--plugins/VersionUpgrade/VersionUpgrade50to52/__init__.py4
2 files changed, 14 insertions, 10 deletions
diff --git a/plugins/VersionUpgrade/VersionUpgrade50to52/VersionUpgrade50to52.py b/plugins/VersionUpgrade/VersionUpgrade50to52/VersionUpgrade50to52.py
index 120e2ef9a4..55f1b6df42 100644
--- a/plugins/VersionUpgrade/VersionUpgrade50to52/VersionUpgrade50to52.py
+++ b/plugins/VersionUpgrade/VersionUpgrade50to52/VersionUpgrade50to52.py
@@ -7,6 +7,7 @@ from typing import List, Tuple
from UM.VersionUpgrade import VersionUpgrade
from cura.PrinterOutput.PrinterOutputDevice import ConnectionType
from cura.Settings.CuraStackBuilder import CuraStackBuilder
+import io
class VersionUpgrade50to52(VersionUpgrade):
"""
@@ -14,18 +15,25 @@ class VersionUpgrade50to52(VersionUpgrade):
state they should be in at version 5.2.
"""
- def upgradeStack(self, serialized: str, _filename: str) -> Tuple[List[str], List[str]]:
+ def upgradeStack(self, serialized: str, original_filename: str) -> Tuple[List[str], List[str]]:
"""
Upgrades container stacks to have the new version number.
Upgrades container stacks for FLSun Racer to change their profiles.
:param serialized: The original contents of the container stack.
- :param filename: The file name of the container stack.
+ :param original_filename: The file name of the container stack.
:return: A list of file names, and a list of the new contents for those
files.
"""
+
parser = configparser.ConfigParser(interpolation = None)
parser.read_string(serialized)
+ parser["metadata"]["setting_version"] = "6000020"
+
+ original_file = io.StringIO()
+ parser.write(original_file)
+ original_data = original_file.getvalue()
+
connection_types = []
if "metadata" in parser and "connection_type" in parser["metadata"]:
connection_types = [int(connection_type) for connection_type in parser["metadata"]["connection_type"].split(",")]
@@ -33,14 +41,14 @@ class VersionUpgrade50to52(VersionUpgrade):
cloud_connection_types = ConnectionType.NetworkConnection, ConnectionType.CloudConnection
if not any(connection_type in cloud_connection_types for connection_type in connection_types):
- return [], []
+ return [original_filename], [original_data]
definition_id = "ultimaker_s5" # TODO use actual definition id from machine here
abstract_machine = CuraStackBuilder.createAbstractMachine(definition_id)
if abstract_machine:
- filename = f"{definition_id}_abstract_machine"
+ file_name = f"{definition_id}_abstract_machine"
data = abstract_machine.serialize()
- return [filename], [data]
+ return [original_filename, file_name], [original_data, data]
- return [], []
+ return [original_filename], [original_data]
diff --git a/plugins/VersionUpgrade/VersionUpgrade50to52/__init__.py b/plugins/VersionUpgrade/VersionUpgrade50to52/__init__.py
index d5f2a4a0df..4b1d2bc92b 100644
--- a/plugins/VersionUpgrade/VersionUpgrade50to52/__init__.py
+++ b/plugins/VersionUpgrade/VersionUpgrade50to52/__init__.py
@@ -20,10 +20,6 @@ def getMetaData() -> Dict[str, Any]:
"get_version": upgrade.getCfgVersion,
"location": {"./machine_instances"},
},
- "abstract_machine": {
- "get_version": upgrade.getCfgVersion,
- "location": {"./abstract_machine_instances"},
- },
},
}