TechDraw: add transactions to multiple commands (#22795)
* TechDraw: add transactions to multiple commands * Feed each 'Create Dimension' option to the translation macro * Call fixSceneDependencies when re-adding dimensions so that it shows up at the right place
This commit is contained in:
@@ -57,6 +57,8 @@ class CommandAxoLengthDimension:
|
||||
|
||||
def Activated(self):
|
||||
"""Run the following code when the command is activated (button press)."""
|
||||
|
||||
App.setActiveTransaction("Create axonometric length dimension")
|
||||
vertexes = []
|
||||
edges = []
|
||||
if Utils.getSelEdges(2):
|
||||
@@ -110,6 +112,7 @@ class CommandAxoLengthDimension:
|
||||
distanceDim.recompute()
|
||||
view.requestPaint()
|
||||
Gui.Selection.clearSelection()
|
||||
App.closeActiveTransaction()
|
||||
|
||||
def IsActive(self):
|
||||
"""Return True when the command should be active or False when it should be disabled (greyed)."""
|
||||
|
||||
@@ -46,6 +46,8 @@ class TaskAddOffsetVertex():
|
||||
self.view = view
|
||||
self.vertex = vertex
|
||||
|
||||
App.setActiveTransaction("Add offset vertex")
|
||||
|
||||
def accept(self):
|
||||
'''slot: OK pressed'''
|
||||
point = self.vertex.Point # this is unscaled and inverted, but is also rotated.
|
||||
@@ -59,6 +61,8 @@ class TaskAddOffsetVertex():
|
||||
# uninverted relative value.
|
||||
self.view.makeCosmeticVertex(point+offset)
|
||||
Gui.Control.closeDialog()
|
||||
App.closeActiveTransaction()
|
||||
|
||||
def reject(self):
|
||||
App.closeActiveTransaction(True)
|
||||
return True
|
||||
|
||||
@@ -428,6 +428,8 @@ class TaskFillTemplateFields:
|
||||
QtCore.QMetaObject.connectSlotsByName(self.dialog)
|
||||
self.dialog.show()
|
||||
self.dialog.exec_()
|
||||
|
||||
App.setActiveTransaction("Fill template fields")
|
||||
else:
|
||||
msgBox = QtGui.QMessageBox()
|
||||
msgTitle = QtCore.QT_TRANSLATE_NOOP(
|
||||
@@ -526,6 +528,9 @@ class TaskFillTemplateFields:
|
||||
self.page.Template.EditableTexts = self.texts
|
||||
self.close()
|
||||
|
||||
App.closeActiveTransaction()
|
||||
|
||||
def close(self):
|
||||
self.dialog.hide()
|
||||
App.closeActiveTransaction(True)
|
||||
return True
|
||||
|
||||
@@ -94,6 +94,8 @@ class TaskHoleShaftFit:
|
||||
self.form.rbHoleBase.clicked.connect(partial(self.on_HoleShaftChanged, True))
|
||||
self.form.rbShaftBase.clicked.connect(partial(self.on_HoleShaftChanged, False))
|
||||
self.form.cbField.currentIndexChanged.connect(self.on_FieldChanged)
|
||||
|
||||
App.setActiveTransaction("Add hole or shaft fit")
|
||||
|
||||
def setHoleFields(self):
|
||||
"""set hole fields in the combo box"""
|
||||
@@ -168,8 +170,10 @@ class TaskHoleShaftFit:
|
||||
else:
|
||||
dim.FormatSpecUnderTolerance = "( %-0.6w)"
|
||||
Gui.Control.closeDialog()
|
||||
App.closeActiveTransaction()
|
||||
|
||||
def reject(self):
|
||||
App.closeActiveTransaction(True)
|
||||
return True
|
||||
|
||||
|
||||
|
||||
@@ -57,8 +57,11 @@ class TaskMoveView:
|
||||
|
||||
self.dialogOpen = False
|
||||
|
||||
App.setActiveTransaction("Move view")
|
||||
|
||||
def accept(self):
|
||||
# print ("Accept")
|
||||
App.closeActiveTransaction()
|
||||
view = App.ActiveDocument.getObject(self.viewName)
|
||||
fromPage = App.ActiveDocument.getObject(self.fromPageName)
|
||||
toPage = App.ActiveDocument.getObject(self.toPageName)
|
||||
@@ -67,6 +70,7 @@ class TaskMoveView:
|
||||
|
||||
def reject(self):
|
||||
# print ("Reject")
|
||||
App.closeActiveTransaction(True)
|
||||
return True
|
||||
|
||||
def pickView(self):
|
||||
|
||||
@@ -57,16 +57,21 @@ class TaskShareView:
|
||||
|
||||
self.dialogOpen = False
|
||||
|
||||
App.setActiveTransaction("Share view")
|
||||
|
||||
def accept(self):
|
||||
# print ("Accept")
|
||||
view = App.ActiveDocument.getObject(self.viewName)
|
||||
fromPage = App.ActiveDocument.getObject(self.fromPageName)
|
||||
toPage = App.ActiveDocument.getObject(self.toPageName)
|
||||
TDToolsMovers.moveView(view, fromPage, toPage, True)
|
||||
|
||||
App.closeActiveTransaction()
|
||||
return True
|
||||
|
||||
def reject(self):
|
||||
# print ("Reject")
|
||||
App.closeActiveTransaction(True)
|
||||
return True
|
||||
|
||||
def pickView(self):
|
||||
|
||||
Reference in New Issue
Block a user