Remove use of deprecated extruders property

This commit is contained in:
Jaime van Kessel 2019-09-13 14:11:55 +02:00
parent 495ed17294
commit 0ff9d72c4c
No known key found for this signature in database
GPG key ID: 3710727397403C91
15 changed files with 111 additions and 90 deletions

View file

@ -70,7 +70,12 @@ class BaseMaterialsModel(ListModel):
if self._extruder_stack is not None:
self._extruder_stack.pyqtContainersChanged.disconnect(self._update)
self._extruder_stack.approximateMaterialDiameterChanged.disconnect(self._update)
self._extruder_stack = global_stack.extruders.get(str(self._extruder_position))
try:
self._extruder_stack = global_stack.extruderList[self._extruder_position]
except IndexError:
self._extruder_stack = None
if self._extruder_stack is not None:
self._extruder_stack.pyqtContainersChanged.connect(self._update)
self._extruder_stack.approximateMaterialDiameterChanged.connect(self._update)
@ -113,12 +118,11 @@ class BaseMaterialsModel(ListModel):
if global_stack is None or not self._enabled:
return False
extruder_position = str(self._extruder_position)
if extruder_position not in global_stack.extruders:
try:
extruder_stack = global_stack.extruderList[self._extruder_position]
except IndexError:
return False
extruder_stack = global_stack.extruders[extruder_position]
self._available_materials = self._material_manager.getAvailableMaterialsForMachineExtruder(global_stack, extruder_stack)
if self._available_materials is None:
return False