From 489b6d6d9ea29f3d79643ce1e264662b29f3e8d9 Mon Sep 17 00:00:00 2001 From: flavio Date: Sat, 25 Feb 2012 17:34:51 +0000 Subject: Mejoras de Rendimiento --- diff --git a/Moonwidgets.py b/Moonwidgets.py index f03788f..181c405 100644 --- a/Moonwidgets.py +++ b/Moonwidgets.py @@ -123,7 +123,7 @@ class CalendarButton(gtk.EventBox): if self.dia > 0: self.actualizar() - def actualizar(self): + def actualizar(self): if self.dia <= 0: return self.image_pixmap = gtk.gdk.Pixmap(self.window, self.imagen_size, self.imagen_size) gc = self.image_pixmap.new_gc(foreground=MG.BACKGROUND) @@ -518,30 +518,32 @@ class MatrizMoonCalendar(gtk.EventBox): self.mes = None self.fecha = None self.hora = None - self.semanas = None + self.semanas = [] self.fixes = [] self.calendarbuttons = [] - + self.tamanioboton = 0 self.connect("expose_event", self.repaint) def repaint(self, widget= None, event= None): - x,y,w,h= self.get_allocation() if not self.fixes: return + x,y,w,h= self.get_allocation() anchoboton = w/len(self.fixes[0]) altoboton = h/len(self.fixes) tamanioboton = min( [anchoboton,altoboton] ) - posy = 0 - for fixed in self.fixes: - self.fixed.move(fixed, 0, posy) - posy += tamanioboton - posx = 0 - for fixed in self.fixes: - for boton in self.calendarbuttons[self.fixes.index(fixed)]: - fixed.move(boton, posx, 0) - boton.repaint(tamanioboton) - posx += tamanioboton + 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): self.anio, self.mes, self.fecha, self.hora = anio, mes, fecha, hora -- cgit v0.9.1