mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 06:19:05 +08:00
Fix typing
This commit is contained in:
parent
18d93d0b7b
commit
1aa6708677
@ -39,7 +39,7 @@ class MaterialManagementModel(QObject):
|
|||||||
# \param material_node The ContainerTree node of the material to check.
|
# \param material_node The ContainerTree node of the material to check.
|
||||||
# \return Whether or not the material can be removed.
|
# \return Whether or not the material can be removed.
|
||||||
@pyqtSlot("QVariant", result = bool)
|
@pyqtSlot("QVariant", result = bool)
|
||||||
def canMaterialBeRemoved(self, material_node: "MaterialNode"):
|
def canMaterialBeRemoved(self, material_node: "MaterialNode") -> bool:
|
||||||
container_registry = CuraContainerRegistry.getInstance()
|
container_registry = CuraContainerRegistry.getInstance()
|
||||||
ids_to_remove = {metadata.get("id", "") for metadata in container_registry.findInstanceContainersMetadata(base_file = material_node.base_file)}
|
ids_to_remove = {metadata.get("id", "") for metadata in container_registry.findInstanceContainersMetadata(base_file = material_node.base_file)}
|
||||||
for extruder_stack in container_registry.findContainerStacks(type = "extruder_train"):
|
for extruder_stack in container_registry.findContainerStacks(type = "extruder_train"):
|
||||||
@ -85,7 +85,8 @@ class MaterialManagementModel(QObject):
|
|||||||
# \param new_metadata Metadata for the new material. If not provided, this
|
# \param new_metadata Metadata for the new material. If not provided, this
|
||||||
# will be duplicated from the original material.
|
# will be duplicated from the original material.
|
||||||
# \return The root material ID of the duplicate material.
|
# \return The root material ID of the duplicate material.
|
||||||
def duplicateMaterialByBaseFile(self, base_file: str, new_base_id: Optional[str] = None, new_metadata: Dict[str, Any] = None) -> Optional[str]:
|
def duplicateMaterialByBaseFile(self, base_file: str, new_base_id: Optional[str] = None,
|
||||||
|
new_metadata: Optional[Dict[str, Any]] = None) -> Optional[str]:
|
||||||
container_registry = CuraContainerRegistry.getInstance()
|
container_registry = CuraContainerRegistry.getInstance()
|
||||||
|
|
||||||
root_materials = container_registry.findContainers(id = base_file)
|
root_materials = container_registry.findContainers(id = base_file)
|
||||||
@ -149,7 +150,8 @@ class MaterialManagementModel(QObject):
|
|||||||
# will be duplicated from the original material.
|
# will be duplicated from the original material.
|
||||||
# \return The root material ID of the duplicate material.
|
# \return The root material ID of the duplicate material.
|
||||||
@pyqtSlot("QVariant", result = str)
|
@pyqtSlot("QVariant", result = str)
|
||||||
def duplicateMaterial(self, material_node: "MaterialNode", new_base_id: Optional[str] = None, new_metadata: Dict[str, Any] = None) -> Optional[str]:
|
def duplicateMaterial(self, material_node: "MaterialNode", new_base_id: Optional[str] = None,
|
||||||
|
new_metadata: Optional[Dict[str, Any]] = None) -> Optional[str]:
|
||||||
return self.duplicateMaterialByBaseFile(material_node.base_file, new_base_id, new_metadata)
|
return self.duplicateMaterialByBaseFile(material_node.base_file, new_base_id, new_metadata)
|
||||||
|
|
||||||
## Create a new material by cloning the preferred material for the current
|
## Create a new material by cloning the preferred material for the current
|
||||||
|
Loading…
x
Reference in New Issue
Block a user