[Sugar-devel] Preview
Gonzalo Odiard
gonzalo at laptop.org
Fri Sep 20 17:53:05 EDT 2013
I like that more than the webkit extension.
In 90% of the cases, javascript should not ask the preview, and be saved in
automatic way by the python code,
just like the actual code. In the rare cases where the web activity want
custom the preview, can get it from the url.
Gonzalo
On Fri, Sep 20, 2013 at 6:47 PM, Daniel Narvaez <dwnarvaez at gmail.com> wrote:
> 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
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20130920/2f93fddb/attachment-0001.html>
More information about the Sugar-devel
mailing list