Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYader Velásquez <yajosev@gmail.com>2010-08-29 22:38:01 (GMT)
committer Yader Velásquez <yajosev@gmail.com>2010-08-29 22:38:01 (GMT)
commit1aba557893f6005a5f0cbfc497cd423ac1c6315d (patch)
treef855de67d24aed3d2bcaa6b30ade3684cbb3f484
parent6e85f242904e121d08d6b00d7bbbe31587fc861b (diff)
it works for saving activities
-rw-r--r--archivo.py12
-rw-r--r--calendario.py18
2 files changed, 18 insertions, 12 deletions
diff --git a/archivo.py b/archivo.py
index 9d89e81..b200fce 100644
--- a/archivo.py
+++ b/archivo.py
@@ -34,12 +34,14 @@ def abrir_efemeride():
texto = pickle.load(archivo)
return texto
-def guardar_dato(indice, contenido, archivo):
+def guardar_dato(indice, contenido):
'''get a id dependig of the unix time, and the content'''
indice = str(indice)
- dict = {}
- dict[indice] = contenido
- f = open(archivo, 'w')
- pickle.dump(dict, f)
+ dia = {}
+ activ = []
+ activ.append(contenido)
+ dia[indice] = activ
+ f = open('files/actividades.pkl', 'w')
+ pickle.dump(dia, f)
f.close()
diff --git a/calendario.py b/calendario.py
index ac6ae38..adb8390 100644
--- a/calendario.py
+++ b/calendario.py
@@ -18,7 +18,7 @@
from gettext import gettext as _
from fecha import FechaUnix, FechaNormal
-from archivo import crear_modelo, abrir_efemeride
+from archivo import crear_modelo, abrir_efemeride, guardar_dato
import gtk
import pickle
@@ -31,7 +31,6 @@ class Calendario:
self.ventana.set_title(_('Calendario'))
self.ventana.connect('destroy', self._cerrar_cb)
self.fecha_normal = FechaNormal()
- self.temporal = [1,'holamundo']
######################### set interface ########################
@@ -58,10 +57,7 @@ class Calendario:
#ephemeris files
- #self.archivo = open('files/efemerides.pkl', 'rb')
- #self.texto = pickle.load(self.archivo)
self.texto = abrir_efemeride()
-
if self.texto.has_key(self.fecha_normal.fecha_especial()): #algo asi mas o menos es lo que se necesita
self.buffer.set_text(self.texto[fecha_normal.fecha_especial()])
@@ -101,7 +97,8 @@ class Calendario:
#callbacks
self.calendario.connect('day_selected', self._dia_selec_cb)
- #self.boton1.connect('clicked',self._limpiar_boton_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)
@@ -133,9 +130,16 @@ class Calendario:
gtk.main_quit()
def _dia_selec_cb(self, widget, data=None):
- '''selected day'''
+ '''when a date is selected'''
self.date = self.calendario.get_date()
+ def _nuevo_ingreso_cb(self, widget, data=None):
+ '''when the user clicked on the save button'''
+ self.lista_fecha = self.calendario.get_date()
+ self.indice_dia = FechaUnix(self.lista_fecha)
+ self.cadena = 'blablabla'
+ guardar_dato(self.indice_dia.fecha_unix(),self.cadena)
+
#def _limpiar_boton_cb(self, widget, data=None):
# '''clean input area'''