mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 15:07:28 -06:00
Fixed duplication of profiles
CURA-1427
This commit is contained in:
parent
fdbd6d7c5f
commit
490a8724e5
2 changed files with 9 additions and 6 deletions
|
@ -279,7 +279,6 @@ class MachineManagerModel(QObject):
|
||||||
|
|
||||||
@pyqtSlot(result = str)
|
@pyqtSlot(result = str)
|
||||||
def convertUserContainerToQuality(self):
|
def convertUserContainerToQuality(self):
|
||||||
print("convertUserContainerToQuality")
|
|
||||||
if not self._global_container_stack:
|
if not self._global_container_stack:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -302,13 +301,17 @@ class MachineManagerModel(QObject):
|
||||||
|
|
||||||
@pyqtSlot(str, result=str)
|
@pyqtSlot(str, result=str)
|
||||||
def duplicateContainer(self, container_id):
|
def duplicateContainer(self, container_id):
|
||||||
print("convertUserContainerToQuality")
|
|
||||||
if not self._global_container_stack:
|
if not self._global_container_stack:
|
||||||
return
|
return
|
||||||
container_to_duplicate = self._global_container_stack.findContainer({"id": container_id})
|
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id=container_id)
|
||||||
if container_to_duplicate:
|
if containers:
|
||||||
new_name = self._createUniqueStackName(container_to_duplicate.getName(), "")
|
new_name = self._createUniqueStackName(containers[0].getName(), "")
|
||||||
|
|
||||||
new_container = InstanceContainer("")
|
new_container = InstanceContainer("")
|
||||||
|
|
||||||
|
## Copy all values
|
||||||
|
new_container.deserialize(containers[0].serialize())
|
||||||
|
|
||||||
new_container.setName(new_name)
|
new_container.setName(new_name)
|
||||||
new_container._id = new_name
|
new_container._id = new_name
|
||||||
UM.Settings.ContainerRegistry.getInstance().addContainer(new_container)
|
UM.Settings.ContainerRegistry.getInstance().addContainer(new_container)
|
||||||
|
|
|
@ -34,7 +34,7 @@ UM.ManagementPage
|
||||||
// Current settings
|
// Current settings
|
||||||
selectedContainer = Cura.MachineManager.convertUserContainerToQuality();
|
selectedContainer = Cura.MachineManager.convertUserContainerToQuality();
|
||||||
} else {
|
} else {
|
||||||
selectedContainer = Cura.MachineManager.duplicateContainer(currentItem.id);
|
selectedContainer = Cura.MachineManager.duplicateContainer(base.currentItem.id);
|
||||||
}
|
}
|
||||||
base.selectContainer(selectedContainer);
|
base.selectContainer(selectedContainer);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue