diff options
Diffstat (limited to 'CristianEdit/objetos.py')
-rw-r--r-- | CristianEdit/objetos.py | 59 |
1 files changed, 42 insertions, 17 deletions
diff --git a/CristianEdit/objetos.py b/CristianEdit/objetos.py index 112cca0..a01fe86 100644 --- a/CristianEdit/objetos.py +++ b/CristianEdit/objetos.py @@ -407,6 +407,7 @@ class Notebook(Gtk.Notebook): boton = Gtk.ToolButton(Gtk.STOCK_ADD) boton.connect('clicked', self.emit_agregar) + self.connect('button-press-event', self.click) self.set_scrollable(True) self.set_action_widget(boton, Gtk.PackType.END) @@ -463,6 +464,10 @@ class Notebook(Gtk.Notebook): return scrolled + def crear_menu(self): + + self.popup = self.get_toplevel().popup + def borrar_pagina(self, numero=None): """Borra la página actual""" @@ -485,6 +490,14 @@ class Notebook(Gtk.Notebook): self.emit('boton-nuevo-clicked') + def click(self, widget, event): + """Recibe el evento cuando se hace clic encima del widget clase.""" + + if event.type == Gdk.EventType.BUTTON_PRESS and event.button == 3: + self.popup.popup(None, None, None, None, event.button, event.time) + self.popup.show_all() + return True # event has been handled + def desplazar_al_final(self): """Se mueve a la última pestaña""" @@ -727,7 +740,7 @@ class DialogoReemplazarTexto(Gtk.Dialog): boton_ok = Gtk.Button('Reemplazar') boton_cerrar = Gtk.Button(None, Gtk.STOCK_CLOSE) - boton_ok.connect('clicked', self.reemplazar) + boton_ok.connect('clicked', self.reemplazar_todo) boton_cerrar.connect('clicked', self.cerrar) hbox.pack_start(boton_ok, False, False, 2) @@ -738,7 +751,7 @@ class DialogoReemplazarTexto(Gtk.Dialog): self.vbox.remove(self.get_children()[0].get_children()[-1]) - def reemplazar(self, widget): + def reemplazar_todo(self, widget): """Reemplaza el texto.""" self.emit('solicitar-buffer') @@ -875,12 +888,17 @@ class DialogoEstado(Gtk.Dialog): __gtype_name__ = 'DialogoEstado' - def __init__(self, padre, notebook): + __gsignals__ = { + 'solicitar-objetos': (GObject.SIGNAL_RUN_FIRST, + None, []) + } - Gtk.Dialog.__init__(self) + def __init__(self, padre, dict): + + Gtk.Dialog.__init__(self, title='Estado del archivo.') self.padre = padre - self.notebook = notebook + self.dict = dict self.label_caracteres = Gtk.Label() self.label_lineas = Gtk.Label() @@ -908,11 +926,6 @@ class DialogoEstado(Gtk.Dialog): for label in lista: label.modify_font(Pango.FontDescription('bold')) - fuente = self.padre.get_fuente() - fuente = Pango.FontDescription(fuente) - fuente.set_size(14000) - self.label_fuente.modify_font(fuente) - self.tabla.attach(label_caracteres, 0, 1, 0, 1) self.tabla.attach(label_lineas, 0, 1, 1, 2) self.tabla.attach(entry_lugar, 0, 1, 2, 3) @@ -942,15 +955,22 @@ class DialogoEstado(Gtk.Dialog): """Actualiza la información que se guarda y muestran en las etiquetas""" - buffer = self.padre.get_buffer() - direccion = self.padre.get_direccion() - fuente = self.padre.get_fuente() - pagina = self.notebook.get_current_page() + 1 - paginas = self.notebook.get_n_pages() + self.emit('solicitar-objetos') + + buffer = self.dict['buffer'] + direccion = self.dict['direccion'] + fuente = self.dict['fuente'] + pagina = self.dict['pagina'] + paginas = self.dict['paginas'] self.label_caracteres.set_text(str(buffer.get_char_count())) self.label_lineas.set_text(str(buffer.get_line_count())) - self.label_fuente.set_text(fuente) + + self.label_fuente.set_text(fuente) + fuente = Pango.FontDescription(self.dict['fuente']) + fuente.set_size(14000) + self.label_fuente.modify_font(fuente) + self.entry_lugar.set_text(direccion) self.label_pestania.set_text(str(pagina) + '/' + str(paginas)) @@ -960,12 +980,17 @@ class DialogoEstado(Gtk.Dialog): else: self.label_modificado.set_text('Sin modificar') + def set_dict(self, dict): + """Setea la variable 'dict' del + widget que ejecuta esta función.""" + + self.dict = dict + def cerrar(self, widget): """Destruye al Widget clase""" self.destroy() - class Configuraciones(Gtk.Dialog): __gtype_name__ = 'Configuraciones' |