Part: [skip ci] show dialog directly when creating a tube feature

This commit is contained in:
wmayer
2020-11-13 12:33:59 +01:00
parent dcfba722f4
commit ce0c9d8f59
2 changed files with 8 additions and 6 deletions

View File

@@ -52,9 +52,9 @@ class CommandTube:
FreeCAD.ActiveDocument.openTransaction(text)
tube = FreeCAD.ActiveDocument.addObject("Part::FeaturePython","Tube")
Shapes.TubeFeature(tube)
ViewProviderShapes.ViewProviderTube(tube.ViewObject)
FreeCAD.ActiveDocument.commitTransaction()
vp = ViewProviderShapes.ViewProviderTube(tube.ViewObject)
FreeCAD.ActiveDocument.recompute()
vp.startDefaultEditMode(tube.ViewObject)
def IsActive(self):
return not FreeCAD.ActiveDocument is None

View File

@@ -47,9 +47,10 @@ class ViewProviderTube:
return False
def startDefaultEditMode(self, viewObject):
text = FreeCAD.Qt.translate("QObject", "Edit %1").replace("%1", viewObject.Object.Label)
document = viewObject.Document.Document
document.openTransaction(text)
if not document.HasPendingTransaction:
text = FreeCAD.Qt.translate("QObject", "Edit %1").replace("%1", viewObject.Object.Label)
document.openTransaction(text)
viewObject.Document.setEdit(viewObject.Object, 0)
def setEdit(self, viewObject, mode):
@@ -117,8 +118,9 @@ class TaskTubeUI:
return True
def reject(self):
document = self.viewObject.Document.Document
guidocument = self.viewObject.Document
document = guidocument.Document
document.abortTransaction()
document.recompute()
self.viewObject.Document.resetEdit()
guidocument.resetEdit()
return True