Added handling for key not found in extruder map

This commit is contained in:
Jaime van Kessel 2016-10-25 11:02:41 +02:00
parent 3e3e6e6b1b
commit ecbe4b264a

View file

@ -50,8 +50,11 @@ class ExtruderManager(QObject):
@pyqtProperty(int, notify = extrudersChanged)
def extruderCount(self):
if not UM.Application.getInstance().getGlobalContainerStack():
return 0 # No active machine, so no extruders.
return len(self._extruder_trains[UM.Application.getInstance().getGlobalContainerStack().getId()])
return 0 # No active machine, so no extruders.
try:
return len(self._extruder_trains[UM.Application.getInstance().getGlobalContainerStack().getId()])
except KeyError:
return 0
@pyqtProperty("QVariantMap", notify=extrudersChanged)
def extruderIds(self):