Thanks Manuel. I have added a comment in the ticket http://dev.laptop.org/ticket/10770#comment:3 Please contact me about any doubt.
Gonzalo 2011/7/1 Manuel Quiñones <[email protected]> > Fixes OLPC #10770 . > > Signed-off-by: Manuel Quiñones <[email protected]> > --- > Desenho.py | 20 ++++++++++++++++++-- > 1 files changed, 18 insertions(+), 2 deletions(-) > > diff --git a/Desenho.py b/Desenho.py > index 9b6c7b5..5bab524 100644 > --- a/Desenho.py > +++ b/Desenho.py > @@ -68,7 +68,10 @@ import gtk > import logging > import math > import gc > +import gobject > > +RESIZE_TIMER = 1500 # The time to wait for the resize operation to be > + # executed, after the resize controls are pressed. > > ##Pixmap manipulation > class Desenho: > @@ -80,6 +83,7 @@ class Desenho: > @param widget -- Area object (GtkDrawingArea) > > """ > + self.waiting_for_resize = False > #self.d = widget > > def line(self, widget, coords): > @@ -706,6 +710,15 @@ class Desenho: > @param height_percent -- Percent of y scale > > """ > + self.width_percent = width_percent > + self.height_percent = height_percent > + > + # Add a timer for resize if there isn't any already: > + if not self.waiting_for_resize: > + self.waiting_for_resize = True > + gobject.timeout_add(RESIZE_TIMER, self._do_resize, widget) > + > + def _do_resize(self, widget): > width, height = widget.window.get_size() > widget.desenha = True > widget.selmove = True > @@ -723,8 +736,8 @@ class Desenho: > > w = self.pixbuf_resize.get_width() > h = self.pixbuf_resize.get_height() > - wr = int(w * width_percent) > - hr = int(h * height_percent) > + wr = int(w * self.width_percent) > + hr = int(h * self.height_percent) > > resized = self.pixbuf_resize.scale_simple(wr, hr, > gtk.gdk.INTERP_HYPER) > > @@ -750,6 +763,9 @@ class Desenho: > widget.queue_draw() > gc.collect() > > + self.waiting_for_resize = False > + return False > + > def polygon(self, widget, coords, temp, fill, param=None): > """Draw polygon. > > -- > 1.7.4.4 > > _______________________________________________ > Sugar-devel mailing list > [email protected] > http://lists.sugarlabs.org/listinfo/sugar-devel >
_______________________________________________ Sugar-devel mailing list [email protected] http://lists.sugarlabs.org/listinfo/sugar-devel

