Abort OP creation transaction if TC selection is aborted with cancel, #3274

This commit is contained in:
Markus Lampert
2017-11-27 15:04:26 -08:00
committed by Yorik van Havre
parent 53dc025ca1
commit c38eee06e2
5 changed files with 17 additions and 9 deletions

View File

@@ -124,5 +124,6 @@ def Create(name):
'''Create(name) ... Creates and returns a Drilling operation.'''
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
proxy = ObjectDrilling(obj)
proxy.findAllHoles(obj)
if obj.Proxy:
proxy.findAllHoles(obj)
return obj

View File

@@ -197,5 +197,6 @@ def Create(name):
'''Create(name) ... Creates and returns a Helix operation.'''
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
proxy = ObjectHelix(obj)
proxy.findAllHoles(obj)
if obj.Proxy:
proxy.findAllHoles(obj)
return obj

View File

@@ -149,8 +149,8 @@ class ObjectOp(object):
self.initOperation(obj)
obj.Proxy = self
self.setDefaultValues(obj)
if self.setDefaultValues(obj):
obj.Proxy = self
def onDocumentRestored(self, obj):
features = self.opFeatures(obj)
@@ -244,6 +244,8 @@ class ObjectOp(object):
if FeatureTool & features:
obj.ToolController = PathUtils.findToolController(obj)
if not obj.ToolController:
return False
obj.OpToolDiameter = 1.0
if FeatureDepths & features:
@@ -273,6 +275,7 @@ class ObjectOp(object):
self.opSetDefaultValues(obj)
obj.recompute()
return True
def _setBaseAndStock(self, obj, ignoreErrors=False):
job = PathUtils.findParentJob(obj)

View File

@@ -934,11 +934,14 @@ def Create(res):
that is created in each operations Gui implementation.'''
FreeCAD.ActiveDocument.openTransaction("Create %s" % res.name)
obj = res.objFactory(res.name)
vobj = ViewProvider(obj.ViewObject, res)
if obj.Proxy:
vobj = ViewProvider(obj.ViewObject, res)
FreeCAD.ActiveDocument.commitTransaction()
obj.ViewObject.startEditing()
return obj
FreeCAD.ActiveDocument.commitTransaction()
obj.ViewObject.startEditing()
return obj
FreeCAD.ActiveDocument.abortTransaction()
return None
class CommandPathOp:
'''Generic, data driven implementation of a Path operation creation command.

View File

@@ -456,7 +456,7 @@ def findToolController(obj, name=None):
mylist = [i.Label for i in controllers]
form.uiToolController.addItems(mylist)
r = form.exec_()
if r is False:
if not r:
tc = None
else:
tc = [i for i in controllers if i.Label == form.uiToolController.currentText()][0]