Create contextmanager for SimpleRevisionCommand
This commit is contained in:
parent
8d2d26fe3c
commit
d2eb981e33
@ -1001,6 +1001,16 @@ class EditorSession(QtCore.QObject):
|
|||||||
finally:
|
finally:
|
||||||
self.pushCommand(command)
|
self.pushCommand(command)
|
||||||
|
|
||||||
|
@contextmanager
|
||||||
|
def beginSimpleCommand(self, text):
|
||||||
|
command = SimpleRevisionCommand(self, text)
|
||||||
|
command.foo()
|
||||||
|
try:
|
||||||
|
with command.begin():
|
||||||
|
yield
|
||||||
|
finally:
|
||||||
|
self.pushCommand(command)
|
||||||
|
|
||||||
def pushCommand(self, command):
|
def pushCommand(self, command):
|
||||||
log.info("Pushing command %s" % command.text())
|
log.info("Pushing command %s" % command.text())
|
||||||
self.undoStack.push(command)
|
self.undoStack.push(command)
|
||||||
|
Reference in New Issue
Block a user