Create a function that given a printer type name, it will return and

abbreviated name.

Contributes to CURA-5942.
This commit is contained in:
Diego Prado Gesto 2018-11-22 15:45:38 +01:00
parent 5c30df2a68
commit 692868a0b4
3 changed files with 23 additions and 16 deletions

View file

@ -395,21 +395,7 @@ class PrintInformation(QObject):
return
active_machine_type_name = global_container_stack.definition.getName()
abbr_machine = ""
for word in re.findall(r"[\w']+", active_machine_type_name):
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
self._abbr_machine = self._application.getMachineManager().getAbbreviatedMachineName(active_machine_type_name)
## Utility method that strips accents from characters (eg: â -> a)
def _stripAccents(self, to_strip: str) -> str: