Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCristian Garcia <cristian99garcia@gmail.com>2013-05-17 20:36:01 (GMT)
committer Cristian Garcia <cristian99garcia@gmail.com>2013-05-17 20:36:01 (GMT)
commit73ca0eb394e1f1dc761b67a9409845bef53249fc (patch)
tree42139cefd1c15c88db324b3c30448e6d040f42c3
parent571ef1571ea5ee3872045125a19d15bd713d5d66 (diff)
Agregando cosas a la funcion set_linea
-rw-r--r--WorkPanel.py29
1 files changed, 26 insertions, 3 deletions
diff --git a/WorkPanel.py b/WorkPanel.py
index 05cd4dc..f982c98 100644
--- a/WorkPanel.py
+++ b/WorkPanel.py
@@ -102,9 +102,32 @@ class Notebook_SourceView(Gtk.Notebook):
Recibe la linea seleccionada en instrospeccion y
y la selecciona en el sourceview activo.
"""
-
- # FIXME en el sourceview activo, seleccionar la linea segĂșn texto
- pass
+
+ scrolled = self.get_children()[self.get_current_page()]
+ view = scrolled.get_children()[0]
+ buffer = view.get_buffer()
+
+ cursor_mark = buffer.get_insert()
+ start = buffer.get_iter_at_mark(cursor_mark)
+ end = buffer.get_end_iter()
+
+ if start.get_offset() == buffer.get_char_count():
+ start = buffer.get_start_iter()
+
+ match = start.forward_search(texto, 0, end)
+
+ if match:
+ match_start, match_end = match
+
+ buffer.select_range(match_start, match_end)
+ view.scroll_to_iter(match_end, 0.1, 1, 1, 1)
+
+ else:
+ try:
+ self.set_linea(texto)
+
+ except RuntimeError:
+ pass
def __switch_page(self, widget, widget_child, indice):
"""