Browse Source

CURA-4891 Use the printer definition name instead of the ID to generate
the abbreviated name.
- Also revert some previous changes to keep the same behavior as before.

Diego Prado Gesto 7 years ago
parent
commit
a4455bbbe5
1 changed files with 14 additions and 18 deletions
  1. 14 18
      cura/PrintInformation.py

+ 14 - 18
cura/PrintInformation.py

@@ -361,26 +361,22 @@ class PrintInformation(QObject):
         if not global_container_stack:
             self._abbr_machine = ""
             return
-        active_machine_type_id = global_container_stack.definition.getId()
+        active_machine_type_name = global_container_stack.definition.getName()
 
         abbr_machine = ""
-        # If 'ultimaker' is in machine type, we found an ultimaker machine!
-        if re.findall(r"\W*(ultimaker)\W*", active_machine_type_id):
-            abbr_machine += "UM"
-            # In this case, also scan for an edition (e.g. 'ultimaker3')
-            edition = re.findall(r"\W*ultimaker([0-9])*\W*", active_machine_type_id)
-            if edition:
-                abbr_machine += edition[0]
-
-        # Otherwise, just use the first 3 letters of the machine:
-        else:
-            stripped_name = self._stripAccents(active_machine_type_id.upper())
-            print("WAS ANOTHER TYPE", stripped_name)
-            # - use only the first character if the word is too long (> 4 characters)
-            # - use the whole word if it's not too long (<= 4 characters)
-            if len(stripped_name) > 4:
-                stripped_name = stripped_name[0]
-            abbr_machine += stripped_name
+        for word in re.findall(r"[\w']", active_machine_type_name):
+            print(word)
+            if word.lower() == "ultimaker":
+                abbr_machine += "UM"
+            elif word.isdigit():
+                abbr_machine += word
+            else:
+                stripped_word = self._stripAccents(word.upper())
+                # - use only the first character if the word is too long (> 3 characters)
+                # - use the whole word if it's not too long (<= 3 characters)
+                if len(stripped_word) > 3:
+                    stripped_word = stripped_word[0]
+                abbr_machine += stripped_word
 
         self._abbr_machine = abbr_machine