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:
authorJaime van Kessel <nallath@gmail.com>2016-11-17 15:15:25 +0300
committerJaime van Kessel <nallath@gmail.com>2016-11-17 15:15:25 +0300
commit54825151577512803f908a982c8f762d2c64ae4a (patch)
tree0183685548b4c0f46feb4c48c2c562838aa6f888 /plugins/GCodeProfileReader
parent41825231ad8a78f7a850c056d9b3d63b5f54d5d9 (diff)
Importing profiles from g-code made by Cura 2.3 is now possible again
CURA-2943
Diffstat (limited to 'plugins/GCodeProfileReader')
-rw-r--r--plugins/GCodeProfileReader/GCodeProfileReader.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/plugins/GCodeProfileReader/GCodeProfileReader.py b/plugins/GCodeProfileReader/GCodeProfileReader.py
index 24c92d08e9..abfef6e296 100644
--- a/plugins/GCodeProfileReader/GCodeProfileReader.py
+++ b/plugins/GCodeProfileReader/GCodeProfileReader.py
@@ -70,10 +70,19 @@ class GCodeProfileReader(ProfileReader):
json_data = json.loads(serialized)
- profile_strings = [json_data["global_quality"]]
- profile_strings.extend(json_data.get("extruder_quality", []))
-
- return [readQualityProfileFromString(profile_string) for profile_string in profile_strings]
+ profiles = []
+ global_profile = readQualityProfileFromString(json_data["global_quality"])
+
+ # This is a fix for profiles created with 2.3.0 For some reason it added the "extruder" property to the
+ # global profile.
+ # The fix is simple and safe, as a global profile should never have the extruder entry.
+ if global_profile.getMetaDataEntry("extruder", None) is not None:
+ global_profile.setMetaDataEntry("extruder", None)
+ profiles.append(global_profile)
+
+ for profile_string in json_data.get("extruder_quality", []):
+ profiles.append(readQualityProfileFromString(profile_string))
+ return profiles
## Unescape a string which has been escaped for use in a gcode comment.
#