Developers/Stack: Difference between revisions

From OLPC
Jump to navigation Jump to search
(Added translation templates)
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Developers}}
{{Developers}}
{{Translations}}
[[Developers/Setup|Previous]] [[Developers/Issues|Next]]
[[Developers/Setup|Previous]] [[Developers/Issues|Next]]


Line 28: Line 29:
== Smalltalk/Etoys ==
== Smalltalk/Etoys ==


[[Etoys]] is a kids application written in Squeak an open-source Smalltalk development environment. Smalltalk is one a first object-oriented language, that is, it has been in use for decades, and as a result has a huge body of components and pre-built content and resources that can be used to create new activities.
[[Etoys]] is a kids application written in Squeak, an open-source Smalltalk development environment. Smalltalk is one of the first object-oriented languages, that is, it has been in use for decades, and as a result has a huge body of components and pre-built content and resources that can be used to create new activities.


The Etoys environment is easily scripted via GUI interactions, and components have access to all of the special hardware features on the laptop. You can often create fascinating projects and useful demonstrations with just a few mouse clicks and a bit of simple logic.
The Etoys environment is easily scripted via GUI interactions, and components have access to all of the special hardware features on the laptop. You can often create fascinating projects and useful demonstrations with just a few mouse clicks and a bit of simple logic.
Line 46: Line 47:
See: ??? to start using XULRunner/Web Control to develop for the OLPC.
See: ??? to start using XULRunner/Web Control to develop for the OLPC.


== Python/PyGTK ==
<span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">== Python/PyGTK == Python and GTK based activities are the "standard" way to write software for the OLPC.</span> == Python / PyGTK == Python y GTK son las actividades basadas en el "estándar" para escribir software para el OLPC.</span> <span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">Using Python and PyGTK is strongly encouraged so that the "View Source" button will normally show the same language wherever the user invokes it.</span> PyGTK usando Python y se alienta a fin de que la "Ver código fuente" botón, se muestran normalmente el mismo idioma cuando el usuario invoca.</span> <span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">The use of the same language throughout also means that code can often be factored out of one project to be shared with another. The support for writing activities provided by the core Sugar system (which is itself largely written in Python) is almost always exposed first through Python libraries.</span> El uso de la misma lengua en todo también significa que el código puede ser a menudo un factor de un proyecto para ser compartida con otra. El apoyo para la escritura de las actividades previstas por el sistema básico de azúcar (que es en sí mismo en gran medida por escrito en Python) es casi siempre expuestos primero a través de las bibliotecas de Python.</span> <span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">On the Sugar platform, PyGTK has access to the following major libraries: * [[Cairo]] -- high performance postscript-like library for drawing vector graphics, with the RSVG SVG-rendering library * [[Pango]] -- flexible text layout system capable of dealing with complex internationalization issues * [[D-BUS]] -- inter-process communications * Telepathy -- inter-machine RPC and presence management with network traversal and discovery logic (activities are encouraged to use Telepathy's Tubes where practical) * [http://numpy.scipy.org/ NumPy] -- standard high performance numeric analysis and array-handling module * [[CSound]] -- acoustically modelled sound-synthesis engine (seen in the [[TamTam]] activity) * [[GStreamer]] -- general purpose media streaming platform, used for accessing the video camera and playing media * [[IPython]] -- enhanced interactive Python interpreter with syntax highlighting, command-completion and the like GTK Controls: * [[Web]] Browser Control ([[HulaHop]]) -- Gecko 1.9 web browser as a simple embeddable control with Python DOM access * [[Write|AbiWord]]/AbiCollab Control -- AbiWord word processor as an embeddable control with the ability to collaboratively edit with another user ** This version of AbiWord also includes support for syntax-colouring collaborative source-code editing * [[Evince]] Control -- PDF and EBook-reading control * [[#OLPCGames|Pygame]] -- game development engine based on SDL (see OLPCGames), not exactly a control, but close... in addition to the Python standard library, which includes rather a lot of built-in functionality.</span> Azúcar en la plataforma, PyGTK tiene acceso a las siguientes bibliotecas: * [[El Cairo]] - PostScript de alto rendimiento-como biblioteca para la preparación de gráficos vectoriales, con la prestación RSVG SVG-biblioteca * [[Pango]] - la flexibilización del texto diseño de sistema capaz de hacer frente a cuestiones complejas internacionalización * [[D-BUS]] - comunicación entre procesos * Telepatía - entre RPC-máquina y la presencia de gestión de red con la lógica transversal y el descubrimiento (actividades son fomentar el uso de los tubos donde la Telepatía práctica ) * [http://numpy.scipy.org/ NumPy] - estándar de alto rendimiento y análisis numérico arreglo de módulo de gestión de * [[CSound]] - acústicamente el modelo de síntesis de sonido del motor (ver en la [[TamTam]] actividad) * [[GStreamer]] - de propósito general los medios de comunicación la plataforma de streaming, utilizado para acceder a la cámara de vídeo y reproducción de medios de comunicación * [[IPython]] - mayor intérprete interactivo de Python con resaltado de sintaxis, de mando y la realización como GTK Controles: * [[Web]] del navegador de Control ([[HulaHop]]) - Gecko 1.9 como navegador web de un simple control de incrustables con Python DOM acceso * [[Escriba | AbiWord]] / AbiCollab Control - procesador de textos AbiWord incrustables como un control con la capacidad de editar en colaboración con otro usuario ** Esta versión de AbiWord también incluye soporte para la coloración de sintaxis-de colaboración de edición de código fuente * [[Evince]] Control - EBook PDF y el control de lectura * [[# OLPCGames | Pygame] ] - motor de desarrollo de juegos basados en SDL (véase OLPCGames), no exactamente un control, pero cerca ... además de la biblioteca estándar de Python, que no incluye una gran cantidad de una funcionalidad.</span> <span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">One key standard library module is the SQLite database engine, which provides a basic single-user SQL database which can be used by activities for storage. See: [[API Reference]] for a more exhaustive set of pointers to libraries available with links to their documentation See: [[Activity tutorial]] to develop in Python (with PyGTK) for the OLPC. Activities can use common Python extensions which are installed into their Activity directory.</span> Una norma fundamental es el módulo de biblioteca de motor de base de datos SQLite, que proporciona una base única de usuarios de bases de datos SQL que puede ser utilizado por las actividades de almacenamiento. Véase: [[Referencia de la API]] para un conjunto más exhaustivo de enlaces a bibliotecas disponibles con enlaces a Consulte su documentación: [[Actividad tutorial]] para desarrollar en Python (con PyGTK) para el OLPC. Las actividades comunes pueden usar las extensiones de Python que se instala en su directorio de la actividad.</span> <span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">You may also consider rewriting areas that profiling say are problems in your activity as [[#Low Level|C extensions]].</span> También puede considerar la reescritura de las zonas de perfiles decir que son problemas en su actividad como [[# Bajo Nivel | C extensiones]].</span> <span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">This can save both processor load and memory depending on the nature of the extension.</span> Esto puede ahorrar la carga del procesador y la memoria en función de la naturaleza de la prórroga.</span> <span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">Keep in mind, though, that premature optimization is generally not a good idea; code first, optimize later.</span> Tenga en cuenta, sin embargo, que la optimización prematura no es generalmente una buena idea; código en primer lugar, optimizar más tarde.</span> <span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">You can also use extensions to wrap already-existing activities (those not normally Sugar or Python based) by creating a GTK control wrapping your activity's core. See: [[#Low Level]] for a discussion of extensions lower-level programming-language issues === OLPCGames === [[Pygame]] is a high-level wrapper around the C [[SDL]] library, which provides low-level support for developing games.</span> También puede utilizar las extensiones para envolver las actividades ya existentes (las que normalmente no basado en Python o azúcar) mediante la creación de un GTK envolver su actividad de control del núcleo. Véase: [[# Bajo Nivel]] para una discusión de las prórrogas de menor nivel de programación en idioma cuestiones OLPCGames === === [[Pygame]] es un alto nivel de todo el envoltorio C [[SDL]] biblioteca, que dispone de bajo nivel de apoyo para el desarrollo de juegos.</span> <span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">Pygame allows you to easily create raster (pixel-based) graphics for games with reasonable performance thanks to SDL. [[OLPCGames]] is a Python package which allows you to create Sugar Activities using Pygame with access to the special features of the laptop.</span> Pygame le permite crear fácilmente trama (basada en píxeles) de gráficos para juegos con un grado razonable de rendimiento gracias a SDL. [[OLPCGames]] es un paquete Python que permite crear actividades utilizando azúcar Pygame con acceso a las características especiales de la portátil.</span> <span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">This includes the Telepathy presence and communications infrastructure and the Pango/Cairo graphics capabilities. See: [[Game development HOWTO]] to start using Python, Pygame and OLPCGames to develop for the OLPC. See: [[Game templates]] for a set of simple templates intended to allow students to create "genres" of games easily</span> Esto incluye la presencia Telepatía y la infraestructura de comunicaciones y el Pango / El Cairo capacidades gráficas. Véase: [[Juego desarrollo HOWTO]] para empezar a utilizar Python, Pygame y OLPCGames a desarrollar para la OLPC. Véase: [[Juego de plantillas de]] para un conjunto sencillo de las plantillas destinadas a permitir a los estudiantes a crear "géneros" de juegos de fácil</span>

Python and GTK based activities are the "standard" way to write software for the OLPC. Using Python and PyGTK is strongly encouraged so that the "View Source" button will normally show the same language wherever the user invokes it. The use of the same language throughout also means that code can often be factored out of one project to be shared with another.

The support for writing activities provided by the core Sugar system (which is itself largely written in Python) is almost always exposed first through Python libraries. On the Sugar platform, PyGTK has access to the following major libraries:

* [[Cairo]] -- high performance postscript-like library for drawing vector graphics, with the RSVG SVG-rendering library
* [[Pango]] -- flexible text layout system capable of dealing with complex internationalization issues
* [[D-BUS]] -- inter-process communications
* Telepathy -- inter-machine RPC and presence management with network traversal and discovery logic (activities are encouraged to use Telepathy's Tubes where practical)
* [http://numpy.scipy.org/ NumPy] -- standard high performance numeric analysis and array-handling module
* [[CSound]] -- acoustically modelled sound-synthesis engine (seen in the [[TamTam]] activity)
* [[GStreamer]] -- general purpose media streaming platform, used for accessing the video camera and playing media
* [[IPython]] -- enhanced interactive Python interpreter with syntax highlighting, command-completion and the like

GTK Controls:

* [[Web]] Browser Control ([[HulaHop]]) -- Gecko 1.9 web browser as a simple embeddable control with Python DOM access
* [[Write|AbiWord]]/AbiCollab Control -- AbiWord word processor as an embeddable control with the ability to collaboratively edit with another user
** This version of AbiWord also includes support for syntax-colouring and collaborative source-code editing
* [[Evince]] Control -- PDF and EBook-reading control
* [[#OLPCGames|Pygame]] -- game development engine based on SDL (see OLPCGames), not exactly a control, but close...

in addition to the Python standard library, which includes rather a lot of built-in functionality. One key standard library module is the SQLite database engine, which provides a basic single-user SQL database which can be used by activities for storage.

See: [[API Reference]] for a more exhaustive set of pointers to libraries available with links to their documentation

See: [[Activity tutorial]] to develop in Python (with PyGTK) for the OLPC.

Activities can use common Python extensions which are installed into their Activity directory. You may also consider rewriting areas that profiling say are problems in your activity as [[#Low Level|C extensions]]. This can save both processor load and memory depending on the nature of the extension. Keep in mind, though, that premature optimization is generally not a good idea; code first, optimize later. You can also use extensions to wrap already-existing activities (those not normally Sugar or Python based) by creating a GTK control wrapping your activity's core.

See: [[#Low Level]] for a discussion of extensions lower-level programming-language issues

=== OLPCGames ===

[[Pygame]] is a high-level wrapper around the C [[SDL]] library, which provides low-level support for developing games. Pygame allows you to easily create raster (pixel-based) graphics for games with reasonable performance thanks to SDL.

[[OLPCGames]] is a Python package which allows you to create Sugar Activities using Pygame with access to the special features of the laptop. This includes the Telepathy presence and communications infrastructure and the Pango/Cairo graphics capabilities.

See: [[Game development HOWTO]] to start using Python, Pygame and OLPCGames to develop for the OLPC.

See: [[Game templates]] for a set of simple templates intended to allow students to create "genres" of games easily

See also [http://wiki.sugarlabs.org/go/Development_Team/Sugargame Sugargame], a different implementation.


== Flash ==
== Flash ==

Latest revision as of 04:53, 22 May 2011

  Please copy/paste "{{Translationlist | xx | origlang=en | translated={{{translated}}}}}" (where xx is ISO 639 language code for your translation) to Developers/Stack/translations HowTo [ID# 256294]  +/-  

Previous Next

There are a number of approaches (software stacks) to develop software for the OLPC environment. The stack you choose will strongly influence what type of setup you need and what your actual development process will look like.

Basic Platform

See also Software components for another discussion of the software installed on the OLPC.

The normal OLPC Operating stack looks like this:

  • Hardware -- Normally an OLPC-XO, but could be another machine with Sugar installed, or cross compiled.
  • Fedora Core 7 based Operating System, heavily modified
    • Linux Kernel (2.6.22 with some patches as of 2007-12-15)
  • X Window System - standard X11 display technology
  • Matchbox - graphical windows manager
  • Bitfrost -- Security System
  • D-BUS Services -- various platform-specific services (most XO-specific hardware/operations are exposed via D-BUS)
  • Sugar -- GUI Shell (desktop)

Activity Development Stacks

This section attempts to describe the major Activity development stacks available in the OLPC Sugar environment.

Smalltalk/Etoys

Etoys is a kids application written in Squeak, an open-source Smalltalk development environment. Smalltalk is one of the first object-oriented languages, that is, it has been in use for decades, and as a result has a huge body of components and pre-built content and resources that can be used to create new activities.

The Etoys environment is easily scripted via GUI interactions, and components have access to all of the special hardware features on the laptop. You can often create fascinating projects and useful demonstrations with just a few mouse clicks and a bit of simple logic.

See: Smalltalk Development on XO to start using Squeak to develop for the OLPC.

Browser

Sugar includes a Mozilla-Firefox-derived (Gecko) Web Browser Activity. This browser includes HTML, XHTML, Javascript and SVG support. You can set up simple web-servers on a laptop using Python, or children may access an application hosted on a public web server (but keep in mind that children often have very poor connectivity).

You can develop for this platform with no particular hardware or setup, and can test using regular Firefox during initial stages. It is easy to port work from elsewhere into this stack, and easy to export your work for use outside of the OLPC project. The environment is, however, rather constrained, without access to most of the special hardware or software components on the laptop.

Browser Component

The built-in Browser is actually just a thin wrapper around the Gecko control. You can use the Gecko control yourself and create web-browser derived activities, either using XUL or Python/PyGTK to instantiate the browser. This gives your Activity access to system services and hardware, at the cost of considerably more complexity.

See: ??? to start using XULRunner/Web Control to develop for the OLPC.

Python/PyGTK

Python and GTK based activities are the "standard" way to write software for the OLPC. Using Python and PyGTK is strongly encouraged so that the "View Source" button will normally show the same language wherever the user invokes it. The use of the same language throughout also means that code can often be factored out of one project to be shared with another.

The support for writing activities provided by the core Sugar system (which is itself largely written in Python) is almost always exposed first through Python libraries. On the Sugar platform, PyGTK has access to the following major libraries:

  • Cairo -- high performance postscript-like library for drawing vector graphics, with the RSVG SVG-rendering library
  • Pango -- flexible text layout system capable of dealing with complex internationalization issues
  • D-BUS -- inter-process communications
  • Telepathy -- inter-machine RPC and presence management with network traversal and discovery logic (activities are encouraged to use Telepathy's Tubes where practical)
  • NumPy -- standard high performance numeric analysis and array-handling module
  • CSound -- acoustically modelled sound-synthesis engine (seen in the TamTam activity)
  • GStreamer -- general purpose media streaming platform, used for accessing the video camera and playing media
  • IPython -- enhanced interactive Python interpreter with syntax highlighting, command-completion and the like

GTK Controls:

  • Web Browser Control (HulaHop) -- Gecko 1.9 web browser as a simple embeddable control with Python DOM access
  • AbiWord/AbiCollab Control -- AbiWord word processor as an embeddable control with the ability to collaboratively edit with another user
    • This version of AbiWord also includes support for syntax-colouring and collaborative source-code editing
  • Evince Control -- PDF and EBook-reading control
  • Pygame -- game development engine based on SDL (see OLPCGames), not exactly a control, but close...

in addition to the Python standard library, which includes rather a lot of built-in functionality. One key standard library module is the SQLite database engine, which provides a basic single-user SQL database which can be used by activities for storage.

See: API Reference for a more exhaustive set of pointers to libraries available with links to their documentation

See: Activity tutorial to develop in Python (with PyGTK) for the OLPC.

Activities can use common Python extensions which are installed into their Activity directory. You may also consider rewriting areas that profiling say are problems in your activity as C extensions. This can save both processor load and memory depending on the nature of the extension. Keep in mind, though, that premature optimization is generally not a good idea; code first, optimize later. You can also use extensions to wrap already-existing activities (those not normally Sugar or Python based) by creating a GTK control wrapping your activity's core.

See: #Low Level for a discussion of extensions lower-level programming-language issues

OLPCGames

Pygame is a high-level wrapper around the C SDL library, which provides low-level support for developing games. Pygame allows you to easily create raster (pixel-based) graphics for games with reasonable performance thanks to SDL.

OLPCGames is a Python package which allows you to create Sugar Activities using Pygame with access to the special features of the laptop. This includes the Telepathy presence and communications infrastructure and the Pango/Cairo graphics capabilities.

See: Game development HOWTO to start using Python, Pygame and OLPCGames to develop for the OLPC.

See: Game templates for a set of simple templates intended to allow students to create "genres" of games easily

See also Sugargame, a different implementation.

Flash

Sugar includes the Gnash engine by default, and the Adobe Flash playing engine can be installed. At the moment we do not have a Flash authoring tool that can be distributed on the laptops, however. If you have Flash-based content, it may be possible to simply run it on Gnash on Sugar.

Low Level

Being a regular Fedora 7 Linux machine, the OLPC-XO can run regular Linux i386 executables. However, integration with the Sugar shell is currently a non-trivial exercise. It is often easier to wrap your C/C++/Assembly/Whatever activity in a (normally Python) wrapper than to attempt to implement the entire Low-level Activity API yourself.

See: Low-level Activity API for the most extensive and up-to-date available discussion of how to integrate a low-level activity manually

See: Sugarizing for a (somewhat fragmentary) discussion of how to wrap an existing native-code executable/library with a Python wrapper.

See: Sugarize Demo for a shared library loader hack that provides much of the X11-level functionality for general X11 activities, allowing them to be run largely unchanged on the XO. Most of the special features of the laptop will not be available, but this approach allows for quick porting/testing of activities.

When coding in Python, you will occasionally want access to a C or C++ extension, either one already written, or one written to optimize some part of your activity. You can build these extensions for use under Sugar by using the normal Python distutils with GCC tool chain.

Make sure that you are aware (and respect) the Geode instruction set. It is about the same as the original Athlon instruction set. See the Geode data book linked in the Geode instruction set page.

The best (most reliable and compatible) approach is generally to compile on an official image, using Yum to install the tools required. Doing this on an actual XO, however, is probably not a good idea, as compilation will tend to cause lots of writes to the disk and reduce the longevity of your flash storage chip.

See: Emulation for Compilation for a tip on how to compile using emulation

Common Libraries Not Available

While the Sugar environment is rich, it cannot include every possible library or extension and still fit in 200MB. The following extremely common libraries are not available by default:

  • OpenGL/MESA
  • Server-based relational databases (MySQL, PostgreSQL)
  • Qt/KDE
  • Gnome
  • Many Kernel-level Linux Drivers (you can build missing drivers yourself, preferably in a throw-away emulator overlay)

Previous Next

See also

  • Java includes a discussion of why java is not available and the prospects for including it (summary: open source Java was not available until recently, and now that it is, work remains to be done to remove the bloat and to make the user experience compatible with the Sugar windowless paradigm).