mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-02 16:54:23 +08:00
Materials & variants are now correctly checked when active
CURA-1278
This commit is contained in:
parent
5dbe0bdc03
commit
dd24e488a8
@ -77,6 +77,12 @@ class MachineManagerModel(QObject):
|
||||
if material:
|
||||
return material.getName()
|
||||
|
||||
@pyqtProperty(str, notify=activeMaterialChanged)
|
||||
def activeMaterialId(self):
|
||||
material = Application.getInstance().getGlobalContainerStack().findContainer({"type": "material"})
|
||||
if material:
|
||||
return material.getId()
|
||||
|
||||
@pyqtSlot(str)
|
||||
def setActiveMaterial(self, material_id):
|
||||
containers = ContainerRegistry.getInstance().findInstanceContainers(id=material_id)
|
||||
@ -99,6 +105,13 @@ class MachineManagerModel(QObject):
|
||||
if variant:
|
||||
return variant.getName()
|
||||
|
||||
@pyqtProperty(str, notify = activeVariantChanged)
|
||||
def activeVariantId(self):
|
||||
variant = Application.getInstance().getGlobalContainerStack().findContainer({"type": "variant"})
|
||||
if variant:
|
||||
return variant.getId()
|
||||
|
||||
|
||||
@pyqtSlot(str, str)
|
||||
def renameMachine(self, machine_id, new_name):
|
||||
containers = ContainerRegistry.getInstance().findContainerStacks(id = machine_id)
|
||||
|
@ -204,7 +204,7 @@ UM.MainWindow
|
||||
MenuItem {
|
||||
text: model.name;
|
||||
checkable: true;
|
||||
checked: model.active;
|
||||
checked: model.id == Cura.MachineManager.activeVariantId;
|
||||
exclusiveGroup: machineVariantsGroup;
|
||||
onTriggered: Cura.MachineManager.setActiveVariant(model.id)
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ Item
|
||||
{
|
||||
text: model.name;
|
||||
checkable: true;
|
||||
checked: model.active;
|
||||
checked: model.id == Cura.MachineManager.activeVariantId;
|
||||
exclusiveGroup: variantSelectionMenuGroup;
|
||||
onTriggered:
|
||||
{
|
||||
@ -199,13 +199,11 @@ Item
|
||||
{
|
||||
filter: {"type": "material"}
|
||||
}
|
||||
//model: UM.InstancesModel {filter: {"type":"material"}}
|
||||
// model: UM.MachineMaterialsModel { id: machineMaterialsModel }
|
||||
MenuItem
|
||||
{
|
||||
text: model.name;
|
||||
checkable: true;
|
||||
checked: model.active;
|
||||
checked: model.id == Cura.MachineManager.activeMaterialId;
|
||||
exclusiveGroup: materialSelectionMenuGroup;
|
||||
onTriggered:
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user