Sugar Architecture: Difference between revisions
No edit summary |
No edit summary |
||
Line 2: | Line 2: | ||
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. |
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. |
||
== |
==Dependencias== |
||
Sugar is mainly coded in python making extensive use of PyGTK/gtk2 (including Pango) and python-dbus/dbus-X11. Other dependencies are |
Sugar is mainly coded in python making extensive use of PyGTK/gtk2 (including Pango) and python-dbus/dbus-X11. Other dependencies are |
||
Line 22: | Line 22: | ||
== |
== Componentes == |
||
In order to understand how these components map to the user-visible elements, familiarity with [[OLPC Human Interface Guidelines]] is required. |
In order to understand how these components map to the user-visible elements, familiarity with [[OLPC Human Interface Guidelines]] is required. |
||
Line 49: | Line 49: | ||
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]]. |
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]]. |
||
=== |
=== Actividades === |
||
What are called applications or programs in other environments, are activities in Sugar, see [[OLPC Human Interface Guidelines/Activities]]. |
What are called applications or programs in other environments, are activities in Sugar, see [[OLPC Human Interface Guidelines/Activities]]. |
||
Line 68: | Line 68: | ||
Activities can choose between using the low level APIs presented above, or the higher-level [[Sugar_Architecture#Activity_API]] presented below. |
Activities can choose between using the low level APIs presented above, or the higher-level [[Sugar_Architecture#Activity_API]] presented below. |
||
=== |
=== Servicios de shell === |
||
Code: http://dev.laptop.org/git?p=sugar;a=tree;f=services/shell |
Code: http://dev.laptop.org/git?p=sugar;a=tree;f=services/shell |
||
Line 80: | Line 80: | ||
These services are offered as D-Bus interfaces. |
These services are offered as D-Bus interfaces. |
||
=== |
=== Diario === |
||
Code: http://dev.laptop.org/git?p=journal-activity;a=tree |
Code: http://dev.laptop.org/git?p=journal-activity;a=tree |
||
Line 88: | Line 88: | ||
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. |
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. |
||
=== |
=== Servicios de datastore === |
||
Code: http://dev.laptop.org/git?p=projects/datastore;a=tree |
Code: http://dev.laptop.org/git?p=projects/datastore;a=tree |
||
Line 94: | Line 94: | ||
Provides activities with a way to store data and metadata and the journal with means for querying, including full text search. |
Provides activities with a way to store data and metadata and the journal with means for querying, including full text search. |
||
=== |
=== Presencia de servicios === |
||
Code: http://dev.laptop.org/git?p=projects/presence-service;a=tree |
Code: http://dev.laptop.org/git?p=projects/presence-service;a=tree |
||
Line 100: | Line 100: | ||
See [[Presence Service]]. |
See [[Presence Service]]. |
||
=== |
=== Actividades del API === |
||
Code: http://dev.laptop.org/git?p=sugar;a=tree;f=lib |
Code: http://dev.laptop.org/git?p=sugar;a=tree;f=lib |
||
Line 119: | Line 119: | ||
* clipboard: wrapper around the clipboard service in [[Sugar_Architecture#Shell_service]], instead of accessing the clipboard through this module, activities should make use of the X selection mechanism, see http://en.wikipedia.org/wiki/X_Window_selection. Activities using PyGTK can use [http://www.pygtk.org/pygtk2reference/class-gtkclipboard.html gtk.Clipboard], see also [http://www.pygtk.org/pygtk2tutorial/ch-NewInPyGTK2.2.html#sec-Clipboards Clipboards]. |
* clipboard: wrapper around the clipboard service in [[Sugar_Architecture#Shell_service]], instead of accessing the clipboard through this module, activities should make use of the X selection mechanism, see http://en.wikipedia.org/wiki/X_Window_selection. Activities using PyGTK can use [http://www.pygtk.org/pygtk2reference/class-gtkclipboard.html gtk.Clipboard], see also [http://www.pygtk.org/pygtk2tutorial/ch-NewInPyGTK2.2.html#sec-Clipboards Clipboards]. |
||
== |
== Especificaciones == |
||
* [[OLPC_Human_Interface_Guidelines|Human Interface guidelines]] |
* [[OLPC_Human_Interface_Guidelines|Human Interface guidelines]] |
||
Line 131: | Line 131: | ||
* [[HippoCanvas]]: Cairo drawing and UI layout widget |
* [[HippoCanvas]]: Cairo drawing and UI layout widget |
||
== |
== Paquetes de terceros == |
||
* [http://www.avahi.org/wiki/ProgrammingDocs Avahi] service discovery layer |
* [http://www.avahi.org/wiki/ProgrammingDocs Avahi] service discovery layer |
||
* [http://cairographics.org/documentation Cairo] 2D graphics library ([http://cairographics.org/pycairo Python interface]) |
* [http://cairographics.org/documentation Cairo] 2D graphics library ([http://cairographics.org/pycairo Python interface]) |
||
Line 138: | Line 138: | ||
* [http://dbus.freedesktop.org/doc/dbus-tutorial.html D-Bus] interprocess communications system ([http://dbus.freedesktop.org/doc/dbus-python/doc/tutorial.html Python interface]) |
* [http://dbus.freedesktop.org/doc/dbus-tutorial.html D-Bus] interprocess communications system ([http://dbus.freedesktop.org/doc/dbus-python/doc/tutorial.html Python interface]) |
||
== |
== Vínculos y referencias == |
||
[http://www.python.org/doc/ Python Documentation] |
[http://www.python.org/doc/ Python Documentation] |
||
Revision as of 05:08, 29 May 2011
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.
Dependencias
Sugar is mainly coded in python making extensive use of PyGTK/gtk2 (including Pango) and python-dbus/dbus-X11. Other dependencies are
- avahi-daemon
- matchbox-window-manager
- network-manager
- python-avahi
- python-cairo
- python-central
- python-gnome2-desktop
- python-hippocanvas
- python-json
- python-numpy
- telepathy-stream-engine
- gstreamer
- rsvg
- xapian
- vte
Componentes
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.
Actividades
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:
- a top level X window with some predefined properties, see Low-level Activity API#X Properties,
- behaves properly when running inside Rainbow, see Low-level_Activity_API#Security,
- saves its state to the Datastore when needed, see Low-level_Activity_API#Datastore,
- can resume that state so the user is confronted with the same state as when the activity was closed,
- provides a D-Bus service that the shell can use, see Low-level_Activity_API#D-Bus_Methods,
- can collaborate, that means that its state is shared between several instances running each on an XO, see Low-level_Activity_API#Presence.
Activities can choose between using the low level APIs presented above, or the higher-level Sugar_Architecture#Activity_API presented below.
Servicios de shell
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.
Diario
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.
Servicios de datastore
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.
Presencia de servicios
Code: http://dev.laptop.org/git?p=projects/presence-service;a=tree
See Presence Service.
Actividades del 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:
- activity: contains a base Activity class for activities to subclass, see Activity_tutorial,
- graphics: provides gtk-based widgets that integrate better with Sugar,
- presence: wrapper around the Sugar_Architecture#Presence_service,
- datastore: wrapper around the Sugar_Architecture#Datastore_service,
- bundle: provides functionality for manipulating Bundles,
- clipboard: wrapper around the clipboard service in Sugar_Architecture#Shell_service, instead of accessing the clipboard through this module, activities should make use of the X selection mechanism, see http://en.wikipedia.org/wiki/X_Window_selection. Activities using PyGTK can use gtk.Clipboard, see also Clipboards.
Especificaciones
API
- Low-level Activity API
- Presence Service DBus API
- HippoCanvas: Cairo drawing and UI layout widget
Paquetes de terceros
- Avahi service discovery layer
- Cairo 2D graphics library (Python interface)
- Pango text layout library (Python interface)
- GTK+ user interface (Python interface)
- D-Bus interprocess communications system (Python interface)