Fix applying material diameter undo

Somehow it seems to get the wrong value there though. Debugging that next...

Contributes to issue CURA-2822.
This commit is contained in:
Ghostkeeper 2017-06-22 12:40:45 +02:00
parent c192d37daa
commit f041473465
No known key found for this signature in database
GPG Key ID: C5F96EE2BC0F7E75

View File

@ -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))