Clean up more errors

Contributes to CL-1051
This commit is contained in:
Ian Paschal 2018-10-16 09:34:50 +02:00
parent 1fa7a8880b
commit b99bc06d1c
5 changed files with 10 additions and 8 deletions

View file

@ -39,8 +39,8 @@ Item {
Popup {
id: popup;
background: Item {
height: popup.height;
width: popup.width;
height: childrenRect.height;
width: childrenRect.width;
DropShadow {
anchors.fill: pointedRectangle;

View file

@ -77,6 +77,9 @@ Item {
UM.RecolorImage {
anchors.centerIn: parent;
color: {
if (!printer) {
return "black";
}
if (printer.state == "disabled") {
return UM.Theme.getColor("monitor_tab_text_inactive");
}

View file

@ -35,7 +35,7 @@ Item {
PrinterInfoBlock {
printer: root.printer;
printJob: root.printer.activePrintJob;
printJob: root.printer ? root.printer.activePrintJob : null;
}
HorizontalLine {}
@ -45,7 +45,7 @@ Item {
width: parent.width;
PrintJobTitle {
job: root.printer.activePrintJob;
job: root.printer ? root.printer.activePrintJob : null;
}
PrintJobContextMenu {
id: contextButton;

View file

@ -19,7 +19,7 @@ ProgressBar {
}
style: ProgressBarStyle {
property var remainingTime: {
if (printer.activePrintJob == null) {
if (!printer || printer.activePrintJob == null) {
return 0;
}
/* Sometimes total minus elapsed is less than 0. Use Math.max() to prevent remaining
@ -28,7 +28,7 @@ ProgressBar {
return Math.max(printer.activePrintJob.timeTotal - printer.activePrintJob.timeElapsed, 0);
}
property var progressText: {
if (!printer.activePrintJob || !printer.activePrintJob.state ) {
if (printer === null ) {
return "";
}
switch (printer.activePrintJob.state) {
@ -64,7 +64,7 @@ ProgressBar {
progress: Rectangle {
id: progressItem;
color: {
if (!printer.activePrintJob) {
if (! printer || !printer.activePrintJob) {
return "black";
}
var state = printer.activePrintJob.state

View file

@ -24,7 +24,6 @@ Item {
anchors {
left: parent.left;
right: parent.right;
}
height: childrenRect.height;
spacing: Math.round(0.5 * UM.Theme.getSize("default_margin").width);