diff --git a/cura/Machines/Models/IntentModel.py b/cura/Machines/Models/IntentModel.py index 25edc0a759..4e96d8e152 100644 --- a/cura/Machines/Models/IntentModel.py +++ b/cura/Machines/Models/IntentModel.py @@ -9,7 +9,7 @@ from UM.Qt.ListModel import ListModel from UM.Settings.ContainerRegistry import ContainerRegistry from cura.Machines.ContainerTree import ContainerTree from cura.Machines.MaterialNode import MaterialNode -from cura.Machines.Models.MachineModelUtils import fetch_layer_height +from cura.Machines.Models.MachineModelUtils import fetchLayerHeight from cura.Machines.QualityGroup import QualityGroup @@ -63,12 +63,12 @@ class IntentModel(ListModel): return quality_groups = ContainerTree.getInstance().getCurrentQualityGroups() - material_nodes = self._get_active_materials() + material_nodes = self._getActiveMaterials() layer_heights_added = [] # type: List[float] for material_node in material_nodes: - intents = self._get_intents_for_material(material_node, quality_groups) + intents = self._getIntentsForMaterial(material_node, quality_groups) for intent in intents: if intent["layer_height"] not in layer_heights_added: new_items.append(intent) @@ -79,7 +79,7 @@ class IntentModel(ListModel): for quality_tuple, quality_group in quality_groups.items(): # Add the intents that are of the correct category if quality_tuple[0] != self._intent_category: - layer_height = fetch_layer_height(quality_group) + layer_height = fetchLayerHeight(quality_group) if layer_height not in layer_heights_added: new_items.append({"name": "Unavailable", "quality_type": "", @@ -92,7 +92,7 @@ class IntentModel(ListModel): self.setItems(new_items) ## Get the active materials for all extruders. No duplicates will be returned - def _get_active_materials(self) -> Set[MaterialNode]: + def _getActiveMaterials(self) -> Set["MaterialNode"]: global_stack = cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack() if global_stack is None: return set() @@ -109,14 +109,14 @@ class IntentModel(ListModel): return nodes - def _get_intents_for_material(self, active_material_node: MaterialNode, quality_groups: Dict[str, QualityGroup]) -> List[Dict[str, Any]]: + def _getIntentsForMaterial(self, active_material_node: "MaterialNode", quality_groups: Dict[str, "QualityGroup"]) -> List[Dict[str, Any]]: extruder_intents = [] # type: List[Dict[str, Any]] for quality_id, quality_node in active_material_node.qualities.items(): if quality_node.quality_type not in quality_groups: # Don't add the empty quality type (or anything else that would crash, defensively). continue quality_group = quality_groups[quality_node.quality_type] - layer_height = fetch_layer_height(quality_group) + layer_height = fetchLayerHeight(quality_group) for intent_id, intent_node in quality_node.intents.items(): if intent_node.intent_category != self._intent_category: diff --git a/cura/Machines/Models/MachineModelUtils.py b/cura/Machines/Models/MachineModelUtils.py index 3e94f4f010..a23b1ff3a5 100644 --- a/cura/Machines/Models/MachineModelUtils.py +++ b/cura/Machines/Models/MachineModelUtils.py @@ -1,3 +1,6 @@ +# Copyright (c) 2019 Ultimaker B.V. +# Cura is released under the terms of the LGPLv3 or higher. + from typing import TYPE_CHECKING from UM.Settings.SettingFunction import SettingFunction @@ -7,7 +10,8 @@ if TYPE_CHECKING: layer_height_unit = "" -def fetch_layer_height(quality_group: "QualityGroup") -> float: + +def fetchLayerHeight(quality_group: "QualityGroup") -> float: from cura.CuraApplication import CuraApplication global_stack = CuraApplication.getInstance().getMachineManager().activeMachine diff --git a/cura/Machines/Models/QualityProfilesDropDownMenuModel.py b/cura/Machines/Models/QualityProfilesDropDownMenuModel.py index 78e8568322..9bf1cc08a8 100644 --- a/cura/Machines/Models/QualityProfilesDropDownMenuModel.py +++ b/cura/Machines/Models/QualityProfilesDropDownMenuModel.py @@ -7,7 +7,7 @@ import cura.CuraApplication # Imported this way to prevent circular dependencie from UM.Logger import Logger from UM.Qt.ListModel import ListModel from cura.Machines.ContainerTree import ContainerTree -from cura.Machines.Models.MachineModelUtils import fetch_layer_height +from cura.Machines.Models.MachineModelUtils import fetchLayerHeight # @@ -87,7 +87,7 @@ class QualityProfilesDropDownMenuModel(ListModel): item_list = [] for quality_group in quality_group_dict.values(): - layer_height = fetch_layer_height(quality_group) + layer_height = fetchLayerHeight(quality_group) item = {"name": quality_group.name, "quality_type": quality_group.quality_type,