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-30 04:05:48 (GMT)
committer Yader Velásquez <yajosev@gmail.com>2010-08-30 04:05:48 (GMT)
commit3a817609dabf27d5174cb6d26d863d4e4a44c127 (patch)
tree7dcf6201b09228d7a8a7f265dbaf1290d785bb96
parent1d835b53452a276a396ebec1fdf51548c29eca72 (diff)
ya se agrega de forma dinamica pero no se muestra
-rw-r--r--archivo.py19
-rw-r--r--calendario.py2
-rw-r--r--files/actividades.pkl2
-rw-r--r--files/nuevo.pkl7
4 files changed, 19 insertions, 11 deletions
diff --git a/archivo.py b/archivo.py
index e609750..8c5f662 100644
--- a/archivo.py
+++ b/archivo.py
@@ -23,9 +23,9 @@ from gettext import gettext as _
def crear_modelo(indice):
'''create a define liststore model'''
- archivo = open('files/actividades.pkl', 'rb')
+ archivo = open('files/actividades.pkl', 'r')
dia = pickle.load(archivo)
- contar = 0
+ contar = 1
modelo = gtk.ListStore(gobject.TYPE_INT, gobject.TYPE_STRING)
#esto cambiara de acuerdo al proceso de automatizacion
if dia.has_key(indice):
@@ -35,23 +35,22 @@ 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'''
- archivo = open('files/efemerides.pkl', 'rb')
+ archivo = open('files/efemerides.pkl', 'r')
texto = pickle.load(archivo)
return texto
def guardar_dato(indice, contenido):
- '''get a id dependig of the unix time, and the content'''
+ '''add new content to a list in a dictionary'''
indice = str(indice)
- dia = {}
- activ = []
- activ.append(contenido)
- dia[indice] = activ
- f = open('files/actividades.pkl', 'w')
+ f = open('files/actividades.pkl', 'r+w')
+ dia = pickle.load(f)
+ dia[indice].append(contenido)
pickle.dump(dia, f)
+ #f.flush()
f.close()
diff --git a/calendario.py b/calendario.py
index 6a38cf6..e5cf0aa 100644
--- a/calendario.py
+++ b/calendario.py
@@ -146,7 +146,7 @@ class Calendario:
self.inicio, self.final = self.buffer.get_bounds()
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'''
diff --git a/files/actividades.pkl b/files/actividades.pkl
index 20c3f56..28049e6 100644
--- a/files/actividades.pkl
+++ b/files/actividades.pkl
@@ -4,4 +4,6 @@ p1
(lp2
S'nuevo'
p3
+aS'nuevo'
+p4
as. \ No newline at end of file
diff --git a/files/nuevo.pkl b/files/nuevo.pkl
new file mode 100644
index 0000000..0d6c1e8
--- /dev/null
+++ b/files/nuevo.pkl
@@ -0,0 +1,7 @@
+(dp0
+S'1288332000'
+p1
+(lp2
+S'hola'
+p3
+as. \ No newline at end of file