Cura/cura/Machines/Models/IntentCategoryModel.py
Ghostkeeper fa65875824
Add psuedocode/boilerplate for intent manager
This won't run. Don't try to import this class yet. It's outlining what we need to implement to get intents per stack.

It does no form of caching at this point. Build first, optimise later, right.

Contributes to issue CURA-6091.
2019-06-19 14:29:19 +02:00

14 lines
582 B
Python

#Copyright (c) 2019 Ultimaker B.V.
#Cura is released under the terms of the LGPLv3 or higher.
from UM.Qt.ListModel import ListModel
from cura.Settings.IntentManager import IntentManager
class IntentCategoryModel(ListModel):
def __init__(self, intent_category: str):
self._intent_category = intent_category
def update(self):
available_intents = IntentManager.getInstance().currentAvailableIntents()
result = filter(lambda intent: intent.getMetaDataEntry("intent_category") == self._intent_category, available_intents)
super().update(result)