From e6551821aaf6ab69f2fb4e1f735427506ead22b5 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 1 Jun 2022 11:07:01 +0200 Subject: [PATCH] Use intent category if no translation is available Previously we would only accept intents that had a translation. If we could not find one, we would use "unknown" as the intent category. However, we didn't really do this consistently. In some places it would show unkown and in others we'd show the intent type. This should make the behavior the same across the board. It will try to get a translation for the intent category and show that. If it's unable to find that it will use the category instead. Note that it will use the python title function to ensure it has nice capitalisation CURA-9297 --- cura/Machines/Models/IntentCategoryModel.py | 2 +- cura/Machines/Models/QualityManagementModel.py | 3 ++- cura/Settings/MachineManager.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cura/Machines/Models/IntentCategoryModel.py b/cura/Machines/Models/IntentCategoryModel.py index 14e3c4d35e..e94bbe6d00 100644 --- a/cura/Machines/Models/IntentCategoryModel.py +++ b/cura/Machines/Models/IntentCategoryModel.py @@ -111,7 +111,7 @@ class IntentCategoryModel(ListModel): except ValueError: weight = 99 result.append({ - "name": IntentCategoryModel.translation(category, "name", category), + "name": IntentCategoryModel.translation(category, "name", category.title()), "description": IntentCategoryModel.translation(category, "description", None), "intent_category": category, "weight": weight, diff --git a/cura/Machines/Models/QualityManagementModel.py b/cura/Machines/Models/QualityManagementModel.py index 8db8719784..b4fb8b38b5 100644 --- a/cura/Machines/Models/QualityManagementModel.py +++ b/cura/Machines/Models/QualityManagementModel.py @@ -358,8 +358,9 @@ class QualityManagementModel(ListModel): "quality_type": quality_type, "quality_changes_group": None, "intent_category": intent_category, - "section_name": catalog.i18nc("@label", intent_translations.get(intent_category, {}).get("name", catalog.i18nc("@label", "Unknown"))), + "section_name": catalog.i18nc("@label", intent_translations.get(intent_category, {}).get("name", catalog.i18nc("@label", intent_category.title()))), }) + # Sort by quality_type for each intent category intent_translations_list = list(intent_translations) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 1c7a8f0e98..9b98179bff 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -1611,7 +1611,7 @@ class MachineManager(QObject): if intent_category != "default": intent_display_name = IntentCategoryModel.translation(intent_category, "name", - catalog.i18nc("@label", "Unknown")) + intent_category.title()) display_name = "{intent_name} - {the_rest}".format(intent_name = intent_display_name, the_rest = display_name)