mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
Properly return a string when creating/duplicating a material
This commit is contained in:
parent
577a8d0a3e
commit
f3c2df3ab4
1 changed files with 6 additions and 1 deletions
|
@ -672,6 +672,8 @@ class ContainerManager(QObject):
|
||||||
|
|
||||||
return new_change_instances
|
return new_change_instances
|
||||||
|
|
||||||
|
## Create a duplicate of a material, which has the same GUID and base_file metadata
|
||||||
|
# \return \type{str} the id of the newly created container.
|
||||||
@pyqtSlot(str, result = str)
|
@pyqtSlot(str, result = str)
|
||||||
def duplicateMaterial(self, material_id: str) -> str:
|
def duplicateMaterial(self, material_id: str) -> str:
|
||||||
containers = self._container_registry.findInstanceContainers(id=material_id)
|
containers = self._container_registry.findInstanceContainers(id=material_id)
|
||||||
|
@ -694,8 +696,10 @@ class ContainerManager(QObject):
|
||||||
duplicated_container.deserialize(f.read())
|
duplicated_container.deserialize(f.read())
|
||||||
duplicated_container.setDirty(True)
|
duplicated_container.setDirty(True)
|
||||||
self._container_registry.addContainer(duplicated_container)
|
self._container_registry.addContainer(duplicated_container)
|
||||||
|
return new_id
|
||||||
|
|
||||||
# Create a new material by cloning Generic PLA and setting the GUID to something unqiue
|
## Create a new material by cloning Generic PLA and setting the GUID to something unqiue
|
||||||
|
# \return \type{str} the id of the newly created container.
|
||||||
@pyqtSlot(result = str)
|
@pyqtSlot(result = str)
|
||||||
def createMaterial(self) -> str:
|
def createMaterial(self) -> str:
|
||||||
# Ensure all settings are saved.
|
# Ensure all settings are saved.
|
||||||
|
@ -722,6 +726,7 @@ class ContainerManager(QObject):
|
||||||
duplicated_container.setName(catalog.i18nc("@label", "Custom Material"))
|
duplicated_container.setName(catalog.i18nc("@label", "Custom Material"))
|
||||||
|
|
||||||
self._container_registry.addContainer(duplicated_container)
|
self._container_registry.addContainer(duplicated_container)
|
||||||
|
return new_id
|
||||||
|
|
||||||
@pyqtSlot(str, result = "QStringList")
|
@pyqtSlot(str, result = "QStringList")
|
||||||
def getLinkedMaterials(self, material_id: str):
|
def getLinkedMaterials(self, material_id: str):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue