mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 07:27:29 -06:00
Prevent crash when setting non default intent category
This commit is contained in:
parent
f456c1a885
commit
fe8a3fc61d
2 changed files with 13 additions and 2 deletions
|
@ -106,11 +106,15 @@ class IntentCategoryModel(ListModel):
|
|||
for category in available_categories:
|
||||
qualities = IntentModel()
|
||||
qualities.setIntentCategory(category)
|
||||
try:
|
||||
weight = list(IntentCategoryModel._get_translations().keys()).index(category)
|
||||
except ValueError:
|
||||
weight = 99
|
||||
result.append({
|
||||
"name": IntentCategoryModel.translation(category, "name", category),
|
||||
"description": IntentCategoryModel.translation(category, "description", None),
|
||||
"intent_category": category,
|
||||
"weight": list(IntentCategoryModel._get_translations().keys()).index(category),
|
||||
"weight": weight,
|
||||
"qualities": qualities
|
||||
})
|
||||
result.sort(key = lambda k: k["weight"])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue