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.
This commit is contained in:
Lipu Fei 2018-03-09 16:40:55 +01:00
parent c41af83b41
commit a81981a27a
3 changed files with 17 additions and 2 deletions

View file

@ -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: