aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-09-10 14:45:46 +0200
committerMattias Andrée <maandree@operamail.com>2013-09-10 14:45:46 +0200
commit5616c6c0e766c270712ef1794be8e062663b6a63 (patch)
tree77a29c72aebbcdba46f3796118ac947f7d85e107 /src
parentadd class edit for storing edits in (diff)
downloadpytagomacs-5616c6c0e766c270712ef1794be8e062663b6a63.tar.gz
pytagomacs-5616c6c0e766c270712ef1794be8e062663b6a63.tar.bz2
pytagomacs-5616c6c0e766c270712ef1794be8e062663b6a63.tar.xz
implement edit reverse, direction change and add specification for push and pop to editring
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src')
-rw-r--r--src/editring.py35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/editring.py b/src/editring.py
index 4c304be..ac3db90 100644
--- a/src/editring.py
+++ b/src/editring.py
@@ -38,6 +38,15 @@ class Edit():
'''
self.deleted, self.inserted = deleted, inserted
self.y, self.old_x, self.new_x = y, old_x, new_x
+
+
+ def reverse(self):
+ '''
+ Create a clone of the object but create a mirror object
+
+ @return :Edit The object's opposite
+ '''
+ return Edit(self.inserted, self.deleted, self.y, self.new_x, self.new_y)
@@ -62,4 +71,28 @@ class Editring():
@return :bool Whether the editring is empty
'''
return len(self.editring) == 0
-
+
+
+ def change_direction(self):
+ '''
+ Swap between undoing and redoing
+ '''
+ self.editdir = -(self.editdir)
+
+
+ def push(self, edit):
+ '''
+ Insert a new edit to the editring
+
+ @param edit:Edit The edit to insert
+ '''
+ pass
+
+
+ def pop(self):
+ '''
+ Get the next undo or redo
+
+ @return :(Edit, bool) The edit to preform (not reverse) and whether it is a undo
+ '''
+ pass