mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 15:07: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()
|
|
@ -58,10 +58,10 @@ Item
|
|||
|
||||
ToolButton {
|
||||
id: machineSelection
|
||||
text: UM.MachineManager.activeMachineInstance;
|
||||
text: Cura.MachineManager.activeMachineName;
|
||||
width: parent.width/100*55
|
||||
height: UM.Theme.getSize("setting_control").height
|
||||
tooltip: UM.MachineManager.activeMachineInstance;
|
||||
tooltip: Cura.MachineManager.activeMachineName;
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue