mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-15 02:37:49 -06:00
Fix QML errors building the material and nozzle menus
Since the network rewrite, outputdevices no longer have hotends and materials. This functionality may return, but until that time this does a better job at checking if the properties exist, preventing QML errors.
This commit is contained in:
parent
4ee36404cc
commit
259b1091f6
2 changed files with 4 additions and 4 deletions
|
@ -44,14 +44,14 @@ Menu
|
||||||
id: automaticMaterial
|
id: automaticMaterial
|
||||||
text:
|
text:
|
||||||
{
|
{
|
||||||
if(printerConnected && Cura.MachineManager.printerOutputDevices[0].materialNames.length > extruderIndex && !isClusterPrinter)
|
if(visible)
|
||||||
{
|
{
|
||||||
var materialName = Cura.MachineManager.printerOutputDevices[0].materialNames[extruderIndex];
|
var materialName = Cura.MachineManager.printerOutputDevices[0].materialNames[extruderIndex];
|
||||||
return catalog.i18nc("@title:menuitem %1 is the automatically selected material", "Automatic: %1").arg(materialName);
|
return catalog.i18nc("@title:menuitem %1 is the automatically selected material", "Automatic: %1").arg(materialName);
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
visible: printerConnected && Cura.MachineManager.printerOutputDevices[0].materialNames.length > extruderIndex && !isClusterPrinter
|
visible: printerConnected && Cura.MachineManager.printerOutputDevices[0].materialNames != undefined && Cura.MachineManager.printerOutputDevices[0].materialNames.length > extruderIndex && !isClusterPrinter
|
||||||
onTriggered:
|
onTriggered:
|
||||||
{
|
{
|
||||||
var materialId = Cura.MachineManager.printerOutputDevices[0].materialIds[extruderIndex];
|
var materialId = Cura.MachineManager.printerOutputDevices[0].materialIds[extruderIndex];
|
||||||
|
|
|
@ -34,14 +34,14 @@ Menu
|
||||||
id: automaticNozzle
|
id: automaticNozzle
|
||||||
text:
|
text:
|
||||||
{
|
{
|
||||||
if(printerConnected && Cura.MachineManager.printerOutputDevices[0].hotendIds.length > extruderIndex && !isClusterPrinter)
|
if(visible)
|
||||||
{
|
{
|
||||||
var nozzleName = Cura.MachineManager.printerOutputDevices[0].hotendIds[extruderIndex];
|
var nozzleName = Cura.MachineManager.printerOutputDevices[0].hotendIds[extruderIndex];
|
||||||
return catalog.i18nc("@title:menuitem %1 is the nozzle currently loaded in the printer", "Automatic: %1").arg(nozzleName);
|
return catalog.i18nc("@title:menuitem %1 is the nozzle currently loaded in the printer", "Automatic: %1").arg(nozzleName);
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
visible: printerConnected && Cura.MachineManager.printerOutputDevices[0].hotendIds.length > extruderIndex && !isClusterPrinter
|
visible: printerConnected && Cura.MachineManager.printerOutputDevices[0].hotendIds != undefined && Cura.MachineManager.printerOutputDevices[0].hotendIds.length > extruderIndex && !isClusterPrinter
|
||||||
onTriggered:
|
onTriggered:
|
||||||
{
|
{
|
||||||
var activeExtruderIndex = Cura.ExtruderManager.activeExtruderIndex;
|
var activeExtruderIndex = Cura.ExtruderManager.activeExtruderIndex;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue