diff options
author | Lipu Fei <lipu.fei815@gmail.com> | 2018-03-09 18:40:55 +0300 |
---|---|---|
committer | Lipu Fei <lipu.fei815@gmail.com> | 2018-03-09 18:40:57 +0300 |
commit | a81981a27a0604eeb7b626709e5eebf1dadf0e80 (patch) | |
tree | 448432983f632194d43135f15db6398d92b2005a /plugins/GCodeProfileReader | |
parent | c41af83b4186401c8087d656e1299c527dd87384 (diff) |
Better info on no profiles to import for gcode
CIRA-4946
If a gcode is sliced with default profiles, there won't be any custom
profiles to import from that gcode. In that case, we show a info message
telling the user about this instead of showing an error message.
Diffstat (limited to 'plugins/GCodeProfileReader')
-rw-r--r-- | plugins/GCodeProfileReader/GCodeProfileReader.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/plugins/GCodeProfileReader/GCodeProfileReader.py b/plugins/GCodeProfileReader/GCodeProfileReader.py index 2a10e01d43..d6bda85a48 100644 --- a/plugins/GCodeProfileReader/GCodeProfileReader.py +++ b/plugins/GCodeProfileReader/GCodeProfileReader.py @@ -9,7 +9,7 @@ from UM.Logger import Logger from UM.i18n import i18nCatalog catalog = i18nCatalog("cura") -from cura.ProfileReader import ProfileReader +from cura.ProfileReader import ProfileReader, NoProfileException ## A class that reads profile data from g-code files. # @@ -66,6 +66,11 @@ class GCodeProfileReader(ProfileReader): return None serialized = unescapeGcodeComment(serialized) + serialized = serialized.strip() + + if not serialized: + Logger.log("i", "No custom profile to import from this g-code: %s", file_name) + raise NoProfileException() # serialized data can be invalid JSON try: |