Etoys, Squeak and Sugar

Wednesday, February 24, 2010

Free Squeak Coming

The Squeak Oversight Board plans to finalize the multi-year effort of re-licensing Squeak. Squeak 4.0 is scheduled to be released on Monday, March 15th, 2010 and will be licensed under the MIT License with some original parts remaining under the Apache License.

Further details are on the Squeak Oversight Board page.

Saturday, January 9, 2010

DBus and Etoys DBus interface

This post is a bit of a digression from Etoys and Sugar Activities interface. It describes a fun use of the Etoys and Squeak interface to DBus. DBus is a crucial link that allows Squeak and the underlying operating system interact at the low level. DBus bindings for Squeak are available on, and can be used to interface with, for example, KDE or Gnome desktop components. Below you will find some screenshots of how DBus console in Etoys can manipulate DBus enabled components in an operating system.

If you want to experiment with Etoys DBus console, you can do it either on Sugar or Linux (technically any OS with DBus!). I figure most people reading this run Linux, so it may be more useful to show screenshots on Linux.

1. First, some terms, links, and installation notes:

1.1 DBus

DBus is a message bus system for inter-process communication. It is part of the Freedesktop specs. "It is supported on most POSIX operating systems, and a port for Windows exists" [1]. Some DBus links:

1.2 DBus interface for Squeak / Etoys

DBus bindings for Squeak was written by Jan Fietz of Impara and Bert Freudenberg and was sponsored by Viewpoints research for the OLPC project (see and DBus for Squeak download site [4]

1.3 If you want to follow steps below hands-on, you need to have:
  • A DBus installed in Squeak image, or the latest Etoys image. You can install DBus into Squeak from the squeaksource link above. The simpliest way to obtain a DBus enabled image is to download Etoys-To-Go from One note: if you are on 64-bit Linux as I am, and want to use Etoys-To-Go, you have to modify Etoys-To-Go file and change the line defining CPU to be CPU=i686.
  • DBus server running in your OS. Without too much detail, if you are on Linux, you will have DBus. The screenshots below are from KDE.

2. Playing with Squeak/Etoys DBus Explorer (screenshots below from Etoys-To-Go and Linux KDE)

2.1 Start DBusConsole from Squeak/Etoys .

Open your Squeak/Etoys image (Squeak with DBus installed or Etoys-To-Go for simplicity, see above). Open a Workspace. In Etoys, enter Alt-Shift-W with cursor on Squeak desktop. The "World Menu" comes up. In the World Menu, click Open. The "Open Menu" will come up. In this menu, click "Workspace".In Workspace, type:

DBusExplorer new inAWindow openInWorld.

2.2 Highlight what you typed above and click do-it (CTRL-D in Etoys).

The DBusConsole will open, with two channels, a System bus and a Session bus:

2.3 Start konsole (terminal) from your KDE desktop:

(Other DBus-enabled desktops and applications can be manipulated)

2.4 org.kde.konsole and it's DBus interface shows in Etoys DBusConsole

2.5 Expand org.kde.konsole and navigate through konsole/mainWindow_1/actions/file_quit to see it's actions available via DBus.

Click on com.trolltech.QAction.trigger.

You have just called, from Etoys, "quit action" on DBus enabled operating system component, and the konsole disappeared (screenshot shown before action triggered).

2.6 Now start konsole again, and navigate to the konsole/mainWindow_1/setCaption

Click on set Caption, a popup window will show, asking to enter parameters. Write some text (I typed "Changed From Squeak") , and the konsole descritopn on top changes:

3. Obviously, the above is just a very simple application of what can be done from Squeak / Etoys via it's DBus interface. 

In principle, the DBus interface allows Squeak to write components and interface with components, on any DBus enables operating system! (similar to what can be done with, for example, Python)

Saturday, December 26, 2009

Using Etoys to Develop XO Sugar Activities

This blog describes how to use Etoys to develop a XO Sugar Activity. Let me start with a FAQ.

Blog FAQs - Using Etoys to Develop XO Sugar Activities

February 2010 
  • added a note about different ways of installing the Sugar Operating System
  • added a note about Etoys and Squeak
What is the Goal of this Blog?

This blog will talk about development of Sugar Activities in Etoys; it will also provide introduction to Squeak/Etoys interface to DBus.

There are several Etoys components which could be converted to Sugar activities by using the approach described in future entries. The example that will be used is FreeCell, see

How did this Blog Start?

Bert Freudenberg converted the Squeak Freecell activity into a Sugar activity, and suggested to add persistence of the Freecell activity statistics. The persistence will use the Etoys DBus interface. Bert also provided many of the suggestions how to do it :)

What is "Sugar"?

Sugar is the main operating system for the OLPC XO, centered on education. See

What is "Squeak"?

Squeak is a FOSS implementation of Smalltalk, which goal is to create a multimedia rich environment. See Squeak home page for details.

What is "Etoys"?

Etoys is a multimedia environment running on top of Squeak. It is distributes as a core activity on the Sugar OS.

From Squeakland, the home of Etoys:

"Etoys is . . .
  • an educational tool for teaching children powerful ideas in compelling ways
  • a media-rich authoring environment and visual programming system
  • a free software program that works on almost all personal computers"
How to install and run Sugar?

The Sugar Operating system runs on multiple systems, or as a alternate desktop on some Linux distros.

Four ways to run Sugar (which does contain Etoys as a core activity):
    1. On the OLPC-XO laptop, Sugar is preinstalled - but not everyone has an OLPC laptop.
    2. Install Sugar on a USB stick from Sugarlabs (Windows, Apple, Linux, Unix).
    3. Run Sugar as alternate desktop (on Linux only) - see section "Are you a developer or Beta tester?" on sugarlabs.
    4. Run Sugar under Emulation on your operating system (Windows, Apple, Linux, Unix). I am running Sugar on VirtualBox emulator using Sugar blueberry version, so I will provide a few steps how to set it up:
    • Install VirtualBox. All Linux distros have VirtualBox available, for Window you can find it here:
    • Download Sugar Blueberry vdi here: . Click on the Prebuilt vdi: [1].
    • Unzip the vdi file and put it into a directory. Do not worry it is not 4Gb in size :)
    • Start VirtualBox and create a New Virtual Machine by clicking New, providing name, for example Sugar Blueberry VM, and pointing to the above blueberry VDI file.
    • Add networking to the Sugar Blueberry Virtual machine (VM). This is not absolutely necessary, but very helpful because it allows to use either FTP or SSH to copy files between your host OS and the vitrual machine. To connect the VM to your network , right click on the Blueberry VM, select a Adapter type PCnet - Fast III, Attched to = Bridged Adapter , Name = whatever adapter is in the dropdown (eth0 in my case).
    • Now, clicking on the newly created Sugar Blueberry VM, the Sugar OS should start, and present it's menu:

    What is DBus?

    DBus is a message bus system which allows applications to communicate. It is part of the Freedesktop specifications. Some DBus links:

    DBus bindings for Squeak are available on squeaksource, , and can be used to interface with KDE or Gnome desktop in interesting ways. See the above link and also for details.

    Terminology: In the Sugar OS, what is a "Bundle" an "Activity", a "Journal", etc?

    These are Sugar terms describing what other systems would call an "application", "application instance". Brief description of activities and related terms is just below. Unfortunately, it seems there is a bit of a confusion in terminology in Sugar. We will try use the highlighted terms, terms i brackets are alternatives that seem to be also used. Read the symbol "=" as "defined as / equivalent to / similar to".

    Specifications for Sugar Activities can be found on the low level API can be found on
    The low level Activity API dscribes how activities interact with the Sugar OS on startup, exit, and during persistence to Journal.

    Note: To me, Sugar seem to have an unfortunate confusion of terms between what a Bundle and an Activity is. From user's perspective, every application you see in the Sugar menu is Activity. However, from developer's perspective, applications in the Sugar menu are Bundles. For example, you install an .XO file. This creates a Bundle in the filesystem, stored unfortunately in directory named "$HOME/Activity" and named Activity in various tutorials.

    What is "Etoys based Sugar Activity"?

    It is an application which:
    • Is developed in Etoys (perhaps more precisely, in the underlying Squeak Smalltalk environment).
    • Runs in Sugar, allowing interaction with the Datastore.
    • Participates in the Sugar environment, that is, can be saved/resumed in the Sugar Journal, can copy/paste onto a Journal.
    How can an "Etoys based Sugar Activity" be created and distributed?

    Etoys based Sugar Activity can be created and distributed in 2 ways:
    • By creating a "regular Etoys project", which is imported at startup, but without storing anything in Datastore (thus not persistable in Sugar). This would not create a true Sugar Activity, but probably worth trying as a start.
    • By programming the Activity as "individual Squeak classes" which are then exported as a changeset, wrapped as an XO bundle, and re-imported to Etoys on activity startup. The classes state can be programatically stored on Journal via Datastore, using the Squeak Etoys interface to DBus. A typical way to distribute a Smalltalk or Squeak project is to distribute a custom image. Because of space restrictions on Sugar, this is distributing only a script (which contains changeset), that is loaded into the default Etoys image on Activity startup, interacting with Sugar via DBus. This is the method which will be described in this blog.
    What is Etoys Freecell?

    It is the Squeak Freecell game converted into a Sugar activity by Bert Freudenberg. It will be used as an example in some follow up posts: