Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorflavio <fdanesse@gmail.com>2013-05-11 13:29:12 (GMT)
committer flavio <fdanesse@gmail.com>2013-05-11 13:29:12 (GMT)
commite3efc2425ab274b1aa55ef589fdb2d9ed50a5324 (patch)
tree98f5697bf97521f8f53c1996df35d68bb8762676
parent17eec6711f5cf34642241cac96571ab8c6641c25 (diff)
Correcciones
-rw-r--r--InfoNotebook.py57
1 files changed, 36 insertions, 21 deletions
diff --git a/InfoNotebook.py b/InfoNotebook.py
index 877d228..e38e483 100644
--- a/InfoNotebook.py
+++ b/InfoNotebook.py
@@ -78,7 +78,8 @@ class InfoNotebook(Gtk.Notebook):
realizar introspeccion sobre él.
"""
- self.introspeccion.set_introspeccion(nombre, texto, self)
+ self.set_tab_label_text(self.get_nth_page(0), nombre)
+ self.introspeccion.set_introspeccion(nombre, texto)
class Introspeccion(Gtk.TreeView):
"""
@@ -94,17 +95,16 @@ class Introspeccion(Gtk.TreeView):
self.__set_columnas()
self.show_all()
- def set_introspeccion(self, nombre, texto, notebook):
+ def set_introspeccion(self, nombre, texto):
"""
Recibe nombre y contenido de archivo para
realizar introspeccion sobre él.
"""
-
- if not texto:
- return
-
- notebook.set_tab_label_text(notebook.get_nth_page(0), nombre)
-
+
+ self.get_model().clear()
+
+ if not texto: return
+
analisis = re.compile(r'(^[ \t]*?class\s.*[(:])|(^[ \t]*?def\s.*[(:])|(^[\t]*?import\s.*$)|(^[ \t]*?from\s.*$)|(^\s*#---.+)', re.MULTILINE)
datos, posiciones = self.__get_datos_introspeccion(texto, analisis)
@@ -115,26 +115,37 @@ class Introspeccion(Gtk.TreeView):
for dato in datos:
if dato.startswith("import ") or dato.startswith("from ") or dato.startswith("def "):
- modelo.append(None, [dato,
- posiciones[actual],
- Gdk.color_parse("#FF0D00")])
+
+ modelo.append(
+ None, [dato,
+ posiciones[actual],
+ Gdk.color_parse("#FF0D00")])
if dato.startswith("class "):
- self.iteractual = modelo.append(None, [dato,
- posiciones[actual],
- Gdk.color_parse("purple")])
+
+ self.iteractual = modelo.append(
+ None, [dato,
+ posiciones[actual],
+ Gdk.color_parse("purple")])
+
if dato[0:13] == "-Tabulacion- " and dato[14] != "T":
+
nuevodato = dato.replace("-Tabulacion- ", "")
- self.ultimodef = modelo.append(self.iteractual, [nuevodato,
- posiciones[actual],
- Gdk.color_parse("#FF0D00")])
+
+ self.ultimodef = modelo.append(
+ self.iteractual, [nuevodato,
+ posiciones[actual],
+ Gdk.color_parse("#FF0D00")])
if dato[0:26] == "-Tabulacion- -Tabulacion- ":
+
nuevodato = dato.replace("-Tabulacion- ", "")
- self.ultimodef = modelo.append(self.ultimodef, [nuevodato,
- posiciones[actual],
- Gdk.color_parse("#FF0D00")])
-
+
+ self.ultimodef = modelo.append(
+ self.ultimodef, [nuevodato,
+ posiciones[actual],
+ Gdk.color_parse("#FF0D00")])
+
actual += 1
def __get_datos_introspeccion(self, texto, objetos):
@@ -149,14 +160,18 @@ class Introspeccion(Gtk.TreeView):
try:
resultado = objetos.next()
+
except:
resultado = None
+
while resultado is not None:
dato_nuevo = resultado.group().replace(" ", "-Tabulacion- ")
datos.append(dato_nuevo)
posiciones.append(resultado.start())
+
try:
resultado = objetos.next()
+
except:
resultado = None