Don't use deprecated extruders property

Done during Turbo Testing and Tooling.
This commit is contained in:
Ghostkeeper 2020-05-29 18:14:21 +02:00
parent 0e4830e6ef
commit e68ebb198e
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A
2 changed files with 5 additions and 6 deletions

View file

@ -294,7 +294,7 @@ class ContainerManager(QObject):
current_quality_changes_name = global_stack.qualityChanges.getName() current_quality_changes_name = global_stack.qualityChanges.getName()
current_quality_type = global_stack.quality.getMetaDataEntry("quality_type") current_quality_type = global_stack.quality.getMetaDataEntry("quality_type")
extruder_stacks = list(global_stack.extruders.values()) extruder_stacks = global_stack.extruderList
container_registry = cura.CuraApplication.CuraApplication.getInstance().getContainerRegistry() container_registry = cura.CuraApplication.CuraApplication.getInstance().getContainerRegistry()
machine_definition_id = ContainerTree.getInstance().machines[global_stack.definition.getId()].quality_definition machine_definition_id = ContainerTree.getInstance().machines[global_stack.definition.getId()].quality_definition
for stack in [global_stack] + extruder_stacks: for stack in [global_stack] + extruder_stacks:
@ -335,8 +335,7 @@ class ContainerManager(QObject):
# Go through global and extruder stacks and clear their topmost container (the user settings). # Go through global and extruder stacks and clear their topmost container (the user settings).
global_stack = machine_manager.activeMachine global_stack = machine_manager.activeMachine
extruder_stacks = list(global_stack.extruders.values()) for stack in [global_stack] + global_stack.extruderList:
for stack in [global_stack] + extruder_stacks:
container = stack.userChanges container = stack.userChanges
container.clear() container.clear()
send_emits_containers.append(container) send_emits_containers.append(container)

View file

@ -1,4 +1,4 @@
# Copyright (c) 2018 Ultimaker B.V. # Copyright (c) 2020 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher. # Cura is released under the terms of the LGPLv3 or higher.
from typing import Any, Optional from typing import Any, Optional
@ -45,13 +45,13 @@ class PerObjectContainerStack(CuraContainerStack):
if "original_limit_to_extruder" in context.context: if "original_limit_to_extruder" in context.context:
limit_to_extruder = context.context["original_limit_to_extruder"] limit_to_extruder = context.context["original_limit_to_extruder"]
if limit_to_extruder is not None and limit_to_extruder != "-1" and limit_to_extruder in global_stack.extruders: if limit_to_extruder is not None and limit_to_extruder != "-1" and int(limit_to_extruder) <= len(global_stack.extruderList):
# set the original limit_to_extruder if this is the first stack that has a non-overridden limit_to_extruder # set the original limit_to_extruder if this is the first stack that has a non-overridden limit_to_extruder
if "original_limit_to_extruder" not in context.context: if "original_limit_to_extruder" not in context.context:
context.context["original_limit_to_extruder"] = limit_to_extruder context.context["original_limit_to_extruder"] = limit_to_extruder
if super().getProperty(key, "settable_per_extruder", context): if super().getProperty(key, "settable_per_extruder", context):
result = global_stack.extruders[str(limit_to_extruder)].getProperty(key, property_name, context) result = global_stack.extruderList[int(limit_to_extruder)].getProperty(key, property_name, context)
if result is not None: if result is not None:
context.popContainer() context.popContainer()
return result return result