[meld] Make the Differ a class variable to avoid future initialisation woes



commit 085d9b18e9df72baf14a7b0b5d204eba1d087b9c
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Mar 13 16:47:38 2010 +1000

    Make the Differ a class variable to avoid future initialisation woes

 meld/filediff.py  |    4 +++-
 meld/filemerge.py |    3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index 621610d..3507c14 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -101,6 +101,8 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
     """Two or three way diff of text files.
     """
 
+    differ = diffutil.Differ
+
     keylookup = {gtk.keysyms.Shift_L : MASK_SHIFT,
                  gtk.keysyms.Control_L : MASK_CTRL,
                  gtk.keysyms.Shift_R : MASK_SHIFT,
@@ -139,7 +141,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
         self._connect_buffer_handlers()
         self._sync_vscroll_lock = False
         self._sync_hscroll_lock = False
-        self.linediffer = diffutil.Differ()
+        self.linediffer = self.differ()
         self.linediffer.ignore_blanks = self.prefs.ignore_blank_lines
         self._inline_cache = set()
         self._cached_match = CachedSequenceMatcher()
diff --git a/meld/filemerge.py b/meld/filemerge.py
index 4c24bcd..55567ba 100644
--- a/meld/filemerge.py
+++ b/meld/filemerge.py
@@ -24,9 +24,10 @@ MASK_SHIFT, MASK_CTRL = 1, 2
 
 class FileMerge(filediff.FileDiff):
 
+    differ = merge.AutoMergeDiffer
+
     def __init__(self, prefs, num_panes):
         filediff.FileDiff.__init__(self, prefs, num_panes)
-        self.linediffer = merge.AutoMergeDiffer()
         self.hidden_textbuffer = gtk.TextBuffer()
 
     def _connect_buffer_handlers(self):



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