Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/archivo.py
diff options
context:
space:
mode:
authorYader Velásquez <yajosev@gmail.com>2011-03-04 00:33:55 (GMT)
committer Yader Velásquez <yajosev@gmail.com>2011-03-04 00:33:55 (GMT)
commit5cb5a2ac27f5e64de75d1a23c8024d5d2ff9a00c (patch)
treec39e997bedf795531a7edfa499aeb21ea31a3a3f /archivo.py
parent0f5293b4728fe04bf3e0d55b096ab7d1bcc73c43 (diff)
colors
Diffstat (limited to 'archivo.py')
-rw-r--r--archivo.py31
1 files changed, 22 insertions, 9 deletions
diff --git a/archivo.py b/archivo.py
index 134b26e..fdcab18 100644
--- a/archivo.py
+++ b/archivo.py
@@ -21,7 +21,14 @@ import gobject
import os
import logging
from gettext import gettext as _
-_log = logging.getLogger('Log archivo')
+_log = logging.getLogger('Log Archivo')
+
+#def color_categoria(entero):
+# if entero >= 0:
+# color = ['#222222', '#333333', '#444444', '#555555', '#666666']
+# return color[entero]
+# else:
+# return None
def separar_cadena(texto):
nuevo_texto = ''
@@ -43,7 +50,7 @@ def crear_modelo(indice, path):
'''create the liststore model for the main block'''
path = path + '/data/actividades.pkl'
modelo = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING,\
- gobject.TYPE_STRING)
+ gobject.TYPE_STRING, gobject.TYPE_STRING)
if not os.path.exists(path):
_log.debug('THE FILE ACTIVIDADES DID NOT EXISTS')
@@ -53,7 +60,6 @@ def crear_modelo(indice, path):
modelo.append(['', '', '', None])
else:
- #_log.debug('THE FILE EXISTS')
archivo = open(path, 'rb')
dia = pickle.load(archivo)
contar_int = 1
@@ -62,12 +68,12 @@ def crear_modelo(indice, path):
if len(dia[indice]):
for activ in dia[indice]:
contar = str(contar_int)
- modelo.append([contar, activ[0], activ[1], activ[2]])
+ modelo.append([contar, activ[0], activ[1], activ[2], activ[3]])
contar_int += 1
else:
- modelo.append(['', '', '', None])
+ modelo.append(['', '', '', None, None])
else :
- modelo.append(['', '', '', None])
+ modelo.append(['', '', '', None, None])
archivo.close()
return modelo
@@ -84,7 +90,6 @@ def comprobar_efemeride(path):
def abrir_efemeride(path):
'''open the ephemeris file and return a data dictionary'''
path = path + '/data/efemerides.pkl'
- _log.debug('THE FILE EPHEMERIS EXISTS')
archivo = open(path, 'rb')
texto = pickle.load(archivo)
archivo.close()
@@ -108,8 +113,11 @@ def guardar_efemeride(path, file_name):
file_new.close()
archivo.close()
-def guardar_dato(indice, contenido, categoria, bolean, path):
+def guardar_dato(indice, contenido, categoria, entero_cat, bolean, path):
'''save the content in a file, add the content to a dictionary->list'''
+ _log.debug(entero_cat)
+ color_categoria = ['#222222', '#333333', '#444444', '#555555', '#666666']
+
path = path + '/data/actividades.pkl'
indice = str(indice)
f = open(path, 'rb+wb')
@@ -123,7 +131,12 @@ def guardar_dato(indice, contenido, categoria, bolean, path):
dia[indice] = []
if len(contenido) > 40:
contenido = separar_cadena(contenido)
- dia[indice].append([contenido, categoria, prioridad])
+ if entero_cat > -1:
+ color = color_categoria[entero_cat]
+ else:
+ color = None
+
+ dia[indice].append([contenido, categoria, prioridad, color])
f.seek(0)
pickle.dump(dia, f)
f.close()