From f0414734656a32f76b4938ced046d27d37618d75 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 22 Jun 2017 12:40:45 +0200 Subject: [PATCH] Fix applying material diameter undo Somehow it seems to get the wrong value there though. Debugging that next... Contributes to issue CURA-2822. --- cura/Settings/MaterialManager.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/cura/Settings/MaterialManager.py b/cura/Settings/MaterialManager.py index c204847fff..abfafc5f9f 100644 --- a/cura/Settings/MaterialManager.py +++ b/cura/Settings/MaterialManager.py @@ -3,10 +3,10 @@ from PyQt5.QtCore import QObject, pyqtSlot #To expose data to QML. +from cura.Settings.ContainerManager import ContainerManager from UM.Logger import Logger from UM.Message import Message #To create a warning message about material diameter. from UM.i18n import i18nCatalog #Translated strings. -from UM.Settings.ContainerRegistry import ContainerRegistry #To find the material containers we need. catalog = i18nCatalog("cura") @@ -47,11 +47,8 @@ class MaterialManager(QObject): # \param button The identifier of the button that was pressed. def _materialWarningMessageAction(self, message, button): if button == "Undo": - container_registry = ContainerRegistry.getInstance() - matches = container_registry.findInstanceContainers(type = "material", id = self._material_diameter_warning_message.material_id) - if matches: - matches[0].setMetaDataEntry("diameter", self._material_diameter_warning_message.previous_diameter) - #No matches? Then the material has been deleted in the meanwhile. + container_manager = ContainerManager.getInstance() + container_manager.setContainerMetaDataEntry(self._material_diameter_warning_message.material_id, "properties/diameter", self._material_diameter_warning_message.previous_diameter) message.hide() else: Logger.log("w", "Unknown button action for material diameter warning message: {action}".format(action = button)) \ No newline at end of file