Introduce printing/busy status and make monitor i18n-aware

CURA-1036
This commit is contained in:
fieldOfView 2016-06-30 10:20:19 +02:00
parent 7d962e97c4
commit 7ec605579e
2 changed files with 25 additions and 13 deletions

View File

@ -18,6 +18,20 @@ Rectangle
property real progress: printerConnected ? Cura.MachineManager.printerOutputDevices[0].progress : 0; property real progress: printerConnected ? Cura.MachineManager.printerOutputDevices[0].progress : 0;
property int backendState: UM.Backend.state; property int backendState: UM.Backend.state;
property variant statusColor:
{
if(!printerConnected)
return UM.Theme.getColor("status_offline")
else if(Cura.MachineManager.printerOutputDevices[0].jobState == "printing")
return UM.Theme.getColor("status_busy")
else if(Cura.MachineManager.printerOutputDevices[0].jobState == "ready")
return UM.Theme.getColor("status_ready")
else if(Cura.MachineManager.printerOutputDevices[0].jobState == "paused")
return UM.Theme.getColor("status_paused")
else if (Cura.MachineManager.printerOutputDevices[0].jobState != "error")
return UM.Theme.getColor("status_error")
}
property bool activity: Printer.getPlatformActivity; property bool activity: Printer.getPlatformActivity;
property int totalHeight: childrenRect.height + UM.Theme.getSize("default_margin").height property int totalHeight: childrenRect.height + UM.Theme.getSize("default_margin").height
property string fileBaseName property string fileBaseName
@ -25,17 +39,17 @@ Rectangle
{ {
if(!printerConnected) if(!printerConnected)
{ {
return "Please check your printer connections" return catalog.i18nc("@label:", "Please check your printer connections")
} else if(Cura.MachineManager.printerOutputDevices[0].jobState == "printing") } else if(Cura.MachineManager.printerOutputDevices[0].jobState == "printing")
{ {
return "Printing..." return catalog.i18nc("@label:", "Printing...")
} else if(Cura.MachineManager.printerOutputDevices[0].jobState == "paused") } else if(Cura.MachineManager.printerOutputDevices[0].jobState == "paused")
{ {
return "Paused" return catalog.i18nc("@label:", "Paused")
} }
else if(Cura.MachineManager.printerOutputDevices[0].jobState == "pre_print") else if(Cura.MachineManager.printerOutputDevices[0].jobState == "pre_print")
{ {
return "Preparing..." return catalog.i18nc("@label:", "Preparing...")
} }
else else
{ {
@ -52,7 +66,7 @@ Rectangle
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.leftMargin: UM.Theme.getSize("default_margin").width
color: printerConnected ? Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? UM.Theme.getColor("status_paused") : UM.Theme.getColor("status_ready") : UM.Theme.getColor("status_offline") color: base.statusColor
font: UM.Theme.getFont("large") font: UM.Theme.getFont("large")
text: statusText; text: statusText;
} }
@ -63,7 +77,7 @@ Rectangle
anchors.top: parent.top anchors.top: parent.top
anchors.right: progressBar.right anchors.right: progressBar.right
color: printerConnected ? Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? UM.Theme.getColor("status_paused") : UM.Theme.getColor("status_ready") : UM.Theme.getColor("status_offline") color: base.statusColor
font: UM.Theme.getFont("large") font: UM.Theme.getFont("large")
text: Math.round(progress) + "%"; text: Math.round(progress) + "%";
visible: printerConnected visible: printerConnected
@ -85,7 +99,7 @@ Rectangle
{ {
width: Math.max(parent.width * base.progress / 100) width: Math.max(parent.width * base.progress / 100)
height: parent.height height: parent.height
color: printerConnected ? Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? UM.Theme.getColor("status_paused") : UM.Theme.getColor("status_ready") : UM.Theme.getColor("status_offline") color: base.statusColor
radius: UM.Theme.getSize("progressbar_radius").width radius: UM.Theme.getSize("progressbar_radius").width
} }
} }

View File

@ -95,16 +95,14 @@ Rectangle
onClicked: monitoringPrint = true onClicked: monitoringPrint = true
iconSource: { iconSource: {
if(!printerConnected) if(!printerConnected)
{
return UM.Theme.getIcon("tab_monitor") return UM.Theme.getIcon("tab_monitor")
} else if(Cura.MachineManager.printerOutputDevices[0].jobState == "paused") else if(Cura.MachineManager.printerOutputDevices[0].jobState == "printing")
{ return UM.Theme.getIcon("tab_monitor_busy")
else if(Cura.MachineManager.printerOutputDevices[0].jobState == "paused")
return UM.Theme.getIcon("tab_monitor_paused") return UM.Theme.getIcon("tab_monitor_paused")
} else if (Cura.MachineManager.printerOutputDevices[0].jobState != "error") else if (Cura.MachineManager.printerOutputDevices[0].jobState != "error")
{
return UM.Theme.getIcon("tab_monitor_connected") return UM.Theme.getIcon("tab_monitor_connected")
} }
}
checkable: true checkable: true
exclusiveGroup: sidebarHeaderBarGroup exclusiveGroup: sidebarHeaderBarGroup