diff options
author | yaderv <yajosev@gmail.com> | 2011-03-08 16:19:01 (GMT) |
---|---|---|
committer | yaderv <yajosev@gmail.com> | 2011-03-08 16:19:01 (GMT) |
commit | 16de059e0b307e791359842f48ae17b76abf62f3 (patch) | |
tree | 8cd5721be9b0c7bd354244dea7d8afc045d1d343 | |
parent | 885ff65cb3eb770e45dda36dd130d762a4a36291 (diff) |
editar
-rw-r--r-- | archivo.py | 12 | ||||
-rw-r--r-- | calendario.py | 18 |
2 files changed, 24 insertions, 6 deletions
@@ -106,7 +106,7 @@ def guardar_efemeride(path, file_name): file_new.close() archivo.close() -def guardar_dato(indice, contenido, categoria, entero_cat, bolean, bolean_2, path): +def guardar_dato(indice, contenido, categoria, entero_cat, bolean, bolean_2, path, indice_lista=False): '''save the content in a file, add the content to a dictionary->list''' color_categoria = ['#6E92FF', '#82FF5F', '#FFE251', '#FF7D7D', '#FFFFFF'] @@ -134,13 +134,19 @@ def guardar_dato(indice, contenido, categoria, entero_cat, bolean, bolean_2, pat else: color = '#FFFFFF' - dia[indice].append([contenido, categoria, prioridad, \ + if indice_lista: + indice_lista = str(indice_lista) + indice = str(indice) + indice_lista = indice_entero(indice_lista) + dia[indice][indice_lista] = [contenido, categoria, prioridad, \ + progreso, color] + else: + dia[indice].append([contenido, categoria, prioridad, \ progreso, color]) f.seek(0) pickle.dump(dia, f) f.close() - def borrar_dato(indice, indice_lista, path): '''delete the selected content''' path = path + '/data/actividades.pkl' diff --git a/calendario.py b/calendario.py index 070b124..b2de17e 100644 --- a/calendario.py +++ b/calendario.py @@ -53,6 +53,7 @@ class CalendarioActivity(activity.Activity): self.fecha_normal = FechaNormal() self._log = logging.getLogger('Log Calendario') self.path = self.get_activity_root() + self.check_editar = False ######################### set interface ######################## @@ -337,6 +338,9 @@ class CalendarioActivity(activity.Activity): '''when the user clicked on the save button, the content is added to a python object and is saved in a file''' + self.guardar() + + def guardar(self): self.buffer = self.entrada.get_buffer() self.inicio, self.final = self.buffer.get_bounds() self.cadena = self.buffer.get_text(self.inicio, self.final, False) @@ -351,9 +355,16 @@ class CalendarioActivity(activity.Activity): self.index = self.combo.get_active() self.categoria = self.modelocombo[self.index][0] self.combo_list = [self.index, self.categoria] - self._log.debug(type(self.index)) - guardar_dato(self.indice, self.cadena, self.combo_list, self.index, self.check_status, \ - self.progre_status, self.path) + + if self.check_editar: + guardar_dato(self.indice, self.cadena, self.combo_list, self.index, self.check_status, \ + self.progre_status, self.path, self.enlace) + self.check_editar = False + + else: + guardar_dato(self.indice, self.cadena, self.combo_list, self.index, self.check_status, \ + self.progre_status, self.path) + self.buffer.set_text(' ') self.modelo = crear_modelo(self.indice, self.path) self.actividades.set_model(self.modelo) @@ -388,6 +399,7 @@ class CalendarioActivity(activity.Activity): if val[4] is not None: self.progre.set_active(True) + self.check_editar = True def _crear_columna(self): '''create the columns for the treeview''' |