[meld] Handle activating fake lines in directory comparison
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] Handle activating fake lines in directory comparison
- Date: Fri, 2 Dec 2011 21:50:10 +0000 (UTC)
commit b7407565d7e4a85061dc6dc37d22bd7448c82a56
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sat Dec 3 07:46:16 2011 +1000
Handle activating fake lines in directory comparison
We get fake lines in DirDiff when we have empty folders. This commit
introduces some sanity checking on path usage so that we don't get a
traceback when someone double-clicks one of these empty placeholder
rows.
In this case, 'handle' means 'do nothing', since there is no sensible
action to take.
meld/dirdiff.py | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index aceac72..8f105c3 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -751,17 +751,19 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
def on_treeview_row_activated(self, view, path, column):
pane = self.treeview.index(view)
- allrows = self.model.value_paths(self.model.get_iter(path))
+ rows = self.model.value_paths(self.model.get_iter(path))
# Click a file: compare; click a directory: expand; click a missing
# entry: check the next neighbouring entry
pane_ordering = ((0, 1, 2), (1, 2, 0), (2, 1, 0))
for p in pane_ordering[pane]:
- if p < self.num_panes and os.path.exists(allrows[p]):
+ if p < self.num_panes and rows[p] and os.path.exists(rows[p]):
pane = p
break
- if os.path.isfile(allrows[pane]):
- self.emit("create-diff", [r for r in allrows if os.path.isfile(r)])
- elif os.path.isdir(allrows[pane]):
+ if not rows[pane]:
+ return
+ if os.path.isfile(rows[pane]):
+ self.emit("create-diff", [r for r in rows if os.path.isfile(r)])
+ elif os.path.isdir(rows[pane]):
if view.row_expanded(path):
view.collapse_row(path)
else:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]