diff options
author | Ignacio Rodríguez <ignaciorodriguez@sugarlabs.org> | 2013-05-25 21:43:07 (GMT) |
---|---|---|
committer | Ignacio Rodríguez <ignaciorodriguez@sugarlabs.org> | 2013-05-25 21:43:24 (GMT) |
commit | 09f83b7d6ffcefc4d748b9a622301eecbe954d36 (patch) | |
tree | 013c3085c9473c7f3659a70b717b9c30e06da757 | |
parent | 68e9bab4d4329c2faa59b1cf2165e89a32b84655 (diff) |
Navegación por teclas.
-rw-r--r-- | InfoNotebook.py | 63 |
1 files changed, 61 insertions, 2 deletions
diff --git a/InfoNotebook.py b/InfoNotebook.py index c9611dd..5b9eff1 100644 --- a/InfoNotebook.py +++ b/InfoNotebook.py @@ -218,6 +218,50 @@ class Introspeccion(Gtk.TreeView): self.append_column(columna1) + def do_key_press_event(self, event): + """ + Funciones adicionales para moverse en el TreeView + """ + + tecla = event.keyval + + model, iter = self.get_selection().get_selected() + + if iter is None: return + + path = self.get_model().get_path(iter) + + if tecla == 65293: + if self.row_expanded(path): + self.collapse_row(path) + else: + self.expand_to_path(path) + + elif tecla == 65361: + if self.row_expanded(path): + self.collapse_row(path) + + elif tecla == 65363: + if not self.row_expanded(path): + self.expand_to_path(path) + + elif tecla == 65364: + siguiente = self.get_model().iter_next(iter) + if siguiente: + self.get_selection().select_iter(siguiente) + + elif tecla == 65362: + anterior = self.get_model().iter_previous(iter) + if anterior: + self.get_selection().select_iter(anterior) + + else: + pass + + return False + + + class Estructura_Proyecto(Gtk.TreeView): """ @@ -385,16 +429,31 @@ class Estructura_Proyecto(Gtk.TreeView): if iter is None: return - valor = self.get_model().get_value(iter, 2) path = self.get_model().get_path(iter) - if tecla == 65361: + if tecla == 65293: + if self.row_expanded(path): + self.collapse_row(path) + else: + self.expand_to_path(path) + + elif tecla == 65361: if self.row_expanded(path): self.collapse_row(path) elif tecla == 65363: if not self.row_expanded(path): self.expand_to_path(path) + + elif tecla == 65364: + siguiente = self.get_model().iter_next(iter) + if siguiente: + self.get_selection().select_iter(siguiente) + + elif tecla == 65362: + anterior = self.get_model().iter_previous(iter) + if anterior: + self.get_selection().select_iter(anterior) else: pass |