mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 15:44:04 -06:00
Prevent QML warnings when there is no connected printer
CURA-1036
This commit is contained in:
parent
beff54e5b1
commit
00ad7b23ff
2 changed files with 21 additions and 16 deletions
|
@ -569,7 +569,7 @@ UM.MainWindow
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.horizontalCenterOffset: - UM.Theme.getSize("sidebar").width / 2
|
anchors.horizontalCenterOffset: - UM.Theme.getSize("sidebar").width / 2
|
||||||
visible: base.monitoringPrint
|
visible: base.monitoringPrint
|
||||||
source: Cura.MachineManager.printerOutputDevices[0].cameraImage
|
source: Cura.MachineManager.printerOutputDevices.length > 0 ? Cura.MachineManager.printerOutputDevices[0].cameraImage : ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,8 @@ Rectangle
|
||||||
id: base;
|
id: base;
|
||||||
UM.I18nCatalog { id: catalog; name:"cura"}
|
UM.I18nCatalog { id: catalog; name:"cura"}
|
||||||
|
|
||||||
property real progress: Cura.MachineManager.printerOutputDevices[0].progress;
|
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 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 activity: Printer.getPlatformActivity;
|
property bool activity: Printer.getPlatformActivity;
|
||||||
|
@ -22,7 +23,10 @@ Rectangle
|
||||||
property string fileBaseName
|
property string fileBaseName
|
||||||
property string statusText:
|
property string statusText:
|
||||||
{
|
{
|
||||||
if(Cura.MachineManager.printerOutputDevices[0].jobState == "printing")
|
if(!printerConnected)
|
||||||
|
{
|
||||||
|
return "Please check your printer connections"
|
||||||
|
} else if(Cura.MachineManager.printerOutputDevices[0].jobState == "printing")
|
||||||
{
|
{
|
||||||
return "Printing..."
|
return "Printing..."
|
||||||
} else if(Cura.MachineManager.printerOutputDevices[0].jobState == "paused")
|
} else if(Cura.MachineManager.printerOutputDevices[0].jobState == "paused")
|
||||||
|
@ -48,7 +52,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: Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? UM.Theme.getColor("status_paused") : UM.Theme.getColor("status_ready")
|
color: printerConnected ? Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? UM.Theme.getColor("status_paused") : UM.Theme.getColor("status_ready") : UM.Theme.getColor("status_offline")
|
||||||
font: UM.Theme.getFont("large")
|
font: UM.Theme.getFont("large")
|
||||||
text: statusText;
|
text: statusText;
|
||||||
}
|
}
|
||||||
|
@ -58,11 +62,11 @@ Rectangle
|
||||||
id: percentageLabel
|
id: percentageLabel
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.right: progressBar.right
|
anchors.right: progressBar.right
|
||||||
//anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
|
||||||
|
|
||||||
color: Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? UM.Theme.getColor("status_paused") : UM.Theme.getColor("status_ready")
|
color: printerConnected ? Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? UM.Theme.getColor("status_paused") : UM.Theme.getColor("status_ready") : UM.Theme.getColor("status_offline")
|
||||||
font: UM.Theme.getFont("large")
|
font: UM.Theme.getFont("large")
|
||||||
text: Math.round(progress * 100) + "%" ;
|
text: Math.round(progress * 100) + "%";
|
||||||
|
visible: printerConnected
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle
|
Rectangle
|
||||||
|
@ -81,16 +85,16 @@ Rectangle
|
||||||
{
|
{
|
||||||
width: Math.max(parent.width * base.progress)
|
width: Math.max(parent.width * base.progress)
|
||||||
height: parent.height
|
height: parent.height
|
||||||
color: Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? UM.Theme.getColor("status_paused") : UM.Theme.getColor("status_ready")
|
color: printerConnected ? Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? UM.Theme.getColor("status_paused") : UM.Theme.getColor("status_ready") : UM.Theme.getColor("status_offline")
|
||||||
radius: UM.Theme.getSize("progressbar_radius").width
|
radius: UM.Theme.getSize("progressbar_radius").width
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Button
|
Button
|
||||||
{
|
{
|
||||||
id: abortButton
|
id: abortButton
|
||||||
|
|
||||||
enabled: true
|
visible: printerConnected
|
||||||
height: UM.Theme.getSize("save_button_save_to_button").height
|
height: UM.Theme.getSize("save_button_save_to_button").height
|
||||||
|
|
||||||
anchors.top: progressBar.bottom
|
anchors.top: progressBar.bottom
|
||||||
|
@ -98,7 +102,7 @@ Rectangle
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
|
||||||
text: catalog.i18nc("@label:", "Abort Job")
|
text: catalog.i18nc("@label:", "Abort Print")
|
||||||
onClicked: { Cura.MachineManager.printerOutputDevices[0].setJobState("abort") }
|
onClicked: { Cura.MachineManager.printerOutputDevices[0].setJobState("abort") }
|
||||||
|
|
||||||
|
|
||||||
|
@ -130,20 +134,21 @@ Rectangle
|
||||||
}
|
}
|
||||||
label: Item { }
|
label: Item { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Button
|
Button
|
||||||
{
|
{
|
||||||
id: pauseButton
|
id: pauseButton
|
||||||
|
|
||||||
height: UM.Theme.getSize("save_button_save_to_button").height
|
height: UM.Theme.getSize("save_button_save_to_button").height
|
||||||
|
visible: printerConnected
|
||||||
|
|
||||||
anchors.top: progressBar.bottom
|
anchors.top: progressBar.bottom
|
||||||
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
||||||
anchors.right: abortButton.left
|
anchors.right: abortButton.left
|
||||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
|
||||||
text: Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? catalog.i18nc("@label:", "Resume") : catalog.i18nc("@label:", "Pause")
|
text: printerConnected ? Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? catalog.i18nc("@label:", "Resume") : catalog.i18nc("@label:", "Pause") : ""
|
||||||
onClicked: { Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? Cura.MachineManager.printerOutputDevices[0].setJobState("print") : Cura.MachineManager.printerOutputDevices[0].setJobState("pause") }
|
onClicked: { Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? Cura.MachineManager.printerOutputDevices[0].setJobState("print") : Cura.MachineManager.printerOutputDevices[0].setJobState("pause") }
|
||||||
|
|
||||||
style: ButtonStyle
|
style: ButtonStyle
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue