The following schema sum up HTML5 activities architecture.
Because it will force independence from Gtk/Python, HTML5 activities is a first step toward Sugar on Android.
The very first Web Activity is Wikipedia. Wikipedia is a Python activity embedding a WebView to display HTML Wikipedia pages. Searching and browsing is available from a standard Python toolbar. Clicking on a toolbar button change the current HTML viewed page or launch an history command (previous/next). To communicate from HTML to Python, Wikipedia embed an HTTP Server. When a hyperlink is clicked in the HTML page it call the HTTP server then run Python code.
HTML5 activities has been choose[http://meeting.sugarlabs.org/sugar-meeting/meetings/2013-04-22T14:04:27 ] as a feature for Sugar 0.100. HTML5 activities will be build on WebKit2 but if time permits we will implement compatibility with previous releases running WebKit1
Daniel explore communication using WebSocket .
Sugar HTML Framework
This part of the framework should expose HTML controls matching the Sugar widgets look&feel and common and customized activity toolbars.
Manuel has done some research about components to do that .
API Use case
- Called by an activity to Write/Read its context (most often seen use case)
- Called by Sugar or by an activity to navigate into. Query could be:
- Filtered by title, mime type, date, …
- Ordered by one or more keys
- Limited to some number of results (with an optional starting offset)
What is a datastore object ?
- A set of properties:
- Some comes from Sugar
- Some are custom properties
- All properties values type are: string, text, int, number, date, binary or external (file)
- A filename (optional)
function DataStore.create(properties, filename); // Return object_id function DataStore.get_properties(object_id); // Return set of properties as JSON object function DataStore.get_filename(object_id); // Return filename function DataStore.find(query, properties); // Return array of object_id function DataStore_created(object_id); // Callback interface to object_id created event function DataStore.addEventListener("created", DataStore_created); function DataStore_Updated(object_id); // Callback interface to object_id updated event function DataStore.addEventListener("updated", DataStore_updated); function DataStore_Deleted(object_id); // Callback interface to object_id deleted event function DataStore.addEventListener("deleted", DataStore_deleted);
function write_file(properties, filename); function Activity.addEventListener("write", write_file); function read_file(properties, filename); function Activity.addEventListener("read", read_file);
HTML5 implementation consideration
- This interface is mostly inherited from the existing sugar.datastore.store API . By the way it make sense to reproduce these features because basically the Sugar DataStore can't be something else than a place to store files and metadata related to files.
- Event registration ("addEventListener") is inspired by the DOM events model thought it's not directly connected to it.
A template will be provide to developers to write its own activity. This template will include the Sugar HTML Framework.
Daniel has wrote a first template .
HTML activties will be developed in parallel with the framework development.
Manuel has started to port the Clock activity using HTML5 Canvas .
Other services needed
These are identified right now:
- text to speech
- touch support?
- power management (in the clock activity, we need a way to tell the xo don't suspend)