mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-19 04:37:51 -06:00
Fix removing custom (quality) profiles
CURA-1585
This commit is contained in:
parent
a139809b75
commit
a2db4740b9
2 changed files with 25 additions and 5 deletions
|
@ -301,7 +301,7 @@ class MachineManagerModel(QObject):
|
|||
new_quality_container._id = name
|
||||
|
||||
UM.Settings.ContainerRegistry.getInstance().addContainer(new_quality_container)
|
||||
self.clearUserSettings() # As all users settings are noq a quality, remove them.
|
||||
self.clearUserSettings() # As all users settings are now transfered to the new quality profile, remove them.
|
||||
self.setActiveQuality(name)
|
||||
return name
|
||||
|
||||
|
@ -325,6 +325,26 @@ class MachineManagerModel(QObject):
|
|||
|
||||
return ""
|
||||
|
||||
|
||||
@pyqtSlot(str)
|
||||
def removeQualityContainer(self, container_id):
|
||||
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = container_id)
|
||||
if not containers or not self._global_container_stack:
|
||||
return
|
||||
|
||||
# If the container that is being removed is the currently active container, set another machine as the active container
|
||||
activate_new_container = container_id == self.activeQualityId
|
||||
|
||||
UM.Settings.ContainerRegistry.getInstance().removeContainer(container_id)
|
||||
|
||||
if activate_new_container:
|
||||
old_container = self._global_container_stack.findInstanceContainers({"type": "quality"})
|
||||
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(type = container_type)
|
||||
if containers and old_container:
|
||||
container_index = self._global_container_stack.getContainerIndex(old_container)
|
||||
self._global_container_stack.replaceContainer(container_index, containers[0])
|
||||
|
||||
|
||||
@pyqtSlot()
|
||||
def updateUserContainerToQuality(self):
|
||||
if not self._global_container_stack:
|
||||
|
|
|
@ -66,8 +66,8 @@ UM.ManagementPage
|
|||
|
||||
activateEnabled: currentItem != null ? currentItem.id != Cura.MachineManager.activeQualityId : false;
|
||||
addEnabled: currentItem != null;
|
||||
removeEnabled: currentItem != null ? !currentItem.readOnly : false;
|
||||
renameEnabled: currentItem != null ? !currentItem.readOnly : false;
|
||||
removeEnabled: currentItem != null ? !currentItem.metadata.read_only : false;
|
||||
renameEnabled: currentItem != null ? !currentItem.metadata.read_only : false;
|
||||
|
||||
scrollviewCaption: catalog.i18nc("@label %1 is printer name","Printer: %1").arg(Cura.MachineManager.activeMachineName)
|
||||
|
||||
|
@ -137,7 +137,7 @@ UM.ManagementPage
|
|||
Label {
|
||||
text: base.currentItem == null ? "" :
|
||||
base.currentItem.id == -1 ? Cura.MachineManager.activeQualityName:
|
||||
base.currentItem.readOnly ? catalog.i18nc("@label", "Protected profile") : catalog.i18nc("@label", "Custom profile")
|
||||
base.currentItem.metadata.read_only ? catalog.i18nc("@label", "Protected profile") : catalog.i18nc("@label", "Custom profile")
|
||||
}
|
||||
|
||||
Column {
|
||||
|
@ -186,7 +186,7 @@ UM.ManagementPage
|
|||
{
|
||||
id: confirmDialog;
|
||||
object: base.currentItem != null ? base.currentItem.name : "";
|
||||
onYes: base.model.removeProfile(base.currentItem.name);
|
||||
onYes: Cura.MachineManager.removeQualityContainer(base.currentItem.id);
|
||||
}
|
||||
UM.RenameDialog
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue