diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index f148942336..0c0187ee98 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -180,15 +180,18 @@ class MachineManager(QObject): extruder_configurations = [] for extruder in self._global_container_stack.extruders.values(): extruder_configurations.append({ - "position": len(extruder_configurations), + "position": int(extruder.getMetaDataEntry("position")), "material": extruder.material.getName() if extruder.material != self._empty_material_container else None, "hotendID": extruder.variant.getName() if extruder.variant != self._empty_variant_container else None }) self._current_printer_configuration.extruderConfigurations = extruder_configurations - self._current_printer_configuration.buildplateConfiguration = self._global_container_stack.variant.getName() if self._global_container_stack.variant is not None else None - print(self._current_printer_configuration.extruderConfigurations) + self._current_printer_configuration.buildplateConfiguration = self._global_container_stack.variant.getName() if self._global_container_stack.variant != self._empty_variant_container else None self.currentConfigurationChanged.emit() + @pyqtSlot(QObject, result = bool) + def matchesConfiguration(self, configuration: ConfigurationModel) -> bool: + return self._current_printer_configuration == configuration + @property def newVariant(self): return self._new_variant_container diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml index 4359e4eac7..3bb14c3c26 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationItem.qml @@ -12,11 +12,14 @@ Rectangle id: configurationItem property var configuration: null + property var selected: false signal configurationSelected() height: childrenRect.height border.width: UM.Theme.getSize("default_lining").width border.color: UM.Theme.getColor("sidebar_lining_thin") + color: selected ? UM.Theme.getColor("configuration_item_active") : UM.Theme.getColor("configuration_item") + property var textColor: selected ? UM.Theme.getColor("configuration_item_text_active") : UM.Theme.getColor("configuration_item_text") Column { @@ -43,6 +46,7 @@ Rectangle { width: Math.round(parent.width / 2) printCoreConfiguration: modelData + mainColor: textColor } } } @@ -54,7 +58,7 @@ Rectangle visible: buildplateInformation.visible width: parent.width - 2 * parent.padding height: visible ? Math.round(UM.Theme.getSize("sidebar_lining_thin").height / 2) : 0 - color: UM.Theme.getColor("sidebar_lining_thin") + color: textColor } Item @@ -73,8 +77,7 @@ Rectangle sourceSize.width: width sourceSize.height: height source: UM.Theme.getIcon("buildplate") - - color: "black" + color: textColor } Label @@ -84,6 +87,7 @@ Rectangle anchors.verticalCenter: parent.verticalCenter anchors.leftMargin: Math.round(UM.Theme.getSize("default_margin").height / 2) text: configuration.buildplateConfiguration + color: textColor } } } @@ -97,4 +101,11 @@ Rectangle onEntered: parent.border.color = UM.Theme.getColor("primary_hover") onExited: parent.border.color = "black" } + + Connections { + target: Cura.MachineManager + onCurrentConfigurationChanged: { + configurationItem.selected = Cura.MachineManager.matchesConfiguration(configuration) + } + } } \ No newline at end of file diff --git a/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml index 7b64ab61ac..74ecc114c7 100644 --- a/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/PrintCoreConfiguration.qml @@ -11,6 +11,7 @@ Column { id: extruderInfo property var printCoreConfiguration + property var mainColor: "black" spacing: Math.round(UM.Theme.getSize("default_margin").height / 2) height: childrenRect.height @@ -29,6 +30,7 @@ Column anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left font: UM.Theme.getFont("default") + color: mainColor } // Rounded item to show the extruder number @@ -46,11 +48,11 @@ Column id: mainCircle anchors.fill: parent + anchors.centerIn: parent sourceSize.width: parent.width sourceSize.height: parent.height source: UM.Theme.getIcon("extruder_button") - - color: extruderNumberText.color + color: mainColor } Label @@ -59,6 +61,7 @@ Column anchors.centerIn: parent text: printCoreConfiguration.position + 1 font: UM.Theme.getFont("default") + color: mainColor } } } @@ -70,6 +73,7 @@ Column elide: Text.ElideRight width: parent.width font: UM.Theme.getFont("default_bold") + color: mainColor } Label @@ -79,5 +83,6 @@ Column elide: Text.ElideRight width: parent.width font: UM.Theme.getFont("default") + color: mainColor } } diff --git a/resources/qml/Menus/ConfigurationMenu/SyncButton.qml b/resources/qml/Menus/ConfigurationMenu/SyncButton.qml index f9e93b2d22..a82d7cc515 100644 --- a/resources/qml/Menus/ConfigurationMenu/SyncButton.qml +++ b/resources/qml/Menus/ConfigurationMenu/SyncButton.qml @@ -9,7 +9,7 @@ import UM 1.2 as UM Button { - text: "Matched" + text: "No match" width: parent.width height: parent.height @@ -54,11 +54,11 @@ Button text: control.text elide: Text.ElideRight anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width * 2 + anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.right: downArrow.left anchors.rightMargin: control.rightMargin anchors.verticalCenter: parent.verticalCenter; - font: UM.Theme.getFont("large") + font: UM.Theme.getFont("medium_bold") } } label: Label {} diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 8c8e6d1c47..46ea0fc49e 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -14,6 +14,16 @@ "weight": 50, "family": "Noto Sans" }, + "medium": { + "size": 1.16, + "weight": 50, + "family": "Noto Sans" + }, + "medium_bold": { + "size": 1.16, + "weight": 63, + "family": "Noto Sans" + }, "default": { "size": 1.0, "weight": 50, @@ -289,7 +299,12 @@ "layerview_move_combing": [0, 0, 255, 255], "layerview_move_retraction": [128, 128, 255, 255], "layerview_support_interface": [64, 192, 255, 255], - "layerview_nozzle": [181, 166, 66, 50] + "layerview_nozzle": [181, 166, 66, 50], + + "configuration_item": [255, 255, 255, 0], + "configuration_item_active": [31, 36, 39, 255], + "configuration_item_text": [0, 0, 0, 255], + "configuration_item_text_active": [255, 255, 255, 255] }, "sizes": {