diff options
Diffstat (limited to 'cura')
-rw-r--r-- | cura/Machines/Models/IntentCategoryModel.py | 28 | ||||
-rw-r--r-- | cura/Machines/Models/IntentTranslations.py | 20 | ||||
-rw-r--r-- | cura/Machines/Models/QualityManagementModel.py | 6 | ||||
-rw-r--r-- | cura/Machines/VariantNode.py | 12 | ||||
-rw-r--r-- | cura/UI/CuraSplashScreen.py | 8 |
5 files changed, 43 insertions, 31 deletions
diff --git a/cura/Machines/Models/IntentCategoryModel.py b/cura/Machines/Models/IntentCategoryModel.py index a968d12b7a..a09d6ce3c4 100644 --- a/cura/Machines/Models/IntentCategoryModel.py +++ b/cura/Machines/Models/IntentCategoryModel.py @@ -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) diff --git a/cura/Machines/Models/IntentTranslations.py b/cura/Machines/Models/IntentTranslations.py new file mode 100644 index 0000000000..fd6a2db9ee --- /dev/null +++ b/cura/Machines/Models/IntentTranslations.py @@ -0,0 +1,20 @@ +import collections +from UM.i18n import i18nCatalog +catalog = i18nCatalog("cura") + +intent_translations = collections.OrderedDict() # type: "collections.OrderedDict[str, Dict[str, Optional[str]]]" +intent_translations["default"] = { + "name": catalog.i18nc("@label", "Default") +} +intent_translations["visual"] = { + "name": catalog.i18nc("@label", "Visual"), + "description": catalog.i18nc("@text", "The visual profile is designed to print visual prototypes and models with the intent of high visual and surface quality.") +} +intent_translations["engineering"] = { + "name": catalog.i18nc("@label", "Engineering"), + "description": catalog.i18nc("@text", "The engineering profile is designed to print functional prototypes and end-use parts with the intent of better accuracy and for closer tolerances.") +} +intent_translations["quick"] = { + "name": catalog.i18nc("@label", "Draft"), + "description": catalog.i18nc("@text", "The draft profile is designed to print initial prototypes and concept validation with the intent of significant print time reduction.") +}
\ No newline at end of file diff --git a/cura/Machines/Models/QualityManagementModel.py b/cura/Machines/Models/QualityManagementModel.py index d8b0785778..74dc8649d0 100644 --- a/cura/Machines/Models/QualityManagementModel.py +++ b/cura/Machines/Models/QualityManagementModel.py @@ -14,6 +14,7 @@ from cura.Machines.ContainerTree import ContainerTree from cura.Settings.cura_empty_instance_containers import empty_quality_changes_container from cura.Settings.IntentManager import IntentManager from cura.Machines.Models.MachineModelUtils import fetchLayerHeight +from cura.Machines.Models.IntentTranslations import intent_translations from UM.i18n import i18nCatalog catalog = i18nCatalog("cura") @@ -336,10 +337,11 @@ class QualityManagementModel(ListModel): "quality_type": quality_type, "quality_changes_group": None, "intent_category": intent_category, - "section_name": catalog.i18nc("@label", intent_category.capitalize()), + "section_name": catalog.i18nc("@label", intent_translations.get(intent_category, {}).get("name", catalog.i18nc("@label", "Unknown"))), }) # Sort by quality_type for each intent category - result = sorted(result, key = lambda x: (x["intent_category"], x["quality_type"])) + + result = sorted(result, key = lambda x: (list(intent_translations).index(x["intent_category"]), x["quality_type"])) item_list += result # Create quality_changes group items diff --git a/cura/Machines/VariantNode.py b/cura/Machines/VariantNode.py index b93be9773e..b2115ca099 100644 --- a/cura/Machines/VariantNode.py +++ b/cura/Machines/VariantNode.py @@ -85,10 +85,20 @@ class VariantNode(ContainerNode): for base_material, material_node in self.materials.items(): if self.machine.preferred_material == base_material and approximate_diameter == int(material_node.getMetaDataEntry("approximate_diameter")): return material_node - # First fallback: Choose any material with matching diameter. + + # First fallback: Check if we should be checking for the 175 variant. + if approximate_diameter == 2: + preferred_material = self.machine.preferred_material + "_175" + for base_material, material_node in self.materials.items(): + if preferred_material == base_material and approximate_diameter == int(material_node.getMetaDataEntry("approximate_diameter")): + return material_node + + # Second fallback: Choose any material with matching diameter. for material_node in self.materials.values(): if material_node.getMetaDataEntry("approximate_diameter") and approximate_diameter == int(material_node.getMetaDataEntry("approximate_diameter")): + Logger.log("w", "Could not find preferred material %s, falling back to whatever works", self.machine.preferred_material) return material_node + fallback = next(iter(self.materials.values())) # Should only happen with empty material node. Logger.log("w", "Could not find preferred material {preferred_material} with diameter {diameter} for variant {variant_id}, falling back to {fallback}.".format( preferred_material = self.machine.preferred_material, diff --git a/cura/UI/CuraSplashScreen.py b/cura/UI/CuraSplashScreen.py index 77c9ad1427..05231c106d 100644 --- a/cura/UI/CuraSplashScreen.py +++ b/cura/UI/CuraSplashScreen.py @@ -56,11 +56,11 @@ class CuraSplashScreen(QSplashScreen): if buildtype: version[0] += " (%s)" % buildtype - # draw version text + # Draw version text font = QFont() # Using system-default font here font.setPixelSize(37) painter.setFont(font) - painter.drawText(215, 66, 330 * self._scale, 230 * self._scale, Qt.AlignLeft | Qt.AlignTop, version[0]) + painter.drawText(60, 66, 330 * self._scale, 230 * self._scale, Qt.AlignLeft | Qt.AlignTop, version[0]) if len(version) > 1: font.setPixelSize(16) painter.setFont(font) @@ -68,14 +68,14 @@ class CuraSplashScreen(QSplashScreen): painter.drawText(247, 105, 330 * self._scale, 255 * self._scale, Qt.AlignLeft | Qt.AlignTop, version[1]) painter.setPen(QColor(255, 255, 255, 255)) - # draw the loading image + # Draw the loading image pen = QPen() pen.setWidth(6 * self._scale) pen.setColor(QColor(32, 166, 219, 255)) painter.setPen(pen) painter.drawArc(60, 150, 32 * self._scale, 32 * self._scale, self._loading_image_rotation_angle * 16, 300 * 16) - # draw message text + # Draw message text if self._current_message: font = QFont() # Using system-default font here font.setPixelSize(13) |