[Sugar-devel] Preview

Daniel Narvaez dwnarvaez at gmail.com
Fri Sep 20 17:47:27 EDT 2013


What about using the custom protocol?  Something like
activity://.../api/screenshot.png could trigger a get_snapshot and return
the image data.

It's an hack, and I would not suggest to go this way on Android for
example, but if we don't feel like writing a webkit extension, it's
certainly cleaner, easier and faster than going through apisocket.


On 20 September 2013 23:41, Daniel Narvaez <dwnarvaez at gmail.com> wrote:

> Very tricky...
>
> The gtk3 API allows activities to override the preview and it seems like
> we should keep that feature here. I feel like to do that sanely the js code
> needs to be able to see the screenshot.
>
> A clean implementation of a javascript screenshot API (both chrome and
> firefox has one for extensions fwiw) would require to write a webkit
> "extension". Those must be written in C unfortunately, epiphany has one I
> think so we could at least take inspiration. An extension might be useful
> to do other stuff in the future, for example the environment stuff could be
> implemented more cleanly that way.
>
> Another approach I can think of is: javascript requests the screenshot on
> the apisocket, the shell gets it from the activity trough dbus. Though it
> requires two ipc steps and it doesn't even make much sense conceptually.
>
> I'm not sure what we should here exactly, just dumping my brain.
>
>
>
> On 20 September 2013 22:28, Suraj K S <suraj.gillespie at gmail.com> wrote:
>
>> I'm able to capture the screenshot of a web activity by making use of
>> http://webkitgtk.org/reference/webkit2gtk/stable/WebKitWebView.html#webkit-web-view-get-snapshot
>> .
>> (The image quality seems to be pretty good. In fact, way better than the
>> current preview screenshots in python activities)
>>
>> I make those calls here,
>> https://github.com/sugarlabs/sugar-toolkit-gtk3/blob/master/src/sugar3/activity/webactivity.py
>>
>>
>> The question is, do we need to pass it(base64 encoded image) to the js
>> api?
>>
>> Or would it suffice to just add it to the datastore object on the shell
>> side (how)?
>>
>>
>
>
>
> --
> Daniel Narvaez
>



-- 
Daniel Narvaez
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20130920/d9c05cb2/attachment.html>


More information about the Sugar-devel mailing list