getting id of definition when none was found no longer causes exception

CURA-1278
This commit is contained in:
Jaime van Kessel 2016-05-17 12:55:40 +02:00
parent f24b56dc85
commit 6d25d21126
3 changed files with 6 additions and 7 deletions

View File

@ -158,7 +158,10 @@ class MachineManagerModel(QObject):
@pyqtProperty(str, notify = globalContainerChanged)
def activeDefinitionId(self):
return Application.getInstance().getGlobalContainerStack().getBottom().id
definition = Application.getInstance().getGlobalContainerStack().getBottom()
if definition:
return definition.id
return None
@pyqtSlot(str, str)
def renameMachine(self, machine_id, new_name):
@ -166,10 +169,6 @@ class MachineManagerModel(QObject):
if containers:
containers[0].setName(new_name)
@pyqtProperty(str, notify=globalContainerChanged)
def activeMachineDefinitionId(self):
return Application.getInstance().getGlobalContainerStack().getContainers()[-1].getId()
@pyqtSlot(str)
def removeMachine(self, machine_id):
UM.Settings.ContainerRegistry.getInstance().removeContainer(machine_id)

View File

@ -198,7 +198,7 @@ UM.MainWindow
filter:
{
"type": "variant",
"definition": Cura.MachineManager.activeMachineDefinitionId //Only show variants of this machine
"definition": Cura.MachineManager.activeDefinitionId //Only show variants of this machine
}
}
MenuItem {

View File

@ -149,7 +149,7 @@ Item
filter:
{
"type": "variant",
"definition": Cura.MachineManager.activeMachineDefinitionId //Only show variants of this machine
"definition": Cura.MachineManager.activeDefinitionId //Only show variants of this machine
}
}
MenuItem