Ok. I will work to try to remove the toolbar.<br><br>Next we can see how to scale without streching.<br>(I had code to do it in the old Browse downloadmanager)<br><br>Gonzalo<br><br><div class="gmail_quote">2012/2/10 Manuel Quiñones <span dir="ltr"><<a href="mailto:manuq@laptop.org" target="_blank">manuq@laptop.org</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>Hi Gonzalo,<br>
<br>
Tested. I see the same issue as the current Browse favourite pages<br>
thumbnails (which I wrote and was a reference for this): unlike the<br>
previous version in GTK2+, the toolbar is added to the screenshot.<br>
<br>
As a side note, we should fix the stretching, which was also in the<br>
previous version. Look how stretched this moon looks:<br>
<br>
<a href="http://dev.laptop.org/%7Emanuq/stretched_thumb.png" target="_blank">http://dev.laptop.org/~manuq/stretched_thumb.png</a><br></div></blockquote><div><br>Hmm, I don't know what is better, a preview with or without toolbar.<br>
A Design Team decision<br><br> <br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>
<br>
<br>
El día 9 de febrero de 2012 17:08, <<a href="mailto:godiard@sugarlabs.org" target="_blank">godiard@sugarlabs.org</a>> escribió:<br>
</div><div><div>> From: Gonzalo Odiard <<a href="mailto:godiard@gmail.com" target="_blank">godiard@gmail.com</a>><br>
><br>
> Signed-off-by: Gonzalo Odiard <<a href="mailto:gonzalo@laptop.org" target="_blank">gonzalo@laptop.org</a>><br>
> ---<br>
> src/sugar3/activity/activity.py | 33 ++++++++++++++++++---------------<br>
> 1 files changed, 18 insertions(+), 15 deletions(-)<br>
><br>
> diff --git a/src/sugar3/activity/activity.py b/src/sugar3/activity/activity.py<br>
> index 19c1974..e943d44 100644<br>
> --- a/src/sugar3/activity/activity.py<br>
> +++ b/src/sugar3/activity/activity.py<br>
> @@ -54,11 +54,12 @@ import os<br>
> import time<br>
> from hashlib import sha1<br>
> from functools import partial<br>
> +import StringIO<br>
><br>
> from gi.repository import GConf<br>
> from gi.repository import Gtk<br>
> from gi.repository import Gdk<br>
> -from gi.repository import GdkPixbuf<br>
> +import cairo<br>
> from gi.repository import GObject<br>
> import dbus<br>
> import dbus.service<br>
> @@ -642,26 +643,28 @@ class Activity(Window, Gtk.Container):<br>
> binary content of a png image with a width of 300 and a height of 225<br>
> pixels.<br>
> """<br>
> - if self.canvas is None or not hasattr(self.canvas, 'get_snapshot'):<br>
> + if self.canvas is None or not hasattr(self.canvas, 'get_window'):<br>
> return None<br>
> - pixmap = self.canvas.get_snapshot((-1, -1, 0, 0))<br>
><br>
> - width, height = pixmap.get_size()<br>
> - pixbuf = GdkPixbuf.Pixbuf(GdkPixbuf.Colorspace.RGB, 0, 8, width, height)<br>
> - pixbuf = pixbuf.get_from_drawable(pixmap, pixmap.get_colormap(),<br>
> - 0, 0, 0, 0, width, height)<br>
> - pixbuf = pixbuf.scale_simple(style.zoom(300), style.zoom(225),<br>
> - GdkPixbuf.InterpType.BILINEAR)<br>
> + window = self.canvas.get_window()<br>
><br>
> - preview_data = []<br>
> + width, height = window.get_width(), window.get_height()<br>
><br>
> - def save_func(buf, data):<br>
> - data.append(buf)<br>
> + preview_width, preview_height = style.zoom(300), style.zoom(225)<br>
><br>
> - pixbuf.save_to_callback(save_func, 'png', user_data=preview_data)<br>
> - preview_data = ''.join(preview_data)<br>
> + preview_surface = Gdk.Window.create_similar_surface(window,<br>
> + cairo.CONTENT_COLOR, preview_width, preview_height)<br>
><br>
> - return preview_data<br>
> + cairo_context = cairo.Context(preview_surface)<br>
> + preview_scale_w = preview_width * 1.0 / width<br>
> + preview_scale_h = preview_height * 1.0 / height<br>
> + cairo_context.scale(preview_scale_w, preview_scale_h)<br>
> + Gdk.cairo_set_source_window(cairo_context, window, 0, 0)<br>
> + cairo_context.paint()<br>
> +<br>
> + preview_str = StringIO.StringIO()<br>
> + preview_surface.write_to_png(preview_str)<br>
> + return preview_str.getvalue()<br>
><br>
> def _get_buddies(self):<br>
> if self.shared_activity is not None:<br>
> --<br>
> 1.7.7.6<br>
><br>
</div></div><div><div>> _______________________________________________<br>
> Sugar-devel mailing list<br>
> <a href="mailto:Sugar-devel@lists.sugarlabs.org" target="_blank">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>
<br>
<br>
<br>
--<br>
.. manuq ..<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Gonzalo Odiard<br>SugarLabs Argentina<br><br>