Sugar Architecture Temp

From OLPC
Jump to navigation Jump to search
  Please copy/paste "{{Translationlist | xx | origlang=en | translated={{{translated}}}}}" (where xx is ISO 639 language code for your translation) to Sugar Architecture Temp/translations HowTo [ID# 103015]  +/-  

This page describes the components in which Sugar is divided and gives pointers to the relevant parts of the source code. The intention is to give a starting point to the people that want to start hacking on Sugar.

Sugar is mainly coded in python making extensive use of PyGTK and dbus-python. Other dependencies are pango, cairo, telepathy, matchbox, avahi, gstreamer, rsvg, xapian, hippo-canvas, vte, ... TODO: complete this list.

Components

In order to understand how these components map to the user-visible elements, familiarity with OLPC Human Interface Guidelines is required.

Shell

Code: http://dev.laptop.org/git?p=sugar;a=tree;f=shell

The Sugar Shell is the UI component that provides the following services to the user:

  • starting, stopping and joining activities,
  • managing devices (network connection, battery, etc),
  • managing the clipboard,
  • managing groups of buddies.

Basically, all that the user does outside activities is done in the shell.

The shell can be divided in two major components, the Frame and the Home view.

Code: http://dev.laptop.org/git?p=sugar;a=tree;f=shell/view/frame

The frame is implemented as four top level windows that cover the border of the screen when visible. Every side of the frame contains icons organized in trays (gtk.Toolbar). See OLPC Human Interface Guidelines/The Laptop Experience/The Frame.

Code: http://dev.laptop.org/git?p=sugar;a=tree;f=shell/view/home

The home view is a top-level window with the DESKTOP hint. The three zoom levels are implemented as hippo.Canvas embedded in that window. See OLPC Human Interface Guidelines/The Laptop Experience/Zoom Metaphor.

Activities

What are called applications or programs in other environments, are activities in Sugar, see OLPC Human Interface Guidelines/Activities.

Activity authors need to understand how the activity concept is different from traditional applications and how its software can make better use of the Sugar platform.

Activities can happen in isolation or in collaboration with other users.

What is a correct activity from the implementation point of view:

Activities can choose between using the low level APIs presented above, or the higher-level Sugar_Architecture#Activity_API presented below.

Shell service

Code: http://dev.laptop.org/git?p=sugar;a=tree;f=services/shell

The shell service provides the following subservices to the Shell:

  • clipboard: store clippings, this is basically the backend of the clipboard tray in the left frame,
  • activity registry: manages a registry of the installed activities,
  • object type registry: maintains a mapping of mime type to "umbrella" types, these are high level object types like Image, Audio, Video, etc that are used to give the user an uniform view of objects in the clipboard and in the journal.

These services are offered as D-Bus interfaces.

Journal

Code: http://dev.laptop.org/git?p=journal-activity;a=tree

The Journal keeps track of what the user has done with the laptop. Every activity should keep records in the journal so the user can see what has been done in the past and probably resume some past activity.

All this data produced by the activities is kept by the Datastore service, and the journal provides to the user different ways of querying and browsing past works.

Datastore service

Code: http://dev.laptop.org/git?p=projects/datastore;a=tree

Provides activities with a way to store data and metadata and the journal with means for querying, including full text search.

Presence service

Code: http://dev.laptop.org/git?p=projects/presence-service;a=tree

This service allows the shell to

Activity API

Code: http://dev.laptop.org/git?p=sugar;a=tree;f=lib

This API aims to make the development of new activities as simple and straightforward as possible.

Currently it is only available to activities implemented in python, but the plan is to gradually rewrite it in C and make available bindings for different languages.

TODO: link to the activity API pydocs

Contains the following modules:

Specifications

API

Third party packages

Links and references

Python Documentation