mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-01 00:04:27 +08:00

This happens when the printer is changed, such as when changing the Machine Width in the machine settings dialogue. It updates these menus then and if not all extruders are defined it'll give the following errors: 2020-03-20 16:56:57,839 - WARNING - [MainThread] UM.Qt.QtApplication.__onQmlWarning [406]: file:///home/trin/Gedeeld/Projects/Cura/resources/qml/Menus/SettingsMenu.qml:51: TypeError: Cannot read property 'isEnabled' of undefined 2020-03-20 16:56:57,840 - WARNING - [MainThread] UM.Qt.QtApplication.__onQmlWarning [406]: file:///home/trin/Gedeeld/Projects/Cura/resources/qml/Menus/SettingsMenu.qml:44: TypeError: Cannot read property 'isEnabled' of undefined 2020-03-20 16:56:57,841 - WARNING - [MainThread] UM.Qt.QtApplication.__onQmlWarning [406]: file:///home/trin/Gedeeld/Projects/Cura/resources/qml/Menus/MaterialMenu.qml:26: TypeError: Cannot read property 'isEnabled' of undefined 2020-03-20 16:56:57,841 - WARNING - [MainThread] UM.Qt.QtApplication.__onQmlWarning [406]: file:///home/trin/Gedeeld/Projects/Cura/resources/qml/Menus/MaterialMenu.qml:28: TypeError: Cannot read property 'material' of undefined Done during Turbo Testing and Tooling.
63 lines
2.3 KiB
QML
63 lines
2.3 KiB
QML
//Copyright (c) 2020 Ultimaker B.V.
|
|
//Cura is released under the terms of the LGPLv3 or higher.
|
|
|
|
import QtQuick 2.2
|
|
import QtQuick.Controls 1.1
|
|
|
|
import UM 1.2 as UM
|
|
import Cura 1.0 as Cura
|
|
|
|
Menu
|
|
{
|
|
id: base
|
|
title: catalog.i18nc("@title:menu menubar:toplevel", "&Settings")
|
|
|
|
PrinterMenu { title: catalog.i18nc("@title:menu menubar:settings", "&Printer") }
|
|
|
|
property var activeMachine: Cura.MachineManager.activeMachine
|
|
Instantiator
|
|
{
|
|
id: extruderInstantiator
|
|
model: activeMachine == null ? null : activeMachine.extruderList
|
|
Menu
|
|
{
|
|
title: modelData.name
|
|
property var extruder: (base.activeMachine === null) ? null : activeMachine.extruderList[model.index]
|
|
NozzleMenu { title: Cura.MachineManager.activeDefinitionVariantsName; visible: Cura.MachineManager.activeMachine.hasVariants; extruderIndex: index }
|
|
MaterialMenu { title: catalog.i18nc("@title:menu", "&Material"); visible: Cura.MachineManager.activeMachine.hasMaterials; extruderIndex: index }
|
|
|
|
MenuSeparator
|
|
{
|
|
visible: Cura.MachineManager.activeMachine.hasVariants || Cura.MachineManager.activeMachine.hasMaterials
|
|
}
|
|
|
|
MenuItem
|
|
{
|
|
text: catalog.i18nc("@action:inmenu", "Set as Active Extruder")
|
|
onTriggered: Cura.ExtruderManager.setActiveExtruderIndex(model.index)
|
|
}
|
|
|
|
MenuItem
|
|
{
|
|
text: catalog.i18nc("@action:inmenu", "Enable Extruder")
|
|
onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, true)
|
|
visible: (extruder === null || extruder === undefined) ? false : !extruder.isEnabled
|
|
}
|
|
|
|
MenuItem
|
|
{
|
|
text: catalog.i18nc("@action:inmenu", "Disable Extruder")
|
|
onTriggered: Cura.MachineManager.setExtruderEnabled(index, false)
|
|
visible: (extruder === null || extruder === undefined) ? false : extruder.isEnabled
|
|
enabled: Cura.MachineManager.numberExtrudersEnabled > 1
|
|
}
|
|
|
|
}
|
|
onObjectAdded: base.insertItem(index, object)
|
|
onObjectRemoved: base.removeItem(object)
|
|
}
|
|
|
|
MenuSeparator { }
|
|
|
|
MenuItem { action: Cura.Actions.configureSettingVisibility }
|
|
} |