mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 21:35:57 +08:00
Remove code that is obsolete and moved to ContainerManager
Contributes to CURA-2006
This commit is contained in:
parent
2c0f0e8559
commit
7ba49b4f88
@ -480,71 +480,6 @@ class MachineManager(QObject):
|
|||||||
if extruder_stack != self._active_container_stack and extruder_stack.getProperty(key, "value") != new_value:
|
if extruder_stack != self._active_container_stack and extruder_stack.getProperty(key, "value") != new_value:
|
||||||
extruder_stack.getTop().setProperty(key, "value", new_value)
|
extruder_stack.getTop().setProperty(key, "value", new_value)
|
||||||
|
|
||||||
@pyqtSlot(str, result=str)
|
|
||||||
def duplicateContainer(self, container_id):
|
|
||||||
if not self._active_container_stack:
|
|
||||||
return ""
|
|
||||||
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = container_id)
|
|
||||||
if containers:
|
|
||||||
new_name = self._createUniqueName("quality", "", containers[0].getName(), catalog.i18nc("@label", "Custom profile"))
|
|
||||||
|
|
||||||
new_container = containers[0].duplicate(new_name, new_name)
|
|
||||||
|
|
||||||
UM.Settings.ContainerRegistry.getInstance().addContainer(new_container)
|
|
||||||
|
|
||||||
return new_name
|
|
||||||
|
|
||||||
return ""
|
|
||||||
|
|
||||||
@pyqtSlot(str, str)
|
|
||||||
def renameQualityContainer(self, container_id, new_name):
|
|
||||||
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = container_id, type = "quality")
|
|
||||||
if containers:
|
|
||||||
new_name = self._createUniqueName("quality", containers[0].getName(), new_name,
|
|
||||||
catalog.i18nc("@label", "Custom profile"))
|
|
||||||
|
|
||||||
if containers[0].getName() == new_name:
|
|
||||||
# Nothing to do.
|
|
||||||
return
|
|
||||||
|
|
||||||
# As we also want the id of the container to be changed (so that profile name is the name of the file
|
|
||||||
# on disk. We need to create a new instance and remove it (so the old file of the container is removed)
|
|
||||||
# If we don't do that, we might get duplicates & other weird issues.
|
|
||||||
new_container = UM.Settings.InstanceContainer("")
|
|
||||||
new_container.deserialize(containers[0].serialize())
|
|
||||||
|
|
||||||
# Actually set the name
|
|
||||||
new_container.setName(new_name)
|
|
||||||
new_container._id = new_name # Todo: Fix proper id change function for this.
|
|
||||||
|
|
||||||
# Add the "new" container.
|
|
||||||
UM.Settings.ContainerRegistry.getInstance().addContainer(new_container)
|
|
||||||
|
|
||||||
# Ensure that the renamed profile is saved -before- we remove the old profile.
|
|
||||||
Application.getInstance().saveSettings()
|
|
||||||
|
|
||||||
# Actually set & remove new / old quality.
|
|
||||||
self.setActiveQuality(new_name)
|
|
||||||
self.removeQualityContainer(containers[0].getId())
|
|
||||||
|
|
||||||
@pyqtSlot(str)
|
|
||||||
def removeQualityContainer(self, container_id):
|
|
||||||
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = container_id)
|
|
||||||
if not containers or not self._active_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:
|
|
||||||
definition_id = "fdmprinter" if not self.filterQualityByMachine else self.activeDefinitionId
|
|
||||||
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(type = "quality", definition = definition_id)
|
|
||||||
if containers:
|
|
||||||
self.setActiveQuality(containers[0].getId())
|
|
||||||
self.activeQualityChanged.emit()
|
|
||||||
|
|
||||||
@pyqtSlot(str)
|
@pyqtSlot(str)
|
||||||
def setActiveMaterial(self, material_id):
|
def setActiveMaterial(self, material_id):
|
||||||
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = material_id)
|
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = material_id)
|
||||||
|
@ -765,10 +765,6 @@ UM.MainWindow
|
|||||||
addMachineDialog.visible = true
|
addMachineDialog.visible = true
|
||||||
addMachineDialog.firstRun = false
|
addMachineDialog.firstRun = false
|
||||||
}
|
}
|
||||||
onClearAllFocus:
|
|
||||||
{
|
|
||||||
contentItem.focus = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer
|
Timer
|
||||||
|
Loading…
x
Reference in New Issue
Block a user