Low-level Activity API: Difference between revisions

From OLPC
Jump to navigation Jump to search
(Initial version)
 
m (add Python API link)
Line 1: Line 1:
Most activities will use the Python API to implement activities. This page will document the underlying mechanism that non-Python activities need to conform to.
Most activities will use the [[Sugar Architecture/API/sugar.activity|Python API]] to implement activities. This page will document the underlying mechanism that non-Python activities need to conform to.


''This documentation effort was started by [[User:Bert|Bert]] while implementing the [[Squeak]]-based [[Etoys]] activity. Please fill in missing pieces and correct mistakes!''
''This documentation effort was started by [[User:Bert|Bert]] while implementing the [[Squeak]]-based [[Etoys]] activity. Please fill in missing pieces and correct mistakes!''

Revision as of 11:41, 14 May 2007

Most activities will use the Python API to implement activities. This page will document the underlying mechanism that non-Python activities need to conform to.

This documentation effort was started by Bert while implementing the Squeak-based Etoys activity. Please fill in missing pieces and correct mistakes!

Overview

An Activity Bundle can specify an executable in the activity.info's exec field. When installing the bundle, the path of this executable will be expanded and added to the list of DBus services in $HOME/.local/share/dbus-1/services/ using the DBus service name as specified in the service_name field. When launching an activity from Sugar shell, a request to that DBus service is made, which makes DBus run the previously specified executable. The executable must create a "factory service" on the DBus using the specified service name.

The most important method the factory service must provide is com.redhat.Sugar.ActivityFactory.create() which spawns an activity instance. Each activity instance has a unique activity_id which is passed as parameter to the create() method.

When the last activity instance exits, the factory service should quit.