mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-04 12:33:57 -06:00
Fix code style
CURA-6840
This commit is contained in:
parent
4579b06f6d
commit
1967dd8404
3 changed files with 14 additions and 10 deletions
|
@ -9,7 +9,7 @@ from UM.Qt.ListModel import ListModel
|
||||||
from UM.Settings.ContainerRegistry import ContainerRegistry
|
from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||||
from cura.Machines.ContainerTree import ContainerTree
|
from cura.Machines.ContainerTree import ContainerTree
|
||||||
from cura.Machines.MaterialNode import MaterialNode
|
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
|
from cura.Machines.QualityGroup import QualityGroup
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,12 +63,12 @@ class IntentModel(ListModel):
|
||||||
return
|
return
|
||||||
quality_groups = ContainerTree.getInstance().getCurrentQualityGroups()
|
quality_groups = ContainerTree.getInstance().getCurrentQualityGroups()
|
||||||
|
|
||||||
material_nodes = self._get_active_materials()
|
material_nodes = self._getActiveMaterials()
|
||||||
|
|
||||||
layer_heights_added = [] # type: List[float]
|
layer_heights_added = [] # type: List[float]
|
||||||
|
|
||||||
for material_node in material_nodes:
|
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:
|
for intent in intents:
|
||||||
if intent["layer_height"] not in layer_heights_added:
|
if intent["layer_height"] not in layer_heights_added:
|
||||||
new_items.append(intent)
|
new_items.append(intent)
|
||||||
|
@ -79,7 +79,7 @@ class IntentModel(ListModel):
|
||||||
for quality_tuple, quality_group in quality_groups.items():
|
for quality_tuple, quality_group in quality_groups.items():
|
||||||
# Add the intents that are of the correct category
|
# Add the intents that are of the correct category
|
||||||
if quality_tuple[0] != self._intent_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:
|
if layer_height not in layer_heights_added:
|
||||||
new_items.append({"name": "Unavailable",
|
new_items.append({"name": "Unavailable",
|
||||||
"quality_type": "",
|
"quality_type": "",
|
||||||
|
@ -92,7 +92,7 @@ class IntentModel(ListModel):
|
||||||
self.setItems(new_items)
|
self.setItems(new_items)
|
||||||
|
|
||||||
## Get the active materials for all extruders. No duplicates will be returned
|
## 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()
|
global_stack = cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack()
|
||||||
if global_stack is None:
|
if global_stack is None:
|
||||||
return set()
|
return set()
|
||||||
|
@ -109,14 +109,14 @@ class IntentModel(ListModel):
|
||||||
|
|
||||||
return nodes
|
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]]
|
extruder_intents = [] # type: List[Dict[str, Any]]
|
||||||
|
|
||||||
for quality_id, quality_node in active_material_node.qualities.items():
|
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).
|
if quality_node.quality_type not in quality_groups: # Don't add the empty quality type (or anything else that would crash, defensively).
|
||||||
continue
|
continue
|
||||||
quality_group = quality_groups[quality_node.quality_type]
|
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():
|
for intent_id, intent_node in quality_node.intents.items():
|
||||||
if intent_node.intent_category != self._intent_category:
|
if intent_node.intent_category != self._intent_category:
|
||||||
|
|
|
@ -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 typing import TYPE_CHECKING
|
||||||
|
|
||||||
from UM.Settings.SettingFunction import SettingFunction
|
from UM.Settings.SettingFunction import SettingFunction
|
||||||
|
@ -7,7 +10,8 @@ if TYPE_CHECKING:
|
||||||
|
|
||||||
layer_height_unit = ""
|
layer_height_unit = ""
|
||||||
|
|
||||||
def fetch_layer_height(quality_group: "QualityGroup") -> float:
|
|
||||||
|
def fetchLayerHeight(quality_group: "QualityGroup") -> float:
|
||||||
from cura.CuraApplication import CuraApplication
|
from cura.CuraApplication import CuraApplication
|
||||||
global_stack = CuraApplication.getInstance().getMachineManager().activeMachine
|
global_stack = CuraApplication.getInstance().getMachineManager().activeMachine
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import cura.CuraApplication # Imported this way to prevent circular dependencie
|
||||||
from UM.Logger import Logger
|
from UM.Logger import Logger
|
||||||
from UM.Qt.ListModel import ListModel
|
from UM.Qt.ListModel import ListModel
|
||||||
from cura.Machines.ContainerTree import ContainerTree
|
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 = []
|
item_list = []
|
||||||
for quality_group in quality_group_dict.values():
|
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,
|
item = {"name": quality_group.name,
|
||||||
"quality_type": quality_group.quality_type,
|
"quality_type": quality_group.quality_type,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue