Changes

New page: Sugar 0.84: What's new for developers The new version of Sugar has made a lot of progress in our goal to encourage the users to appropriate the technology. We don't think it's fine with o...
Sugar 0.84: What's new for developers

The new version of Sugar has made a lot of progress in our goal to
encourage the users to appropriate the technology. We don't think it's
fine with our users to be just consumers so we would like them to feel
empowered to understand how things are done. That's why we have been
working towards making it as easy as possible to modify Sugar itself
to better suit <em>their</em> personal and collective needs.

There are two aspects of Sugar that remove the ceiling about what can
be done with it: it's written in Python and it's distributed as <a
href="http://en.wikipedia.org/wiki/Free_software">Free Software</a>.
Python is an interpreted programming language that is very easy to
understand and modify, and being Free Software means that users have
the rights to use, modify and redistribute it.

Operating under the belief that the separations between code and
content and between consumer and producer are artifacts of the
<em>now</em> traditional software and media industries, we have been
working during the last months on three areas that lower the floor for
people that wish to modify Sugar.

<h2>View source</h2>

In earlier releases, only Etoys and some simple activities like Chat
and Read had some capability of displaying their source code. For
0.84, we have extended to all of them this capability of drilling
deeper on how things are done. It will work better for activities that
are written in an interpreted language like Python, but if a compiled
activity also ships the source code, users will be able to read it
and, since Sugar users are all smart people, understand how it works.

<screenshot>

The authors of activities like Browse and TurtleArt might wish to give
some special <em>drilling</em> capability to their activity, so the
users can see how their programs in TurtleArt would look in Logo, or
curious readers can peek into the HTML code of a web page.

The author of an activity written in Python that wishes to handle all
the view source by herself can override the <a
href="http://api.sugarlabs.org/sugar.activity.activity.Activity-class.html">Activity.handle_view_source</a>
method, thus replacing the standard dialog that would be displayed by
the default implementation. And if it's only intended to provide an
additional source file to the default dialog, then
<a>Activity.get_document_path</a> can be overridden.

Authors of activities written in other languages than Python can
implement the methods <em>org.laptop.Activity.HandleViewSource()</em>
and <em>org.laptop.Activity.GetDocumentPath()</em>, as kindly
documented by Bert Freudenberg <a
href="http://wiki.laptop.org/go/Low-level_Activity_API#D-Bus_Methods">here</a>.

<h2>Extending the Sugar shell</h2>

Extending the shell was never that easy. For example you can extend
the Control Panel by adding a new section, add a new device to the
Frame or define a keyboard shortcut. You only need to put your python
code, following the API guidelines, at a certain place and the
extension is picked up by the shell on startup automatically. The API
is unstable for the moment and will be reviewed in the next release
cycle. Neverless, people have been writing little widgets, like a
clock, for the Frame already. Have a look <a>at</a> on how to do so.

<h2>Using Etoys, Mozilla, Abiword and Evince in your activity</h2>

The <a href="http://wiki.sugarlabs.org/go/DevelopmentTeam/SugarPlatform/0.84">Sugar
platform</a> provides several sets of building blocks.

One of those is Etoys, you have a Squeak virtual machine on which you
can base your activities and also the Etoys environment is available
to give the users of your activity an advanced interactive
environment.

Embedding Mozilla in your activity will give it browser abilities like
rendering html and executing javascript. For python activities, run
'pydoc hulahop' or check out the <a
href="http://git.sugarlabs.org/projects/browse">Browse sources</a>.
Watch out for better integration with the web in 0.86.

Abiword offers a powerful text widget with advanced features like
those found in word processors. But also offers collaboration so
several users of your activity can edit a text buffer simultaneously
across the network. You can base yourself on <a
href="http://git.sugarlabs.org/projects/write">Write's source code</a>
or run 'pydoc abiword'.

Evince is a document viewer that will render PDF, PostScript and other
formats in an area in your activity's window. Python coders can check
'pydoc evince' or see <a
href="http://git.sugarlabs.org/projects/read">Read's source code</a>.

Stop reading nonsense and start coding, you lazy bums! [please suggest
a better final word]