[meld] dirdiff: Remember expanded rows when parents are collapsed (bgo#589585)
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] dirdiff: Remember expanded rows when parents are collapsed (bgo#589585)
- Date: Sat, 10 Jan 2015 22:15:20 +0000 (UTC)
commit 0d3634ef2aa07349e8359c5e858a7ef2d51ae962
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sun Jan 11 08:13:55 2015 +1000
dirdiff: Remember expanded rows when parents are collapsed (bgo#589585)
meld/dirdiff.py | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index 954bdd8..ceb5c70 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -355,6 +355,7 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
self.current_path, self.prev_path, self.next_path = None, None, None
self.on_treeview_focus_out_event(None, None)
self.focus_pane = None
+ self.row_expansions = set()
# One column-dict for each treeview, for changing visibility and order
self.columns_dict = [{}, {}, {}]
@@ -1042,6 +1043,8 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
if self.current_path and self.focus_pane:
self.focus_pane.set_cursor(self.current_path)
+ self.row_expansions = set()
+
def on_treeview_selection_changed(self, selection, pane):
if not self.treeview[pane].is_focus():
return
@@ -1159,11 +1162,17 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
view.expand_row(path, False)
def on_treeview_row_expanded(self, view, it, path):
- self._do_to_others(view, self.treeview, "expand_row", (path,0) )
+ self.row_expansions.add(str(path))
+ for row in self.model[path].iterchildren():
+ if str(row.path) in self.row_expansions:
+ view.expand_row(row.path, False)
+
+ self._do_to_others(view, self.treeview, "expand_row", (path, False))
self._update_diffmaps()
def on_treeview_row_collapsed(self, view, me, path):
- self._do_to_others(view, self.treeview, "collapse_row", (path,) )
+ self.row_expansions.discard(str(path))
+ self._do_to_others(view, self.treeview, "collapse_row", (path,))
self._update_diffmaps()
def on_popup_deactivate_event(self, popup):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]