mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
Revert "Temporarily revert "Renaming profiles now also renames them on disk""
Starting work on it again, so unreverting the revert (i guess)
This reverts commit d8e8b0740a.
This commit is contained in:
parent
d8e8b0740a
commit
070a522abb
1 changed files with 16 additions and 0 deletions
|
|
@ -5,12 +5,17 @@ from PyQt5.QtCore import QObject, pyqtSlot, pyqtProperty, pyqtSignal
|
|||
from UM.Application import Application
|
||||
from UM.Preferences import Preferences
|
||||
from UM.Logger import Logger
|
||||
from UM.Resources import Resources
|
||||
|
||||
import os
|
||||
import urllib
|
||||
|
||||
import UM.Settings
|
||||
from UM.Settings.Validator import ValidatorState
|
||||
from UM.Settings.InstanceContainer import InstanceContainer
|
||||
from UM.Settings.ContainerStack import ContainerStack
|
||||
from . import ExtruderManager
|
||||
import cura.CuraApplication
|
||||
from UM.i18n import i18nCatalog
|
||||
catalog = i18nCatalog("cura")
|
||||
|
||||
|
|
@ -303,8 +308,19 @@ class MachineManagerModel(QObject):
|
|||
def renameQualityContainer(self, container_id, new_name):
|
||||
containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = container_id, type = "quality")
|
||||
if containers:
|
||||
|
||||
# Remove old container form drive.
|
||||
old_id = containers[0].getId()
|
||||
file_name = urllib.parse.quote_plus(old_id) + ".inst.cfg"
|
||||
path = Resources.getStoragePath(cura.CuraApplication.CuraApplication.ResourceTypes.QualityInstanceContainer,
|
||||
file_name)
|
||||
os.remove(path)
|
||||
|
||||
## Check if the new name is allowed.
|
||||
new_name = self._createUniqueName("quality", containers[0].getName(), new_name, catalog.i18nc("@label", "Custom profile"))
|
||||
|
||||
containers[0].setName(new_name)
|
||||
containers[0]._id = new_name # Todo: Fix proper id change function for this.
|
||||
self.activeQualityChanged.emit()
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue