Merge pull request #2677 from fieldOfView/fix_isclusterprinter

Fix qml error when there is no connected printer
This commit is contained in:
Lipu Fei 2017-10-26 11:23:39 +02:00 committed by GitHub
commit 9488d543de
3 changed files with 33 additions and 15 deletions

View File

@ -119,11 +119,17 @@ Item
onClicked: manager.loadConfigurationFromPrinter() onClicked: manager.loadConfigurationFromPrinter()
function isClusterPrinter() { function isClusterPrinter() {
var clusterSize = Cura.MachineManager.printerOutputDevices[0].clusterSize if(Cura.MachineManager.printerOutputDevices.length == 0)
// This is a non cluster printer or the cluster it is just one printer {
return false;
}
var clusterSize = Cura.MachineManager.printerOutputDevices[0].clusterSize;
// This is not a cluster printer or the cluster it is just one printer
if(clusterSize == undefined || clusterSize == 1) if(clusterSize == undefined || clusterSize == 1)
return false {
return true return false;
}
return true;
} }
} }
} }

View File

@ -16,11 +16,17 @@ Menu
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0 property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
property bool isClusterPrinter: property bool isClusterPrinter:
{ {
var clusterSize = Cura.MachineManager.printerOutputDevices[0].clusterSize if(Cura.MachineManager.printerOutputDevices.length == 0)
// This is a non cluster printer or the cluster it is just one printer {
return false;
}
var clusterSize = Cura.MachineManager.printerOutputDevices[0].clusterSize;
// This is not a cluster printer or the cluster it is just one printer
if(clusterSize == undefined || clusterSize == 1) if(clusterSize == undefined || clusterSize == 1)
return false {
return true return false;
}
return true;
} }
UM.SettingPropertyProvider UM.SettingPropertyProvider

View File

@ -16,11 +16,17 @@ Menu
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0 property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
property bool isClusterPrinter: property bool isClusterPrinter:
{ {
var clusterSize = Cura.MachineManager.printerOutputDevices[0].clusterSize if(Cura.MachineManager.printerOutputDevices.length == 0)
// This is a non cluster printer or the cluster it is just one printer {
return false;
}
var clusterSize = Cura.MachineManager.printerOutputDevices[0].clusterSize;
// This is not a cluster printer or the cluster it is just one printer
if(clusterSize == undefined || clusterSize == 1) if(clusterSize == undefined || clusterSize == 1)
return false {
return true return false;
}
return true;
} }
MenuItem MenuItem