Merge branch 'CURA-11299' of github.com:Ultimaker/Cura into 5.6

This commit is contained in:
Jaime van Kessel 2023-11-15 13:11:36 +01:00
commit fc3d150b39
No known key found for this signature in database
GPG Key ID: C85F7A3AF1BAA7C4
2 changed files with 12 additions and 14 deletions

View File

@ -48,6 +48,8 @@ from UM.i18n import i18nCatalog
catalog = i18nCatalog("cura") catalog = i18nCatalog("cura")
from cura.Settings.GlobalStack import GlobalStack from cura.Settings.GlobalStack import GlobalStack
if TYPE_CHECKING: if TYPE_CHECKING:
from PyQt6.QtCore import QVariantList
from cura.CuraApplication import CuraApplication from cura.CuraApplication import CuraApplication
from cura.Machines.MaterialNode import MaterialNode from cura.Machines.MaterialNode import MaterialNode
from cura.Machines.QualityChangesGroup import QualityChangesGroup from cura.Machines.QualityChangesGroup import QualityChangesGroup
@ -581,6 +583,10 @@ class MachineManager(QObject):
def activeMachine(self) -> Optional["GlobalStack"]: def activeMachine(self) -> Optional["GlobalStack"]:
return self._global_container_stack return self._global_container_stack
@pyqtProperty("QVariantList", notify=activeVariantChanged)
def activeMachineExtruders(self) -> Optional["QVariantList"]:
return self._global_container_stack.extruderList if self._global_container_stack else None
@pyqtProperty(str, notify = activeStackChanged) @pyqtProperty(str, notify = activeStackChanged)
def activeStackId(self) -> str: def activeStackId(self) -> str:
if self._active_container_stack: if self._active_container_stack:

View File

@ -27,24 +27,17 @@ Cura.Menu
{ {
text: model.hotend_name text: model.hotend_name
checkable: true checkable: true
property var activeMachine: Cura.MachineManager.activeMachine
checked: checked:
{ {
if (activeMachine === null) const extruder = Cura.MachineManager.activeMachineExtruders[extruderIndex];
{ if (!extruder) return false;
return false return extruder.variant.name == model.hotend_name;
}
var extruder = activeMachine.extruderList[extruderIndex]
return (extruder === undefined) ? false : (extruder.variant.name == model.hotend_name)
} }
enabled: enabled:
{ {
if (activeMachine === null) const extruder = Cura.MachineManager.activeMachineExtruders[extruderIndex];
{ if (!extruder) return false;
return false return extruder.isEnabled;
}
var extruder = activeMachine.extruderList[extruderIndex]
return (extruder === undefined) ? false : extruder.isEnabled
} }
onTriggered: Cura.MachineManager.setVariant(nozzleMenu.extruderIndex, model.container_node) onTriggered: Cura.MachineManager.setVariant(nozzleMenu.extruderIndex, model.container_node)
} }
@ -52,5 +45,4 @@ Cura.Menu
onObjectAdded: function(index, object) { nozzleMenu.insertItem(index, object) } onObjectAdded: function(index, object) { nozzleMenu.insertItem(index, object) }
onObjectRemoved: function(index, object) {nozzleMenu.removeItem(object)} onObjectRemoved: function(index, object) {nozzleMenu.removeItem(object)}
} }
} }