From 964c566ffb151126533ba0232d4279813e10cc80 Mon Sep 17 00:00:00 2001 From: "j.delarago" Date: Mon, 13 Jun 2022 14:43:23 +0200 Subject: [PATCH 01/31] Add spacing option between icon and text in IconWithText.qml --- resources/qml/IconWithText.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resources/qml/IconWithText.qml b/resources/qml/IconWithText.qml index cc0834d7ea..24f211ae17 100644 --- a/resources/qml/IconWithText.qml +++ b/resources/qml/IconWithText.qml @@ -22,6 +22,7 @@ Item property alias elide: label.elide property real margin: UM.Theme.getSize("narrow_margin").width property alias wrapMode: label.wrapMode + property real spacing: UM.Theme.getSize("narrow_margin").width // These properties can be used in combination with layouts. readonly property real contentWidth: icon.width + margin + label.contentWidth @@ -61,6 +62,7 @@ Item top: parent.top bottom: parent.bottom rightMargin: 0 + leftMargin: spacing margins: margin } } From ed7ec6ab8f634feabe276ebd5f591ad55dbb3853 Mon Sep 17 00:00:00 2001 From: "j.delarago" Date: Tue, 14 Jun 2022 09:59:22 +0200 Subject: [PATCH 02/31] Add intent change signal so intent changes can trigger updates in resolution drop down. CURA-8849 --- cura/Settings/IntentManager.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cura/Settings/IntentManager.py b/cura/Settings/IntentManager.py index 2dfec02201..fd5dd22b82 100644 --- a/cura/Settings/IntentManager.py +++ b/cura/Settings/IntentManager.py @@ -8,6 +8,7 @@ from UM.Logger import Logger from UM.Settings.InstanceContainer import InstanceContainer import cura.CuraApplication +from UM.Signal import Signal from cura.Machines.ContainerTree import ContainerTree from cura.Settings.cura_empty_instance_containers import empty_intent_container @@ -29,6 +30,7 @@ class IntentManager(QObject): return cls.__instance intentCategoryChanged = pyqtSignal() #Triggered when we switch categories. + intentCategoryChangedSignal = Signal() def intentMetadatas(self, definition_id: str, nozzle_name: str, material_base_file: str) -> List[Dict[str, Any]]: """Gets the metadata dictionaries of all intent profiles for a given @@ -189,3 +191,4 @@ class IntentManager(QObject): application.getMachineManager().setQualityGroupByQualityType(quality_type) if old_intent_category != intent_category: self.intentCategoryChanged.emit() + self.intentCategoryChangedSignal.emit() From e7d403846162886966b9bf8b17bda178b492fb27 Mon Sep 17 00:00:00 2001 From: "j.delarago" Date: Tue, 14 Jun 2022 09:59:52 +0200 Subject: [PATCH 03/31] Add new icons for intents CURA-8849 --- resources/themes/cura-light/icons/default/GearCheck.svg | 4 ++++ resources/themes/cura-light/icons/default/Nut.svg | 8 ++++++++ resources/themes/cura-light/icons/default/Visual.svg | 9 +++++++++ 3 files changed, 21 insertions(+) create mode 100644 resources/themes/cura-light/icons/default/GearCheck.svg create mode 100644 resources/themes/cura-light/icons/default/Nut.svg create mode 100644 resources/themes/cura-light/icons/default/Visual.svg diff --git a/resources/themes/cura-light/icons/default/GearCheck.svg b/resources/themes/cura-light/icons/default/GearCheck.svg new file mode 100644 index 0000000000..1ec89a5a8d --- /dev/null +++ b/resources/themes/cura-light/icons/default/GearCheck.svg @@ -0,0 +1,4 @@ + + + + diff --git a/resources/themes/cura-light/icons/default/Nut.svg b/resources/themes/cura-light/icons/default/Nut.svg new file mode 100644 index 0000000000..77df86d31b --- /dev/null +++ b/resources/themes/cura-light/icons/default/Nut.svg @@ -0,0 +1,8 @@ + + + + + + + diff --git a/resources/themes/cura-light/icons/default/Visual.svg b/resources/themes/cura-light/icons/default/Visual.svg new file mode 100644 index 0000000000..8d75b7feb4 --- /dev/null +++ b/resources/themes/cura-light/icons/default/Visual.svg @@ -0,0 +1,9 @@ + + + + + + + From 6f88adab8e031176b27f90ed50abe374112afeef Mon Sep 17 00:00:00 2001 From: "j.delarago" Date: Tue, 14 Jun 2022 11:27:50 +0200 Subject: [PATCH 04/31] Add new theme colors from figma CURA-8849 --- resources/themes/cura-light/theme.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index b3ee4c912b..fda9e4631a 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -201,7 +201,8 @@ "um_orange_9": [64, 45, 32, 255], "um_yellow_1": [255, 248, 225, 255], "um_yellow_5": [253, 209, 58, 255], - "um_yellow_9": [64, 58, 36, 255] + "um_yellow_9": [64, 58, 36, 255], + "um_blue_1": [232, 240, 253, 255] }, "colors": { From a87695cd8dfb5c257ed63ffd05a972846bcb77ec Mon Sep 17 00:00:00 2001 From: "j.delarago" Date: Tue, 14 Jun 2022 11:41:38 +0200 Subject: [PATCH 05/31] Added new intent selection buttons and resolution drop down to replace the matrix. We are now selecting intents first and then quality, however the container hierarchy quality -> intents. This is the reason for the new functions inside machine manager. CURA-8849 --- cura/CuraApplication.py | 4 + .../Models/ActiveIntentQualitiesModel.py | 121 +++++++++++ cura/Machines/Models/IntentSelectionModel.py | 129 ++++++++++++ cura/Settings/MachineManager.py | 28 +++ .../Recommended/RecommendedPrintSetup.qml | 27 ++- .../RecommendedQualityProfileSelector.qml | 191 ++---------------- ...ecommendedQualityProfileSelectorButton.qml | 63 ++++++ .../RecommendedResolutionSelector.qml | 65 ++++++ resources/themes/cura-light/theme.json | 4 +- 9 files changed, 454 insertions(+), 178 deletions(-) create mode 100644 cura/Machines/Models/ActiveIntentQualitiesModel.py create mode 100644 cura/Machines/Models/IntentSelectionModel.py create mode 100644 resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelectorButton.qml create mode 100644 resources/qml/PrintSetupSelector/Recommended/RecommendedResolutionSelector.qml diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 3a3ac17cdf..e1805584b0 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -115,6 +115,8 @@ from . import CuraActions from . import PlatformPhysics from . import PrintJobPreviewImageProvider from .AutoSave import AutoSave +from .Machines.Models.ActiveIntentQualitiesModel import ActiveIntentQualitiesModel +from .Machines.Models.IntentSelectionModel import IntentSelectionModel from .SingleInstance import SingleInstance if TYPE_CHECKING: @@ -1192,6 +1194,8 @@ class CuraApplication(QtApplication): qmlRegisterType(NozzleModel, "Cura", 1, 0, "NozzleModel") qmlRegisterType(IntentModel, "Cura", 1, 6, "IntentModel") qmlRegisterType(IntentCategoryModel, "Cura", 1, 6, "IntentCategoryModel") + qmlRegisterType(IntentSelectionModel, "Cura", 1, 7, "IntentSelectionModel") + qmlRegisterType(ActiveIntentQualitiesModel, "Cura", 1, 7, "ActiveIntentQualitiesModel") self.processEvents() qmlRegisterType(MaterialSettingsVisibilityHandler, "Cura", 1, 0, "MaterialSettingsVisibilityHandler") diff --git a/cura/Machines/Models/ActiveIntentQualitiesModel.py b/cura/Machines/Models/ActiveIntentQualitiesModel.py new file mode 100644 index 0000000000..67b9cec9a4 --- /dev/null +++ b/cura/Machines/Models/ActiveIntentQualitiesModel.py @@ -0,0 +1,121 @@ +# Copyright (c) 2022 Ultimaker B.V. +# Cura is released under the terms of the LGPLv3 or higher. +from typing import Optional, Set, Dict, List, Any + +from PyQt6.QtCore import Qt, QObject, QTimer + +import cura.CuraApplication +from UM.Logger import Logger +from UM.Qt.ListModel import ListModel +from cura.Machines.ContainerTree import ContainerTree +from cura.Machines.Models.MachineModelUtils import fetchLayerHeight +from cura.Machines.MaterialNode import MaterialNode +from cura.Machines.QualityGroup import QualityGroup +from cura.Settings.IntentManager import IntentManager + + +class ActiveIntentQualitiesModel(ListModel): + NameRole = Qt.ItemDataRole.UserRole + 1 + DisplayTextRole = Qt.ItemDataRole.UserRole + 2 + QualityTypeRole = Qt.ItemDataRole.UserRole + 3 + LayerHeightRole = Qt.ItemDataRole.UserRole + 4 + IntentCategeoryRole = Qt.ItemDataRole.UserRole + 5 + + def __init__(self, parent: Optional[QObject] = None) -> None: + super().__init__(parent) + + self.addRoleName(self.NameRole, "name") + self.addRoleName(self.QualityTypeRole, "quality_type") + self.addRoleName(self.LayerHeightRole, "layer_height") + self.addRoleName(self.DisplayTextRole, "display_text") + self.addRoleName(self.IntentCategeoryRole, "intent_category") + + self._intent_category = "" + + IntentManager.intentCategoryChangedSignal.connect(self._update) + + self._update_timer = QTimer() + self._update_timer.setInterval(100) + self._update_timer.setSingleShot(True) + self._update_timer.timeout.connect(self._update) + + self._update() + + def _updateDelayed(self): + self._update_timer.start() + + def _onChanged(self, container): + if container.getMetaDataEntry("type") == "intent": + self._updateDelayed() + + def _update(self): + active_extruder_stack = cura.CuraApplication.CuraApplication.getInstance().getMachineManager().activeStack + if active_extruder_stack: + self._intent_category = active_extruder_stack.intent.getMetaDataEntry("intent_category", "") + + new_items = [] # type: List[Dict[str, Any]] + global_stack = cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack() + if not global_stack: + self.setItems(new_items) + return + quality_groups = ContainerTree.getInstance().getCurrentQualityGroups() + + material_nodes = self._getActiveMaterials() + + added_quality_type_set = set() # type: Set[str] + for material_node in material_nodes: + intents = self._getIntentsForMaterial(material_node, quality_groups) + for intent in intents: + if intent["quality_type"] not in added_quality_type_set: + new_items.append(intent) + added_quality_type_set.add(intent["quality_type"]) + + new_items = sorted(new_items, key=lambda x: x["layer_height"]) + self.setItems(new_items) + + def _getActiveMaterials(self) -> Set["MaterialNode"]: + """Get the active materials for all extruders. No duplicates will be returned""" + + global_stack = cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack() + if global_stack is None: + return set() + + container_tree = ContainerTree.getInstance() + machine_node = container_tree.machines[global_stack.definition.getId()] + nodes = set() # type: Set[MaterialNode] + + for extruder in global_stack.extruderList: + active_variant_name = extruder.variant.getMetaDataEntry("name") + if active_variant_name not in machine_node.variants: + Logger.log("w", "Could not find the variant %s", active_variant_name) + continue + active_variant_node = machine_node.variants[active_variant_name] + active_material_node = active_variant_node.materials.get(extruder.material.getMetaDataEntry("base_file")) + if active_material_node is None: + Logger.log("w", "Could not find the material %s", extruder.material.getMetaDataEntry("base_file")) + continue + nodes.add(active_material_node) + + return nodes + + def _getIntentsForMaterial(self, active_material_node: "MaterialNode", quality_groups: Dict[str, "QualityGroup"]) -> List[Dict[str, Any]]: + extruder_intents = [] # type: List[Dict[str, Any]] + + for quality_id, quality_node in active_material_node.qualities.items(): + if quality_node.quality_type not in quality_groups: # Don't add the empty quality type (or anything else that would crash, defensively). + continue + quality_group = quality_groups[quality_node.quality_type] + layer_height = fetchLayerHeight(quality_group) + + for intent_id, intent_node in quality_node.intents.items(): + if intent_node.intent_category != self._intent_category: + continue + extruder_intents.append({"name": quality_group.name, + "display_text": f"{quality_group.name} - {layer_height}mm", + "quality_type": quality_group.quality_type, + "layer_height": layer_height, + "intent_category": self._intent_category + }) + return extruder_intents + + diff --git a/cura/Machines/Models/IntentSelectionModel.py b/cura/Machines/Models/IntentSelectionModel.py new file mode 100644 index 0000000000..c8c9b9974d --- /dev/null +++ b/cura/Machines/Models/IntentSelectionModel.py @@ -0,0 +1,129 @@ +# Copyright (c) 2022 Ultimaker B.V. +# Cura is released under the terms of the LGPLv3 or higher. + +import collections +from typing import OrderedDict + +from PyQt6.QtCore import Qt, QTimer + +import cura +from UM import i18nCatalog +from UM.Logger import Logger +from UM.Qt.ListModel import ListModel +from UM.Settings.ContainerRegistry import ContainerRegistry +from UM.Settings.Interfaces import ContainerInterface +from cura.Settings.IntentManager import IntentManager + +catalog = i18nCatalog("cura") + + +class IntentSelectionModel(ListModel): + + NameRole = Qt.ItemDataRole.UserRole + 1 + IntentCategoryRole = Qt.ItemDataRole.UserRole + 2 + WeightRole = Qt.ItemDataRole.UserRole + 3 + DescriptionRole = Qt.ItemDataRole.UserRole + 4 + IconRole = Qt.ItemDataRole.UserRole + 5 + + def __init__(self, parent=None): + super().__init__(parent) + + self.addRoleName(self.NameRole, "name") + self.addRoleName(self.IntentCategoryRole, "intent_category") + self.addRoleName(self.WeightRole, "weight") + self.addRoleName(self.DescriptionRole, "description") + self.addRoleName(self.IconRole, "icon") + + application = cura.CuraApplication.CuraApplication.getInstance() + + ContainerRegistry.getInstance().containerAdded.connect(self._onContainerChange) + ContainerRegistry.getInstance().containerRemoved.connect(self._onContainerChange) + machine_manager = cura.CuraApplication.CuraApplication.getInstance().getMachineManager() + machine_manager.activeMaterialChanged.connect(self._update) + machine_manager.activeVariantChanged.connect(self._update) + machine_manager.extruderChanged.connect(self._update) + + extruder_manager = application.getExtruderManager() + extruder_manager.extrudersChanged.connect(self._update) + + self._update_timer = QTimer() # type: QTimer + self._update_timer.setInterval(100) + self._update_timer.setSingleShot(True) + self._update_timer.timeout.connect(self._update) + + self._onChange() + + @staticmethod + def _getDefaultProfileInformation() -> OrderedDict[str, dict]: + """ Default information user-visible string. Ordered by weight. """ + default_profile_information = collections.OrderedDict() + default_profile_information["default"] = { + "name": catalog.i18nc("@label", "Default"), + "icon": "GearCheck" + } + default_profile_information["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."), + "icon" : "Visual" + } + default_profile_information["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."), + "icon": "Nut" + } + default_profile_information["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."), + "icon": "SpeedOMeter" + } + return default_profile_information + + def _onContainerChange(self, container: ContainerInterface) -> None: + """Updates the list of intents if an intent profile was added or removed.""" + + if container.getMetaDataEntry("type") == "intent": + self._update() + + def _onChange(self) -> None: + self._update_timer.start() + + def _update(self): + Logger.log("d", "Updating {model_class_name}.".format(model_class_name = self.__class__.__name__)) + + global_stack = cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack() + if global_stack is None: + self.setItems([]) + Logger.log("d", "No active GlobalStack, set quality profile model as empty.") + return + + # Check for material compatibility + if not cura.CuraApplication.CuraApplication.getInstance().getMachineManager().activeMaterialsCompatible(): + Logger.log("d", "No active material compatibility, set quality profile model as empty.") + self.setItems([]) + return + + default_profile_info = self._getDefaultProfileInformation() + + available_categories = IntentManager.getInstance().currentAvailableIntentCategories() + result = [] + for i, category in enumerate(available_categories): + profile_info = default_profile_info.get(category, {}) + + try: + weight = list(default_profile_info.keys()).index(category) + except ValueError: + weight = len(available_categories) + i + + result.append({ + "name": profile_info.get("name", category.title()), + "description": profile_info.get("description", None), + "icon" : profile_info.get("icon", ""), + "intent_category": category, + "weight": weight, + }) + + result.sort(key=lambda k: k["weight"]) + + self.setItems(result) + + diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 9b98179bff..64d34d6c3e 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -1778,3 +1778,31 @@ class MachineManager(QObject): abbr_machine += stripped_word return abbr_machine + + @pyqtSlot(str, str, result = bool) + def intentCategoryHasQuality(self, intent_category: str, quality_type: str) -> bool: + """ Checks if there are any quality groups for active extruders that have an intent category """ + quality_groups = ContainerTree.getInstance().getCurrentQualityGroups() + + if quality_type in quality_groups: + quality_group = quality_groups[quality_type] + for node in quality_group.nodes_for_extruders.values(): + if any(intent.intent_category == intent_category for intent in node.intents.values()): + return True + + return False + + @pyqtSlot(str, result = str) + def getDefaultQualityTypeForIntent(self, intent_category) -> str: + """ If there is an intent category for the default machine quality return it, otherwise return the first quality for this intent category """ + machine = ContainerTree.getInstance().machines.get(self._global_container_stack.definition.getId()) + + if self.intentCategoryHasQuality(intent_category, machine.preferred_quality_type): + return machine.preferred_quality_type + + for quality_type, quality_group in ContainerTree.getInstance().getCurrentQualityGroups().items(): + for node in quality_group.nodes_for_extruders.values(): + if any(intent.intent_category == intent_category for intent in node.intents.values()): + return quality_type + + return "" diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml index de8cce6e94..9dce3565a0 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml @@ -3,8 +3,8 @@ import QtQuick 2.10 -import UM 1.2 as UM -import Cura 1.0 as Cura +import UM 1.6 as UM +import Cura 1.6 as Cura Item { @@ -13,11 +13,11 @@ Item height: childrenRect.height + 2 * padding property bool settingsEnabled: Cura.ExtruderManager.activeExtruderStackId || extrudersEnabledCount.properties.value == 1 - property real padding: UM.Theme.getSize("thick_margin").width + property real padding: UM.Theme.getSize("default_margin").width Column { - spacing: UM.Theme.getSize("wide_margin").height + spacing: UM.Theme.getSize("default_margin").height anchors { @@ -30,11 +30,26 @@ Item // TODO property real firstColumnWidth: Math.round(width / 3) + UM.Label + { + text: catalog.i18nc("@label", "Profiles") + font: UM.Theme.getFont("medium") + } + RecommendedQualityProfileSelector { width: parent.width - // TODO Create a reusable component with these properties to not define them separately for each component - labelColumnWidth: parent.firstColumnWidth + } + + RecommendedResolutionSelector + { + width: parent.width + } + + UM.Label + { + text: catalog.i18nc("@label", "Print settings") + font: UM.Theme.getFont("medium") } RecommendedInfillDensitySelector diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml index f96062463d..edce3c59a0 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml @@ -3,9 +3,10 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 +import QtQuick.Layouts 2.10 import UM 1.5 as UM -import Cura 1.6 as Cura +import Cura 1.7 as Cura import ".." Item @@ -13,187 +14,35 @@ Item id: qualityRow height: childrenRect.height - property real labelColumnWidth: Math.round(width / 3) - property real settingsColumnWidth: width - labelColumnWidth - - // Here are the elements that are shown in the left column - - Column + RowLayout { - anchors - { - left: parent.left - right: parent.right - } - - spacing: UM.Theme.getSize("default_margin").height - - ButtonGroup - { - id: activeProfileButtonGroup - exclusive: true - onClicked: Cura.IntentManager.selectIntent(button.modelData.intent_category, button.modelData.quality_type) - } - - Item - { - height: childrenRect.height - anchors - { - left: parent.left - right: parent.right - } - Cura.IconWithText - { - id: profileLabel - source: UM.Theme.getIcon("PrintQuality") - text: catalog.i18nc("@label", "Profiles") - font: UM.Theme.getFont("medium") - width: labelColumnWidth - iconSize: UM.Theme.getSize("medium_button_icon").width - } - UM.SimpleButton - { - id: resetToDefaultQualityButton - - visible: Cura.SimpleModeSettingsManager.isProfileCustomized || Cura.MachineManager.hasCustomQuality - height: visible ? UM.Theme.getSize("print_setup_icon").height : 0 - width: height - anchors - { - right: profileLabel.right - rightMargin: UM.Theme.getSize("default_margin").width - leftMargin: UM.Theme.getSize("default_margin").width - verticalCenter: parent.verticalCenter - } - - color: hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button") - iconSource: UM.Theme.getIcon("ArrowReset") - - onClicked: - { - // if the current profile is user-created, switch to a built-in quality - Cura.MachineManager.resetToUseDefaultQuality() - } - onEntered: - { - var tooltipContent = catalog.i18nc("@tooltip","You have modified some profile settings. If you want to change these go to custom mode.") - base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, 0), tooltipContent) - } - onExited: base.hideTooltip() - } - - Cura.LabelBar - { - id: labelbar - anchors - { - left: profileLabel.right - right: parent.right - verticalCenter: profileLabel.verticalCenter - } - - model: Cura.QualityProfilesDropDownMenuModel - modelKey: "layer_height" - } - } - + id: intentRow + width: parent.width Repeater { - model: Cura.IntentCategoryModel {} - Item + model: Cura.IntentSelectionModel {} + + RecommendedQualityProfileSelectorButton { - anchors - { - left: parent.left - right: parent.right - } - height: intentCategoryLabel.height + text: model.name + iconSource: UM.Theme.getIcon(model.icon) - UM.Label - { - id: intentCategoryLabel - text: model.name - width: labelColumnWidth - UM.Theme.getSize("section_icon").width - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("section_icon").width + UM.Theme.getSize("narrow_margin").width - font: UM.Theme.getFont("medium") - elide: Text.ElideRight - } - Cura.RadioCheckbar - { - anchors + selected: Cura.MachineManager.activeIntentCategory == model.intent_category + + onClicked: { + var qualityType + if (Cura.MachineManager.intentCategoryHasQuality(model.intent_category, Cura.MachineManager.activeQualityType)) { - left: intentCategoryLabel.right - right: parent.right + qualityType = Cura.MachineManager.activeQualityType + } else { + qualityType = Cura.MachineManager.getDefaultQualityTypeForIntent(model.intent_category) + print(Cura.MachineManager.getDefaultQualityTypeForIntent(model.intent_category)) } - dataModel: model["qualities"] - buttonGroup: activeProfileButtonGroup - - function checkedFunction(modelItem) - { - if(Cura.MachineManager.hasCustomQuality) - { - // When user created profile is active, no quality tickbox should be active. - return false - } - - if(modelItem === null) - { - return false - } - return Cura.MachineManager.activeQualityType == modelItem.quality_type && Cura.MachineManager.activeIntentCategory == modelItem.intent_category - } - - isCheckedFunction: checkedFunction + Cura.IntentManager.selectIntent(model.intent_category, qualityType) } - - MouseArea // Intent description tooltip hover area - { - id: intentDescriptionHoverArea - anchors.fill: parent - hoverEnabled: true - enabled: model.description !== undefined - acceptedButtons: Qt.NoButton // react to hover only, don't steal clicks - - Timer - { - id: intentTooltipTimer - interval: 500 - running: false - repeat: false - onTriggered: base.showTooltip( - intentCategoryLabel, - Qt.point(-(intentCategoryLabel.x - qualityRow.x) - UM.Theme.getSize("thick_margin").width, 0), - model.description - ) - } - - onEntered: intentTooltipTimer.start() - onExited: - { - base.hideTooltip() - intentTooltipTimer.stop() - } - } - - NoIntentIcon // This icon has hover priority over intentDescriptionHoverArea, so draw it above it. - { - affected_extruders: Cura.MachineManager.extruderPositionsWithNonActiveIntent - intent_type: model.name - anchors.right: intentCategoryLabel.right - anchors.rightMargin: UM.Theme.getSize("narrow_margin").width - width: intentCategoryLabel.height * 0.75 - anchors.verticalCenter: parent.verticalCenter - height: width - visible: Cura.MachineManager.activeIntentCategory == model.intent_category && affected_extruders.length - } - - } - } } } diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelectorButton.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelectorButton.qml new file mode 100644 index 0000000000..53b77812e2 --- /dev/null +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelectorButton.qml @@ -0,0 +1,63 @@ +// Copyright (c) 2022 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 +import QtQuick.Layouts 2.10 + +import UM 1.5 as UM +import Cura 1.7 as Cura + + +Rectangle +{ + id: base + height: 60 + Layout.fillWidth: true + color: mouseArea.containsMouse || selected ? UM.Theme.getColor("um_blue_1") : UM.Theme.getColor("background_1") + + property alias iconSource: intentIcon.source + property alias text: qualityLabel.text + property bool selected: false + + signal clicked() + + MouseArea + { + id: mouseArea + anchors.fill: parent + hoverEnabled: true + onClicked: base.clicked() + } + + Item + { + width: intentIcon.width + anchors + { + top: parent.top + bottom: qualityLabel.top + horizontalCenter: parent.horizontalCenter + } + + UM.ColorImage + { + id: intentIcon + width: UM.Theme.getSize("recommended_button_icon").width + height: width + anchors.centerIn: parent + color: UM.Theme.getColor("icon") + } + } + + UM.Label + { + id: qualityLabel + anchors + { + bottom: parent.bottom + horizontalCenter: parent.horizontalCenter + bottomMargin: UM.Theme.getSize("narrow_margin").height + } + } +} \ No newline at end of file diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedResolutionSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedResolutionSelector.qml new file mode 100644 index 0000000000..0cc29a2d5c --- /dev/null +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedResolutionSelector.qml @@ -0,0 +1,65 @@ +// Copyright (c) 2022 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 + +import UM 1.6 as UM +import Cura 1.7 as Cura + +Item +{ + height: childrenRect.height + + property real labelColumnWidth: Math.round(width / 3) + + Cura.IconWithText + { + id: resolutionTitle + anchors.top: parent.top + anchors.left: parent.left + source: UM.Theme.getIcon("PrintQuality") + text: catalog.i18nc("@label", "Resolution") + width: labelColumnWidth + height: parent.height + spacing: UM.Theme.getSize("thick_margin").width + iconSize: UM.Theme.getSize("medium_button_icon").width + } + + Cura.ComboBox + { + id: visibilityPreset + implicitHeight: UM.Theme.getSize("combobox").height + implicitWidth: UM.Theme.getSize("combobox").width + anchors + { + top: parent.top + right: parent.right + } + + textRole: "display_text" + + model: Cura.ActiveIntentQualitiesModel{} + + currentIndex: + { + var current_quality_type = Cura.MachineManager.activeQualityType + + var index = 0 + for (var i = 0; i < model.count; i++) + { + if (model.getItem(i).quality_type == current_quality_type) + { + index = i + break + } + } + return index + } + + onActivated: + { + var selected_item = model.getItem(currentIndex) + Cura.IntentManager.selectIntent(selected_item.intent_category, selected_item.quality_type) + } + } +} \ No newline at end of file diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index fda9e4631a..6e3477d9b2 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -638,6 +638,8 @@ "marketplace_large_icon": [4.0, 4.0], - "preferences_page_list_item": [8.0, 2.0] + "preferences_page_list_item": [8.0, 2.0], + + "recommended_button_icon": [1.7, 1.7] } } From 5cfb6f94e3ca1df3f08a88bcd939e1a53f5b55cf Mon Sep 17 00:00:00 2001 From: "j.delarago" Date: Tue, 14 Jun 2022 15:03:47 +0200 Subject: [PATCH 06/31] Update the resolution dropdown model whenever a custom profile is enabled. Otherwise it won't reflect the custom profiles parent resolution. CURA-8849 --- cura/Machines/Models/ActiveIntentQualitiesModel.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cura/Machines/Models/ActiveIntentQualitiesModel.py b/cura/Machines/Models/ActiveIntentQualitiesModel.py index 67b9cec9a4..dc546bc5d4 100644 --- a/cura/Machines/Models/ActiveIntentQualitiesModel.py +++ b/cura/Machines/Models/ActiveIntentQualitiesModel.py @@ -33,6 +33,8 @@ class ActiveIntentQualitiesModel(ListModel): self._intent_category = "" IntentManager.intentCategoryChangedSignal.connect(self._update) + machine_manager = cura.CuraApplication.CuraApplication.getInstance().getMachineManager() + machine_manager.activeQualityGroupChanged.connect(self._update) self._update_timer = QTimer() self._update_timer.setInterval(100) From 28c1291febebbb6f93f9eca00067cca89c96d084 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 14 Jun 2022 15:09:34 +0200 Subject: [PATCH 07/31] Allow configuring combobox with whether they allow styled text or not For some models we'd like to have the possibility to have rich text in the combobox. For some we'd like to prevent that, for instance to prevent the user from using colours in their profile names, or boldface, or even images. Contributes to issue CURA-8849. --- resources/qml/Widgets/ComboBox.qml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/resources/qml/Widgets/ComboBox.qml b/resources/qml/Widgets/ComboBox.qml index 988b7c3782..f85c5d060b 100644 --- a/resources/qml/Widgets/ComboBox.qml +++ b/resources/qml/Widgets/ComboBox.qml @@ -17,6 +17,8 @@ ComboBox property var defaultTextOnEmptyModel: catalog.i18nc("@label", "No items to select from") // Text displayed in the combobox when the model is empty property var defaultTextOnEmptyIndex: "" // Text displayed in the combobox when the model has items but no item is selected + property alias textFormat: contentLabel.textFormat + enabled: delegateModel.count > 0 onVisibleChanged: { popup.close() } @@ -146,7 +148,7 @@ ComboBox anchors.rightMargin: UM.Theme.getSize("setting_unit_margin").width text: delegateItem.text - textFormat: Text.PlainText + textFormat: control.textFormat color: UM.Theme.getColor("setting_control_text") elide: Text.ElideRight wrapMode: Text.NoWrap From 074e9a86077698114538b5e34774c699592d8788 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 14 Jun 2022 15:10:26 +0200 Subject: [PATCH 08/31] Show profile group name in bold That highlights it relative to the layer height. Contributes to issue CURA-8849. --- cura/Machines/Models/ActiveIntentQualitiesModel.py | 2 +- .../Recommended/RecommendedResolutionSelector.qml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cura/Machines/Models/ActiveIntentQualitiesModel.py b/cura/Machines/Models/ActiveIntentQualitiesModel.py index dc546bc5d4..dc3bf41831 100644 --- a/cura/Machines/Models/ActiveIntentQualitiesModel.py +++ b/cura/Machines/Models/ActiveIntentQualitiesModel.py @@ -113,7 +113,7 @@ class ActiveIntentQualitiesModel(ListModel): if intent_node.intent_category != self._intent_category: continue extruder_intents.append({"name": quality_group.name, - "display_text": f"{quality_group.name} - {layer_height}mm", + "display_text": f"{quality_group.name} - {layer_height}mm", "quality_type": quality_group.quality_type, "layer_height": layer_height, "intent_category": self._intent_category diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedResolutionSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedResolutionSelector.qml index 0cc29a2d5c..ef64d7d6d4 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedResolutionSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedResolutionSelector.qml @@ -37,6 +37,7 @@ Item } textRole: "display_text" + textFormat: Text.StyledText model: Cura.ActiveIntentQualitiesModel{} From 40d473c243297dcdd0d7de7c7fb03c83c3b951cb Mon Sep 17 00:00:00 2001 From: "j.delarago" Date: Tue, 14 Jun 2022 15:44:11 +0200 Subject: [PATCH 09/31] Add circle with letter inside for non default intents CURA-8849 --- .../RecommendedQualityProfileSelector.qml | 4 +- ...ecommendedQualityProfileSelectorButton.qml | 43 ++++++++++++++++--- resources/themes/cura-light/theme.json | 5 +++ 3 files changed, 44 insertions(+), 8 deletions(-) diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml index edce3c59a0..569cf7f7d0 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml @@ -25,8 +25,8 @@ Item RecommendedQualityProfileSelectorButton { - text: model.name - iconSource: UM.Theme.getIcon(model.icon) + profileName: model.name + icon: model.icon selected: Cura.MachineManager.activeIntentCategory == model.intent_category diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelectorButton.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelectorButton.qml index 53b77812e2..a08cfab37a 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelectorButton.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelectorButton.qml @@ -16,9 +16,9 @@ Rectangle Layout.fillWidth: true color: mouseArea.containsMouse || selected ? UM.Theme.getColor("um_blue_1") : UM.Theme.getColor("background_1") - property alias iconSource: intentIcon.source - property alias text: qualityLabel.text property bool selected: false + property string profileName: "" + property string icon: "" signal clicked() @@ -38,21 +38,52 @@ Rectangle top: parent.top bottom: qualityLabel.top horizontalCenter: parent.horizontalCenter + topMargin: UM.Theme.getSize("narrow_margin").height } - UM.ColorImage + Item { id: intentIcon width: UM.Theme.getSize("recommended_button_icon").width - height: width - anchors.centerIn: parent - color: UM.Theme.getColor("icon") + height: UM.Theme.getSize("recommended_button_icon").height + UM.ColorImage + { + anchors.fill: parent + anchors.centerIn: parent + visible: icon != "" + source: UM.Theme.getIcon(icon) + color: UM.Theme.getColor("icon") + } + + Rectangle + { + id: circle + anchors.fill: parent + radius: width + anchors.verticalCenter: parent.verticalCenter + visible: icon == "" + color: transparent + border.width: UM.Theme.getSize("thick_lining").width + border.color: UM.Theme.getColor("text") + + UM.Label + { + id: initialLabel + anchors.centerIn: parent + text: profileName.charAt(0).toUpperCase() + font: UM.Theme.getFont("small_bold") + horizontalAlignment: Text.AlignHCenter + } + } + + } } UM.Label { id: qualityLabel + text: profileName anchors { bottom: parent.bottom diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 6e3477d9b2..69e7f3dcfe 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -133,6 +133,11 @@ "weight": 400, "family": "Noto Sans" }, + "small_bold": { + "size": 0.9, + "weight": 700, + "family": "Noto Sans" + }, "small_ja_JP": { "size": 0.9, "weight": 400, From bd131257fec7ea80e2edd9cdc41da2e06f69c50a Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 14 Jun 2022 15:39:28 +0200 Subject: [PATCH 10/31] Implement sending a signal when changing intent changes quality level For now it does nothing. But I'm adding a function that should cause the combobox to pulse. That'll be a new feature so I'm implementing it in a separate commit. Contributes to issue CURA-8849. --- cura/Settings/IntentManager.py | 2 +- .../Recommended/RecommendedResolutionSelector.qml | 15 +++++++++++++++ resources/qml/Widgets/ComboBox.qml | 5 +++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/cura/Settings/IntentManager.py b/cura/Settings/IntentManager.py index fd5dd22b82..7d3e2659bf 100644 --- a/cura/Settings/IntentManager.py +++ b/cura/Settings/IntentManager.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Ultimaker B.V. +# Copyright (c) 2022 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. from PyQt6.QtCore import QObject, pyqtProperty, pyqtSignal, pyqtSlot diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedResolutionSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedResolutionSelector.qml index ef64d7d6d4..62cdf94185 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedResolutionSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedResolutionSelector.qml @@ -8,9 +8,11 @@ import Cura 1.7 as Cura Item { + id: recommendedResolutionSelector height: childrenRect.height property real labelColumnWidth: Math.round(width / 3) + property string _previousResolution: Cura.MachineManager.activeQualityType //Internal variable to detect changes. Cura.IconWithText { @@ -62,5 +64,18 @@ Item var selected_item = model.getItem(currentIndex) Cura.IntentManager.selectIntent(selected_item.intent_category, selected_item.quality_type) } + + Connections + { + target: Cura.IntentManager + function onIntentCategoryChanged() + { + if(recommendedResolutionSelector._previousResolution !== Cura.MachineManager.activeQualityType) + { + visibilityPreset.pulse(); + } + recommendedResolutionSelector._previousResolution = Cura.MachineManager.activeQualityType; + } + } } } \ No newline at end of file diff --git a/resources/qml/Widgets/ComboBox.qml b/resources/qml/Widgets/ComboBox.qml index f85c5d060b..0e98cdb25a 100644 --- a/resources/qml/Widgets/ComboBox.qml +++ b/resources/qml/Widgets/ComboBox.qml @@ -164,4 +164,9 @@ ComboBox text: delegateLabel.truncated ? delegateItem.text : "" } } + + function pulse() + { + //TODO: Initiate a pulse of colour. + } } From e095d41f0bde88194b91142fe60c4c2fbd5be173 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 14 Jun 2022 15:57:28 +0200 Subject: [PATCH 11/31] Implement pulse animation option for ComboBox widget You can now call pulse() on it and it'll pulse in the warning colour. Contributes to issue CURA-8849. --- resources/qml/Widgets/ComboBox.qml | 31 ++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/resources/qml/Widgets/ComboBox.qml b/resources/qml/Widgets/ComboBox.qml index 0e98cdb25a..77e6c489e9 100644 --- a/resources/qml/Widgets/ComboBox.qml +++ b/resources/qml/Widgets/ComboBox.qml @@ -54,7 +54,34 @@ ComboBox } ] - background: UM.UnderlineBackground{} + background: UM.UnderlineBackground + { + //Rectangle for highlighting when this combobox needs to pulse. + Rectangle + { + anchors.fill: parent + opacity: 0 + color: UM.Theme.getColor("warning") + + SequentialAnimation on opacity + { + id: pulseAnimation + running: false + loops: 1 + alwaysRunToEnd: true + PropertyAnimation + { + to: 1 + duration: 300 + } + PropertyAnimation + { + to: 0 + duration : 2000 + } + } + } + } indicator: UM.ColorImage { @@ -167,6 +194,6 @@ ComboBox function pulse() { - //TODO: Initiate a pulse of colour. + pulseAnimation.restart(); } } From 83ea5c29442c2efc4e0a97e9fb4ef2e8a27b8bc4 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 14 Jun 2022 15:59:54 +0200 Subject: [PATCH 12/31] Fix triggering first pulse Before the first pulse, the _previousResolution property was still bound to the activeQualityType property of the MachineManager. When it then checks if it changed, it finds that it didn't change because it checks against that same property, but the _previousResolution automatically updated with it. After that it loses its binding because it's set in the function itself to a fixed value. Instead, we'll now give it its initial value with the Component.onCompleted function so that it doesn't bind, and then doesn't change along with the first change. Contributes to issue CURA-8849. --- .../Recommended/RecommendedResolutionSelector.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedResolutionSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedResolutionSelector.qml index 62cdf94185..c69b4dbd13 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedResolutionSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedResolutionSelector.qml @@ -12,7 +12,8 @@ Item height: childrenRect.height property real labelColumnWidth: Math.round(width / 3) - property string _previousResolution: Cura.MachineManager.activeQualityType //Internal variable to detect changes. + property string _previousResolution: "" //Internal variable to detect changes. + Component.onCompleted: _previousResolution = Cura.MachineManager.activeQualityType; Cura.IconWithText { From 6b6f41bfe9b3f92eedb130ad95fec67d60ac7bf0 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 14 Jun 2022 16:07:05 +0200 Subject: [PATCH 13/31] Add a horizontal line between sections of recommended set-up This delimits the selecting of the profile from the few basic settings. Contributes to issue CURA-8849. --- .../Recommended/RecommendedPrintSetup.qml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml index 9dce3565a0..f0b1010517 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml @@ -46,6 +46,15 @@ Item width: parent.width } + //Line between the sections. + Rectangle + { + width: parent.width + height: UM.Theme.getSize("default_lining").height + + color: UM.Theme.getColor("lining") + } + UM.Label { text: catalog.i18nc("@label", "Print settings") From aee614ff9b205e8cddd3b0c3c87858524fc6e926 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 14 Jun 2022 16:12:10 +0200 Subject: [PATCH 14/31] Hide intent category selector if there's just 'default' intent It doesn't make sense to let the user choose then. Contributes to issue CURA-8849. --- .../Recommended/RecommendedQualityProfileSelector.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml index 569cf7f7d0..6bcca955d1 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelector.qml @@ -13,6 +13,7 @@ Item { id: qualityRow height: childrenRect.height + visible: intentSelectionRepeater.count > 1 //Only show selector if there's more options than just "default". RowLayout { @@ -21,6 +22,7 @@ Item Repeater { + id: intentSelectionRepeater model: Cura.IntentSelectionModel {} RecommendedQualityProfileSelectorButton From b8e37936319625327f79073f7141bc7bd64d819b Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 14 Jun 2022 16:19:56 +0200 Subject: [PATCH 15/31] Fix QML warning about no variable 'transparent' existing It's a colour name. It should be within quotes here. Contributes to issue CURA-8849. --- .../Recommended/RecommendedQualityProfileSelectorButton.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelectorButton.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelectorButton.qml index a08cfab37a..278a75ce0f 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelectorButton.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelectorButton.qml @@ -62,7 +62,7 @@ Rectangle radius: width anchors.verticalCenter: parent.verticalCenter visible: icon == "" - color: transparent + color: "transparent" border.width: UM.Theme.getSize("thick_lining").width border.color: UM.Theme.getColor("text") From 5c15ac68b89ae7c526c319ab0316f4cf7333c584 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 14 Jun 2022 16:59:23 +0200 Subject: [PATCH 16/31] Add a design for the notification when there's no recommended profile Looks more harsh than it should be, perhaps. I'd prefer if we could add some text that says that you can create your own custom profiles too... Contributes to issue CURA-8849. --- .../UnsupportedProfileIndication.qml | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 resources/qml/PrintSetupSelector/Recommended/UnsupportedProfileIndication.qml diff --git a/resources/qml/PrintSetupSelector/Recommended/UnsupportedProfileIndication.qml b/resources/qml/PrintSetupSelector/Recommended/UnsupportedProfileIndication.qml new file mode 100644 index 0000000000..86852de4a0 --- /dev/null +++ b/resources/qml/PrintSetupSelector/Recommended/UnsupportedProfileIndication.qml @@ -0,0 +1,54 @@ +//Copyright (c) 2022 Ultimaker B.V. +//Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.15 + +import Cura 1.6 as Cura +import UM 1.6 as UM + +//Message showing the user that the configuration they have selected has no profiles. +Column +{ + spacing: UM.Theme.getSize("default_margin").height + + Row + { + width: parent.width + + spacing: UM.Theme.getSize("thin_margin").width + + UM.StatusIcon + { + width: UM.Theme.getSize("notification_icon").width + status: UM.StatusIcon.Status.ERROR + } + + UM.Label + { + width: parent.width + + font: UM.Theme.getFont("default_bold") + text: catalog.i18nc("@error", "Configuration not supported") + } + } + + UM.Label + { + width: parent.width + + text: catalog.i18nc("@message:text %1 is the name the printer uses for 'nozzle'.", "No profiles are available for the selected material/%1 configuration. Please change your configuration." + ).arg(Cura.MachineManager.activeDefinitionVariantsName) + } + + Cura.TertiaryButton + { + anchors.right: parent.right + + text: catalog.i18nc("@button:label", "Learn more") + textFont: UM.Theme.getFont("default") + iconSource: UM.Theme.getIcon("LinkExternal") + isIconOnRightSide: true + + onClicked: Qt.openUrlExternally("https://ultimaker.com/") //TODO: Fill in the actual link. + } +} \ No newline at end of file From b18cb1f649db96090e4cd4c8e78504d435618a36 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 14 Jun 2022 18:20:00 +0200 Subject: [PATCH 17/31] Show UnsupportedProfileIndication if list of quality types is empty And otherwise show the intent and quality level selectors. This is currently quite broken because the list of quality levels is not correct. It should only show a quality type if it is supported by all extruders. Contributes to issue CURA-8849. --- .../Recommended/RecommendedPrintSetup.qml | 14 ++++++++++++-- .../Recommended/RecommendedResolutionSelector.qml | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml index f0b1010517..fbe1c5bc54 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml @@ -1,5 +1,5 @@ -// Copyright (c) 2018 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. +//Copyright (c) 2022 Ultimaker B.V. +//Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.10 @@ -39,13 +39,23 @@ Item RecommendedQualityProfileSelector { width: parent.width + + visible: recommendedResolutionSelector.visible } RecommendedResolutionSelector { + id: recommendedResolutionSelector width: parent.width } + UnsupportedProfileIndication + { + width: parent.width + + visible: !recommendedResolutionSelector.visible + } + //Line between the sections. Rectangle { diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedResolutionSelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedResolutionSelector.qml index c69b4dbd13..6217cfe1cc 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedResolutionSelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedResolutionSelector.qml @@ -15,6 +15,8 @@ Item property string _previousResolution: "" //Internal variable to detect changes. Component.onCompleted: _previousResolution = Cura.MachineManager.activeQualityType; + visible: visibilityPreset.count > 0 //Only show if there are quality types to select from. + Cura.IconWithText { id: resolutionTitle From 3acc7bcb1c522cb9dcbec243af9c414fd95f7847 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 14 Jun 2022 18:20:35 +0200 Subject: [PATCH 18/31] Add actual link to help page for when a profile is not supported Doesn't have UTM tags though. Maybe that's not important here. Contributes to issue CURA-8849. --- .../Recommended/UnsupportedProfileIndication.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/PrintSetupSelector/Recommended/UnsupportedProfileIndication.qml b/resources/qml/PrintSetupSelector/Recommended/UnsupportedProfileIndication.qml index 86852de4a0..6d1511d526 100644 --- a/resources/qml/PrintSetupSelector/Recommended/UnsupportedProfileIndication.qml +++ b/resources/qml/PrintSetupSelector/Recommended/UnsupportedProfileIndication.qml @@ -49,6 +49,6 @@ Column iconSource: UM.Theme.getIcon("LinkExternal") isIconOnRightSide: true - onClicked: Qt.openUrlExternally("https://ultimaker.com/") //TODO: Fill in the actual link. + onClicked: Qt.openUrlExternally("https://support.ultimaker.com/hc/en-us/articles/360012909099-How-to-check-why-a-profile-is-Not-supported") //TODO: Add tags? } } \ No newline at end of file From d19e89325f34b766b27718705c4f1947b8f4a0c9 Mon Sep 17 00:00:00 2001 From: "j.delarago" Date: Wed, 15 Jun 2022 09:06:00 +0200 Subject: [PATCH 19/31] Stop returning quality types from inactive quality groups. This was causing the resolution drop down to show unavailable resolutions. CURA-8849 --- cura/Machines/Models/ActiveIntentQualitiesModel.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cura/Machines/Models/ActiveIntentQualitiesModel.py b/cura/Machines/Models/ActiveIntentQualitiesModel.py index dc3bf41831..ab59ada7c9 100644 --- a/cura/Machines/Models/ActiveIntentQualitiesModel.py +++ b/cura/Machines/Models/ActiveIntentQualitiesModel.py @@ -107,11 +107,16 @@ class ActiveIntentQualitiesModel(ListModel): if quality_node.quality_type not in quality_groups: # Don't add the empty quality type (or anything else that would crash, defensively). continue quality_group = quality_groups[quality_node.quality_type] + + if not quality_group.is_available: + continue + layer_height = fetchLayerHeight(quality_group) for intent_id, intent_node in quality_node.intents.items(): if intent_node.intent_category != self._intent_category: continue + extruder_intents.append({"name": quality_group.name, "display_text": f"{quality_group.name} - {layer_height}mm", "quality_type": quality_group.quality_type, From d293855c6528019e919f043b88648d05b3c1269b Mon Sep 17 00:00:00 2001 From: "j.delarago" Date: Wed, 15 Jun 2022 09:07:35 +0200 Subject: [PATCH 20/31] Remove typo CURA-8849 --- .../Recommended/RecommendedQualityProfileSelectorButton.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelectorButton.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelectorButton.qml index 278a75ce0f..25ac660c8a 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelectorButton.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelectorButton.qml @@ -62,7 +62,6 @@ Rectangle radius: width anchors.verticalCenter: parent.verticalCenter visible: icon == "" - color: "transparent" border.width: UM.Theme.getSize("thick_lining").width border.color: UM.Theme.getColor("text") From 5fa10b0b8ac9614832d7506cbaa09ba7740f0ca4 Mon Sep 17 00:00:00 2001 From: "j.delarago" Date: Wed, 15 Jun 2022 09:48:08 +0200 Subject: [PATCH 21/31] Add campaign link CURA-8849 --- .../Recommended/UnsupportedProfileIndication.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/PrintSetupSelector/Recommended/UnsupportedProfileIndication.qml b/resources/qml/PrintSetupSelector/Recommended/UnsupportedProfileIndication.qml index 6d1511d526..ff12fa9307 100644 --- a/resources/qml/PrintSetupSelector/Recommended/UnsupportedProfileIndication.qml +++ b/resources/qml/PrintSetupSelector/Recommended/UnsupportedProfileIndication.qml @@ -49,6 +49,6 @@ Column iconSource: UM.Theme.getIcon("LinkExternal") isIconOnRightSide: true - onClicked: Qt.openUrlExternally("https://support.ultimaker.com/hc/en-us/articles/360012909099-How-to-check-why-a-profile-is-Not-supported") //TODO: Add tags? + onClicked: Qt.openUrlExternally("https://support.ultimaker.com/hc/en-us/articles/360012909099") } } \ No newline at end of file From 8362d4c96765be9a6ba76c01a2e2e897006b45d2 Mon Sep 17 00:00:00 2001 From: "j.delarago" Date: Wed, 15 Jun 2022 10:48:04 +0200 Subject: [PATCH 22/31] Switch to column layout in RecommendedPrintSetup.qml so that left margins can be put on infill selector and items below it. Add warning and reset button when custom profile is select and/or settings have been changed CURA-8849 --- .../Recommended/ProfileWarningReset.qml | 108 ++++++++++++++++++ .../Recommended/RecommendedPrintSetup.qml | 22 +++- resources/themes/cura-light/theme.json | 4 +- 3 files changed, 129 insertions(+), 5 deletions(-) create mode 100644 resources/qml/PrintSetupSelector/Recommended/ProfileWarningReset.qml diff --git a/resources/qml/PrintSetupSelector/Recommended/ProfileWarningReset.qml b/resources/qml/PrintSetupSelector/Recommended/ProfileWarningReset.qml new file mode 100644 index 0000000000..c9abcab1c8 --- /dev/null +++ b/resources/qml/PrintSetupSelector/Recommended/ProfileWarningReset.qml @@ -0,0 +1,108 @@ +import QtQuick 2.10 + +import UM 1.6 as UM +import Cura 1.6 as Cura + +Rectangle +{ + height: visible ? UM.Theme.getSize("action_button_icon").height : 0 + visible: Cura.SimpleModeSettingsManager.isProfileCustomized || Cura.MachineManager.hasCustomQuality + anchors.topMargin: UM.Theme.getSize("default_margin") + anchors.bottomMargin: UM.Theme.getSize("default_margin") + + + Rectangle + { + id: warningIcon + color: UM.Theme.getColor("um_yellow_5") + height: UM.Theme.getSize("action_button_icon").height + width: height + radius: width + anchors + { + left: parent.left + verticalCenter: parent.verticalCenter + } + UM.ColorImage + { + height: UM.Theme.getSize("action_button_icon").height + width: height + source: UM.Theme.getIcon("Warning", "low") + } + } + + UM.Label + { + id: warning + anchors + { + left: warningIcon.right + verticalCenter: parent.verticalCenter + leftMargin: UM.Theme.getSize("thin_margin").width + } + + text: "" + + states: [ + State + { + name: "settings changed and custom quality" + when: Cura.SimpleModeSettingsManager.isProfileCustomized && Cura.MachineManager.hasCustomQuality + PropertyChanges + { + target: warning + text: { + var profile_name = Cura.MachineManager.activeQualityChangesGroup.name + return "%1 %2".arg(profile_name).arg(catalog.i18nc("@info", "custom profile is active and you overwrote some settings.")) + } + } + + }, + State + { + name: "custom quality" + when: Cura.MachineManager.hasCustomQuality + PropertyChanges + { + target: warning + text: { + var profile_name = Cura.MachineManager.activeQualityChangesGroup.name + return "%1 %2".arg(profile_name).arg(catalog.i18nc("@info", "custom profile is overriding some settings.")) + } + } + }, + State + { + name: "settings changed" + when: Cura.SimpleModeSettingsManager.isProfileCustomized + PropertyChanges + { + target: warning + text: catalog.i18nc("@info", "Some settings were changed.") + } + } + ] + + } + + UM.SimpleButton + { + id: resetToDefaultQualityButton + height: UM.Theme.getSize("action_button_icon").height + width: height + iconSource: UM.Theme.getIcon("ArrowReset") + anchors + { + right: parent.right + verticalCenter: parent.verticalCenter + } + + color: UM.Theme.getColor("accent_1") + + onClicked: + { + Cura.MachineManager.resetToUseDefaultQuality() + } + } + +} \ No newline at end of file diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml index fbe1c5bc54..aac8dcecfb 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml @@ -2,6 +2,7 @@ //Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.10 +import QtQuick.Layouts 1.1 import UM 1.6 as UM import Cura 1.6 as Cura @@ -15,7 +16,7 @@ Item property bool settingsEnabled: Cura.ExtruderManager.activeExtruderStackId || extrudersEnabledCount.properties.value == 1 property real padding: UM.Theme.getSize("default_margin").width - Column + ColumnLayout { spacing: UM.Theme.getSize("default_margin").height @@ -39,29 +40,37 @@ Item RecommendedQualityProfileSelector { width: parent.width - visible: recommendedResolutionSelector.visible } RecommendedResolutionSelector { id: recommendedResolutionSelector + Layout.fillWidth: true width: parent.width } UnsupportedProfileIndication { width: parent.width - visible: !recommendedResolutionSelector.visible } + + ProfileWarningReset + { + width: parent.width + Layout.fillWidth: true + } + //Line between the sections. Rectangle { width: parent.width height: UM.Theme.getSize("default_lining").height - + Layout.topMargin: UM.Theme.getSize("narrow_margin").height + Layout.bottomMargin: UM.Theme.getSize("narrow_margin").height + Layout.fillWidth: true color: UM.Theme.getColor("lining") } @@ -76,6 +85,9 @@ Item width: parent.width // TODO Create a reusable component with these properties to not define them separately for each component labelColumnWidth: parent.firstColumnWidth + Layout.fillWidth: true + Layout.leftMargin: UM.Theme.getSize("default_margin").width + Layout.rightMargin: UM.Theme.getSize("default_margin").width } RecommendedSupportSelector @@ -83,6 +95,7 @@ Item width: parent.width // TODO Create a reusable component with these properties to not define them separately for each component labelColumnWidth: parent.firstColumnWidth + Layout.leftMargin: UM.Theme.getSize("default_margin").width } RecommendedAdhesionSelector @@ -90,6 +103,7 @@ Item width: parent.width // TODO Create a reusable component with these properties to not define them separately for each component labelColumnWidth: parent.firstColumnWidth + Layout.leftMargin: UM.Theme.getSize("default_margin").width } } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 69e7f3dcfe..c9299f4d04 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -645,6 +645,8 @@ "preferences_page_list_item": [8.0, 2.0], - "recommended_button_icon": [1.7, 1.7] + "recommended_button_icon": [1.7, 1.7], + + "reset_profile_icon": [1, 1] } } From caa0c255aae0288e2484b52869ffc30ac80bcb66 Mon Sep 17 00:00:00 2001 From: Joey de l'Arago Date: Wed, 15 Jun 2022 17:28:06 +0200 Subject: [PATCH 23/31] Update cura/Machines/Models/ActiveIntentQualitiesModel.py Co-authored-by: Casper Lamboo --- cura/Machines/Models/ActiveIntentQualitiesModel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/Machines/Models/ActiveIntentQualitiesModel.py b/cura/Machines/Models/ActiveIntentQualitiesModel.py index ab59ada7c9..bd2f5cf771 100644 --- a/cura/Machines/Models/ActiveIntentQualitiesModel.py +++ b/cura/Machines/Models/ActiveIntentQualitiesModel.py @@ -101,7 +101,7 @@ class ActiveIntentQualitiesModel(ListModel): return nodes def _getIntentsForMaterial(self, active_material_node: "MaterialNode", quality_groups: Dict[str, "QualityGroup"]) -> List[Dict[str, Any]]: - extruder_intents = [] # type: List[Dict[str, Any]] + extruder_intents: List[Dict[str, Any]] = [] for quality_id, quality_node in active_material_node.qualities.items(): if quality_node.quality_type not in quality_groups: # Don't add the empty quality type (or anything else that would crash, defensively). From 760976159c4d86b0fa4eb8dda09489818c377f61 Mon Sep 17 00:00:00 2001 From: Joey de l'Arago Date: Wed, 15 Jun 2022 17:28:13 +0200 Subject: [PATCH 24/31] Update cura/Machines/Models/ActiveIntentQualitiesModel.py Co-authored-by: Casper Lamboo --- cura/Machines/Models/ActiveIntentQualitiesModel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/Machines/Models/ActiveIntentQualitiesModel.py b/cura/Machines/Models/ActiveIntentQualitiesModel.py index bd2f5cf771..f8f88aa7a6 100644 --- a/cura/Machines/Models/ActiveIntentQualitiesModel.py +++ b/cura/Machines/Models/ActiveIntentQualitiesModel.py @@ -64,7 +64,7 @@ class ActiveIntentQualitiesModel(ListModel): material_nodes = self._getActiveMaterials() - added_quality_type_set = set() # type: Set[str] + added_quality_type_set: Set[str] = set() for material_node in material_nodes: intents = self._getIntentsForMaterial(material_node, quality_groups) for intent in intents: From 87afb117d0f7359d6b6f1f26d65e96513dd68b73 Mon Sep 17 00:00:00 2001 From: Joey de l'Arago Date: Wed, 15 Jun 2022 17:28:22 +0200 Subject: [PATCH 25/31] Update cura/Machines/Models/ActiveIntentQualitiesModel.py Co-authored-by: Casper Lamboo --- cura/Machines/Models/ActiveIntentQualitiesModel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/Machines/Models/ActiveIntentQualitiesModel.py b/cura/Machines/Models/ActiveIntentQualitiesModel.py index f8f88aa7a6..0c038c9ffa 100644 --- a/cura/Machines/Models/ActiveIntentQualitiesModel.py +++ b/cura/Machines/Models/ActiveIntentQualitiesModel.py @@ -55,7 +55,7 @@ class ActiveIntentQualitiesModel(ListModel): if active_extruder_stack: self._intent_category = active_extruder_stack.intent.getMetaDataEntry("intent_category", "") - new_items = [] # type: List[Dict[str, Any]] + new_items: List[Dict[str, Any]] = [] global_stack = cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack() if not global_stack: self.setItems(new_items) From b4152d29d6bd08f67037c22d23c915bd2d29629e Mon Sep 17 00:00:00 2001 From: Joey de l'Arago Date: Wed, 15 Jun 2022 17:29:16 +0200 Subject: [PATCH 26/31] Update cura/Machines/Models/ActiveIntentQualitiesModel.py Co-authored-by: Casper Lamboo --- cura/Machines/Models/ActiveIntentQualitiesModel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/Machines/Models/ActiveIntentQualitiesModel.py b/cura/Machines/Models/ActiveIntentQualitiesModel.py index 0c038c9ffa..f25391fcad 100644 --- a/cura/Machines/Models/ActiveIntentQualitiesModel.py +++ b/cura/Machines/Models/ActiveIntentQualitiesModel.py @@ -84,7 +84,7 @@ class ActiveIntentQualitiesModel(ListModel): container_tree = ContainerTree.getInstance() machine_node = container_tree.machines[global_stack.definition.getId()] - nodes = set() # type: Set[MaterialNode] + nodes: Set[MaterialNode] = set() for extruder in global_stack.extruderList: active_variant_name = extruder.variant.getMetaDataEntry("name") From e47a2d1c99a932c134b5c5e7d36784ac930688a8 Mon Sep 17 00:00:00 2001 From: Joey de l'Arago Date: Wed, 15 Jun 2022 17:29:26 +0200 Subject: [PATCH 27/31] Update cura/Machines/Models/IntentSelectionModel.py Co-authored-by: Casper Lamboo --- cura/Machines/Models/IntentSelectionModel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/Machines/Models/IntentSelectionModel.py b/cura/Machines/Models/IntentSelectionModel.py index c8c9b9974d..610b50fb50 100644 --- a/cura/Machines/Models/IntentSelectionModel.py +++ b/cura/Machines/Models/IntentSelectionModel.py @@ -46,7 +46,7 @@ class IntentSelectionModel(ListModel): extruder_manager = application.getExtruderManager() extruder_manager.extrudersChanged.connect(self._update) - self._update_timer = QTimer() # type: QTimer + self._update_timer: QTimer = QTimer() self._update_timer.setInterval(100) self._update_timer.setSingleShot(True) self._update_timer.timeout.connect(self._update) From b132b5c08c47089f2bc8ec7111d11fabeae7df87 Mon Sep 17 00:00:00 2001 From: Joey de l'Arago Date: Wed, 15 Jun 2022 17:29:59 +0200 Subject: [PATCH 28/31] Update cura/Machines/Models/IntentSelectionModel.py Co-authored-by: Casper Lamboo --- cura/Machines/Models/IntentSelectionModel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/Machines/Models/IntentSelectionModel.py b/cura/Machines/Models/IntentSelectionModel.py index 610b50fb50..5302dc0ae5 100644 --- a/cura/Machines/Models/IntentSelectionModel.py +++ b/cura/Machines/Models/IntentSelectionModel.py @@ -87,7 +87,7 @@ class IntentSelectionModel(ListModel): def _onChange(self) -> None: self._update_timer.start() - def _update(self): + def _update(self) -> None: Logger.log("d", "Updating {model_class_name}.".format(model_class_name = self.__class__.__name__)) global_stack = cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack() From 142f1823b39a3a4884babc71eec8da4a377e3428 Mon Sep 17 00:00:00 2001 From: Joey de l'Arago Date: Wed, 15 Jun 2022 17:31:40 +0200 Subject: [PATCH 29/31] Apply suggestions from code review Co-authored-by: Casper Lamboo --- cura/Machines/Models/ActiveIntentQualitiesModel.py | 2 +- cura/Machines/Models/IntentSelectionModel.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cura/Machines/Models/ActiveIntentQualitiesModel.py b/cura/Machines/Models/ActiveIntentQualitiesModel.py index f25391fcad..c20ccde383 100644 --- a/cura/Machines/Models/ActiveIntentQualitiesModel.py +++ b/cura/Machines/Models/ActiveIntentQualitiesModel.py @@ -46,7 +46,7 @@ class ActiveIntentQualitiesModel(ListModel): def _updateDelayed(self): self._update_timer.start() - def _onChanged(self, container): + def _onChanged(self, container: ContainerStack) -> None: if container.getMetaDataEntry("type") == "intent": self._updateDelayed() diff --git a/cura/Machines/Models/IntentSelectionModel.py b/cura/Machines/Models/IntentSelectionModel.py index 5302dc0ae5..1a57d0b3a0 100644 --- a/cura/Machines/Models/IntentSelectionModel.py +++ b/cura/Machines/Models/IntentSelectionModel.py @@ -25,7 +25,7 @@ class IntentSelectionModel(ListModel): DescriptionRole = Qt.ItemDataRole.UserRole + 4 IconRole = Qt.ItemDataRole.UserRole + 5 - def __init__(self, parent=None): + def __init__(self, parent=QAbstractListModel) -> None: super().__init__(parent) self.addRoleName(self.NameRole, "name") From 6f8470167fa38f9c6e61098cd23d4d61477d8c4b Mon Sep 17 00:00:00 2001 From: "j.delarago" Date: Wed, 15 Jun 2022 17:40:07 +0200 Subject: [PATCH 30/31] Suggested changes CURA-8849 --- cura/Machines/Models/IntentSelectionModel.py | 2 +- .../Recommended/RecommendedQualityProfileSelectorButton.qml | 2 +- resources/themes/cura-light/theme.json | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cura/Machines/Models/IntentSelectionModel.py b/cura/Machines/Models/IntentSelectionModel.py index 1a57d0b3a0..e6726382d2 100644 --- a/cura/Machines/Models/IntentSelectionModel.py +++ b/cura/Machines/Models/IntentSelectionModel.py @@ -25,7 +25,7 @@ class IntentSelectionModel(ListModel): DescriptionRole = Qt.ItemDataRole.UserRole + 4 IconRole = Qt.ItemDataRole.UserRole + 5 - def __init__(self, parent=QAbstractListModel) -> None: + def __init__(self, parent = None) -> None: super().__init__(parent) self.addRoleName(self.NameRole, "name") diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelectorButton.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelectorButton.qml index 25ac660c8a..6804e7e5ba 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelectorButton.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedQualityProfileSelectorButton.qml @@ -14,7 +14,7 @@ Rectangle id: base height: 60 Layout.fillWidth: true - color: mouseArea.containsMouse || selected ? UM.Theme.getColor("um_blue_1") : UM.Theme.getColor("background_1") + color: mouseArea.containsMouse || selected ? UM.Theme.getColor("background_3") : UM.Theme.getColor("background_1") property bool selected: false property string profileName: "" diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index c9299f4d04..83eb13f0cb 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -206,8 +206,7 @@ "um_orange_9": [64, 45, 32, 255], "um_yellow_1": [255, 248, 225, 255], "um_yellow_5": [253, 209, 58, 255], - "um_yellow_9": [64, 58, 36, 255], - "um_blue_1": [232, 240, 253, 255] + "um_yellow_9": [64, 58, 36, 255] }, "colors": { From f9dda4040984f14766fc1e8f0cd15a7f1a6b8da4 Mon Sep 17 00:00:00 2001 From: "j.delarago" Date: Wed, 15 Jun 2022 17:41:21 +0200 Subject: [PATCH 31/31] Better typing CURA-8849 --- cura/Machines/Models/IntentSelectionModel.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cura/Machines/Models/IntentSelectionModel.py b/cura/Machines/Models/IntentSelectionModel.py index e6726382d2..ec6957832c 100644 --- a/cura/Machines/Models/IntentSelectionModel.py +++ b/cura/Machines/Models/IntentSelectionModel.py @@ -2,9 +2,9 @@ # Cura is released under the terms of the LGPLv3 or higher. import collections -from typing import OrderedDict +from typing import OrderedDict, Optional -from PyQt6.QtCore import Qt, QTimer +from PyQt6.QtCore import Qt, QTimer, QObject import cura from UM import i18nCatalog @@ -25,7 +25,7 @@ class IntentSelectionModel(ListModel): DescriptionRole = Qt.ItemDataRole.UserRole + 4 IconRole = Qt.ItemDataRole.UserRole + 5 - def __init__(self, parent = None) -> None: + def __init__(self, parent: Optional[QObject] = None) -> None: super().__init__(parent) self.addRoleName(self.NameRole, "name")