From 5e1e914aea72e2802c89ff21cf9c421c734abd72 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Mon, 9 Apr 2012 23:22:53 +0200 Subject: [PATCH] handle right / left to expand / collapse rows in treeview. Fixes #7138 --- src/roster_window.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/roster_window.py b/src/roster_window.py index 9ba2e87de..50c9dbe82 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -3418,6 +3418,27 @@ class RosterWindow: num = gtk.gdk.keyval_to_unicode(event.keyval) self.enable_rfilter(unichr(num)) + elif event.keyval == gtk.keysyms.Left: + treeselection = self.tree.get_selection() + model, list_of_paths = treeselection.get_selected_rows() + if len(list_of_paths) != 1: + return + path = list_of_paths[0] + iter_ = model.get_iter(path) + if model.iter_has_child(iter_): + self.tree.collapse_row(path) + return True + elif event.keyval == gtk.keysyms.Right: + treeselection = self.tree.get_selection() + model, list_of_paths = treeselection.get_selected_rows() + if len(list_of_paths) != 1: + return + path = list_of_paths[0] + iter_ = model.get_iter(path) + if model.iter_has_child(iter_): + self.tree.expand_row(path, False) + return True + def on_roster_treeview_button_release_event(self, widget, event): try: path = self.tree.get_path_at_pos(int(event.x), int(event.y))[0]