Added name for active machine

CURA-1278
This commit is contained in:
Jaime van Kessel 2016-05-11 16:21:09 +02:00
parent f91a4f9369
commit 66a29a2f1c
2 changed files with 12 additions and 4 deletions

View file

@ -1,7 +1,7 @@
from PyQt5.QtCore import QObject, pyqtSlot, pyqtProperty, pyqtSignal from PyQt5.QtCore import QObject, pyqtSlot, pyqtProperty, pyqtSignal
from UM.Application import Application from UM.Application import Application
from UM.Signal import Signal, signalemitter from UM.Settings.ContainerRegistry import ContainerRegistry
class MachineManagerModel(QObject): class MachineManagerModel(QObject):
def __init__(self, parent = None): def __init__(self, parent = None):
@ -15,11 +15,19 @@ class MachineManagerModel(QObject):
@pyqtSlot(str) @pyqtSlot(str)
def setActiveMachine(self, stack_id): 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) @pyqtProperty(str, notify = globalContainerChanged)
def activeMachineId(self): def activeMachineId(self):
return Application.getInstance().getGlobalContainerStack().getId() return Application.getInstance().getGlobalContainerStack().getId()
def createMachineManagerModel(engine, script_engine): def createMachineManagerModel(engine, script_engine):
return MachineManagerModel() return MachineManagerModel()

View file

@ -58,10 +58,10 @@ Item
ToolButton { ToolButton {
id: machineSelection id: machineSelection
text: UM.MachineManager.activeMachineInstance; text: Cura.MachineManager.activeMachineName;
width: parent.width/100*55 width: parent.width/100*55
height: UM.Theme.getSize("setting_control").height height: UM.Theme.getSize("setting_control").height
tooltip: UM.MachineManager.activeMachineInstance; tooltip: Cura.MachineManager.activeMachineName;
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("default_margin").width anchors.rightMargin: UM.Theme.getSize("default_margin").width
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter