MarketingTeam/TODO/What's New for Developers/Sugar 0.84

From Sugar Labs
Jump to navigation Jump to search

Sugar 0.84: What's new for developers

With the new version of Sugar, 0.84, we have made a lot of progress in our goal to encourage Sugar users to appropriate the technology. We do not think that our users should be satisfied to be just consumers of Sugar; we would like them to understand how Sugar works and to feel empowered to make improvements. This is why we have been working towards making it as easy as possible for them to modify Sugar such that it is better suited to their personal and collective needs.

There are two aspects of Sugar that are sympathetic to our goal of user modifications: (1) it is written in Python; and (2) it is 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 old software and media industries, we have been working during the last months on three areas that lower the barriers to entry for people that wish to modify Sugar. We call the removing of limits on possibilities, *removing the ceiling*, and the lowering or easing of entry ramps, *lowering the floor* for computing success.

View source

In previous releases, only Etoys and some simple activities such as Chat and Read had the capability of displaying their source code, letting the user drill deep into how the activity works. For 0.84, we have extended this ability to every activity. It works better for activities that are written in an interpreted language, e.g., Python, but if a compiled activity includes the source code, users will be able to “view” it and, since Sugar makes people smarter, they'll be able to understand how it works.

[screenshot from http://wiki.sugarlabs.org/go/DevelopmentTeam/Release/Releases/Sucrose/0.84#View_Source]

The authors of some activities, for example Browse and TurtleArt, provided some additional drilling capability to their activities. The users can see how their Turtle Art programs look as Logo code; 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.Activityclass.html">Activity.handle_view_source</a> method, thus replacing the standard dialog by an activity-specific implementation. And for providing an additional code representation like HTML or Logo, then <a>Activity.get_document_path</a> can be overridden to provide a file path to it.

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

Extending the Sugar shell

Extending the shell was never that easy. For example you can extend the Control Panel by adding a new section, adding a new device to the Frame, or defining a new 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. Nevertheless, people have been writing little widgets, like a clock, for the Frame already. Have a look <a>at</a> on how to do so.

Using Etoys, Mozilla, Abiword, and Evince in your activity

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 into 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>. You can watch for even better integration with the web in Sugar 0.86.

Abiword offers a powerful text processing widget with advanced features like those found in word processors. It also offers collaboration that allows several users of your activity to edit a text buffer simultaneously across the network. You can base your work 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 document formats within an area of 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>.

And now, stop reading nonsense and start coding, you lazy potential hackers!