Disable controls when manual control is not available

This commit is contained in:
fieldOfView 2017-10-24 10:23:07 +02:00
parent 9cd8869382
commit 6294900bc7

View File

@ -683,10 +683,29 @@ Column
property string label: catalog.i18nc("@label", "Printer control") property string label: catalog.i18nc("@label", "Printer control")
} }
Column
{
enabled:
{
if (connectedPrinter == null)
{
return false; //Can't control the printer if not connected.
}
if (!connectedPrinter.acceptsCommands)
{
return false; //Not allowed to do anything.
}
if (connectedPrinter.jobState == "printing" || connectedPrinter.jobState == "resuming" || connectedPrinter.jobState == "pausing" || connectedPrinter.jobState == "error" || connectedPrinter.jobState == "offline")
{
return false; //Printer is in a state where it can't react to manual control
}
return true;
}
Row Row
{ {
width: base.width - 2 * UM.Theme.getSize("default_margin").width width: base.width - 2 * UM.Theme.getSize("default_margin").width
height: childrenRect.height + 2 * UM.Theme.getSize("default_margin").width height: childrenRect.height + UM.Theme.getSize("default_margin").width
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.leftMargin: UM.Theme.getSize("default_margin").width
@ -868,7 +887,7 @@ Column
id: distancesRow id: distancesRow
width: base.width - 2 * UM.Theme.getSize("default_margin").width width: base.width - 2 * UM.Theme.getSize("default_margin").width
height: childrenRect.height + 2 * UM.Theme.getSize("default_margin").width height: childrenRect.height + UM.Theme.getSize("default_margin").width
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.leftMargin: UM.Theme.getSize("default_margin").width
@ -931,6 +950,7 @@ Column
} }
} }
} }
}
ListModel ListModel
{ {