From 0998139878240109abfb261e74b9679288eef454 Mon Sep 17 00:00:00 2001 From: Yader Velásquez Date: Thu, 02 Sep 2010 14:35:55 +0000 Subject: better documentation --- (limited to 'archivo.py') 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() -- cgit v0.9.1