mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-03 09:14:24 +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:
|
if material:
|
||||||
return material.getName()
|
return material.getName()
|
||||||
|
|
||||||
|
@pyqtProperty(str, notify=activeMaterialChanged)
|
||||||
|
def activeMaterialId(self):
|
||||||
|
material = Application.getInstance().getGlobalContainerStack().findContainer({"type": "material"})
|
||||||
|
if material:
|
||||||
|
return material.getId()
|
||||||
|
|
||||||
@pyqtSlot(str)
|
@pyqtSlot(str)
|
||||||
def setActiveMaterial(self, material_id):
|
def setActiveMaterial(self, material_id):
|
||||||
containers = ContainerRegistry.getInstance().findInstanceContainers(id=material_id)
|
containers = ContainerRegistry.getInstance().findInstanceContainers(id=material_id)
|
||||||
@ -99,6 +105,13 @@ class MachineManagerModel(QObject):
|
|||||||
if variant:
|
if variant:
|
||||||
return variant.getName()
|
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)
|
@pyqtSlot(str, str)
|
||||||
def renameMachine(self, machine_id, new_name):
|
def renameMachine(self, machine_id, new_name):
|
||||||
containers = ContainerRegistry.getInstance().findContainerStacks(id = machine_id)
|
containers = ContainerRegistry.getInstance().findContainerStacks(id = machine_id)
|
||||||
|
@ -204,7 +204,7 @@ UM.MainWindow
|
|||||||
MenuItem {
|
MenuItem {
|
||||||
text: model.name;
|
text: model.name;
|
||||||
checkable: true;
|
checkable: true;
|
||||||
checked: model.active;
|
checked: model.id == Cura.MachineManager.activeVariantId;
|
||||||
exclusiveGroup: machineVariantsGroup;
|
exclusiveGroup: machineVariantsGroup;
|
||||||
onTriggered: Cura.MachineManager.setActiveVariant(model.id)
|
onTriggered: Cura.MachineManager.setActiveVariant(model.id)
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ Item
|
|||||||
{
|
{
|
||||||
text: model.name;
|
text: model.name;
|
||||||
checkable: true;
|
checkable: true;
|
||||||
checked: model.active;
|
checked: model.id == Cura.MachineManager.activeVariantId;
|
||||||
exclusiveGroup: variantSelectionMenuGroup;
|
exclusiveGroup: variantSelectionMenuGroup;
|
||||||
onTriggered:
|
onTriggered:
|
||||||
{
|
{
|
||||||
@ -199,13 +199,11 @@ Item
|
|||||||
{
|
{
|
||||||
filter: {"type": "material"}
|
filter: {"type": "material"}
|
||||||
}
|
}
|
||||||
//model: UM.InstancesModel {filter: {"type":"material"}}
|
|
||||||
// model: UM.MachineMaterialsModel { id: machineMaterialsModel }
|
|
||||||
MenuItem
|
MenuItem
|
||||||
{
|
{
|
||||||
text: model.name;
|
text: model.name;
|
||||||
checkable: true;
|
checkable: true;
|
||||||
checked: model.active;
|
checked: model.id == Cura.MachineManager.activeMaterialId;
|
||||||
exclusiveGroup: materialSelectionMenuGroup;
|
exclusiveGroup: materialSelectionMenuGroup;
|
||||||
onTriggered:
|
onTriggered:
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user