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-06-10 23:02:52 (GMT)
committer Cristian Garcia <cristian99garcia@gmail.com>2013-06-10 23:02:52 (GMT)
commit57eb3c7864ddbefee8526c846f4f282adbbae6c3 (patch)
treeb669bee0560e2d077df038814031e6db55c89f74
parent414489ed120dabdfff88ee0c77e228fdd5f3909d (diff)
Agregando para que 'le ponga colores' a los archivos que no tienen extension pero siguen siendo de un lenguaje de programacion
-rw-r--r--CristianEdit.py4
-rw-r--r--CristianEdit/CristianEdit.py6
-rw-r--r--CristianEdit/objetos.py22
-rw-r--r--CristianEdit/objetos.pycbin42019 -> 42305 bytes
4 files changed, 26 insertions, 6 deletions
diff --git a/CristianEdit.py b/CristianEdit.py
index dc64d0b..1e7973d 100644
--- a/CristianEdit.py
+++ b/CristianEdit.py
@@ -126,6 +126,10 @@ class Ventana(Gtk.Window):
if if_cerrar:
Gtk.main_quit()
+ else:
+ if if_cerrar:
+ Gtk.main_quit()
+
if __name__ == '__main__':
if len(sys.argv) >= 2:
lista = list(sys.argv)[1:]
diff --git a/CristianEdit/CristianEdit.py b/CristianEdit/CristianEdit.py
index 184a121..86be384 100644
--- a/CristianEdit/CristianEdit.py
+++ b/CristianEdit/CristianEdit.py
@@ -225,8 +225,10 @@ class CristianEdit(Gtk.Plug):
pagina = self.notebook.get_current_page()
if not direccion:
- navegador = Navegador('Abrir archivo de Texto',
- self.get_toplevel(), Gtk.FileChooserAction.OPEN,
+ navegador = Navegador(
+ 'Abrir archivo de Texto',
+ self.get_toplevel(),
+ Gtk.FileChooserAction.OPEN,
['Abrir', Gtk.ResponseType.ACCEPT])
if os.path.exists(self.lugares[pagina]):
diff --git a/CristianEdit/objetos.py b/CristianEdit/objetos.py
index a2f560b..0ebe37b 100644
--- a/CristianEdit/objetos.py
+++ b/CristianEdit/objetos.py
@@ -20,6 +20,7 @@
import mimetypes
import os
+import commands
from gi.repository import Pango
from gi.repository import Gtk
@@ -183,6 +184,23 @@ class Buffer(GtkSource.Buffer):
lenguaje = self.lenguaje_manager.guess_language(filename, None)
+ if not lenguaje:
+ tipo = commands.getoutput('file %s --mime-type' % filename).split(' ')[1]
+
+ if 'x-' in tipo:
+ tipo = tipo.replace('x-', '')
+
+ if 'text/' in tipo:
+ tipo = tipo.replace('text/', '')
+
+ lenguaje = self.lenguaje_manager.get_language(tipo)
+
+ if not lenguaje:
+ print tipo
+ self.set_highlight_syntax(False)
+
+ combo.set_active(0)
+
if lenguaje:
self.set_highlight_syntax(True)
self.set_language(lenguaje)
@@ -196,10 +214,6 @@ class Buffer(GtkSource.Buffer):
except:
pass
- else:
- self.set_highlight_syntax(False)
-
- combo.set_active(0)
def get_lenguaje(self):
"""Devuelve el lenguaje seleccionado"""
diff --git a/CristianEdit/objetos.pyc b/CristianEdit/objetos.pyc
index ea19bdd..43e208d 100644
--- a/CristianEdit/objetos.pyc
+++ b/CristianEdit/objetos.pyc
Binary files differ