ActiveQuality.py 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. from dataclasses import dataclass
  2. from typing import List
  3. from UM import i18nCatalog
  4. catalog = i18nCatalog("cura")
  5. @dataclass
  6. class ActiveQuality:
  7. """ Represents the active intent+profile combination, contains all information needed to display active quality. """
  8. intent_category: str = "" # Name of the base intent. For example "visual" or "engineering".
  9. intent_name: str = "" # Name of the base intent formatted for display. For Example "Visual" or "Engineering"
  10. profile: str = "" # Name of the base profile. For example "Fine" or "Fast"
  11. custom_profile: str = "" # Name of the custom profile, this is based on profile. For example "MyCoolCustomProfile"
  12. layer_height: float = None # Layer height of quality in mm. For example 0.4
  13. is_experimental: bool = False # If the quality experimental.
  14. def getMainStringParts(self) -> List[str]:
  15. string_parts = []
  16. if self.custom_profile is not None:
  17. string_parts.append(self.custom_profile)
  18. else:
  19. string_parts.append(self.profile)
  20. if self.intent_category != "default":
  21. string_parts.append(self.intent_name)
  22. return string_parts
  23. def getTailStringParts(self) -> List[str]:
  24. string_parts = []
  25. if self.custom_profile is not None:
  26. string_parts.append(self.profile)
  27. if self.intent_category != "default":
  28. string_parts.append(self.intent_name)
  29. if self.layer_height:
  30. string_parts.append(f"{self.layer_height}mm")
  31. if self.is_experimental:
  32. string_parts.append(catalog.i18nc("@label", "Experimental"))
  33. return string_parts
  34. def getStringParts(self) -> List[str]:
  35. return self.getMainStringParts() + self.getTailStringParts()