From a3e9316f4858581863cd7ead9b2d80c6f30e308f Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 18 Sep 2019 14:26:41 +0200 Subject: [PATCH 1/2] Rename all_root_materials to all_base_files This naming is more consistent with the naming of the metadata entry and most of the other code. Contributes to issue CURA-6600. --- plugins/UM3NetworkPrinting/src/Network/SendMaterialJob.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/src/Network/SendMaterialJob.py b/plugins/UM3NetworkPrinting/src/Network/SendMaterialJob.py index 5637f388c1..e13ac96c40 100644 --- a/plugins/UM3NetworkPrinting/src/Network/SendMaterialJob.py +++ b/plugins/UM3NetworkPrinting/src/Network/SendMaterialJob.py @@ -69,9 +69,9 @@ class SendMaterialJob(Job): def _sendMaterials(self, materials_to_send: Set[str]) -> None: container_registry = CuraApplication.getInstance().getContainerRegistry() all_materials = container_registry.findInstanceContainersMetadata(type = "material") - all_root_materials = {material["base_file"] for material in all_materials if "base_file" in material} # Filters out uniques by making it a set. Don't include files without base file (i.e. empty material). + all_base_files = {material["base_file"] for material in all_materials if "base_file" in material} # Filters out uniques by making it a set. Don't include files without base file (i.e. empty material). - for root_material_id in all_root_materials: + for root_material_id in all_base_files: if root_material_id not in materials_to_send: # If the material does not have to be sent we skip it. continue From 05de920c21cc3cf262ecb376de86e6944c3852bb Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 18 Sep 2019 14:28:22 +0200 Subject: [PATCH 2/2] Once more with feeling Sorry, I didn't see the other review comment until after I pushed the previous commit. Contributes to issue CURA-6600. --- plugins/UM3NetworkPrinting/src/Network/SendMaterialJob.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/src/Network/SendMaterialJob.py b/plugins/UM3NetworkPrinting/src/Network/SendMaterialJob.py index e13ac96c40..09949ed37e 100644 --- a/plugins/UM3NetworkPrinting/src/Network/SendMaterialJob.py +++ b/plugins/UM3NetworkPrinting/src/Network/SendMaterialJob.py @@ -129,10 +129,10 @@ class SendMaterialJob(Job): def _getLocalMaterials() -> Dict[str, LocalMaterial]: result = {} # type: Dict[str, LocalMaterial] all_materials = CuraApplication.getInstance().getContainerRegistry().findInstanceContainersMetadata(type = "material") - all_root_materials = [material for material in all_materials if material["id"] == material.get("base_file")] # Don't send materials without base_file: The empty material doesn't need to be sent. + all_base_files = [material for material in all_materials if material["id"] == material.get("base_file")] # Don't send materials without base_file: The empty material doesn't need to be sent. # Find the latest version of all material containers in the registry. - for material_metadata in all_root_materials: + for material_metadata in all_base_files: try: # material version must be an int material_metadata["version"] = int(material_metadata["version"])