From b743217870772ff0eb9fd3829a61e22b78dd3505 Mon Sep 17 00:00:00 2001 From: David Vierra Date: Fri, 9 Jan 2015 18:14:46 -1000 Subject: [PATCH] Clear undo block before saving, adjust comments --- src/mcedit2/editorsession.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/mcedit2/editorsession.py b/src/mcedit2/editorsession.py index d17987b..5f177fe 100644 --- a/src/mcedit2/editorsession.py +++ b/src/mcedit2/editorsession.py @@ -32,10 +32,10 @@ from mceditlib.worldeditor import WorldEditor log = logging.getLogger(__name__) """ - An EditorSession is a world currently opened for editing, the state of the editor including the current - selection box, the editor tab containing its viewports, its command history, a separate instance of each editor - tool (why?), and the ChunkLoader that coordinates loading chunks into its viewports. - """ +An EditorSession is a world currently opened for editing, the state of the editor including the current +selection box, the editor tab containing its viewports, its command history, a separate instance of each editor +tool (why?), and the ChunkLoader that coordinates loading chunks into its viewports. +""" class EditorSession(QtCore.QObject): def __init__(self, filename, versionInfo, readonly=False): @@ -198,6 +198,8 @@ class EditorSession(QtCore.QObject): self.worldEditor.close() self.worldEditor = None + # --- Selection --- + selectionChanged = QtCore.Signal(BoundingBox) _currentSelection = None @@ -211,8 +213,6 @@ class EditorSession(QtCore.QObject): self.enableSelectionCommands(box is not None and box.volume != 0) self.selectionChanged.emit(box) - # --- Menu commands --- - def enableSelectionCommands(self, enable): self.actionCut.setEnabled(enable) self.actionCopy.setEnabled(enable) @@ -221,7 +221,10 @@ class EditorSession(QtCore.QObject): self.actionPaste_Entities.setEnabled(enable) self.actionClear.setEnabled(enable) + # --- Menu commands --- + def save(self): + self.undoStack.clearUndoBlock() self.worldEditor.saveChanges() self.dirty = False