mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-20 05:07:50 -06:00
Use stack properties instead of .findContainer(type = ...)
Recently we changed the empty containers such that there is only one empty container instance and it doesn't have the proper type any more. Instead we have properties on the stack that allows us to find the container with the proper type. It's faster and easier to use. We've had a few bugs about this so I decided to update all of them to remove those for the future, except the ones in plugins/MachineSettingsAction/MachineSettingsAction.py because we have a pending pull request that fixes those. Fixing them would give merge conflicts for fieldOfView. It doesn't really belong to CURA-4024 but I'm sticking it under that nomer anyway to get it reviewed.
This commit is contained in:
parent
4ad9ebc444
commit
81e07b1530
4 changed files with 11 additions and 15 deletions
|
@ -157,7 +157,7 @@ class MachineManager(QObject):
|
|||
if str(index) == extruder.getMetaDataEntry("position"):
|
||||
matching_extruder = extruder
|
||||
break
|
||||
if matching_extruder and matching_extruder.findContainer({"type": "variant"}).getName() != hotend_id:
|
||||
if matching_extruder and matching_extruder.variant.getName() != hotend_id:
|
||||
# Save the material that needs to be changed. Multiple changes will be handled by the callback.
|
||||
self._auto_hotends_changed[str(index)] = containers[0].getId()
|
||||
self._printer_output_devices[0].materialHotendChangedMessage(self._materialHotendChangedCallback)
|
||||
|
@ -181,11 +181,10 @@ class MachineManager(QObject):
|
|||
matching_extruder = extruder
|
||||
break
|
||||
|
||||
if matching_extruder and matching_extruder.findContainer({"type": "material"}).getMetaDataEntry("GUID") != material_id:
|
||||
if matching_extruder and matching_extruder.material.getMetaDataEntry("GUID") != material_id:
|
||||
# Save the material that needs to be changed. Multiple changes will be handled by the callback.
|
||||
variant_container = matching_extruder.findContainer({"type": "variant"})
|
||||
if self._global_container_stack.getBottom().getMetaDataEntry("has_variants") and variant_container:
|
||||
variant_id = self.getQualityVariantId(self._global_container_stack.getBottom(), variant_container)
|
||||
if self._global_container_stack.getBottom().getMetaDataEntry("has_variants") and matching_extruder.variant:
|
||||
variant_id = self.getQualityVariantId(self._global_container_stack.getBottom(), matching_extruder.variant)
|
||||
for container in containers:
|
||||
if container.getMetaDataEntry("variant") == variant_id:
|
||||
self._auto_materials_changed[str(index)] = container.getId()
|
||||
|
@ -507,9 +506,8 @@ class MachineManager(QObject):
|
|||
result = []
|
||||
if ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks() is not None:
|
||||
for stack in ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks():
|
||||
variant_container = stack.findContainer({"type": "variant"})
|
||||
if variant_container and variant_container != self._empty_variant_container:
|
||||
result.append(variant_container.getId())
|
||||
if stack.variant and stack.variant != self._empty_variant_container:
|
||||
result.append(stack.variant.getId())
|
||||
|
||||
return result
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue