|
@@ -2,8 +2,8 @@
|
|
|
#Cura is released under the terms of the LGPLv3 or higher.
|
|
|
|
|
|
from PyQt5.QtCore import Qt, QTimer
|
|
|
-import collections
|
|
|
from typing import TYPE_CHECKING, Optional, Dict
|
|
|
+from cura.Machines.Models.IntentTranslations import intent_translations
|
|
|
|
|
|
from cura.Machines.Models.IntentModel import IntentModel
|
|
|
from cura.Settings.IntentManager import IntentManager
|
|
@@ -29,26 +29,6 @@ class IntentCategoryModel(ListModel):
|
|
|
|
|
|
modelUpdated = pyqtSignal()
|
|
|
|
|
|
- # Translations to user-visible string. Ordered by weight.
|
|
|
- # TODO: Create a solution for this name and weight to be used dynamically.
|
|
|
- _translations = collections.OrderedDict() # type: "collections.OrderedDict[str,Dict[str,Optional[str]]]"
|
|
|
- _translations["default"] = {
|
|
|
- "name": catalog.i18nc("@label", "Default")
|
|
|
- }
|
|
|
- _translations["visual"] = {
|
|
|
- "name": catalog.i18nc("@label", "Visual"),
|
|
|
- "description": catalog.i18nc("@text", "Optimized for appearance")
|
|
|
- }
|
|
|
- _translations["engineering"] = {
|
|
|
- "name": catalog.i18nc("@label", "Engineering"),
|
|
|
- "description": catalog.i18nc("@text", "Optimized for higher accuracy")
|
|
|
- }
|
|
|
- _translations["quick"] = {
|
|
|
- "name": catalog.i18nc("@label", "Draft"),
|
|
|
- "description": catalog.i18nc("@text", "Optimized for fast results")
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
## Creates a new model for a certain intent category.
|
|
|
# \param The category to list the intent profiles for.
|
|
|
def __init__(self, intent_category: str) -> None:
|
|
@@ -99,15 +79,15 @@ class IntentCategoryModel(ListModel):
|
|
|
"name": IntentCategoryModel.translation(category, "name", catalog.i18nc("@label", "Unknown")),
|
|
|
"description": IntentCategoryModel.translation(category, "description", None),
|
|
|
"intent_category": category,
|
|
|
- "weight": list(self._translations.keys()).index(category),
|
|
|
+ "weight": list(intent_translations).index(category),
|
|
|
"qualities": qualities
|
|
|
})
|
|
|
result.sort(key = lambda k: k["weight"])
|
|
|
self.setItems(result)
|
|
|
|
|
|
- ## Get a display value for a category. See IntenCategoryModel._translations
|
|
|
+ ## Get a display value for a category.
|
|
|
## for categories and keys
|
|
|
@staticmethod
|
|
|
def translation(category: str, key: str, default: Optional[str] = None):
|
|
|
- display_strings = IntentCategoryModel._translations.get(category, {})
|
|
|
+ display_strings = intent_translations.get(category, {})
|
|
|
return display_strings.get(key, default)
|