[meld] undo: PEP8



commit bd1515714c4cb26c820ce9a22fcbecb6d3b21f0c
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Jan 11 12:09:37 2014 +1000

    undo: PEP8

 meld/undo.py |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/meld/undo.py b/meld/undo.py
index 10b74d4..f8d7e0b 100644
--- a/meld/undo.py
+++ b/meld/undo.py
@@ -33,6 +33,7 @@ def on_undo_button_pressed():
 
 from gi.repository import GObject
 
+
 class GroupAction(object):
     """A group action combines several actions into one logical action.
     """
@@ -41,13 +42,16 @@ class GroupAction(object):
         # TODO: If a GroupAction affects more than one sequence, our logic
         # breaks. Currently, this isn't a problem.
         self.buffer = seq.actions[0].buffer
+
     def undo(self):
         while self.seq.can_undo():
             self.seq.undo()
+
     def redo(self):
         while self.seq.can_redo():
             self.seq.redo()
 
+
 class UndoSequence(GObject.GObject):
     """A manager class for operations which can be undone/redone.
     """
@@ -151,7 +155,7 @@ class UndoSequence(GObject.GObject):
 
     def redo(self):
         """Redo an action.
-        
+
         Raises and AssertionError if the sequence is not undoable.
         """
         assert self.next_redo < len(self.actions)
@@ -176,8 +180,8 @@ class UndoSequence(GObject.GObject):
         while start > 0 and self.actions[start - 1].buffer != buf:
             start -= 1
         end = self.next_redo
-        while end < len(self.actions) - 1 and \
-              self.actions[end + 1].buffer != buf:
+        while (end < len(self.actions) - 1 and
+               self.actions[end + 1].buffer != buf):
             end += 1
         if end == len(self.actions):
             end = None
@@ -207,13 +211,13 @@ class UndoSequence(GObject.GObject):
             return
 
         if self.group:
-            self.group.begin_group() 
+            self.group.begin_group()
         else:
             self.group = UndoSequence()
 
     def end_group(self):
         """End a logical group action. See also begin_group().
-        
+
         Raises an AssertionError if there was not a matching call to
         begin_group().
         """
@@ -226,14 +230,15 @@ class UndoSequence(GObject.GObject):
         else:
             group = self.group
             self.group = None
-            if len(group.actions) == 1: # collapse 
-                self.add_action( group.actions[0] )
+            # Collapse single action groups
+            if len(group.actions) == 1:
+                self.add_action(group.actions[0])
             elif len(group.actions) > 1:
-                self.add_action( GroupAction(group) )
+                self.add_action(GroupAction(group))
 
     def abort_group(self):
         """Revert the sequence to the state before begin_group() was called.
-        
+
         Raises an AssertionError if there was no a matching call to begin_group().
         """
         if self.busy:
@@ -247,4 +252,3 @@ class UndoSequence(GObject.GObject):
 
     def in_grouped_action(self):
         return self.group is not None
-


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]