diff options
author | Ignacio Rodríguez <ignaciorodriguez@sugarlabs.org> | 2013-07-07 02:09:51 (GMT) |
---|---|---|
committer | Ignacio Rodríguez <ignaciorodriguez@sugarlabs.org> | 2013-07-07 02:09:51 (GMT) |
commit | cbf7769b4af884a78e903e3f2be0ddc4243d7654 (patch) | |
tree | 49d2389c0312dc9065ac55cbd803aebd2129bd49 /CristianEdit/CristianEdit.py | |
parent | 1e1328a1131c56911a6255b33dce5310558cf4f5 (diff) |
Base, con muchos bugs.
Diffstat (limited to 'CristianEdit/CristianEdit.py')
-rw-r--r-- | CristianEdit/CristianEdit.py | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/CristianEdit/CristianEdit.py b/CristianEdit/CristianEdit.py index 48020d1..07073bc 100644 --- a/CristianEdit/CristianEdit.py +++ b/CristianEdit/CristianEdit.py @@ -40,22 +40,23 @@ from objetos import Configuraciones from objetos import Teclado from Creditos import Creditos -from gi.repository import Gtk -from gi.repository import GObject -from gi.repository import Pango -from gi.repository import Gdk +import gtk +import gobject +import pango +from gtk import gdk +import random -class CristianEdit(Gtk.Plug): +class CristianEdit(gtk.Plug): """Clase principal.""" __gsignals__ = { - 'cerrar': (GObject.SIGNAL_RUN_FIRST, None, []) + 'cerrar': (gobject.SIGNAL_RUN_FIRST, None, []) } def __init__(self): - Gtk.Plug.__init__(self) + gtk.Plug.__init__(self, random.randint(1, 1000)) self.buffers = [] self.views = [] @@ -76,13 +77,13 @@ class CristianEdit(Gtk.Plug): """Se crea la interfaz grafica, se setea y empaqueta todo.""" - self.vbox = Gtk.VBox() + self.vbox = gtk.VBox() self.add(self.vbox) self.abrir_configuracion() self.menu = Menu(self) - hbox_toolbar = Gtk.HBox() + hbox_toolbar = gtk.HBox() self.toolbar = Toolbar() self.notebook = Notebook(self) self.dialogo = DialogoReemplazarTexto(self.get_toplevel()) @@ -147,14 +148,14 @@ class CristianEdit(Gtk.Plug): respuesta = dialog.run() - if respuesta == Gtk.ResponseType.CANCEL: + if respuesta == gtk.RESPONSE_CANCEL: dialog.cerrar(None) - elif respuesta == Gtk.ResponseType.NO: + elif respuesta == gtk.RESPONSE_NO: self.notebook.remove_page(numero) dialog.cerrar(None) - elif respuesta == Gtk.ResponseType.YES: + elif respuesta == gtk.RESPONSE_YES: self.guardar(None) self.notebook.remove_page(numero) dialog.cerrar(None) @@ -226,15 +227,15 @@ class CristianEdit(Gtk.Plug): navegador = Navegador( 'Abrir archivo de Texto', self.get_toplevel(), - Gtk.FileChooserAction.OPEN, - ['Abrir', Gtk.ResponseType.ACCEPT]) + gtk.FILECHOOSER_ACTION_OPEN, + ['Abrir', gtk.RESPONSE_ACCEPT]) if os.path.exists(self.lugares[pagina]): navegador.set_filename(self.lugares[pagina]) respuesta = navegador.run() - if respuesta == Gtk.ResponseType.ACCEPT: + if respuesta == gtk.RESPONSE_ACCEPT: for lugar in navegador.get_filenames(): if os.path.exists(lugar) and \ not lugar in self.lugares and \ @@ -361,8 +362,8 @@ class CristianEdit(Gtk.Plug): self.navegador = Navegador( 'Guardar archivo', self.get_toplevel(), - Gtk.FileChooserAction(1), - (Gtk.STOCK_SAVE, 1)) + gtk.FILE_CHOOSER_ACTION_SAVE, + (gtk.STOCK_SAVE, 1)) respuesta = self.navegador.run() direccion = self.navegador.get_filename() @@ -450,14 +451,14 @@ class CristianEdit(Gtk.Plug): combo = barra_inferior.get_combo() buffer = Buffer() view = View(buffer) - label = Gtk.Label('Sin título') + label = gtk.Label('Sin título') combo.connect('changed', self.combo_changed) buffer.connect('mark-set', self.actualizar_b_estado) buffer.connect('modified-changed', self.changed_modificado) view.connect('cambio-de-busqueda', self.color_changed) - label.modify_font(Pango.FontDescription('Arial')) + label.modify_font(pango.FontDescription('Arial')) self.notebook.agregar(view, label, barra_inferior) self.buffers.append(buffer) @@ -502,10 +503,10 @@ class CristianEdit(Gtk.Plug): label = self.etiquetas[pagina] if widget.get_modified(): - label.modify_font(Pango.FontDescription('bold')) + label.modify_font(pango.FontDescription('bold')) else: - label.modify_font(Pango.FontDescription('Arial')) + label.modify_font(pango.FontDescription('Arial')) def color_changed(self, widget, color): """Cambia el color del texto de la entrada de busqueda, @@ -513,7 +514,7 @@ class CristianEdit(Gtk.Plug): entry = self.toolbar.entry - entry.modify_fg(Gtk.StateType.NORMAL, Gdk.color_parse(color)) + entry.modify_fg(gtk.STATE_NORMAL, gdk.color_parse(color)) if color == '#FF0000': print '\a' @@ -767,4 +768,4 @@ class CristianEdit(Gtk.Plug): 'recientes': [], 'abrir_archivo': False} - self.guardar_configuracion() + self.guardar_configuracion()
\ No newline at end of file |