From 7e7f9883461c5498240640f4dcfdfabe303e1efb Mon Sep 17 00:00:00 2001 From: flavio Date: Tue, 08 Jan 2013 14:01:15 +0000 Subject: Mejoras en la legibilidad del codigo. --- (limited to 'Moonwidgets.py') diff --git a/Moonwidgets.py b/Moonwidgets.py index 05e38cc..adfd6aa 100644 --- a/Moonwidgets.py +++ b/Moonwidgets.py @@ -25,10 +25,8 @@ # Febrero 2012 # Correcciones, Simplificación y Reestructuración Modular: # Desarrollo de CalendarButton + MoonCalendar: -# Instalador y Portado a gnome: +# Instalador y Portado a gnome y Gtk 3: # Flavio Danesse CeibalJAM! - Uruguay - Activity Central -# Traducciones a Español: -# Ana Cichero CeibalJAM! - Uruguay import math import time @@ -156,6 +154,7 @@ class CalendarButton(Gtk.EventBox): def actualizar(self): pass + # FIXME: Reimplementar. ''' if self.dia <= 0: return @@ -226,6 +225,7 @@ class CalendarButton(Gtk.EventBox): def draw_grid(self, compass_text): pass + # FIXME: Reimplementar. ''' # Draw Selenographic grid line data. rgc = self.image_pixmap.new_gc(foreground=MG.RED) @@ -298,6 +298,7 @@ class CalendarButton(Gtk.EventBox): def draw_fase_moon(self, mask_pixmap, kgc, wgc): pass + # FIXME: Reimplementar. ''' if self.data_model.phase_of_moon <= .25: #print "New Moon to First Quarter" @@ -485,7 +486,8 @@ class MoonCalendar(Gtk.AspectFrame): boton = Gtk.ToggleToolButton() boton.connect('clicked', self.anterior) - pixbuf= GdkPixbuf.Pixbuf.new_from_file_at_size(os.path.join(MG.ICONOS,'flecha-ico.svg'), 32, 32) + pixbuf= GdkPixbuf.Pixbuf.new_from_file_at_size( + os.path.join(MG.ICONOS,'flecha-ico.svg'), 32, 32) imagen = Gtk.Image() imagen.set_from_pixbuf(pixbuf) boton.set_icon_widget(imagen) @@ -508,8 +510,9 @@ class MoonCalendar(Gtk.AspectFrame): boton = Gtk.ToggleToolButton() boton.connect('clicked', self.siguiente) - pixbuf= GdkPixbuf.Pixbuf.new_from_file_at_size(os.path.join(MG.ICONOS,'flecha-ico.svg'), 32, 32) - pixbuf= pixbuf.flip(1) + pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size( + os.path.join(MG.ICONOS,'flecha-ico.svg'), 32, 32) + pixbuf = pixbuf.flip(1) imagen = Gtk.Image() imagen.set_from_pixbuf(pixbuf) boton.set_icon_widget(imagen) @@ -569,7 +572,9 @@ class MoonCalendar(Gtk.AspectFrame): for d in calendar.day_name: if d: dias.append(d) - self.hoy = "%s-%s-%s %s" % (self.matriz.anio, self.matriz.mes, self.matriz.fecha, self.matriz.hora) + self.hoy = "%s-%s-%s %s" % (self.matriz.anio, + self.matriz.mes, self.matriz.fecha, self.matriz.hora) + meses= [] for m in calendar.month_name: @@ -621,22 +626,28 @@ class MatrizMoonCalendar(Gtk.EventBox): def repaint(self, widget= None, event= None): if not self.fixes: return + rect = self.get_allocation() anchoboton = rect.width/len(self.fixes[0]) altoboton = rect.height/len(self.fixes) tamanioboton = min( [anchoboton,altoboton] ) + if self.tamanioboton != tamanioboton: self.tamanioboton = tamanioboton posy = 0 + for fixed in self.fixes: self.fixed.move(fixed, 0, posy) posy += self.tamanioboton + posx = 0 + for fixed in self.fixes: for boton in self.calendarbuttons[self.fixes.index(fixed)]: fixed.move(boton, posx, 0) boton.repaint(self.tamanioboton) posx += self.tamanioboton + posx = 0 def set_mes(self, anio, mes, fecha, hora): @@ -645,17 +656,21 @@ class MatrizMoonCalendar(Gtk.EventBox): self.fixes = [] self.calendarbuttons = [] self.semanas = MG.get_semanas_del_mes(anio, mes) + for child in self.fixed.get_children(): self.fixed.remove(child) child.destroy() + for sem in self.semanas: listadias = [] fixed = Gtk.Fixed() self.fixes.append(fixed) self.fixed.put(fixed, 0,0) + for dia in sem: boton = CalendarButton(self.anio, self.mes, dia, self.hora) listadias.append(boton) fixed.put(boton, 0,0) + self.calendarbuttons.append(listadias) \ No newline at end of file -- cgit v0.9.1