[Sugar-devel] Sugar Activity template for HTML5/Enyo

Edward Mokurai Cherlin mokurai at sugarlabs.org
Sat Aug 25 18:11:54 EDT 2012


Excellent. I have been wanting a way to use HTML5 with various Sugar
activities in the Replacing Textbooks program, both to write
interactive tutorials on the activities, and to write subject-matter
materials incorporating Sugar. Can you see how to do this? Can we
adapt existing activities in Python and other languages to work with
your template? What would it take to link to Etoys and Scratch, as the
next language extension?

On Sat, August 25, 2012 4:50 pm, lionel at olpc-france.org wrote:
>
>
> Hi all,
>
>
>
> I've enhanced the work of Manuel Quinones to create an activity template
> using Enyo JavaScript Framework.
>
>
>
> My objective was to provide a template to write a Sugar activity using
> HTML5
> but without losing advantage of the Sugar integration. Plus, I didn't want
> using a HTTP Server integrated into the activity like in the Wikipedia
> activity.
>
>
>
> Finally, using some WebKit tips & tricks (calling a JavaScript in the
> current page and console message handling), I finally conceived a simple
> framework that allow bi-directional communication between Python code and
> JavaScript code (using Enyo Framework). You could find the resulting
> source
> code from this framework here [1] for Python and here [2] for JavaScript.
>
>
>
> To test this framework, I wrote a sample activity (downloadable here [3])
> with a part of the activity wrote in HTML5 and the other part wrote in
> Python. I've illustrated the power of this framework with few features:
>
> - Sending basic type or full python object to JavaScript,
>
> - Sending basic type or full JavaScript object to Python,
>
> - JavaScript Enyo controls (Checkbox and Slider) synchronized with
> matching
> Gtk control,
>
> - Passing of Sugar context (buddy nickname and color) to JavaScript,
>
> - Using Sugar toolbar to launch JavaScript event,
>
> - Handling a HTML5 canvas (a small Logo Turtle ;-) from Gtk button.
>
> A screen capture of the activity is visible here [4].
>
>
>
> I think it's a good start to show what we could hope from this sort of
> integration and finally, to have more HTML5 developers writing or adapting
> activities to Sugar.
>
>
>
> Lot of thing could be done to enhance this basic framework. I hope to have
> time to write a real activity to work on some other interesting stuff:
>
> - Read/Write from Sugar Journal from JavaScript
>
> - Use POT localization for HTML5 resource
>
> - Using Sugar presence from JavaScript
>
> - ...
>
>
>
> Hope that some of you could be interested by this.
>
>
>
> Best regards from France.
>
>
>
>                    Lionel.
>
>
>
>
>
> [1]
> <http://git.sugarlabs.org/enyo-activity/enyo-activity/blobs/master/enyo.py>
> http://git.sugarlabs.org/enyo-activity/enyo-activity/blobs/master/enyo.py
>
> [2]
> <http://git.sugarlabs.org/enyo-activity/enyo-activity/blobs/master/html/suga
> r.js>
> http://git.sugarlabs.org/enyo-activity/enyo-activity/blobs/master/html/sugar
> .js
>
> [3]  <http://olpc-france.org/download/enyo-1.xo>
> http://olpc-france.org/download/enyo-1.xo
>
> [4]  <http://olpc-france.org/download/enyo-1_capture.png>
> http://olpc-france.org/download/enyo-1_capture.png
>
>
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>


--
Edward Mokurai (默雷/निशब्दगर्ज/نشبدگرج) Cherlin
Silent Thunder is my name, and Children are my nation.
The Cosmos is my dwelling place, the Truth my destination.
http://wiki.sugarlabs.org/go/Replacing_Textbooks


More information about the Sugar-devel mailing list