GCompris in sugar ?

Bruno Coudoin bruno.coudoin at free.fr
Thu Feb 1 18:14:56 EST 2007


Le jeudi 01 février 2007 à 17:09 -0500, Marco Pesenti Gritti a écrit :
> On Thu, 2007-02-01 at 21:15 +0100, Yves Combe wrote:
> I guess my question is... would it possible to integrate GCompris, or
> some of the GCompris boards with sugar as activities (which doesn't
> necessarily imply mesh support)?
> I think it's by far a more interesting question, and I'd love to see it
> happen.

If you have the gnomecanvas and it's python bindings, then one approach
could be to port GCompris python boards as sugar activity. This means,
also creating a subset of the GCompris core in python.

Let's take a real exemple, the electric activity
(src/boards/python/electric.py):
http://gcompris.net/en-electric

This activity requires the gnucap binary, the python gnomecanvas and
calls these functions from the GCompris core:

gcompris.bar_set()
gcompris.bar_set_level()
Our control bar is part of the core, we use it display the difficulty
level. The bar could be rewritten in python or removed and we could
replace this by sugar interactions.


gcompris.set_background()
This set the background image. its a couple lines of code to rewrite
this in python.

gcompris.utils.load_pixmap() (90% of the calls)
The most used function, it just load an image from disk. One line in
python to do the same.

gcompris.skin.image_to_skin()
We have a skin system, that can be simply skipped by using fixed path in
image loading.

gcompris.utils.dialog()
Display an image that looks like a modal dialog box. easy to rewrite one
but can be removed, it's mostly use for error case that should not
happen on a close system like the olpc. There is perhaps a central
console in sugar that could get these messages.

gcompris.bonus.board_finished()
Display a cute image as a bonus, can be rewrite easily or removed.

gcompris.set_cursor()
It's a few lines of code in C/GTK to to this, it is probably more easy
to do in python. Can be skipped.


As you see, we are not so dependent on GCompris core. Just providing a
python load_pixmap() equivalent and commenting the other functions
should be enough to have a functional and independent electricity
activity.

Clearly, this path is a fork and we won't share code but if this can
bring some nice activities to the OLPC, on our side, we will support
you.

There is another slightly different approach, we could add a native
python GCompris core API so that we will stay close in most cases.

-- 
Bruno Coudoin
http://gcompris.net Free educational software for kids
http://toulibre.org Logiciel Libre à Toulouse




More information about the Devel mailing list