mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Added name for active machine
CURA-1278
This commit is contained in:
parent
f91a4f9369
commit
66a29a2f1c
2 changed files with 12 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
|||
|
||||
from PyQt5.QtCore import QObject, pyqtSlot, pyqtProperty, pyqtSignal
|
||||
from UM.Application import Application
|
||||
from UM.Signal import Signal, signalemitter
|
||||
from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||
|
||||
class MachineManagerModel(QObject):
|
||||
def __init__(self, parent = None):
|
||||
|
@ -15,11 +15,19 @@ class MachineManagerModel(QObject):
|
|||
|
||||
@pyqtSlot(str)
|
||||
def setActiveMachine(self, stack_id):
|
||||
pass
|
||||
containers = ContainerRegistry.getInstance().findContainerStacks(id = stack_id)
|
||||
if containers:
|
||||
Application.getInstance().setGlobalContainerStack(containers[0])
|
||||
|
||||
@pyqtProperty(str, notify = globalContainerChanged)
|
||||
def activeMachineName(self):
|
||||
return Application.getInstance().getGlobalContainerStack().getName()
|
||||
|
||||
@pyqtProperty(str, notify = globalContainerChanged)
|
||||
def activeMachineId(self):
|
||||
return Application.getInstance().getGlobalContainerStack().getId()
|
||||
|
||||
|
||||
|
||||
def createMachineManagerModel(engine, script_engine):
|
||||
return MachineManagerModel()
|
Loading…
Add table
Add a link
Reference in a new issue