Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--archivo.py11
-rw-r--r--calendario.py11
-rw-r--r--files/actividades.pkl6
3 files changed, 13 insertions, 15 deletions
diff --git a/archivo.py b/archivo.py
index 878514e..e4149f9 100644
--- a/archivo.py
+++ b/archivo.py
@@ -22,12 +22,12 @@ import gobject
from gettext import gettext as _
def crear_modelo(indice):
- '''create a define liststore model'''
+ '''create the liststore model for the main block'''
archivo = open('files/actividades.pkl', 'rb')
dia = pickle.load(archivo)
contar = 1
modelo = gtk.ListStore(gobject.TYPE_INT, gobject.TYPE_STRING)
- #esto cambiara de acuerdo al proceso de automatizacion
+
if dia.has_key(indice):
for activ in dia[indice]:
modelo.append([contar, activ])
@@ -35,17 +35,18 @@ def crear_modelo(indice):
else :
vacio = (_('no hay actividades para el día de hoy'))
modelo.append([0,vacio])
+
archivo.close()
return modelo
def abrir_efemeride():
- '''open the ephemeris file and return a dictionary'''
+ '''open the ephemeris file and return a data dictionary'''
archivo = open('files/efemerides.pkl', 'rb')
texto = pickle.load(archivo)
return texto
def guardar_dato(indice, contenido):
- '''add new content to a list in a dictionary'''
+ '''save the content in a file, add the content to a dictionary->list'''
indice = str(indice)
f = open('files/actividades.pkl', 'rb+wb')
dia = pickle.load(f)
@@ -54,6 +55,6 @@ def guardar_dato(indice, contenido):
dia[indice].append(contenido)
f.seek(0)
pickle.dump(dia, f)
- #f.flush()
+ f.flush()
f.close()
diff --git a/calendario.py b/calendario.py
index e5cf0aa..f8192dd 100644
--- a/calendario.py
+++ b/calendario.py
@@ -63,7 +63,7 @@ class Calendario:
#ephemeris files
self.texto = abrir_efemeride()
- if self.texto.has_key(self.fecha_normal.fecha_especial()): #algo asi mas o menos es lo que se necesita
+ if self.texto.has_key(self.fecha_normal.fecha_especial()):
self.buffer.set_text(self.texto[fecha_normal.fecha_especial()])
else:
@@ -103,7 +103,6 @@ class Calendario:
#callbacks
self.calendario.connect('day_selected', self._dia_selec_cb)
self.boton1.connect('clicked', self._nuevo_ingreso_cb)
- #self.boton2.connect('clicked',self._limpiar_boton_cb)
########################### Add Blocks ################################
self.contenedor_h.pack_start(self.contenedor_vi, False, padding = 5)
@@ -127,7 +126,7 @@ class Calendario:
self.ventana.show()
def main(self):
- '''run gtk'''
+ '''main gtk'''
gtk.main()
def _cerrar_cb(self, widget, data=None):
@@ -139,7 +138,9 @@ class Calendario:
self.date = self.calendario.get_date()
def _nuevo_ingreso_cb(self, widget, data=None):
- '''when the user clicked on the save button'''
+ '''when the user clicked on the save button,
+ the content is added to a python object and
+ is saved in a file'''
self.lista_fecha = self.calendario.get_date()
self.indice_dia = FechaUnix(self.lista_fecha)
self.buffer = self.entrada.get_buffer()
@@ -147,8 +148,6 @@ class Calendario:
self.cadena = self.buffer.get_text(self.inicio, self.final, False)
guardar_dato(self.indice_dia.fecha_unix(),self.cadena)
self.buffer.set_text(' ')
- #def _limpiar_boton_cb(self, widget, data=None):
- # '''clean input area'''
def _crear_columna(self):
'''create the columns for the treeview'''
diff --git a/files/actividades.pkl b/files/actividades.pkl
index 32289d1..b0c97c5 100644
--- a/files/actividades.pkl
+++ b/files/actividades.pkl
@@ -13,8 +13,6 @@ S'hola'
p7
aS'nuevo'
p8
-as.
-p4
-aS'probando\n'
-p5
+aS'otra prueba de entrada de texto'
+p9
as. \ No newline at end of file