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.
This commit is contained in:
Diego Prado Gesto 2018-02-14 13:47:30 +01:00
parent ee9de1f11b
commit a4455bbbe5

View File

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