[meld] Refactor next_diff() in VcView and DirDiff
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] Refactor next_diff() in VcView and DirDiff
- Date: Sun, 7 Mar 2010 06:06:56 +0000 (UTC)
commit 179a8409d3b9fc7e16776907bf620d766d81a274
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sun Sep 6 18:07:47 2009 +1000
Refactor next_diff() in VcView and DirDiff
meld/dirdiff.py | 12 ++++--------
meld/vcview.py | 10 +++-------
2 files changed, 7 insertions(+), 15 deletions(-)
---
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index 8843eae..1f87f20 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -1029,17 +1029,13 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
pane = 0
start_iter = self.model.get_iter( (self._get_selected_paths(pane) or [(0,)])[-1] )
- def goto_iter(it):
- curpath = self.model.get_path(it)
- for i in range(len(curpath)-1):
- self.treeview[pane].expand_row( curpath[:i+1], 0)
- self.treeview[pane].set_cursor(curpath)
-
- search = {gdk.SCROLL_UP : self.model.inorder_search_up}.get(direction, self.model.inorder_search_down)
+ search = {gtk.gdk.SCROLL_UP : self.model.inorder_search_up}.get(direction, self.model.inorder_search_down)
for it in search( start_iter ):
state = int(self.model.get_state( it, pane ))
if state not in (tree.STATE_NORMAL, tree.STATE_EMPTY):
- goto_iter(it)
+ curpath = self.model.get_path(it)
+ self.treeview[pane].expand_to_path(curpath)
+ self.treeview[pane].set_cursor(curpath)
return
def on_reload_activate(self, *extra):
diff --git a/meld/vcview.py b/meld/vcview.py
index 1af33df..23002c2 100644
--- a/meld/vcview.py
+++ b/meld/vcview.py
@@ -609,17 +609,13 @@ class VcView(melddoc.MeldDoc, gnomeglade.Component):
def next_diff(self, direction):
start_iter = self.model.get_iter((self._get_selected_paths() or [(0,)])[-1])
- def goto_iter(it):
- curpath = self.model.get_path(it)
- for i in range(len(curpath)-1):
- self.treeview.expand_row( curpath[:i+1], 0)
- self.treeview.set_cursor(curpath)
-
search = {gtk.gdk.SCROLL_UP : self.model.inorder_search_up}.get(direction, self.model.inorder_search_down)
for it in search( start_iter ):
state = int(self.model.get_state( it, 0))
if state not in (tree.STATE_NORMAL, tree.STATE_EMPTY):
- goto_iter(it)
+ curpath = self.model.get_path(it)
+ self.treeview.expand_to_path(curpath)
+ self.treeview.set_cursor(curpath)
return
def on_reload_activate(self, *extra):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]