diff options
| author | Adrien Tétar | 2015-10-08 18:31:08 +0200 |
|---|---|---|
| committer | Adrien Tétar | 2015-10-08 18:31:08 +0200 |
| commit | c50cdece55f7aa324c395faf7a5b468369dfa70f (patch) | |
| tree | 68ede8309982f36151060f373460c1400c137614 /Lib/defconQt/glyphView.py | |
| parent | 49faf9fb746978a2daef6881f09a733fdd75f140 (diff) | |
| download | trufont-c50cdece55f7aa324c395faf7a5b468369dfa70f.tar.bz2 | |
glyphView: correctly set undo/redo stack
Diffstat (limited to 'Lib/defconQt/glyphView.py')
| -rw-r--r-- | Lib/defconQt/glyphView.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/defconQt/glyphView.py b/Lib/defconQt/glyphView.py index 32e1fe5..d3f043e 100644 --- a/Lib/defconQt/glyphView.py +++ b/Lib/defconQt/glyphView.py @@ -853,6 +853,8 @@ class GlyphScene(QGraphicsScene): if mimeData.hasFormat("application/x-defconQt-glyph-data"): data = pickle.loads(mimeData.data("application/x-defconQt-glyph-data")) if len(data) == 1: + undo = self._glyphObject.serialize() + self._dataForUndo.append(undo) pen = self._glyphObject.getPointPen() pasteGlyph = TGlyph() pasteGlyph.deserialize(data[0]) @@ -1537,14 +1539,15 @@ class GlyphView(QGraphicsView): self._glyph.appendComponent(component) def setGlyph(self, glyph): + scene = self.scene() self._glyph.removeObserver(self, "Glyph.Changed") # TODO: consider creating a new scene instead of zeroing things out # manually - self._dataForUndo = [] - self._dataForRedo = [] + scene._dataForUndo = [] + scene._dataForRedo = [] self._glyph = glyph # XXX: DRY ALERT! - self.scene()._glyphObject = glyph + scene._glyphObject = glyph app = QApplication.instance() app.setCurrentGlyph(glyph) self._glyph.addObserver(self, "_glyphChanged", "Glyph.Changed") |
