Materials & variants are now correctly checked when active

CURA-1278
This commit is contained in:
Jaime van Kessel 2016-05-13 12:04:38 +02:00
parent 5dbe0bdc03
commit dd24e488a8
3 changed files with 16 additions and 5 deletions

View File

@ -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)

View File

@ -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)
}

View File

@ -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:
{