Update extruder button styles

CURA-4211
This commit is contained in:
Lipu Fei 2017-09-06 10:20:38 +02:00
parent 81b6675518
commit e15a96263d
7 changed files with 121 additions and 44 deletions

View file

@ -24,41 +24,109 @@ Column
Item
{
height: UM.Theme.getSize("default_margin").height / 4
width: height
visible: extruderSelectionRow.visible
}
Label
{
id: extruderSelectionLabel
anchors
{
left: parent.left
leftMargin: UM.Theme.getSize("default_margin").width
leftMargin: UM.Theme.getSize("sidebar_margin").width
right: parent.right
rightMargin: UM.Theme.getSize("default_margin").width
rightMargin: UM.Theme.getSize("sidebar_margin").width
topMargin: UM.Theme.getSize("default_margin").height
}
height: UM.Theme.getSize("sidebar_tabs").height / 3
text: catalog.i18nc("@label", "Extruder configuration")
font: UM.Theme.getFont("default_bold")
color: UM.Theme.getColor("text")
visible: extruderSelectionRow.visible
height: syncMachineButton.height + UM.Theme.getSize("sidebar_margin").height / 2
Label
{
id: extruderSelectionLabel
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
height: UM.Theme.getSize("sidebar_tabs").height / 3
text: catalog.i18nc("@label", "Extruder configuration")
font: UM.Theme.getFont("large")
color: UM.Theme.getColor("text")
visible: extruderSelectionRow.visible
}
Button
{
id: syncMachineButton
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
text: catalog.i18nc("@button:action", "Sync")
visible: extruderSelectionRow.visible
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
enabled: printerConnected
onClicked:
{
CuraApplication.startSyncingConfigurationFromPrinter();
}
style: ButtonStyle
{
background: Rectangle
{
implicitWidth: UM.Theme.getSize("button").width * 1.1
implicitHeight: UM.Theme.getSize("sidebar_tabs").height / 3
color: "transparent"
}
label: Item
{
implicitWidth: UM.Theme.getSize("button").width * 1.1
implicitHeight: UM.Theme.getSize("sidebar_tabs").height / 3
Label
{
id: labelText
anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_lining").width
anchors.right: downArrow.left
anchors.rightMargin: UM.Theme.getSize("default_margin").width / 2
anchors.top: parent.top
text: control.text
font: UM.Theme.getFont("default")
color: control.hovered ? UM.Theme.getColor("sync_button_text_hovered") : UM.Theme.getColor("sync_button_text")
elide: Text.ElideRight;
verticalAlignment: Text.AlignVCenter;
}
UM.RecolorImage
{
id: downArrow
anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2
anchors.top: labelText.top
anchors.topMargin: UM.Theme.getSize("default_margin").height / 3
source: UM.Theme.getIcon("arrow_bottom")
width: UM.Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height
sourceSize.width: width + 5
sourceSize.height: width + 5
color: control.hovered ? UM.Theme.getColor("sync_button_text_hovered") : UM.Theme.getColor("sync_button_text")
}
}
}
}
}
Item
{
id: extruderSelectionRow
width: parent.width
height: UM.Theme.getSize("sidebar_tabs").height
height: UM.Theme.getSize("sidebar_tabs").height * 2 / 3
visible: machineExtruderCount.properties.value > 1 && !sidebar.monitoringPrint
anchors
{
left: parent.left
leftMargin: UM.Theme.getSize("default_margin").width
leftMargin: UM.Theme.getSize("default_margin").width * 1.5
right: parent.right
rightMargin: UM.Theme.getSize("default_margin").width
rightMargin: UM.Theme.getSize("default_margin").width * 1.5
}
ListView
@ -136,7 +204,7 @@ Column
width: {
var extruderTextWidth = extruderStaticText.visible ? extruderStaticText.width : 0;
var iconWidth = extruderIconItem.width;
return extruderTextWidth + iconWidth + UM.Theme.getSize("default_margin").width / 4;
return extruderTextWidth + iconWidth + UM.Theme.getSize("default_margin").width / 2;
}
// Static text "Extruder"
@ -150,7 +218,7 @@ Column
control.hovered ? UM.Theme.getColor("action_button_hovered_text") :
UM.Theme.getColor("action_button_text")
font: UM.Theme.getFont("default")
font: control.checked ? UM.Theme.getFont("default_bold") : UM.Theme.getFont("default")
text: catalog.i18nc("@label", "Extruder")
visible: width < (control.width - extruderIconItem.width - UM.Theme.getSize("default_margin").width)
elide: Text.ElideRight
@ -168,7 +236,7 @@ Column
var minimumWidth = control.width < UM.Theme.getSize("button").width ? control.width : UM.Theme.getSize("button").width;
var minimumHeight = control.height < UM.Theme.getSize("button").height ? control.height : UM.Theme.getSize("button").height;
var minimumSize = minimumWidth < minimumHeight ? minimumWidth : minimumHeight;
minimumSize -= UM.Theme.getSize("default_margin").width;
minimumSize -= UM.Theme.getSize("default_margin").width / 2;
return minimumSize;
}
@ -205,18 +273,18 @@ Column
{
right: parent.right
top: parent.top
rightMargin: parent.sizeToUse * 0.04
topMargin: parent.sizeToUse * 0.04
rightMargin: parent.sizeToUse * 0.01
topMargin: parent.sizeToUse * 0.05
}
color: model.color
width: parent.width * 0.27
height: parent.height * 0.27
width: parent.width * 0.35
height: parent.height * 0.35
radius: width / 2
border.width: 0
border.color: "transparent"
border.width: 1
border.color: UM.Theme.getColor("extruder_button_material_border")
opacity: !control.checked ? 0.6 : 1.0
}
@ -337,7 +405,7 @@ Column
Item
{
id: materialInfoRow
height: UM.Theme.getSize("sidebar_setup").height
height: UM.Theme.getSize("sidebar_setup").height / 2
visible: (Cura.MachineManager.hasVariants || Cura.MachineManager.hasMaterials) && !sidebar.monitoringPrint && !sidebar.hideSettings
anchors
@ -358,10 +426,11 @@ Column
{
id: materialInfoLabel
wrapMode: Text.WordWrap
text: catalog.i18nc("@label", "Check material compability");
text: catalog.i18nc("@label", "Check material compability")
font: UM.Theme.getFont("default");
verticalAlignment: Text.AlignVCenter
verticalAlignment: Text.AlignTop
anchors.top: parent.top
anchors.right: parent.right
anchors.bottom: parent.bottom
color: UM.Theme.getColor("text")