[Sugar-devel] Sugarizer: the (dark) technical side
Lionel Laské
lionel at olpc-france.org
Fri Dec 20 17:42:17 EST 2013
Hi all,
Thanks a lot for your support to Sugarizer. Really appreciate.
To complete the technical explanation on the first prototype [1], here a
technical overview of the new Sugarizer.
1) Settings: Sugarizer use HTML5 localStorage feature to store user
settings [2]. The settings is set in a key name "sugar_settings". Settings
include: buddy name (no way to change it from the GUI for the moment :-),
buddy color (tip to change it: click/touch several time the XO buddy icon),
current view (Circle, List or Journal) - to go back to last view at the end
of an activity -, and current installed activities list with favorite
choice.
2) Datastore: To ensure compatibility with Sugar Web Framework I've
implemented datastore using the same interface than the current
datastore.js. See it [3]. Once again HTML5 localStorage is used to store
it. Each datastore entry is store in a key name
"sugar_datastore_[UUID=ObjectId]". The key value has a property "metadata".
I've set the same metadata values than in the "true" datastore
(creation_time, file_size, time_stamp, ...). The key value has also a
property "text" for the text content. Both value are set together.
3) Environment: The Sugarizer launcher need to transmit the context to the
activity (activityId, name, objectId). I choose to use query_string to send
these parameter. So all parameters are pass to the "index.html" page of the
activity [4] after a "?". The values are set to the Sugar Web Framework
"window.top.sugar" variable at first call of datastore [5]. I'm not very
happy with that but don't find any other place to initialize the
environment.
4) Sugar web framework upgrade: the drawback of the Sugar Web Framework is
that it should be copied on each activity directory. For Sugarizer I've
changed two files only in the framework (datastore.js and bus.js).
Unfortunately I've found some issues in activities related to old version
of palette.js and activitypalette.js so I choose to upgrade all the
framework in all activities.
5) Activities issue: My philosophy with Sugarizer is "don't update
activities". BTW I've decided to fix an issue in "WelcomeWeb" in
activity.js. Most of the code seems to be pasted from the GetThingsDone
Activity so I've commented a part of it [6] that don't work in the context
of "WelcomeWeb".
The Paint activity has yet a HTML5 compatibility issue due to the use of
CustomEvent feature - not supported on "old" browser version - in
colorpalette.js [7] but I don't know how to update it.
6) GUI complexity: Of course because I've reproduced a part of Sugar home
view I've discovered some subtle way of working in the interface (like the
double-timer in the popup menu !). BTW the more specific issue I've had to
solve was related to colorize icon. The current process in Sugar Web
Framework is nice (put it as data an redraw it [8]) but time consuming in
JavaScript. So I've created a local cache of colorized icon [9] to optimize
the code when colorize need to be call multiple times (in activity popup or
journal for example).
Hope that these explanations could let you have a better understanding of
specific web issues.
Lionel.
[1] http://lists.sugarlabs.org/archive/sugar-devel/2013-November/045887.html
[2] https://github.com/llaske/Sugarizer/blob/master/lib/settings.js#L43
[3]
https://github.com/llaske/Sugarizer/blob/master/lib/sugar-web/datastore.js
[4] https://github.com/llaske/Sugarizer/blob/master/lib/settings.js#L103
[5]
https://github.com/llaske/Sugarizer/blob/master/lib/sugar-web/datastore.js#L79
[6]
https://github.com/llaske/Sugarizer/blob/master/activities/WelcomeWeb.activity/js/activity.js#L17
[7]
https://github.com/llaske/Sugarizer/blob/master/activities/Paint.activity/js/colorpalette.js#L9
[8]
https://github.com/llaske/Sugarizer/blob/master/lib/sugar-web/graphics/icon.js#L20
[9] https://github.com/llaske/Sugarizer/blob/master/js/activityicon.js#L38
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20131220/b32d9231/attachment-0001.html>
More information about the Sugar-devel
mailing list