mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-13 15:18:02 +08:00
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:
parent
c192d37daa
commit
f041473465
@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
from PyQt5.QtCore import QObject, pyqtSlot #To expose data to QML.
|
from PyQt5.QtCore import QObject, pyqtSlot #To expose data to QML.
|
||||||
|
|
||||||
|
from cura.Settings.ContainerManager import ContainerManager
|
||||||
from UM.Logger import Logger
|
from UM.Logger import Logger
|
||||||
from UM.Message import Message #To create a warning message about material diameter.
|
from UM.Message import Message #To create a warning message about material diameter.
|
||||||
from UM.i18n import i18nCatalog #Translated strings.
|
from UM.i18n import i18nCatalog #Translated strings.
|
||||||
from UM.Settings.ContainerRegistry import ContainerRegistry #To find the material containers we need.
|
|
||||||
|
|
||||||
catalog = i18nCatalog("cura")
|
catalog = i18nCatalog("cura")
|
||||||
|
|
||||||
@ -47,11 +47,8 @@ class MaterialManager(QObject):
|
|||||||
# \param button The identifier of the button that was pressed.
|
# \param button The identifier of the button that was pressed.
|
||||||
def _materialWarningMessageAction(self, message, button):
|
def _materialWarningMessageAction(self, message, button):
|
||||||
if button == "Undo":
|
if button == "Undo":
|
||||||
container_registry = ContainerRegistry.getInstance()
|
container_manager = ContainerManager.getInstance()
|
||||||
matches = container_registry.findInstanceContainers(type = "material", id = self._material_diameter_warning_message.material_id)
|
container_manager.setContainerMetaDataEntry(self._material_diameter_warning_message.material_id, "properties/diameter", self._material_diameter_warning_message.previous_diameter)
|
||||||
if matches:
|
|
||||||
matches[0].setMetaDataEntry("diameter", self._material_diameter_warning_message.previous_diameter)
|
|
||||||
#No matches? Then the material has been deleted in the meanwhile.
|
|
||||||
message.hide()
|
message.hide()
|
||||||
else:
|
else:
|
||||||
Logger.log("w", "Unknown button action for material diameter warning message: {action}".format(action = button))
|
Logger.log("w", "Unknown button action for material diameter warning message: {action}".format(action = button))
|
Loading…
x
Reference in New Issue
Block a user