Sugar on Windows

From OLPC
Revision as of 15:28, 23 November 2006 by CarlKenner (talk | contribs) (Category Sugar)
Jump to navigation Jump to search

For the timebeing, this is NOT going to be a one-click install process. At the very least you will need to install Python and PyGTK separately. Windows support for GTK is a bit confusing with multiple versions, some with missing libraries which have to be sourced from other sites. And then there is GECKO. And finally, the SUGAR environment that is built on all of it.

However, if you can build a pure Python application that uses a simple GUI, i.e. easy to translate into PyGTK, and does not have heavy dependencies, then it will be easy to port into Sugar. Get your proof of concept up and running, fix the major issues and then ask for help to port it to Sugar.

Step one: Get Python

First thing is to get Python running on your Windows machine. A nice all-in-one MSI installer is available from ActiveState

Step two: Get GTK+

This is the Windows version of the GTK+ GUI toolkit used by the OLPC. It is also the GUI toolkit used by the Open source art program named GIMP. You may want to download GIMP as well to test that the GTK+ is functioning and it will also assist you in dealing with JPEGs, GIFs, PNGs and other image content. Go to the GIMP website and download and install the GTK+ Runtime environment first. Then download and install GIMP. If you can successfully start up GIMP then you have a working installation.

If you ever run into a missing library from GTK, then you can pick it up here: http://www.gimp.org/~tml/gimp/win32/downloads.html

Step three: Get PyGTK

This is a Python module that allows you to interface to the GTK+ toolkit from Python rather than C++. You need to download two components to get this running. First PyCairo and then PyGTK. Both are found at this page: http://www.pcpm.ucl.ac.be/~gustin/win32_ports/

Make sure that you get a binary install that matches the version number of your Python installation. Python 2.4 has been stable and well-tested for a long time. It has the most support of 3rd-party modules, i.e. if you need some Python module, there is more likely to be a binary version already available for Python 2.4.

Step four: Get GECKO

This still needs to be sorted out. In the meantime, unless your application relies on displaying HTML, you can get to work on developing the bulk of your application.

Tutorials & Other bits

To begin with, there are some tutorials on the PyGTK website. However, if you have any experience in readin C or C++ code, you can learn a lot by reading any tutorial material targetted to use of the GTK+ GUI on Linux or elsewhere. It is the same toolkit no matter how you interface with it or what OS you use it on.

Glade

A lot of tutorial material uses a tool named GLADE to draw your GUI and save you from writing a lot of code. The Windows version is known as GLADE-Win. Try to use it for your first steps in PyGTK programming because it will help you over the learning curve.

NOTE: If you whish to use glade then install the full package, glade + pango + gtk, from the gladewin32 site.

However, if you want to avoid having that XML config file and build your GUI directly, there is a tool called Tepache that can generate Python code equivalent from the .glade file.

Cygwin

Many applications will use some of the many general purpose utility programs that come with Linux. If you need one or more of these then you can install them using the Cygwin installer. This installer lets you pick and choose different sets of utilities or even individual utilities. You have the choice of installing binaries only or source code and binaries. The installer only downloads the components that you select. You can rerun it and add more utilities or update existing ones whenever you wish. It is possible to turn a Windows machine into a fully UNIX-compatible computer by installing all of Cygwin, but most people will only require a few dozen utilities out of the base system, text and archivers.

Warning: don't install the Python from Cygwin. This will only confuse your system.

Overwhelmed

Some people who want to get involved in developing applications for the OLPC are overwhelmed by this complexity. Unfortunately, that comes with the territory. The OLPC is very new, only in prototype stage at present. There are no clear maps of the territory and many details could change in the future. The job of a developer is to deal with all that detail and complexity while crafting something that is simple for the user and adds real value to their educational experience. Simple drill and practice applications will not cut it here.

On the other hand, there is a community to help on this Wiki.

The External Developers page may be of interest.