GCodeProfileReader: Fixing read of profiles from GCode

This commit is contained in:
Thomas Karl Pietrowski 2016-06-24 16:01:47 +02:00
parent d49ba80117
commit 93cdce7b33

View file

@ -75,15 +75,16 @@ class GCodeProfileReader(ProfileReader):
# Create an empty profile - the id will be changed later # Create an empty profile - the id will be changed later
profile = InstanceContainer("") profile = InstanceContainer("")
profile.addMetaDataEntry("type", "quality")
try: try:
profile.deserialize(serialized) profile.deserialize(serialized)
except Exception as e: # Not a valid g-code file. except Exception as e: # Not a valid g-code file.
Logger.log("e", "Unable to serialise the profile: %s", str(e)) Logger.log("e", "Unable to serialise the profile: %s", str(e))
return None return None
profile.addMetaDataEntry("type", "quality")
#Creating a unique name using the filename of the GCode #Creating a unique name using the filename of the GCode
new_name = catalog.i18nc("@label", "Custom profile (%s)") %(os.path.splitext(os.path.basename(file_name))[0]) new_name = catalog.i18nc("@label", "G-Code-imported profile")
profile.setName(new_name) profile.setName(new_name)
profile._id = new_name profile._id = new_name