From a4b987157fd601df3d2aad001588197d26a7180f Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Thu, 13 Oct 2016 13:47:56 -0700 Subject: [PATCH] Replaced homebrewn cancel support with using a transaction. --- src/Mod/Path/PathScripts/DogboneDressup.py | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/Mod/Path/PathScripts/DogboneDressup.py b/src/Mod/Path/PathScripts/DogboneDressup.py index 8784dcbf9..adb23bcc8 100644 --- a/src/Mod/Path/PathScripts/DogboneDressup.py +++ b/src/Mod/Path/PathScripts/DogboneDressup.py @@ -508,7 +508,7 @@ class CommandDogboneDressup: return # everything ok! - FreeCAD.ActiveDocument.openTransaction(translate("Dogbone_Dressup", "Create Dress-up")) + FreeCAD.ActiveDocument.openTransaction(translate("Dogbone_Dressup", "Create Dogbone Dress-up")) FreeCADGui.addModule("PathScripts.DogboneDressup") FreeCADGui.addModule("PathScripts.PathUtils") FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", "DogboneDressup")') @@ -525,29 +525,20 @@ class TaskPanel: DataIds = QtCore.Qt.ItemDataRole.UserRole DataKey = QtCore.Qt.ItemDataRole.UserRole + 1 - PropertiesToRestore = ['Shape', 'Side', 'Length', 'Custom', 'BoneBlacklist'] - def __init__(self, obj): self.obj = obj self.form = FreeCADGui.PySideUic.loadUi(":/panels/DogboneEdit.ui") - self.props = {} - for prop in self.PropertiesToRestore: - self.props[prop] = obj.getPropertyByName(prop) + FreeCAD.ActiveDocument.openTransaction(translate("Dogbone_Dressup", "Edit Dogbone Dress-up")) def reject(self): - # haven't found a way to use the list :( - self.obj.Shape = self.props['Shape'] - self.obj.Side = self.props['Side'] - self.obj.Length = self.props['Length'] - self.obj.Custom = self.props['Custom'] - self.obj.BoneBlacklist = self.props['BoneBlacklist'] - self.obj.Proxy.execute(self.obj) + FreeCAD.ActiveDocument.abortTransaction() FreeCADGui.Control.closeDialog() FreeCAD.ActiveDocument.recompute() FreeCADGui.Selection.removeObserver(self.s) def accept(self): self.getFields() + FreeCAD.ActiveDocument.commitTransaction() FreeCADGui.ActiveDocument.resetEdit() FreeCADGui.Control.closeDialog() FreeCAD.ActiveDocument.recompute()