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