Fix qml error when there is no connected printer

Also fixes code style
This commit is contained in:
fieldOfView 2017-10-25 11:52:43 +02:00
parent 9ad0fd2b83
commit ff847aa329
3 changed files with 33 additions and 15 deletions

View file

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

View file

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

View file

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