Allow getContainer() to return None

And in the rest of the locations we must then check if it's None and handle that gracefully.
Here we assume that the getContainer message shows a message to the user if necessary. For now we'll just log it.

Contributes to issue CURA-5045.
This commit is contained in:
Ghostkeeper 2018-03-26 15:48:03 +02:00
parent 2a39d81a3c
commit 6d3fed8f52
No known key found for this signature in database
GPG key ID: 5252B696FB5E7C7A
9 changed files with 52 additions and 23 deletions

View file

@ -895,7 +895,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
variant_type = VariantType.BUILD_PLATE
node = variant_manager.getVariantNode(global_stack.definition.getId(), variant_name, variant_type)
if node is not None:
if node is not None and node.getContainer() is not None:
global_stack.variant = node.getContainer()
for position, extruder_stack in extruder_stack_dict.items():
@ -911,7 +911,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
variant_type = VariantType.NOZZLE
node = variant_manager.getVariantNode(global_stack.definition.getId(), variant_name, variant_type)
if node is not None:
if node is not None and node.getContainer() is not None:
extruder_stack.variant = node.getContainer()
def _applyMaterials(self, global_stack, extruder_stack_dict):
@ -937,7 +937,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
extruder_stack.variant.getName(),
machine_material_diameter,
root_material_id)
if material_node is not None:
if material_node is not None and material_node.getContainer() is not None:
extruder_stack.material = material_node.getContainer()
def _applyChangesToMachine(self, global_stack, extruder_stack_dict):