mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 18:39:07 +08:00
Don't crash when file is not found for intent profiles
CURA-9709
This commit is contained in:
parent
f18e470260
commit
c049595fe3
@ -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…
x
Reference in New Issue
Block a user