mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-28 00:59:02 +08:00
Improve currentIntentCategory logic
CURA-11854
This commit is contained in:
parent
600cd7669c
commit
a5a25f676e
@ -55,7 +55,6 @@ class ActiveIntentQualitiesModel(ListModel):
|
||||
|
||||
def _update(self):
|
||||
self._intent_category = IntentManager.getInstance().currentIntentCategory
|
||||
|
||||
new_items: List[Dict[str, Any]] = []
|
||||
global_stack = cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack()
|
||||
if not global_stack:
|
||||
|
@ -145,10 +145,24 @@ class IntentManager(QObject):
|
||||
@pyqtProperty(str, notify = intentCategoryChanged)
|
||||
def currentIntentCategory(self) -> str:
|
||||
application = cura.CuraApplication.CuraApplication.getInstance()
|
||||
active_extruder_stack = application.getMachineManager().activeStack
|
||||
if active_extruder_stack is None:
|
||||
return ""
|
||||
return active_extruder_stack.intent.getMetaDataEntry("intent_category", "")
|
||||
global_stack = application.getGlobalContainerStack()
|
||||
|
||||
active_intent = "default"
|
||||
if global_stack is None:
|
||||
return active_intent
|
||||
|
||||
# Loop over all active extruders and check if they have an intent that isn't default.
|
||||
# The logic behind this is that support materials (for instance, PVA) don't have intents, but they should be
|
||||
# combinable with all other intents. So if one extruder has "engineering" as an intent and the other has
|
||||
# "default" the 'dominant' intent is "engineering"
|
||||
for extruder_stack in global_stack.extruderList:
|
||||
if not extruder_stack.isEnabled: # Ignore disabled stacks
|
||||
continue
|
||||
extruder_intent = extruder_stack.intent.getMetaDataEntry("intent_category", "")
|
||||
if extruder_intent != "default":
|
||||
active_intent = extruder_intent
|
||||
|
||||
return active_intent
|
||||
|
||||
@pyqtSlot(str, str)
|
||||
def selectIntent(self, intent_category: str, quality_type: str) -> None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user