mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-12 17:27:51 -06:00
Changing the material is now possible
CURA-1278
This commit is contained in:
parent
89c0644e4b
commit
f5e63f2e71
2 changed files with 17 additions and 4 deletions
|
@ -17,8 +17,14 @@ class MachineManagerModel(QObject):
|
|||
activeMaterialChanged = pyqtSignal()
|
||||
|
||||
def _onGlobalContainerChanged(self):
|
||||
Application.getInstance().getGlobalContainerStack().containersChanged.connect(self._onInstanceContainersChanged)
|
||||
self.globalContainerChanged.emit()
|
||||
|
||||
def _onInstanceContainersChanged(self, container):
|
||||
container_type = container.getMetaDataEntry("type")
|
||||
if container_type == "material":
|
||||
self.activeMaterialChanged.emit()
|
||||
|
||||
@pyqtSlot(str)
|
||||
def setActiveMachine(self, stack_id):
|
||||
containers = ContainerRegistry.getInstance().findContainerStacks(id = stack_id)
|
||||
|
@ -61,6 +67,13 @@ class MachineManagerModel(QObject):
|
|||
if material:
|
||||
return material.getName()
|
||||
|
||||
@pyqtSlot(str)
|
||||
def setActiveMaterial(self, material_id):
|
||||
containers = ContainerRegistry.getInstance().findInstanceContainers(id=material_id)
|
||||
old_material = Application.getInstance().getGlobalContainerStack().findContainer({"type":"material"})
|
||||
material_index = Application.getInstance().getGlobalContainerStack().getContainerIndex(old_material)
|
||||
Application.getInstance().getGlobalContainerStack().replaceContainer(material_index, containers[0])
|
||||
|
||||
@pyqtSlot(str, str)
|
||||
def renameMachine(self, machine_id, new_name):
|
||||
containers = ContainerRegistry.getInstance().findContainerStacks(id = machine_id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue