mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-09 07:56:22 -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(),
|
||||
intent_category=category)[0]
|
||||
|
||||
intent_name = intent_metadata.get("name", category.title())
|
||||
icon = intent_metadata.get("icon", None)
|
||||
description = intent_metadata.get("description", None)
|
||||
|
||||
if icon is not None:
|
||||
icon = QUrl.fromLocalFile(
|
||||
Resources.getPath(cura.CuraApplication.CuraApplication.ResourceTypes.ImageFiles, icon))
|
||||
try:
|
||||
icon = QUrl.fromLocalFile(
|
||||
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({
|
||||
"name": intent_metadata.get("name", category.title()),
|
||||
"description": intent_metadata.get("description", None),
|
||||
"name": intent_name,
|
||||
"description": description,
|
||||
"custom_icon": icon,
|
||||
"icon": None,
|
||||
"intent_category": category,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue