mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-10 00:07:51 -06:00
Don't crash when file is not found for intent profiles
CURA-9709
This commit is contained in:
parent
f18e470260
commit
c049595fe3
1 changed files with 11 additions and 4 deletions
|
@ -107,14 +107,21 @@ class IntentSelectionModel(ListModel):
|
||||||
.findContainersMetadata(type="intent", definition=global_stack.definition.getId(),
|
.findContainersMetadata(type="intent", definition=global_stack.definition.getId(),
|
||||||
intent_category=category)[0]
|
intent_category=category)[0]
|
||||||
|
|
||||||
|
intent_name = intent_metadata.get("name", category.title())
|
||||||
icon = intent_metadata.get("icon", None)
|
icon = intent_metadata.get("icon", None)
|
||||||
|
description = intent_metadata.get("description", None)
|
||||||
|
|
||||||
if icon is not None:
|
if icon is not None:
|
||||||
|
try:
|
||||||
icon = QUrl.fromLocalFile(
|
icon = QUrl.fromLocalFile(
|
||||||
Resources.getPath(cura.CuraApplication.CuraApplication.ResourceTypes.ImageFiles, icon))
|
Resources.getPath(cura.CuraApplication.CuraApplication.ResourceTypes.ImageFiles, icon))
|
||||||
|
except FileNotFoundError:
|
||||||
|
Logger.log("e", f"Icon file for intent {intent_name} not found.")
|
||||||
|
icon = None
|
||||||
|
|
||||||
result.append({
|
result.append({
|
||||||
"name": intent_metadata.get("name", category.title()),
|
"name": intent_name,
|
||||||
"description": intent_metadata.get("description", None),
|
"description": description,
|
||||||
"custom_icon": icon,
|
"custom_icon": icon,
|
||||||
"icon": None,
|
"icon": None,
|
||||||
"intent_category": category,
|
"intent_category": category,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue