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:
authorThomas Karl Pietrowski <thopiekar@googlemail.com>2016-06-17 13:41:24 +0300
committerThomas Karl Pietrowski <thopiekar@googlemail.com>2016-06-17 13:41:24 +0300
commit4ca247cf3753cedd77919778187bc0e4e43c88e9 (patch)
tree78c5c7a0e2aeee8105c98cd1794c61c74522fafc /plugins/GCodeProfileReader
parent95116926388674371feb95ac93e15a4481b642ce (diff)
Changing the profile name to something unique.
Imported profiles will be now called "Custom profile (<G-code filename>)"
Diffstat (limited to 'plugins/GCodeProfileReader')
-rw-r--r--plugins/GCodeProfileReader/GCodeProfileReader.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/plugins/GCodeProfileReader/GCodeProfileReader.py b/plugins/GCodeProfileReader/GCodeProfileReader.py
index 3cff7167b5..8b8809df57 100644
--- a/plugins/GCodeProfileReader/GCodeProfileReader.py
+++ b/plugins/GCodeProfileReader/GCodeProfileReader.py
@@ -7,6 +7,8 @@ import re #Regular expressions for parsing escape characters in the settings.
from UM.Application import Application #To get the machine manager to create the new profile in.
from UM.Settings.InstanceContainer import InstanceContainer
from UM.Logger import Logger
+from UM.i18n import i18nCatalog
+catalog = i18nCatalog("cura")
from cura.ProfileReader import ProfileReader
@@ -71,7 +73,7 @@ class GCodeProfileReader(ProfileReader):
serialized = pattern.sub(lambda m: GCodeProfileReader.escape_characters[re.escape(m.group(0))], serialized)
Logger.log("i", "Serialized the following from %s: %s" %(file_name, repr(serialized)))
- # Create an empty profile with the name of the G-code file
+ # Create an empty profile - the id will be changed later
profile = InstanceContainer("G-code-imported-profile")
profile.addMetaDataEntry("type", "quality")
try:
@@ -80,4 +82,9 @@ class GCodeProfileReader(ProfileReader):
Logger.log("e", "Unable to serialise the profile: %s", str(e))
return None
+ #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])
+ profile.setName(new_name)
+ profile._id = new_name
+
return profile \ No newline at end of file