diff options
-rwxr-xr-x | MANIFEST | 3 | ||||
-rw-r--r-- | archivo.py | 22 | ||||
-rw-r--r-- | calendario.py | 46 | ||||
-rw-r--r-- | dist/Calendario-3.xo | bin | 25120 -> 32729 bytes |
4 files changed, 52 insertions, 19 deletions
@@ -12,5 +12,6 @@ locale/es/activity.linfo po/es.po .calendario.py.swp -.archivo.py.swp + locale/es/LC_MESSAGES/org.laptop.Calendario.mo +activity/icono2.svg @@ -43,14 +43,14 @@ 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, gobject.TYPE_STRING, gobject.TYPE_STRING) if not os.path.exists(path): _log.debug('THE FILE ACTIVIDADES DID NOT EXISTS') archivo = open(path, 'wb') dia = {} pickle.dump(dia, archivo) - modelo.append(['', '', '', None, None]) + modelo.append(['', '', '', None, None, None]) else: archivo = open(path, 'rb') @@ -61,12 +61,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], activ[3]]) + modelo.append([contar, activ[0], activ[1], activ[2], activ[3], activ[4]]) contar_int += 1 else: - modelo.append(['', '', '', None, None]) + modelo.append(['', '', '', None, None, None]) else : - modelo.append(['', '', '', None, None]) + modelo.append(['', '', '', None, None, None]) archivo.close() return modelo @@ -106,20 +106,25 @@ def guardar_efemeride(path, file_name): file_new.close() archivo.close() -def guardar_dato(indice, contenido, categoria, entero_cat, bolean, path): +def guardar_dato(indice, contenido, categoria, entero_cat, bolean, bolean_2, path): '''save the content in a file, add the content to a dictionary->list''' - _log.debug(entero_cat) color_categoria = ['#6E92FF', '#82FF5F', '#FFE251', '#FF7D7D', '#FFFFFF'] path = path + '/data/actividades.pkl' indice = str(indice) f = open(path, 'rb+wb') dia = pickle.load(f) + if bolean: prioridad = gtk.STOCK_ABOUT else: prioridad = None + if bolean_2: + progreso = gtk.STOCK_YES + else: + progreso = None + if not indice in dia: dia[indice] = [] if len(contenido) > 40: @@ -129,7 +134,8 @@ def guardar_dato(indice, contenido, categoria, entero_cat, bolean, path): else: color = '#FFFFFF' - dia[indice].append([contenido, categoria, prioridad, color]) + dia[indice].append([contenido, categoria, prioridad, \ + progreso, color]) f.seek(0) pickle.dump(dia, f) f.close() diff --git a/calendario.py b/calendario.py index e056e62..e7ead8f 100644 --- a/calendario.py +++ b/calendario.py @@ -159,9 +159,15 @@ class CalendarioActivity(activity.Activity): self.expandir = gtk.Expander(_('Expand for options')) self.check_status = 0 self.check = gtk.CheckButton(_('Important')) + self.progre_status = 0 + self.progre = gtk.CheckButton(_('In Progress')) + #self.compl_status = 0 + #self.compl = gtk.CheckButton(_('Completed')) self.expandir_h = gtk.HBox() self.expandir_h.pack_start(self.combo, False) - self.expandir_h.pack_start(self.check) + self.expandir_h.pack_start(self.check, False) + self.expandir_h.pack_start(self.progre, False) + #self.expandir_h.pack_start(self.compl, False) self.expandir.add(self.expandir_h) #file @@ -187,6 +193,7 @@ class CalendarioActivity(activity.Activity): self.boton2.connect('clicked', self._borrar_fila_cb) self.boton3.connect('clicked', self._importar_archivo_cb) self.check.connect('toggled', self._check_cb) + self.progre.connect('toggled', self._progre_cb) ########################### Add Blocks ################################ self.contenedor_h.pack_start(self.contenedor_vi, False, padding = 5) @@ -220,6 +227,14 @@ class CalendarioActivity(activity.Activity): else: self.check_status = 1 + def _progre_cb(self, widget, data=None): + '''return 1 if the chckbutton is now enable, else + return 0''' + if self.progre_status is 1: + self.progre_status = 0 + else: + self.progre_status = 1 + def _dia_selec_cb(self, widget, data=None): '''when a date is selected''' self.lista_fecha = self.calendario.get_date() @@ -333,14 +348,14 @@ class CalendarioActivity(activity.Activity): self.modelocombo = self.combo.get_model() self.index = self.combo.get_active() self.categoria = self.modelocombo[self.index][0] - guardar_dato(self.indice, self.cadena, self.categoria, self.index, self.check_status, self.path) + guardar_dato(self.indice, self.cadena, self.categoria, 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) self.marcar_calendario(self.marcar_dia) #mark the day in the calendar - if self.check_status is 1: #make inactive again the checkbutton - self.check.set_active(False) - + self.desactivar_boton() #make inactive again the checkbutton + def _importar_cb(self, widget, data=None): '''change to the import view''' self.set_canvas(self.archivo) @@ -362,26 +377,37 @@ class CalendarioActivity(activity.Activity): self.actividad = (_('Activity')) self.categoria = (_('Category')) self.prioridad = (_('Priority')) + self.estado = (_('Status')) - self.columna = gtk.TreeViewColumn('', self.celda, text = 0, cell_background = 4) + self.columna = gtk.TreeViewColumn('', self.celda, text = 0, cell_background = 5) self.actividades.append_column(self.columna) - self.columna = gtk.TreeViewColumn(self.actividad, self.celda, text = 1, cell_background = 4) + self.columna = gtk.TreeViewColumn(self.actividad, self.celda, text = 1, cell_background = 5) self.columna.set_min_width(365) self.actividades.append_column(self.columna) - self.columna = gtk.TreeViewColumn(self.categoria, self.celda, text = 2, cell_background = 4) + self.columna = gtk.TreeViewColumn(self.categoria, self.celda, text = 2, cell_background = 5) + self.actividades.append_column(self.columna) + self.columna = gtk.TreeViewColumn(self.prioridad, self.icono, stock_id = 3, cell_background = 5) self.actividades.append_column(self.columna) - self.columna = gtk.TreeViewColumn(self.prioridad, self.icono, stock_id = 3, cell_background = 4) + self.columna = gtk.TreeViewColumn(self.estado, self.icono, stock_id = 4, cell_background = 5) self.actividades.append_column(self.columna) + def marcar_calendario(self, fecha=None): '''mark the days that have activities stored''' - self._log.debug(fecha) guardar = 1 self.lista_dias_marcados = dict_meses(self.path, fecha, guardar) indice = fecha[:4] for dia in self.lista_dias_marcados[indice]: self.calendario.mark_day(dia) + def desactivar_boton(self): + '''inactive the checkbuttons''' + if self.check_status is 1: + self.check.set_active(False) + if self.progre_status is 1: + self.progre.set_active(False) + + def close(self, skip_save=False): '''Override the close method so we don't try to create a Journal entry''' diff --git a/dist/Calendario-3.xo b/dist/Calendario-3.xo Binary files differindex 9f52f87..6855479 100644 --- a/dist/Calendario-3.xo +++ b/dist/Calendario-3.xo |