CURA-4870 Check wether the current configuration matches one of the unique configurations available on the printer output device.

Improve some elements in the UI
This commit is contained in:
Diego Prado Gesto 2018-03-05 14:39:49 +01:00
parent f779a20a6e
commit a992487589
5 changed files with 46 additions and 12 deletions

View file

@ -180,15 +180,18 @@ class MachineManager(QObject):
extruder_configurations = [] extruder_configurations = []
for extruder in self._global_container_stack.extruders.values(): for extruder in self._global_container_stack.extruders.values():
extruder_configurations.append({ 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, "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 "hotendID": extruder.variant.getName() if extruder.variant != self._empty_variant_container else None
}) })
self._current_printer_configuration.extruderConfigurations = extruder_configurations 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 self._current_printer_configuration.buildplateConfiguration = self._global_container_stack.variant.getName() if self._global_container_stack.variant != self._empty_variant_container else None
print(self._current_printer_configuration.extruderConfigurations)
self.currentConfigurationChanged.emit() self.currentConfigurationChanged.emit()
@pyqtSlot(QObject, result = bool)
def matchesConfiguration(self, configuration: ConfigurationModel) -> bool:
return self._current_printer_configuration == configuration
@property @property
def newVariant(self): def newVariant(self):
return self._new_variant_container return self._new_variant_container

View file

@ -12,11 +12,14 @@ Rectangle
id: configurationItem id: configurationItem
property var configuration: null property var configuration: null
property var selected: false
signal configurationSelected() signal configurationSelected()
height: childrenRect.height height: childrenRect.height
border.width: UM.Theme.getSize("default_lining").width border.width: UM.Theme.getSize("default_lining").width
border.color: UM.Theme.getColor("sidebar_lining_thin") 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 Column
{ {
@ -43,6 +46,7 @@ Rectangle
{ {
width: Math.round(parent.width / 2) width: Math.round(parent.width / 2)
printCoreConfiguration: modelData printCoreConfiguration: modelData
mainColor: textColor
} }
} }
} }
@ -54,7 +58,7 @@ Rectangle
visible: buildplateInformation.visible visible: buildplateInformation.visible
width: parent.width - 2 * parent.padding width: parent.width - 2 * parent.padding
height: visible ? Math.round(UM.Theme.getSize("sidebar_lining_thin").height / 2) : 0 height: visible ? Math.round(UM.Theme.getSize("sidebar_lining_thin").height / 2) : 0
color: UM.Theme.getColor("sidebar_lining_thin") color: textColor
} }
Item Item
@ -73,8 +77,7 @@ Rectangle
sourceSize.width: width sourceSize.width: width
sourceSize.height: height sourceSize.height: height
source: UM.Theme.getIcon("buildplate") source: UM.Theme.getIcon("buildplate")
color: textColor
color: "black"
} }
Label Label
@ -84,6 +87,7 @@ Rectangle
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: Math.round(UM.Theme.getSize("default_margin").height / 2) anchors.leftMargin: Math.round(UM.Theme.getSize("default_margin").height / 2)
text: configuration.buildplateConfiguration text: configuration.buildplateConfiguration
color: textColor
} }
} }
} }
@ -97,4 +101,11 @@ Rectangle
onEntered: parent.border.color = UM.Theme.getColor("primary_hover") onEntered: parent.border.color = UM.Theme.getColor("primary_hover")
onExited: parent.border.color = "black" onExited: parent.border.color = "black"
} }
Connections {
target: Cura.MachineManager
onCurrentConfigurationChanged: {
configurationItem.selected = Cura.MachineManager.matchesConfiguration(configuration)
}
}
} }

View file

@ -11,6 +11,7 @@ Column
{ {
id: extruderInfo id: extruderInfo
property var printCoreConfiguration property var printCoreConfiguration
property var mainColor: "black"
spacing: Math.round(UM.Theme.getSize("default_margin").height / 2) spacing: Math.round(UM.Theme.getSize("default_margin").height / 2)
height: childrenRect.height height: childrenRect.height
@ -29,6 +30,7 @@ Column
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left anchors.left: parent.left
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")
color: mainColor
} }
// Rounded item to show the extruder number // Rounded item to show the extruder number
@ -46,11 +48,11 @@ Column
id: mainCircle id: mainCircle
anchors.fill: parent anchors.fill: parent
anchors.centerIn: parent
sourceSize.width: parent.width sourceSize.width: parent.width
sourceSize.height: parent.height sourceSize.height: parent.height
source: UM.Theme.getIcon("extruder_button") source: UM.Theme.getIcon("extruder_button")
color: mainColor
color: extruderNumberText.color
} }
Label Label
@ -59,6 +61,7 @@ Column
anchors.centerIn: parent anchors.centerIn: parent
text: printCoreConfiguration.position + 1 text: printCoreConfiguration.position + 1
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")
color: mainColor
} }
} }
} }
@ -70,6 +73,7 @@ Column
elide: Text.ElideRight elide: Text.ElideRight
width: parent.width width: parent.width
font: UM.Theme.getFont("default_bold") font: UM.Theme.getFont("default_bold")
color: mainColor
} }
Label Label
@ -79,5 +83,6 @@ Column
elide: Text.ElideRight elide: Text.ElideRight
width: parent.width width: parent.width
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")
color: mainColor
} }
} }

View file

@ -9,7 +9,7 @@ import UM 1.2 as UM
Button Button
{ {
text: "Matched" text: "No match"
width: parent.width width: parent.width
height: parent.height height: parent.height
@ -54,11 +54,11 @@ Button
text: control.text text: control.text
elide: Text.ElideRight elide: Text.ElideRight
anchors.left: parent.left 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.right: downArrow.left
anchors.rightMargin: control.rightMargin anchors.rightMargin: control.rightMargin
anchors.verticalCenter: parent.verticalCenter; anchors.verticalCenter: parent.verticalCenter;
font: UM.Theme.getFont("large") font: UM.Theme.getFont("medium_bold")
} }
} }
label: Label {} label: Label {}

View file

@ -14,6 +14,16 @@
"weight": 50, "weight": 50,
"family": "Noto Sans" "family": "Noto Sans"
}, },
"medium": {
"size": 1.16,
"weight": 50,
"family": "Noto Sans"
},
"medium_bold": {
"size": 1.16,
"weight": 63,
"family": "Noto Sans"
},
"default": { "default": {
"size": 1.0, "size": 1.0,
"weight": 50, "weight": 50,
@ -289,7 +299,12 @@
"layerview_move_combing": [0, 0, 255, 255], "layerview_move_combing": [0, 0, 255, 255],
"layerview_move_retraction": [128, 128, 255, 255], "layerview_move_retraction": [128, 128, 255, 255],
"layerview_support_interface": [64, 192, 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": { "sizes": {