diff options
author | Cristian Garcia <cristian99garcia@gmail.com> | 2013-05-14 18:07:11 (GMT) |
---|---|---|
committer | Cristian Garcia <cristian99garcia@gmail.com> | 2013-05-14 18:07:11 (GMT) |
commit | 9998fc0ef0c4c5f7e5882897dcc51baf5bda5046 (patch) | |
tree | cec3d246a23daf215d93207f8515d2edd6b22796 | |
parent | d9b39782b780d96538824eb264b9fe7a7c79ff82 (diff) |
Correcciones 2
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | CristianEdit/CristianEdit.py | 58 | ||||
-rw-r--r-- | CristianEdit/CristianEdit.pyc | bin | 19593 -> 0 bytes | |||
-rw-r--r-- | CristianEdit/objetos.py | 43 | ||||
-rw-r--r-- | CristianEdit/objetos.pyc | bin | 46425 -> 46702 bytes |
5 files changed, 52 insertions, 50 deletions
@@ -1,4 +1,3 @@ *~ *.pyc *-pyw -*.bak diff --git a/CristianEdit/CristianEdit.py b/CristianEdit/CristianEdit.py index 8c9725e..24f2660 100644 --- a/CristianEdit/CristianEdit.py +++ b/CristianEdit/CristianEdit.py @@ -49,7 +49,8 @@ class CristianEdit(Gtk.Plug): self.barras_de_abajo = None self.funciones = None - self.configuraciones = None + self.configuraciones = {} + self.recientes = None self.vbox = None self.menu = None @@ -97,6 +98,8 @@ class CristianEdit(Gtk.Plug): #****** <<< Listas y Diccionarios ****** #****** Configuraciones >>> ****** + self.recientes = '' + self.abrir_configuracion() #****** <<< Configuraciones ****** @@ -464,8 +467,19 @@ class CristianEdit(Gtk.Plug): configurador = objetos.Configuraciones(self, self.configuraciones) configurador.set_modal(True) + + configurador.connect('configuration-changed', self.configuration_changed) + configurador.show_all() + def configuration_changed(self, widget, dict): + + self.configuraciones = dict + self.guardar_configuracion() + + for view in self.views: + view.configurar(self.configuraciones) + def get_view(self): """Devuelve el view actual""" @@ -575,17 +589,17 @@ class CristianEdit(Gtk.Plug): cfg.add_section('datos') - G.guardar_dato('enumeracion', self.enumeracion, cfg) - cfg.set('datos', 'fuente', self.fuente) - cfg.set('datos', 'margen', self.margen) - G.guardar_dato('is_margen', self.is_margen, cfg) - G.guardar_dato('ajuste', self.ajuste, cfg) - G.guardar_dato('ajuste_palabras', self.ajuste_palabras, cfg) - cfg.set('datos', 'tabulador', self.tabulador) - G.guardar_dato('insertar_espacios', self.insertar_espacios, cfg) - G.guardar_dato('sangria', self.sangria, cfg) + G.guardar_dato('enumeracion', self.configuraciones['enumeracion'], cfg) + cfg.set('datos', 'fuente', self.configuraciones['fuente']) + cfg.set('datos', 'margen', self.configuraciones['margen']) + G.guardar_dato('is_margen', self.configuraciones['is_margen'], cfg) + G.guardar_dato('ajuste', self.configuraciones['ajuste'], cfg) + G.guardar_dato('ajuste_palabras', self.configuraciones['ajuste_palabras'], cfg) + cfg.set('datos', 'tabulador', self.configuraciones['tabulador']) + G.guardar_dato('insertar_espacios', self.configuraciones['insertar_espacios'], cfg) + G.guardar_dato('sangria', self.configuraciones['sangria'], cfg) cfg.set('datos', 'recientes', self.recientes) - cfg.set('datos', 'tema', self.tema) + cfg.set('datos', 'tema', self.configuraciones['tema']) f = open(G.configuracion, 'w') cfg.write(f) @@ -598,17 +612,17 @@ class CristianEdit(Gtk.Plug): cfg.read([G.configuracion]) try: - self.enumeracion = bool(cfg.get('datos', 'enumeracion')) - self.fuente = cfg.get('datos', 'fuente') - self.margen = int(float(cfg.get('datos', 'margen'))) - self.is_margen = bool(cfg.get('datos', 'is_margen')) - self.ajuste = bool(cfg.get('datos', 'ajuste')) - self.ajuste_palabras = bool(cfg.get('datos', 'ajuste_palabras')) - self.tabulador = int(float(cfg.get('datos', 'tabulador'))) - self.insertar_espacios = bool(cfg.get('datos', 'insertar_espacios')) - self.sangria = bool(cfg.get('datos', 'sangria')) - self.recientes = str(cfg.get('datos', 'recientes')) - self.tema = str(cfg.get('datos', 'tema')) + self.configuraciones['enumeracion'] = bool(cfg.get('datos', 'enumeracion')) + self.configuraciones['fuente'] = cfg.get('datos', 'fuente') + self.configuraciones['margen'] = int(float(cfg.get('datos', 'margen'))) + self.configuraciones['is_margen'] = bool(cfg.get('datos', 'is_margen')) + self.configuraciones['ajuste'] = bool(cfg.get('datos', 'ajuste')) + self.configuraciones['ajuste_palabras'] = bool(cfg.get('datos', 'ajuste_palabras')) + self.configuraciones['tabulador'] = int(float(cfg.get('datos', 'tabulador'))) + self.configuraciones['insertar_espacios'] = bool(cfg.get('datos', 'insertar_espacios')) + self.configuraciones['sangria'] = bool(cfg.get('datos', 'sangria')) + self.configuraciones['recientes'] = str(cfg.get('datos', 'recientes')) + self.configuraciones['tema'] = str(cfg.get('datos', 'tema')) except ConfigParser.NoOptionError: self.recientes = '' diff --git a/CristianEdit/CristianEdit.pyc b/CristianEdit/CristianEdit.pyc Binary files differdeleted file mode 100644 index d8d5b49..0000000 --- a/CristianEdit/CristianEdit.pyc +++ /dev/null diff --git a/CristianEdit/objetos.py b/CristianEdit/objetos.py index 5b7ed3e..a310da1 100644 --- a/CristianEdit/objetos.py +++ b/CristianEdit/objetos.py @@ -857,10 +857,10 @@ class SelectordeFuente(Gtk.FontSelectionDialog): class Configuraciones(Gtk.Dialog): - #__gsignals__ = { - # 'configuration-changed': (GObject.SIGNAL_RUN_FIRST, - # None, (list,)) - # } + __gsignals__ = { + 'configuration-changed': (GObject.SIGNAL_RUN_FIRST, + None, (GObject.TYPE_PYOBJECT,)) + } def __init__(self, padre, configuraciones): @@ -956,78 +956,67 @@ class Configuraciones(Gtk.Dialog): """Establece en tema de colores""" self.configuraciones['tema'] = widget.get_active() - self.padre.set_configuracion(self.configuraciones) + self.emit('configuration-changed', self.configuraciones) def sangria_changed(self, widget): """Establece o desabilita la sangría automatica""" self.configuraciones['sangria'] = widget.get_active() - self.padre.set_configuracion(self.configuraciones) + self.emit('configuration-changed', self.configuraciones) def insertar_espacios_changed(self, widget): """Establece sí resaltar la línea actual o no""" self.configuraciones['insertar_espacios'] = widget.get_active() - self.padre.set_configuracion(self.configuraciones) + self.emit('configuration-changed', self.configuraciones) def tabulador_changed(self, widget): """Establece el ancho del tabulador""" self.configuraciones['tabulador'] = widget.get_value() - self.padre.set_configuracion(self.configuraciones) + self.emit('configuration-changed', self.configuraciones) def change_ajuste(self, widget, boton): """Activa/Desactiva ajuste de texto""" self.configuraciones['ajuste'] = widget.get_active() - boton.set_sensitive(estado) + boton.set_sensitive(self.configuraciones['ajuste']) - if estado: - #view.set_wrap_mode(Gtk.WrapMode(1)) + if self.configuraciones['ajuste']: self.configuraciones['ajuste_palabras'] = False - #else: - #view.set_wrap_mode(Gtk.WrapMode(0)) - - if estado and boton.get_active() and boton.get_sensitive(): - #view.set_wrap_mode(Gtk.WrapMode(2)) + if boton.get_active() and boton.get_sensitive(): self.configuraciones['ajuste_palabras'] = True - self.padre.set_configuracion(self.configuraciones) + self.emit('configuration-changed', self.configuraciones) def change_ajuste_palabras(self, widget): """Ajuste por palabras, no divide las palabras en dos líneas""" - #if widget.get_active(): - #view.set_wrap_mode(Gtk.WrapMode(2)) - - #else: - #view.set_wrap_mode(Gtk.WrapMode(1)) - self.configuraciones['ajuste_palabras'] = widget.get_active() - self.padre.set_configuracion(self.configuraciones) + self.emit('configuration-changed', self.configuraciones) def change_enumeracion(self, widget): """Hace que la enumeración sea igual al estado de activación del botón""" self.configuraciones['enumeracion'] = widget.get_active() - self.padre.set_configuracion(self.configuraciones) + self.emit('configuration-changed', self.configuraciones) def margen_changed(self, widget): """Establece en la columna en la que se muestra el margen derecho""" self.configuraciones['margen'] = widget.get_value() - self.padre.set_configuracion(self.configuraciones) + self.emit('configuration-changed', self.configuraciones) def is_margen_changed(self, widget, spin): """Establece sí el usuario quiere o no margen derecho""" self.configuraciones['is_margen'] = widget.get_active() spin.set_sensitive(self.configuraciones['is_margen']) - self.padre.set_configuracion(self.configuraciones) + self.emit('configuration-changed', self.configuraciones) def cerrar(self, widget): """Destruir al Widget clase""" diff --git a/CristianEdit/objetos.pyc b/CristianEdit/objetos.pyc Binary files differindex 036222e..95f808a 100644 --- a/CristianEdit/objetos.pyc +++ b/CristianEdit/objetos.pyc |