Hacking Sugar: Difference between revisions

From OLPC
Jump to navigation Jump to search
Line 130: Line 130:


git clone git://dev.laptop.org/sugar-jhbuild
git clone git://dev.laptop.org/sugar-jhbuild

Sugar need some packages dependencies from your local distribution, let's run a sanity check:

cd sugar-jhbuild
./sugar-jhbuild sanitycheck

Revision as of 01:58, 20 September 2007

Introduction

Hacking Sugar is a public resource for developers that want to get involved in the Sugar Shell development. Here you can find useful information about how to hack/write new sugar components or write external activities and how to integrate them in Sugar.

Sugar is a big opportunity for developers, you can get involved and get the chance to create and improve this wonderful graphical Shell

Motivation

In the latest two years, OLPC has developed and improved a lot of components for the XO platform, including Hardware, Firmwares, Linux Devices Drivers and a graphical shell for kids called Sugar. To start working in a open source project, sometimes it can be a little difficult if you don't have an updated documentation about "how this piece of software works ?", and you have to spent some time reading the source code.

The OLPC project, specially Sugar is changing every day, new API, components, ideas, etc. The main idea of "Hacking Sugar" is to write a collaborative document where you can find the exactly information about your needs and a lot of tips from experienced developers.

Is this document for me ?

Every time that we read some document, we ask our self if "is this document that we want?", so let's do some questions before to spent many hours reading this:

  • do I have a developer skill, if don't, do I would like to have one?
  • do I want to learn a lot of Python, GTK and Sugar Internals ?
  • do I want to contribute and to put a better laptop in the hands of every child ?

well, if you are reading this last line I'm happy that we got a new contributor.

OLPC, a collaborative work

OLPC is a big project, and talking about the software components we can't avoid to talk about how is development done?. OLPC has a main staff of developers, most of them provided by RedHat Inc. and lot of collaborators and volunteers from different countries, and the big part of this job is done through Internet. Let's understand how.

Softwares are in repositories

Repositories are specialized software hosted in central servers that allow to manage different project with a Control Version System, the selected one by OLPC is GIT. So all pieces of softwares of OLPC are hosted in a development server called dev.laptop.org, every piece of software has it's own repository and it's own maintainer and developers. You can browse through the code, look for applied patches, commits, revision changes, etc. A real example about this is here:


About how to get the software from the GIT respositories, do some patch and others, please read this helpful pages:


So if you have in mind to develop some SW, try to install GIT in your local Linux distribution, it's a good step to start ;)

Bug Tracker

As everybody knows, software can have a lot of problems such as special cases with bad validations or security holes that can cause many problems. It's indispensable to file this information in a bug tracker system in order to be sure that every problem has been fixed and which of it's not. Bug trackers allow to assign special problems or task TO-DO to specific developers, in OLPC the tracker system can be found here:

So you have to sign up to the track system and then view/create/comment tickets, report bugs or maybe assign your self some ticket not assigned (it's your opportunity to contribute)

Communication

Share ideas is fundamental, and more important is the opinion from others about it. Communication is the base of every project and is more difficult in this case where the people are around the world, OLPC uses different channels of communications such as:

  • IRC (Internet Relay Chat) - irc.freenode.net #olpc #sugar #olpc-help
  • Mailing List
  • Teleconferences call
  • WiKi! http://wiki.laptop.org

Always you can find someone available to help in the IRC channels, join us!

Help is welcome!

Be creative is important but this ideas are not restricted to "create something new", in Sugar you have two mainly areas where to contribute:

  • Sugar core development
  • Sugar Activities
  • Localization

Sugar Core is not so difficult, but it needs to read some code, there's necessary to build a lot of widgets in order to use them in activities, you can improve the internal API, public ideas about how to speed up some modules, etc. Take a look to the code, you need some Python knowledge, don't feel scared it's just Python!

Activities are external programs to the Sugar Core. They aims to be a PyGTK program Sugarized called activities. You can create an Activity or just "sugarize" a good PyGTK program, in this document we will explain you how.

OLPC is going to different countries, different languages, most of the activities are written in english, do you will like to translate something ??, just do it!

Sugar

Sugar is the core of the OLPC Human Interface. Its goal is to turn the Laptop into a fun, easy to use, social experience that promotes sharing and learning. Our first step is to learn how sugar works, in order to do that, it's necessary to have some basic Python knowledge , if you don't know about python, you can learn about it in http://www.diveintopython.org , please read the book, to do some examples and come back here :) .

Sugar is not a Desktop as Gnome, KDE or XFCE, it's a Graphical Shell for Kids and this shell has been written from scratch following the HIG (Human Interface Guidelines). So every change, feature or new component in the core of sugar must be approved by the designer team.

This great UI (user interface), needs external components to work in a better way (similar to normal Desktops), as base, we need a Linux OS (no restricted distribution) and aditional software as:

  • D-Bus
  • HAL
  • Hippo-Canvas
  • GTK+
  • Avahi
  • Matchox Window Manager
  • Network Manager
  • Others...

How Sugar takes the control?

Talking about code, Sugar is a GTK+ program that require a Windows Manager and a X Server. A main python script called sugar-shell execute the matchbox-window-manager and this last one connect to the X server, and then the script stay in the gtk main loop. Now we have a main window as an UI and have the control. Please take a look to:

Sugar Internals

Setting up a development environment

In order to develop software for Sugar (core or activities) you need a development environment, we have different ways such as:

Emulation Images

OLPC provide every day a system image, you only need to run it inside an emulation software, the recommended one is QEMU, please take a look to this page for more information about how to emulate a XO system image:

Sugar JHBUILD

JHbuild is a tool designed to make building collections of source packages, the main idea is build a piece of software and all it's dependencies in a local directory, setup and environment to work and it avoid to cause problems in the local system. Sugar-JHBuild allow you to have a safe running Sugar environment inside your local desktop. In order to get Sugar running, you need to get sugar-jhbuild and run the 'build' process:

git clone git://dev.laptop.org/sugar-jhbuild

Sugar need some packages dependencies from your local distribution, let's run a sanity check:

cd sugar-jhbuild
./sugar-jhbuild sanitycheck