getAvailableMaterialsForMachineExtruder can never return None

So no need to check for it.

Contributes to issue CURA-6600.
This commit is contained in:
Ghostkeeper 2019-08-19 17:32:39 +02:00
parent 5abb03e269
commit 46b489c3f9
No known key found for this signature in database
GPG key ID: 86BEF881AE2CF276
2 changed files with 2 additions and 7 deletions

View file

@ -103,7 +103,7 @@ class MaterialManager(QObject):
# A convenience function to get available materials for the given machine with the extruder position.
#
def getAvailableMaterialsForMachineExtruder(self, machine: "GlobalStack",
extruder_stack: "ExtruderStack") -> Optional[Dict[str, MaterialNode]]:
extruder_stack: "ExtruderStack") -> Dict[str, MaterialNode]:
nozzle_name = None
if extruder_stack.variant.getId() != "empty_variant":
nozzle_name = extruder_stack.variant.getName()

View file

@ -106,20 +106,15 @@ class BaseMaterialsModel(ListModel):
# so it's placed here for easy access.
def _canUpdate(self):
global_stack = self._machine_manager.activeMachine
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:
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
self._available_materials = self._material_manager.getAvailableMaterialsForMachineExtruder(global_stack, extruder_stack)
return True
## This is another convenience function which is shared by all material