Adjusted visibility of printer monitor progress bar + percentage.

CURA-2064
This commit is contained in:
Jack Ha 2016-08-08 17:08:01 +02:00
parent b365cdfd0f
commit 6d52319ee4

View File

@ -19,6 +19,29 @@ 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 bool showProgress: {
// determine if we need to show the progress bar + percentage
if(!printerConnected || !printerAcceptsCommands)
return false;
switch(Cura.MachineManager.printerOutputDevices[0].jobState)
{
case "printing":
case "pre_print": // heating, etc.
case "paused":
return true;
case "wait_cleanup":
case "ready": // nut sure if this occurs, "" seems to be the ready state.
case "offline":
case "abort": // note sure if this jobState actually occurs in the wild
case "error": // after clicking abort you apparently get "error"
case "": // ready to print
default:
return false;
}
}
property variant statusColor: property variant statusColor:
{ {
if(!printerConnected || !printerAcceptsCommands) if(!printerConnected || !printerAcceptsCommands)
@ -96,7 +119,7 @@ Rectangle
color: base.statusColor color: base.statusColor
font: UM.Theme.getFont("large") font: UM.Theme.getFont("large")
text: Math.round(progress) + "%" text: Math.round(progress) + "%"
visible: printerConnected visible: showProgress
} }
Rectangle Rectangle
@ -110,6 +133,7 @@ Rectangle
anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.leftMargin: UM.Theme.getSize("default_margin").width
radius: UM.Theme.getSize("progressbar_radius").width radius: UM.Theme.getSize("progressbar_radius").width
color: UM.Theme.getColor("progressbar_background") color: UM.Theme.getColor("progressbar_background")
visible: showProgress
Rectangle Rectangle
{ {