mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-07 05:53:59 -06:00
Add dataclass for ActiveQuality. Move some logic out of MachineManager into ActiveQuality.
CURA-9793
This commit is contained in:
parent
f297909a82
commit
8dcccd941b
3 changed files with 49 additions and 37 deletions
37
cura/Settings/ActiveQuality.py
Normal file
37
cura/Settings/ActiveQuality.py
Normal file
|
@ -0,0 +1,37 @@
|
|||
from dataclasses import dataclass
|
||||
from typing import List
|
||||
|
||||
from UM import i18nCatalog
|
||||
|
||||
catalog = i18nCatalog("cura")
|
||||
|
||||
|
||||
@dataclass
|
||||
class ActiveQuality:
|
||||
""" Represents the active intent+profile combination, contains all information needed to display active quality. """
|
||||
intent_category: str = "" # Name of the base intent. For example "visual" or "engineering".
|
||||
intent_name: str = "" # Name of the base intent formatted for display. For Example "Visual" or "Engineering"
|
||||
profile: str = "" # Name of the base profile. For example "Fine" or "Fast"
|
||||
custom_profile: str = "" # Name of the custom profile, this is based on profile. For example "MyCoolCustomProfile"
|
||||
layer_height: float = None # Layer height of quality in mm. For example 0.4
|
||||
is_experimental: bool = False # If the quality experimental.
|
||||
|
||||
def getStringParts(self) -> List[str]:
|
||||
string_parts = []
|
||||
|
||||
if self.custom_profile is not None:
|
||||
string_parts.append(self.custom_profile)
|
||||
|
||||
if self.intent_category is not "default":
|
||||
string_parts.append(f"{self.intent_name} - {self.profile}")
|
||||
else:
|
||||
string_parts.append(self.profile)
|
||||
|
||||
if self.layer_height:
|
||||
string_parts.append(f"{self.layer_height}mm")
|
||||
|
||||
if self.is_experimental:
|
||||
string_parts.append(catalog.i18nc("@label", "Experimental"))
|
||||
|
||||
return string_parts
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue