mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-06 05:23:58 -06:00
Create a function that given a printer type name, it will return and
abbreviated name. Contributes to CURA-5942.
This commit is contained in:
parent
5c30df2a68
commit
692868a0b4
3 changed files with 23 additions and 16 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue