<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://maemo.octonezd.me/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=189.2.128.130</id>
	<title>Maemo Wiki Mirror - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://maemo.octonezd.me/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=189.2.128.130"/>
	<link rel="alternate" type="text/html" href="https://maemo.octonezd.me/index.php/Special:Contributions/189.2.128.130"/>
	<updated>2026-04-22T04:23:30Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://maemo.octonezd.me/index.php?title=PyMaemo/Scratchboxless_packaging_guide&amp;diff=33510</id>
		<title>PyMaemo/Scratchboxless packaging guide</title>
		<link rel="alternate" type="text/html" href="https://maemo.octonezd.me/index.php?title=PyMaemo/Scratchboxless_packaging_guide&amp;diff=33510"/>
		<updated>2011-03-02T13:46:23Z</updated>

		<summary type="html">&lt;p&gt;189.2.128.130: Fix some typos&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The usual way of developing Maemo applications is using either Scratchbox or [[MADDE]], which are quite heavy for Python development. An alternative is using [http://github.com/astraw/stdeb stdeb], a set of extensions to distutils that allows generating Debian packages, both binary and source, that can be installed on the device or sent to the [[extras-devel]] repository.&lt;br /&gt;
&lt;br /&gt;
This tutorial will show how to integrate it into your project, build the packages and upload them to extras-devel.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
This tutorial is aimed at Debian-based systems, as some stdeb commands requires the dpkg tools installed. If you&#039;re using another distro, please refer to the section &lt;br /&gt;
&lt;br /&gt;
Also, you should get the [http://github.com/astraw/stdeb git] version of stdeb to use the debianize command, as it is a new addition and not yet available in the repositories. Run the following commands to install it:&lt;br /&gt;
&lt;br /&gt;
 # Clone the git repository&lt;br /&gt;
 git clone http://github.com/astraw/stdeb.git&lt;br /&gt;
 &lt;br /&gt;
 # Enter source package&lt;br /&gt;
 cd stdeb&lt;br /&gt;
 &lt;br /&gt;
 # Build .deb (making use of stdeb package directory in sys.path).&lt;br /&gt;
 python setup.py --command-packages=stdeb.command bdist_deb&lt;br /&gt;
 &lt;br /&gt;
 # Install it&lt;br /&gt;
 sudo dpkg -i deb_dist/python-stdeb_0.5.1+git-1_all.deb&lt;br /&gt;
&lt;br /&gt;
As only python2.5 is supported in pymaemo, it should be installed if you want to create binary packages. On Ubuntu Lucid (10.04), you can install it from [https://launchpad.net/~fkrull/+archive/deadsnakes this ppa], following the instructions [http://www.codigomanso.com/en/2010/05/google-app-engine-en--10-4-lucid-lynx/ here].&lt;br /&gt;
&lt;br /&gt;
== Preparing the package ==&lt;br /&gt;
&lt;br /&gt;
As stdeb extends distutils, it is necessary that you have a working setup.py script. For our example application, which consists of a [http://pymaemo.garage.maemo.org/stdeb_example/myscript-app/myscript single script] named &amp;quot;myscript&amp;quot; and support files like [http://pymaemo.garage.maemo.org/stdeb_example/myscript-app/myscript.desktop .desktop]&amp;lt;ref name=&amp;quot;desktop&amp;quot;&amp;gt;[[Desktop file format]]&amp;lt;/ref&amp;gt; and an [http://pymaemo.garage.maemo.org/stdeb_example/myscript-app/myscript.png icon]&amp;lt;ref name=&amp;quot;icon&amp;quot;&amp;gt;[[Packaging#Displaying an icon in the Application Manager next to your package]]&amp;lt;/ref&amp;gt;, the [http://pymaemo.garage.maemo.org/stdeb_example/myscript-app/setup.py setup.py] will look like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
from distutils.core import setup&lt;br /&gt;
&lt;br /&gt;
setup(&lt;br /&gt;
    name=&#039;myscript&#039;,&lt;br /&gt;
    version=&#039;0.1&#039;,&lt;br /&gt;
    author=&#039;Lauro Moura&#039;,&lt;br /&gt;
    author_email=&#039;lauro.neto@donotspamme.com&#039;,&lt;br /&gt;
    scripts=[&#039;myscript&#039;],&lt;br /&gt;
    data_files=[(&#039;share/applications/hildon&#039;, [&#039;myscript.desktop&#039;]),&lt;br /&gt;
                (&#039;share/pixmaps&#039;, [&#039;myscript.png&#039;])],&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
A file named [http://pymaemo.garage.maemo.org/stdeb_example/myscript-app/stdeb.cfg stdeb.cfg] in the same directory as setup.py is required, with stdeb Maemo-specific options. A detailed list of options can be found in the [http://github.com/astraw/stdeb stdeb website].&lt;br /&gt;
&lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 XS-Python-Version: 2.5 # Only version currently supported by PyMaemo.&lt;br /&gt;
 Package:my-script # Binary package name. stdeb adds the prefix &amp;quot;python-&amp;quot; by default&lt;br /&gt;
 Section: user/development # Section should start with user/ to appear in the menu.&lt;br /&gt;
 Depends: python-gtk2 # extra dependencies go here&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Warning 1&amp;lt;/b&amp;gt;: Make sure to use [[Maemo_packaging#Sections|an allowed section]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Warning 2&amp;lt;/b&amp;gt;: The &amp;lt;code&amp;gt;Depends&amp;lt;/code&amp;gt; field in stdeb.cfg will be used on your debian/control file, so fill it correctly with all the dependencies of your application - otherwise it will break when you try to install it. For instance, [http://gitorious.org/twcano/twcano twcano] depends on the following packages: &amp;lt;code&amp;gt;python-simplejson, pyside-qt4-maemo5, pyside-qt4-webkit and python-twitter&amp;lt;/code&amp;gt;, so the &amp;lt;code&amp;gt;Depends&amp;lt;/code&amp;gt; field should be filled this way:&lt;br /&gt;
&lt;br /&gt;
 Depends: python-simplejson, pyside-qt4-maemo5, pyside-qt4-webkit, python-twitter&lt;br /&gt;
&lt;br /&gt;
== Building the packages ==&lt;br /&gt;
&lt;br /&gt;
The basic command is&lt;br /&gt;
&lt;br /&gt;
 python setup.py --command-packages=stdeb.command bdist_deb&lt;br /&gt;
&lt;br /&gt;
It&#039;ll create a folder called deb_dist with the source and binary packages. Alternatively, the &amp;quot;sdist_dsc&amp;quot; command will create only the source package.&lt;br /&gt;
&lt;br /&gt;
After generating, you can copy the package to your device and install it (requires an [[SSH]] server):&lt;br /&gt;
&lt;br /&gt;
 $ scp myscript_0.1-1_all.deb root@&amp;lt;n900 ip&amp;gt;:/root&lt;br /&gt;
 $ ssh root@&amp;lt;n900 ip&amp;gt;&lt;br /&gt;
 # dpkg -i myscript_0.1-1_all.deb&lt;br /&gt;
&lt;br /&gt;
== Building a basic debian directory ==&lt;br /&gt;
&lt;br /&gt;
Another useful command is &#039;&#039;debianize&#039;&#039;. It will read the configuration file and write a directory named debian in the same directory. This can be used for manually creating the packages using dpkg tools directly. For a detailed usage example see the [http://github.com/astraw/stdeb#debianize-distutils-command stdeb website].&lt;br /&gt;
&lt;br /&gt;
Note: sdist_dsc and bdist_deb do &#039;&#039;&#039;not&#039;&#039;&#039; use this directory, generating a new one in the source dir under deb_dist/.&lt;br /&gt;
&lt;br /&gt;
== Uploading to extras ==&lt;br /&gt;
&lt;br /&gt;
To upload to extras, use the debianize command and then call dpkg-buildpackage:&lt;br /&gt;
&lt;br /&gt;
 $ dpkg-buildpackage -rfakeroot -uc -us -S&lt;br /&gt;
&lt;br /&gt;
This command will create the .dsc, .tar.gz and .changes files that can be used to [[uploading to Extras-devel|upload the application to extras-devel]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Support for non-Debian systems ==&lt;br /&gt;
&lt;br /&gt;
{{ambox&lt;br /&gt;
| type = notice&lt;br /&gt;
| image= &lt;br /&gt;
| text = Keep in mind that the support for non-Debian systems is &#039;&#039;&#039;experimental&#039;&#039;&#039;: it is not as funcional as the stdeb approach shown above and may not work for your package. Also, these instructions may change without notice. }}&lt;br /&gt;
&lt;br /&gt;
If you&#039;re using a distro not based on Debian, you can still create source packages for uploading to extras-devel, but won&#039;t be able to create binary packages (.deb).&lt;br /&gt;
&lt;br /&gt;
For doing this, you will need the sdist_deb module available [http://gitorious.org/pymaemo/sboxless here]; just clone it in some directory and point the PYTHONPATH environment variable there. &lt;br /&gt;
&lt;br /&gt;
Now create a file called sboxless.cfg, which will contain additional information for generating the package. For now, you can add additional runtime dependencies for your package. If you want to add python-twitter as dependency, just write&lt;br /&gt;
&lt;br /&gt;
 [control]&lt;br /&gt;
 depends=python-twitter&lt;br /&gt;
&lt;br /&gt;
The file is mandatory, so if you don&#039;t want to add any dependency, just leave the field empty (&#039;depends=&#039;).&lt;br /&gt;
&lt;br /&gt;
Now, run the sdist_deb command:&lt;br /&gt;
&lt;br /&gt;
 PYTHONPATH=/path/to/sboxless python setup.py --command-packages=sboxless  sdist_deb&lt;br /&gt;
&lt;br /&gt;
The source files will be generated on the ./dist directory.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Python]]&lt;br /&gt;
[[Category:Packaging]]&lt;/div&gt;</summary>
		<author><name>189.2.128.130</name></author>
	</entry>
	<entry>
		<id>https://maemo.octonezd.me/index.php?title=PyMaemo/Quick_start_guide&amp;diff=33465</id>
		<title>PyMaemo/Quick start guide</title>
		<link rel="alternate" type="text/html" href="https://maemo.octonezd.me/index.php?title=PyMaemo/Quick_start_guide&amp;diff=33465"/>
		<updated>2010-02-19T18:57:20Z</updated>

		<summary type="html">&lt;p&gt;189.2.128.130: Undo revision 29864 by 189.2.128.130 (Talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Started: Setting Up Python Development Environment for N900 =&lt;br /&gt;
&lt;br /&gt;
A basic development environment for Python development for Maemo consists of:&lt;br /&gt;
&lt;br /&gt;
* A source code editor&lt;br /&gt;
* Some way to transfer application files to the tablet&lt;br /&gt;
* Easily run the application (without installing it)&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can try other more complex development environments, briefly described at the end of this article.&lt;br /&gt;
&lt;br /&gt;
This article will cover:&lt;br /&gt;
&lt;br /&gt;
* Installation of necessary packages and USB connectivity setup&lt;br /&gt;
* Some suggestions for Python code editors&lt;br /&gt;
* How to transfer the application files to the N900&lt;br /&gt;
* How to run the application&lt;br /&gt;
&lt;br /&gt;
Application packaging and final deployment will be discussed separately at a later date.&lt;br /&gt;
&lt;br /&gt;
Finally, there is a [http://www.youtube.com/watch?v=onAkb_7U5pk screencast] demonstrating the instructions from this guide, which should help clarifying some of the steps in a real setup session.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
Before continuing, make sure you have:&lt;br /&gt;
&lt;br /&gt;
Tablet requirements:&lt;br /&gt;
&lt;br /&gt;
* Some kind of connectivity to the tablet (e.g. WLAN or GPRS), so that you can install required packages.&lt;br /&gt;
* The N900 USB cable, which will be used to transfer files to the tablet.&lt;br /&gt;
&lt;br /&gt;
Host requirements:&lt;br /&gt;
&lt;br /&gt;
* A SSH client. For Linux, OpenSSH (through the &amp;quot;ssh&amp;quot; command) is enough. For Windows, [http://en.sourceforge.jp/projects/ttssh2/releases/ Tera Term] can be used. For Mac you can use &amp;quot;ssh&amp;quot; command in the Terminal.&lt;br /&gt;
* A SCP/SFTP client. For Linux, OpenSSH (through the &amp;quot;scp&amp;quot; command) is enough. The KDE/GNOME environments also have built-in support for these protocols. For Windows, you can try [http://winscp.net/eng/index.php WinSCP] or [http://filezilla-project.org/ FileZilla].&lt;br /&gt;
&lt;br /&gt;
For the purposes of this tutorial, you will &#039;&#039;&#039;not&#039;&#039;&#039; need Scratchbox installed. Scratchbox would only be necessary if you are unable to test your applications on the actual tablet.&lt;br /&gt;
&lt;br /&gt;
== Installing required packages on N900 ==&lt;br /&gt;
&lt;br /&gt;
You will need to install two applications on the tablet:&lt;br /&gt;
&lt;br /&gt;
* OpenSSH Server&lt;br /&gt;
* rootsh&lt;br /&gt;
&lt;br /&gt;
OpenSSH is needed to run commands remotely on your N900. This will make testing on the device a lot easier.&lt;br /&gt;
&lt;br /&gt;
rootsh is needed to allow to run commands as root on the X Terminal (using &amp;quot;sudo gainroot&amp;quot;). See http://wiki.maemo.org/Root_access for other options to enable root access.&lt;br /&gt;
&lt;br /&gt;
To install these applications, follow these steps:&lt;br /&gt;
&lt;br /&gt;
# Enable extras repository. See http://wiki.maemo.org/Extras#Using_Extras for how to do it.&lt;br /&gt;
# Install the packages listed above.&lt;br /&gt;
# The installation will ask for a new root password for SSH access. Choose a good one.&lt;br /&gt;
# Wait for installation to complete.&lt;br /&gt;
&lt;br /&gt;
== Enabling USB networking ==&lt;br /&gt;
&lt;br /&gt;
USB networking allows to easily and quickly transfer files to the device and connect to it using SSH. To enable it, follow these steps (you need to repeat them every time you reboot the device):&lt;br /&gt;
&lt;br /&gt;
# If the USB cable is plugged and in &amp;quot;Mass storage mode&amp;quot;, unplug the cable and plug it again, now selecting &amp;quot;PC Suite Mode&amp;quot;.&lt;br /&gt;
# On N900, open &amp;quot;X Terminal&amp;quot; and run:&lt;br /&gt;
 rootsh ifup usb0&lt;br /&gt;
# Now you need to configure the host. This is dependent on which OS (or Linux distro) you use, see http://wiki.maemo.org/USB_networking#Host_USB_Network_Configuration for detailed instructions for various OSes and Linux distros.&lt;br /&gt;
&lt;br /&gt;
From now on you can connect to the N900 using any SSH client and the following information:&lt;br /&gt;
 Host: 192.168.2.15&lt;br /&gt;
 Port: 22&lt;br /&gt;
 User: root&lt;br /&gt;
 Password: the password setup earlier&lt;br /&gt;
&lt;br /&gt;
For instance, from a Linux terminal, you can connect to the tablet using this command:&lt;br /&gt;
&lt;br /&gt;
 ssh root@192.168.2.15&lt;br /&gt;
&lt;br /&gt;
== Preparing the N900 for Python Development ==&lt;br /&gt;
&lt;br /&gt;
To enable the full power for Python development for Maemo, you must enable the &amp;quot;extras-devel&amp;quot; repository on your device. &#039;&#039;Be advised that this might be a risky operation&#039;&#039; because extras-devel contains many untested and possibly broken packages. But it also contains the latest versions of all available Python bindings for Maemo, which we are interested on.&lt;br /&gt;
&lt;br /&gt;
Note that the requirement to enable the &amp;quot;extras-devel&amp;quot; repository might be removed later.&lt;br /&gt;
&lt;br /&gt;
To enable extras-devel add a new catalogue to the Application Manager, as instructed in [[Extras-devel]] (did you see the big warning on that page?)&lt;br /&gt;
&lt;br /&gt;
After extras-devel is enabled, you will see on Application Manager a package called &amp;quot;maemo-python-device-env&amp;quot;. Installing it will also install the basic environment necessary to run most Python applications on Maemo.&lt;br /&gt;
&lt;br /&gt;
== Writing your code ==&lt;br /&gt;
&lt;br /&gt;
Any good programmer oriented editor will be enough for development. If you have some development experience, you most probably already have chosen your favorite code editor and you can simply use it.&lt;br /&gt;
&lt;br /&gt;
Here we list some options, both for Linux and Windows:&lt;br /&gt;
&lt;br /&gt;
* [http://projects.gnome.org/gedit/ gedit]: the GNOME Editor has syntax highlight support for Python (Linux only)&lt;br /&gt;
* [http://www.vim.org/ VIM] and [http://www.gnu.org/software/emacs/ Emacs]: the most popular editors, with many advanced features and versions for both Linux and Windows&lt;br /&gt;
* [http://wiki.netbeans.org/Python NetBeans + Python plugin]: NetBeans is a multi-platform IDE, which with help of a plugin, supports development for Python&lt;br /&gt;
* [http://maemo.org/downloads/product/Maemo5/pygtkeditor/ PyGTKEditor]: a syntax highlighting Python editor which runs natively on Maemo devices&lt;br /&gt;
&lt;br /&gt;
Note that none of these editors will support code completion for PyMaemo modules out of box.&lt;br /&gt;
&lt;br /&gt;
For testing purposes, you can try the following code (the classic &amp;quot;hello world&amp;quot; example):&lt;br /&gt;
&lt;br /&gt;
 import gtk&lt;br /&gt;
 from gtk import Window, Button, Widget&lt;br /&gt;
 if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
     window = Window(gtk.WINDOW_TOPLEVEL)&lt;br /&gt;
     window.connect(&amp;quot;destroy&amp;quot;, gtk.main_quit)&lt;br /&gt;
     button = Button(&amp;quot;Hello World&amp;quot;)&lt;br /&gt;
     button.connect_object(&amp;quot;clicked&amp;quot;, Widget.destroy, window)&lt;br /&gt;
     window.add(button)&lt;br /&gt;
     window.show_all()&lt;br /&gt;
     gtk.main()&lt;br /&gt;
&lt;br /&gt;
Once you have your code written, you can proceed to copying application files to the device.&lt;br /&gt;
&lt;br /&gt;
== Running the Python application on the device ==&lt;br /&gt;
&lt;br /&gt;
Now that you have the N900 properly setup and the code to run, you just need to copy the application files to the device and run it.&lt;br /&gt;
&lt;br /&gt;
The simplest way to copy files it to use a SFTP or SCP client. There are many free clients available for most OSes (we listed some examples on the &amp;quot;Requirements&amp;quot; section). On the Linux command line, you can use:&lt;br /&gt;
&lt;br /&gt;
 scp -pr my_application/ root@192.168.2.15:/root/my_application/&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;my_application/&amp;quot; with the path to the directory which contains your application files.&lt;br /&gt;
&lt;br /&gt;
Finally, to run the application on the tablet, use (from a SSH terminal):&lt;br /&gt;
&lt;br /&gt;
 cd /root/my_application&lt;br /&gt;
 python my_application.py&lt;br /&gt;
&lt;br /&gt;
== Alternative development environments ==&lt;br /&gt;
&lt;br /&gt;
Besides the environment described on this article, there are two alternative development environments that might or might not be more appropriate for your purposes:&lt;br /&gt;
&lt;br /&gt;
; PluThon (Eclipse based)&lt;br /&gt;
: [http://pluthon.garage.maemo.org/ PluThon] is a full Python IDE for Maemo, based on Eclipse. While PluThon is easy to use and provides a complete solution, it is not necessary for basic Python development for Maemo. If you already use Eclipse for your development, PluThon might be your best option.&lt;br /&gt;
; Official Maemo SDK (Scratchbox based)&lt;br /&gt;
: [http://www.scratchbox.org/ Scratchbox] is a cross-compilation toolkit used for native Maemo development. Although it can be used in Python development as well (and comes very handy if you do not have access to a real device), it has a non-trivial learning curve and is not needed for pure Python development. However, if you plan to write new Python extensions (for instance, using [http://www.cython.org/ Cython] or [http://docs.python.org/c-api/index.html Python/C API] directly), Scratchbox is needed to cross-compile the C code. See the [http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/Development_Environment/Maemo_SDK Maemo SDK section] on Maemo 5 developer guide for more details on it.&lt;br /&gt;
&lt;br /&gt;
Note that PluThon has built-in support for transferring and running code on the device. On the other hand, the Maemo SDK has no such support (unless you use some IDE like [http://esbox.garage.maemo.org/ ESbox]), so you need to follow steps similar to the ones described on this guide to copy and run your code on the tablet, if you choose to use the Maemo SDK.&lt;br /&gt;
&lt;br /&gt;
== Advanced tips ==&lt;br /&gt;
&lt;br /&gt;
If you want to activate USB networking automatically upon connecting the device to the computer, just create a file called /etc/event.d/usbnet on the device with the following contents:&lt;br /&gt;
&lt;br /&gt;
 start on G_NOKIA_READY&lt;br /&gt;
 &lt;br /&gt;
 console output&lt;br /&gt;
 exec ifconfig usb0 192.168.2.15 up&lt;br /&gt;
&lt;br /&gt;
This way you just have to select &amp;quot;PC Suite mode&amp;quot; when plugging the device in.&lt;br /&gt;
&lt;br /&gt;
[[Category:N900]]&lt;br /&gt;
[[Category:Python]]&lt;/div&gt;</summary>
		<author><name>189.2.128.130</name></author>
	</entry>
	<entry>
		<id>https://maemo.octonezd.me/index.php?title=PyMaemo/Quick_start_guide&amp;diff=33466</id>
		<title>PyMaemo/Quick start guide</title>
		<link rel="alternate" type="text/html" href="https://maemo.octonezd.me/index.php?title=PyMaemo/Quick_start_guide&amp;diff=33466"/>
		<updated>2010-02-19T18:32:12Z</updated>

		<summary type="html">&lt;p&gt;189.2.128.130: /* Advanced tips */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Started: Setting Up Python Development Environment for N900 =&lt;br /&gt;
&lt;br /&gt;
A basic development environment for Python development for Maemo consists of:&lt;br /&gt;
&lt;br /&gt;
* A source code editor&lt;br /&gt;
* Some way to transfer application files to the tablet&lt;br /&gt;
* Easily run the application (without installing it)&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can try other more complex development environments, briefly described at the end of this article.&lt;br /&gt;
&lt;br /&gt;
This article will cover:&lt;br /&gt;
&lt;br /&gt;
* Installation of necessary packages and USB connectivity setup&lt;br /&gt;
* Some suggestions for Python code editors&lt;br /&gt;
* How to transfer the application files to the N900&lt;br /&gt;
* How to run the application&lt;br /&gt;
&lt;br /&gt;
Application packaging and final deployment will be discussed separately at a later date.&lt;br /&gt;
&lt;br /&gt;
Finally, there is a [http://www.youtube.com/watch?v=onAkb_7U5pk screencast] demonstrating the instructions from this guide, which should help clarifying some of the steps in a real setup session.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
Before continuing, make sure you have:&lt;br /&gt;
&lt;br /&gt;
Tablet requirements:&lt;br /&gt;
&lt;br /&gt;
* Some kind of connectivity to the tablet (e.g. WLAN or GPRS), so that you can install required packages.&lt;br /&gt;
* The N900 USB cable, which will be used to transfer files to the tablet.&lt;br /&gt;
&lt;br /&gt;
Host requirements:&lt;br /&gt;
&lt;br /&gt;
* A SSH client. For Linux, OpenSSH (through the &amp;quot;ssh&amp;quot; command) is enough. For Windows, [http://en.sourceforge.jp/projects/ttssh2/releases/ Tera Term] can be used. For Mac you can use &amp;quot;ssh&amp;quot; command in the Terminal.&lt;br /&gt;
* A SCP/SFTP client. For Linux, OpenSSH (through the &amp;quot;scp&amp;quot; command) is enough. The KDE/GNOME environments also have built-in support for these protocols. For Windows, you can try [http://winscp.net/eng/index.php WinSCP] or [http://filezilla-project.org/ FileZilla].&lt;br /&gt;
&lt;br /&gt;
For the purposes of this tutorial, you will &#039;&#039;&#039;not&#039;&#039;&#039; need Scratchbox installed. Scratchbox would only be necessary if you are unable to test your applications on the actual tablet.&lt;br /&gt;
&lt;br /&gt;
== Installing required packages on N900 ==&lt;br /&gt;
&lt;br /&gt;
You will need to install two applications on the tablet:&lt;br /&gt;
&lt;br /&gt;
* OpenSSH Server&lt;br /&gt;
* rootsh&lt;br /&gt;
&lt;br /&gt;
OpenSSH is needed to run commands remotely on your N900. This will make testing on the device a lot easier.&lt;br /&gt;
&lt;br /&gt;
rootsh is needed to allow to run commands as root on the X Terminal (using &amp;quot;sudo gainroot&amp;quot;). See http://wiki.maemo.org/Root_access for other options to enable root access.&lt;br /&gt;
&lt;br /&gt;
To install these applications, follow these steps:&lt;br /&gt;
&lt;br /&gt;
# Enable extras repository. See http://wiki.maemo.org/Extras#Using_Extras for how to do it.&lt;br /&gt;
# Install the packages listed above.&lt;br /&gt;
# The installation will ask for a new root password for SSH access. Choose a good one.&lt;br /&gt;
# Wait for installation to complete.&lt;br /&gt;
&lt;br /&gt;
== Enabling USB networking ==&lt;br /&gt;
&lt;br /&gt;
USB networking allows to easily and quickly transfer files to the device and connect to it using SSH. To enable it, follow these steps (you need to repeat them every time you reboot the device):&lt;br /&gt;
&lt;br /&gt;
# If the USB cable is plugged and in &amp;quot;Mass storage mode&amp;quot;, unplug the cable and plug it again, now selecting &amp;quot;PC Suite Mode&amp;quot;.&lt;br /&gt;
# On N900, open &amp;quot;X Terminal&amp;quot; and run:&lt;br /&gt;
 rootsh ifup usb0&lt;br /&gt;
# Now you need to configure the host. This is dependent on which OS (or Linux distro) you use, see http://wiki.maemo.org/USB_networking#Host_USB_Network_Configuration for detailed instructions for various OSes and Linux distros.&lt;br /&gt;
&lt;br /&gt;
From now on you can connect to the N900 using any SSH client and the following information:&lt;br /&gt;
 Host: 192.168.2.15&lt;br /&gt;
 Port: 22&lt;br /&gt;
 User: root&lt;br /&gt;
 Password: the password setup earlier&lt;br /&gt;
&lt;br /&gt;
For instance, from a Linux terminal, you can connect to the tablet using this command:&lt;br /&gt;
&lt;br /&gt;
 ssh root@192.168.2.15&lt;br /&gt;
&lt;br /&gt;
== Preparing the N900 for Python Development ==&lt;br /&gt;
&lt;br /&gt;
To enable the full power for Python development for Maemo, you must enable the &amp;quot;extras-devel&amp;quot; repository on your device. &#039;&#039;Be advised that this might be a risky operation&#039;&#039; because extras-devel contains many untested and possibly broken packages. But it also contains the latest versions of all available Python bindings for Maemo, which we are interested on.&lt;br /&gt;
&lt;br /&gt;
Note that the requirement to enable the &amp;quot;extras-devel&amp;quot; repository might be removed later.&lt;br /&gt;
&lt;br /&gt;
To enable extras-devel add a new catalogue to the Application Manager, as instructed in [[Extras-devel]] (did you see the big warning on that page?)&lt;br /&gt;
&lt;br /&gt;
After extras-devel is enabled, you will see on Application Manager a package called &amp;quot;maemo-python-device-env&amp;quot;. Installing it will also install the basic environment necessary to run most Python applications on Maemo.&lt;br /&gt;
&lt;br /&gt;
== Writing your code ==&lt;br /&gt;
&lt;br /&gt;
Any good programmer oriented editor will be enough for development. If you have some development experience, you most probably already have chosen your favorite code editor and you can simply use it.&lt;br /&gt;
&lt;br /&gt;
Here we list some options, both for Linux and Windows:&lt;br /&gt;
&lt;br /&gt;
* [http://projects.gnome.org/gedit/ gedit]: the GNOME Editor has syntax highlight support for Python (Linux only)&lt;br /&gt;
* [http://www.vim.org/ VIM] and [http://www.gnu.org/software/emacs/ Emacs]: the most popular editors, with many advanced features and versions for both Linux and Windows&lt;br /&gt;
* [http://wiki.netbeans.org/Python NetBeans + Python plugin]: NetBeans is a multi-platform IDE, which with help of a plugin, supports development for Python&lt;br /&gt;
* [http://maemo.org/downloads/product/Maemo5/pygtkeditor/ PyGTKEditor]: a syntax highlighting Python editor which runs natively on Maemo devices&lt;br /&gt;
&lt;br /&gt;
Note that none of these editors will support code completion for PyMaemo modules out of box.&lt;br /&gt;
&lt;br /&gt;
For testing purposes, you can try the following code (the classic &amp;quot;hello world&amp;quot; example):&lt;br /&gt;
&lt;br /&gt;
 import gtk&lt;br /&gt;
 from gtk import Window, Button, Widget&lt;br /&gt;
 if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
     window = Window(gtk.WINDOW_TOPLEVEL)&lt;br /&gt;
     window.connect(&amp;quot;destroy&amp;quot;, gtk.main_quit)&lt;br /&gt;
     button = Button(&amp;quot;Hello World&amp;quot;)&lt;br /&gt;
     button.connect_object(&amp;quot;clicked&amp;quot;, Widget.destroy, window)&lt;br /&gt;
     window.add(button)&lt;br /&gt;
     window.show_all()&lt;br /&gt;
     gtk.main()&lt;br /&gt;
&lt;br /&gt;
Once you have your code written, you can proceed to copying application files to the device.&lt;br /&gt;
&lt;br /&gt;
== Running the Python application on the device ==&lt;br /&gt;
&lt;br /&gt;
Now that you have the N900 properly setup and the code to run, you just need to copy the application files to the device and run it.&lt;br /&gt;
&lt;br /&gt;
The simplest way to copy files it to use a SFTP or SCP client. There are many free clients available for most OSes (we listed some examples on the &amp;quot;Requirements&amp;quot; section). On the Linux command line, you can use:&lt;br /&gt;
&lt;br /&gt;
 scp -pr my_application/ root@192.168.2.15:/root/my_application/&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;my_application/&amp;quot; with the path to the directory which contains your application files.&lt;br /&gt;
&lt;br /&gt;
Finally, to run the application on the tablet, use (from a SSH terminal):&lt;br /&gt;
&lt;br /&gt;
 cd /root/my_application&lt;br /&gt;
 python my_application.py&lt;br /&gt;
&lt;br /&gt;
== Alternative development environments ==&lt;br /&gt;
&lt;br /&gt;
Besides the environment described on this article, there are two alternative development environments that might or might not be more appropriate for your purposes:&lt;br /&gt;
&lt;br /&gt;
; PluThon (Eclipse based)&lt;br /&gt;
: [http://pluthon.garage.maemo.org/ PluThon] is a full Python IDE for Maemo, based on Eclipse. While PluThon is easy to use and provides a complete solution, it is not necessary for basic Python development for Maemo. If you already use Eclipse for your development, PluThon might be your best option.&lt;br /&gt;
; Official Maemo SDK (Scratchbox based)&lt;br /&gt;
: [http://www.scratchbox.org/ Scratchbox] is a cross-compilation toolkit used for native Maemo development. Although it can be used in Python development as well (and comes very handy if you do not have access to a real device), it has a non-trivial learning curve and is not needed for pure Python development. However, if you plan to write new Python extensions (for instance, using [http://www.cython.org/ Cython] or [http://docs.python.org/c-api/index.html Python/C API] directly), Scratchbox is needed to cross-compile the C code. See the [http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/Development_Environment/Maemo_SDK Maemo SDK section] on Maemo 5 developer guide for more details on it.&lt;br /&gt;
&lt;br /&gt;
Note that PluThon has built-in support for transferring and running code on the device. On the other hand, the Maemo SDK has no such support (unless you use some IDE like [http://esbox.garage.maemo.org/ ESbox]), so you need to follow steps similar to the ones described on this guide to copy and run your code on the tablet, if you choose to use the Maemo SDK.&lt;br /&gt;
&lt;br /&gt;
== Advanced tips ==&lt;br /&gt;
&lt;br /&gt;
If you want to activate USB networking automatically upon connecting the device to the computer, just create a file called /etc/event.d/usbnet on the device with the following contents:&lt;br /&gt;
&lt;br /&gt;
 start on G_NOKIA_READY&lt;br /&gt;
 &lt;br /&gt;
 console output&lt;br /&gt;
 exec ifconfig usb0 192.168.2.15 up&lt;br /&gt;
&lt;br /&gt;
This way you just have to select &amp;quot;PC Suite mode&amp;quot; when plugging the device in. Beware, though, that this will cause problems if you want to access the mass storage of the device via USB, use this technique only if you won&#039;t do that.&lt;br /&gt;
&lt;br /&gt;
[[Category:N900]]&lt;br /&gt;
[[Category:Python]]&lt;/div&gt;</summary>
		<author><name>189.2.128.130</name></author>
	</entry>
	<entry>
		<id>https://maemo.octonezd.me/index.php?title=PyMaemo/How_to_build&amp;diff=33386</id>
		<title>PyMaemo/How to build</title>
		<link rel="alternate" type="text/html" href="https://maemo.octonezd.me/index.php?title=PyMaemo/How_to_build&amp;diff=33386"/>
		<updated>2010-01-18T18:36:34Z</updated>

		<summary type="html">&lt;p&gt;189.2.128.130: /* Modifying PyMaemo packages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;b style=&amp;quot;color: red&amp;quot;&amp;gt;DRAFT&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= How to build PyMaemo packages=&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
To build PyMaemo packages from the source, you&#039;ll need:&lt;br /&gt;
&lt;br /&gt;
* Maemo 5 SDK &lt;br /&gt;
* Rootstraps for X86 and ARMEL targets&lt;br /&gt;
* grep-dctrl&lt;br /&gt;
* pymaemo-tools&lt;br /&gt;
&lt;br /&gt;
The scripts from pymaemo-tools are used to download packages&#039; sources and build them using sbdmock, one at a time. sbdmock, in turn, uses the SDK and the rootstraps to create a clean environment for building every package. More information about sbdmock can be obtained [[Building_packages_with_sbdmock|here]], although pymaemo-tools uses a slightly modified of sbdmock - see pymaemo-tools README if you want to know which modifications were made.&lt;br /&gt;
&lt;br /&gt;
The build scripts from pymaemo-tools can be used to build the entire set of packages or only some of them, for X86 or ARMEL targets. It is advised to first build and (if possible) test in the X86 target and use ARMEL target only for cross-compiling for the device.&lt;br /&gt;
&lt;br /&gt;
== Overview of the build process ==&lt;br /&gt;
&lt;br /&gt;
The build process is composed of three phases: download, preparation and the proper build. A high-level description of the process follows:&lt;br /&gt;
&lt;br /&gt;
* Download phase:&lt;br /&gt;
** If the package is originally from Debian or Ubuntu:&lt;br /&gt;
*** The original source is taken from upstream;&lt;br /&gt;
*** The Debian packaging for Maemo is taken from the respective repository in PyMaemo project.&lt;br /&gt;
** If the package is Maemo-specific:&lt;br /&gt;
*** The source package is taken from the respective repository in PyMaemo project&lt;br /&gt;
* Preparation phase:&lt;br /&gt;
** If the package is taken from upstream, assemble package&lt;br /&gt;
** Verify if dependencies are satisfied&lt;br /&gt;
* Build phase:&lt;br /&gt;
** Call sbdmock with proper parameters&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
The base directory for these instructions, refered as $BASE, is /scratchbox/users/&amp;lt;user&amp;gt;/home/&amp;lt;user&amp;gt;/pymaemo, &lt;br /&gt;
where &amp;lt;user&amp;gt; is your username in Scratchbox. All operations are made &#039;&#039;&#039;outside&#039;&#039;&#039; Scratchbox.&lt;br /&gt;
&lt;br /&gt;
First, download the rootstraps for X86 and ARMEL targets and put them in $BASE/rootstraps:&lt;br /&gt;
&lt;br /&gt;
* http://repository.maemo.org/stable/5.0/armel/maemo-sdk-rootstrap_5.0_armel.tgz&lt;br /&gt;
* http://repository.maemo.org/stable/5.0/i386/maemo-sdk-rootstrap_5.0_i386.tgz&lt;br /&gt;
&lt;br /&gt;
Clone the pymaemo-tools project inside $BASE:&lt;br /&gt;
&lt;br /&gt;
 $ git clone [git repo]&lt;br /&gt;
&lt;br /&gt;
This will create the directory pymaemo-tools under $BASE.&lt;br /&gt;
&lt;br /&gt;
Edit the fremantle_i386.cfg and fremantle_armel.cfg under $BASE/pymaemo-tools/sbdmock,&lt;br /&gt;
putting the rootstrap path correspondent to each in the following key:&lt;br /&gt;
* i386: config_opts[&#039;rootstrap&#039;] = &amp;quot;$BASE/rootstraps/maemo-sdk-rootstrap_5.0_i386.tgz&amp;quot;&lt;br /&gt;
* armel: config_opts[&#039;rootstrap&#039;] = &amp;quot;$BASE/rootstraps/maemo-sdk-rootstrap_5.0_armel.tgz&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Building ==&lt;br /&gt;
&lt;br /&gt;
For building all the packages for the X86 target, enter $BASE/pymaemo-tools and run:&lt;br /&gt;
&lt;br /&gt;
 $ ./build_packages.sh sbdmock:fremantle_i386 packages_fremantle.ini&lt;br /&gt;
&lt;br /&gt;
The same can be done to ARMEL target, just replacing &amp;quot;i386&amp;quot; with &amp;quot;armel&amp;quot;. The file packages_fremantle.ini contains all data necessary for obtaining the sources. &lt;br /&gt;
&lt;br /&gt;
You can build individual packages too, specifying them as parameters. If you want to build only, let&#039;s say, pyopenssl and pycurl for the ARMEL target, run:&lt;br /&gt;
&lt;br /&gt;
 $ ./build_packages.sh sbdmock:fremantle_armel packages_fremantle.ini pyopenssl,pycurl&lt;br /&gt;
&lt;br /&gt;
Be advised that any PyMaemo dependency for these packages must be built first, as build_packages.sh will attempt to build only the packages provided at the command line.&lt;br /&gt;
&lt;br /&gt;
There are other options for the build; for more information, run build_packages.sh &lt;br /&gt;
with no parameters or refer to the README file inside pymaemo-tools.&lt;br /&gt;
&lt;br /&gt;
When the build finishes the resultant Debian packages will be placed at &lt;br /&gt;
$BASE/pymaemo-tools/workdir/fremantle_&amp;lt;target&amp;gt;/repo, where &amp;lt;target&amp;gt; is i386 or armel,and the build logs placed in $BASE/pymaemo-tools/workdir/fremantle_&amp;lt;target&amp;gt;/logs.&lt;br /&gt;
From that point on, they can be installed on the targets and the ARMEL ones&lt;br /&gt;
can be copied to the device to be installed there.&lt;br /&gt;
&lt;br /&gt;
=== Directories created ===&lt;br /&gt;
&lt;br /&gt;
* $BASE/pymaemo-tools/download_cache: all downloaded files are placed here, one directory by package, so you don&#039;t have to download everything again in every build. If the sources are updated, though, you will have to erase the corresponding entries on download_cache for allow them to be downloaded again.&lt;br /&gt;
* $BASE/pymaemo-tools/workdir: the generated files (prepared sources, logs, built packages) are placed under this directory, grouped by the name of the sbdmock config file used to build them. Inside each group, the logs and repo directories will contain, respectively, the build logs and the built packages.&lt;br /&gt;
&lt;br /&gt;
== Customization ==&lt;br /&gt;
&lt;br /&gt;
If you want to roll out your own packages or modify the existing ones, the sections below will provide some directions.&lt;br /&gt;
&lt;br /&gt;
=== Adding your own packages to the build ===&lt;br /&gt;
&lt;br /&gt;
If you want to add your own package to the build process, you just have to edit one simple file, packages-fremantle.ini. Just add an entry at the end of the file depending on how your package is organized.&lt;br /&gt;
&lt;br /&gt;
* If all the contents of your package are contained in a single SVN or GIT repository, you have a &amp;quot;native&amp;quot; package. If you&#039;re using SVN, the lines below are enough:&lt;br /&gt;
&lt;br /&gt;
 [new-package]&lt;br /&gt;
 svn_url=https://svnrepository.com/new-package/trunk&lt;br /&gt;
 native=yes&lt;br /&gt;
&lt;br /&gt;
If you&#039;re using git, just change &amp;quot;svn_url&amp;quot; to &amp;quot;git_url&amp;quot; and use the appropriate repository address (git://...). Note also that the flag &amp;quot;native=yes&amp;quot; must be present. Just change &amp;quot;new-package&amp;quot; to a string identifying your package and you&#039;re set.&lt;br /&gt;
&lt;br /&gt;
* If your package has Debian or Ubuntu as upstream and only the packaging is specific for Maemo, you&#039;ll have to specify the location of all the files needed in addition to the repository where the packaging is located. See below an example for pyclutter:&lt;br /&gt;
&lt;br /&gt;
 [pyclutter]&lt;br /&gt;
 source_url=http://ftp.de.debian.org/debian/pool/main/p/pyclutter/pyclutter_0.8.0.orig.tar.gz&lt;br /&gt;
 diff_url=http://ftp.de.debian.org/debian/pool/main/p/pyclutter/pyclutter_0.8.0-1.diff.gz&lt;br /&gt;
 dsc_url=http://ftp.de.debian.org/debian/pool/main/p/pyclutter/pyclutter_0.8.0-1.dsc&lt;br /&gt;
 svn_url=https://garage.maemo.org/svn/pymaemo/packages/pyclutter/trunk/debian&lt;br /&gt;
&lt;br /&gt;
In this example the source, .diff.gz and .dsc files are taken from Debian, and the Maemo-specific packaging is taken from the (former) PyMaemo repository. pymaemo-tools will assemble the package prior to build, as explained in the Overview section.&lt;br /&gt;
&lt;br /&gt;
=== Modifying PyMaemo packages ===&lt;br /&gt;
&lt;br /&gt;
The PyMaemo packages are in Gitorious now, allowing the submission of modifications for any of them via merge requests. An overview of the entire process is listed below:&lt;br /&gt;
&lt;br /&gt;
# Create a clone of the repository at Gitorious for the package you want to modify, and git-clone it;&lt;br /&gt;
# Modify the packages-fremantle.ini entry of the package to point to the full path of the repository directory;&lt;br /&gt;
# Erase your package files from $BASE/download_cache, $BASE/workdir and $BASE/workdir/fremantle_&amp;lt;target&amp;gt;/repo before the build;&lt;br /&gt;
# Modify the package and run build_packages.sh to build it;&lt;br /&gt;
# Install on Scratchbox and on the device, if possible, and run all available unit tests for the package - needless to say, your modifications should not introduce regressions of any type;&lt;br /&gt;
# Add unit tests to assert the funcionality of the new features added, whenever possible;&lt;br /&gt;
# When you are satisfied with the results, push your local changes to your Gitorious clone and file a merge request.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As said before, there are two types of packages: native and taken from upstream.  If you want to modify a native package, you can do anything you want, as the entire package is contained in the repository. However, if the package is taken from upstream, the only changes you can make will be located in the packaging - you&#039;ll have to use patches to actually modify any upstream file in build time.&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
=== Create Debian repository with one line ===&lt;br /&gt;
&lt;br /&gt;
If you want to quickly make a Debian repository for easy installation, &lt;br /&gt;
run the following command at $BASE/pymaemo-tools/workdir/fremantle_&amp;lt;target&amp;gt;/repo:&lt;br /&gt;
&lt;br /&gt;
 $ apt-ftparchive packages . | gzip -9c &amp;gt; Packages.gz &lt;br /&gt;
&lt;br /&gt;
Now you have to expose the packages&#039; path to the Web server and add the repository&lt;br /&gt;
in the target machine accordingly.&lt;br /&gt;
&lt;br /&gt;
=== Tracking build in real time ===&lt;br /&gt;
&lt;br /&gt;
If you want to accompany the build log of any package in real time, you can just use the tail command in the following log files:&lt;br /&gt;
&lt;br /&gt;
* Prep and setup: &lt;br /&gt;
 $ tail -F $BASE/workdir/fremantle_&amp;lt;target&amp;gt;/repo/root.log&lt;br /&gt;
* Build: &lt;br /&gt;
 $ tail -F $BASE/workdir/fremantle_&amp;lt;target&amp;gt;/repo/build.log&lt;/div&gt;</summary>
		<author><name>189.2.128.130</name></author>
	</entry>
	<entry>
		<id>https://maemo.octonezd.me/index.php?title=PyMaemo/How_to_build&amp;diff=33387</id>
		<title>PyMaemo/How to build</title>
		<link rel="alternate" type="text/html" href="https://maemo.octonezd.me/index.php?title=PyMaemo/How_to_build&amp;diff=33387"/>
		<updated>2010-01-18T16:05:26Z</updated>

		<summary type="html">&lt;p&gt;189.2.128.130: /* Adding your own packages to the build */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;b style=&amp;quot;color: red&amp;quot;&amp;gt;DRAFT&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= How to build PyMaemo packages=&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
To build PyMaemo packages from the source, you&#039;ll need:&lt;br /&gt;
&lt;br /&gt;
* Maemo 5 SDK &lt;br /&gt;
* Rootstraps for X86 and ARMEL targets&lt;br /&gt;
* grep-dctrl&lt;br /&gt;
* pymaemo-tools&lt;br /&gt;
&lt;br /&gt;
The scripts from pymaemo-tools are used to download packages&#039; sources and build them using sbdmock, one at a time. sbdmock, in turn, uses the SDK and the rootstraps to create a clean environment for building every package. More information about sbdmock can be obtained [[Building_packages_with_sbdmock|here]], although pymaemo-tools uses a slightly modified of sbdmock - see pymaemo-tools README if you want to know which modifications were made.&lt;br /&gt;
&lt;br /&gt;
The build scripts from pymaemo-tools can be used to build the entire set of packages or only some of them, for X86 or ARMEL targets. It is advised to first build and (if possible) test in the X86 target and use ARMEL target only for cross-compiling for the device.&lt;br /&gt;
&lt;br /&gt;
== Overview of the build process ==&lt;br /&gt;
&lt;br /&gt;
The build process is composed of three phases: download, preparation and the proper build. A high-level description of the process follows:&lt;br /&gt;
&lt;br /&gt;
* Download phase:&lt;br /&gt;
** If the package is originally from Debian or Ubuntu:&lt;br /&gt;
*** The original source is taken from upstream;&lt;br /&gt;
*** The Debian packaging for Maemo is taken from the respective repository in PyMaemo project.&lt;br /&gt;
** If the package is Maemo-specific:&lt;br /&gt;
*** The source package is taken from the respective repository in PyMaemo project&lt;br /&gt;
* Preparation phase:&lt;br /&gt;
** If the package is taken from upstream, assemble package&lt;br /&gt;
** Verify if dependencies are satisfied&lt;br /&gt;
* Build phase:&lt;br /&gt;
** Call sbdmock with proper parameters&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
The base directory for these instructions, refered as $BASE, is /scratchbox/users/&amp;lt;user&amp;gt;/home/&amp;lt;user&amp;gt;/pymaemo, &lt;br /&gt;
where &amp;lt;user&amp;gt; is your username in Scratchbox. All operations are made &#039;&#039;&#039;outside&#039;&#039;&#039; Scratchbox.&lt;br /&gt;
&lt;br /&gt;
First, download the rootstraps for X86 and ARMEL targets and put them in $BASE/rootstraps:&lt;br /&gt;
&lt;br /&gt;
* http://repository.maemo.org/stable/5.0/armel/maemo-sdk-rootstrap_5.0_armel.tgz&lt;br /&gt;
* http://repository.maemo.org/stable/5.0/i386/maemo-sdk-rootstrap_5.0_i386.tgz&lt;br /&gt;
&lt;br /&gt;
Clone the pymaemo-tools project inside $BASE:&lt;br /&gt;
&lt;br /&gt;
 $ git clone [git repo]&lt;br /&gt;
&lt;br /&gt;
This will create the directory pymaemo-tools under $BASE.&lt;br /&gt;
&lt;br /&gt;
Edit the fremantle_i386.cfg and fremantle_armel.cfg under $BASE/pymaemo-tools/sbdmock,&lt;br /&gt;
putting the rootstrap path correspondent to each in the following key:&lt;br /&gt;
* i386: config_opts[&#039;rootstrap&#039;] = &amp;quot;$BASE/rootstraps/maemo-sdk-rootstrap_5.0_i386.tgz&amp;quot;&lt;br /&gt;
* armel: config_opts[&#039;rootstrap&#039;] = &amp;quot;$BASE/rootstraps/maemo-sdk-rootstrap_5.0_armel.tgz&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Building ==&lt;br /&gt;
&lt;br /&gt;
For building all the packages for the X86 target, enter $BASE/pymaemo-tools and run:&lt;br /&gt;
&lt;br /&gt;
 $ ./build_packages.sh sbdmock:fremantle_i386 packages_fremantle.ini&lt;br /&gt;
&lt;br /&gt;
The same can be done to ARMEL target, just replacing &amp;quot;i386&amp;quot; with &amp;quot;armel&amp;quot;. The file packages_fremantle.ini contains all data necessary for obtaining the sources. &lt;br /&gt;
&lt;br /&gt;
You can build individual packages too, specifying them as parameters. If you want to build only, let&#039;s say, pyopenssl and pycurl for the ARMEL target, run:&lt;br /&gt;
&lt;br /&gt;
 $ ./build_packages.sh sbdmock:fremantle_armel packages_fremantle.ini pyopenssl,pycurl&lt;br /&gt;
&lt;br /&gt;
Be advised that any PyMaemo dependency for these packages must be built first, as build_packages.sh will attempt to build only the packages provided at the command line.&lt;br /&gt;
&lt;br /&gt;
There are other options for the build; for more information, run build_packages.sh &lt;br /&gt;
with no parameters or refer to the README file inside pymaemo-tools.&lt;br /&gt;
&lt;br /&gt;
When the build finishes the resultant Debian packages will be placed at &lt;br /&gt;
$BASE/pymaemo-tools/workdir/fremantle_&amp;lt;target&amp;gt;/repo, where &amp;lt;target&amp;gt; is i386 or armel,and the build logs placed in $BASE/pymaemo-tools/workdir/fremantle_&amp;lt;target&amp;gt;/logs.&lt;br /&gt;
From that point on, they can be installed on the targets and the ARMEL ones&lt;br /&gt;
can be copied to the device to be installed there.&lt;br /&gt;
&lt;br /&gt;
=== Directories created ===&lt;br /&gt;
&lt;br /&gt;
* $BASE/pymaemo-tools/download_cache: all downloaded files are placed here, one directory by package, so you don&#039;t have to download everything again in every build. If the sources are updated, though, you will have to erase the corresponding entries on download_cache for allow them to be downloaded again.&lt;br /&gt;
* $BASE/pymaemo-tools/workdir: the generated files (prepared sources, logs, built packages) are placed under this directory, grouped by the name of the sbdmock config file used to build them. Inside each group, the logs and repo directories will contain, respectively, the build logs and the built packages.&lt;br /&gt;
&lt;br /&gt;
== Customization ==&lt;br /&gt;
&lt;br /&gt;
If you want to roll out your own packages or modify the existing ones, the sections below will provide some directions.&lt;br /&gt;
&lt;br /&gt;
=== Adding your own packages to the build ===&lt;br /&gt;
&lt;br /&gt;
If you want to add your own package to the build process, you just have to edit one simple file, packages-fremantle.ini. Just add an entry at the end of the file depending on how your package is organized.&lt;br /&gt;
&lt;br /&gt;
* If all the contents of your package are contained in a single SVN or GIT repository, you have a &amp;quot;native&amp;quot; package. If you&#039;re using SVN, the lines below are enough:&lt;br /&gt;
&lt;br /&gt;
 [new-package]&lt;br /&gt;
 svn_url=https://svnrepository.com/new-package/trunk&lt;br /&gt;
 native=yes&lt;br /&gt;
&lt;br /&gt;
If you&#039;re using git, just change &amp;quot;svn_url&amp;quot; to &amp;quot;git_url&amp;quot; and use the appropriate repository address (git://...). Note also that the flag &amp;quot;native=yes&amp;quot; must be present. Just change &amp;quot;new-package&amp;quot; to a string identifying your package and you&#039;re set.&lt;br /&gt;
&lt;br /&gt;
* If your package has Debian or Ubuntu as upstream and only the packaging is specific for Maemo, you&#039;ll have to specify the location of all the files needed in addition to the repository where the packaging is located. See below an example for pyclutter:&lt;br /&gt;
&lt;br /&gt;
 [pyclutter]&lt;br /&gt;
 source_url=http://ftp.de.debian.org/debian/pool/main/p/pyclutter/pyclutter_0.8.0.orig.tar.gz&lt;br /&gt;
 diff_url=http://ftp.de.debian.org/debian/pool/main/p/pyclutter/pyclutter_0.8.0-1.diff.gz&lt;br /&gt;
 dsc_url=http://ftp.de.debian.org/debian/pool/main/p/pyclutter/pyclutter_0.8.0-1.dsc&lt;br /&gt;
 svn_url=https://garage.maemo.org/svn/pymaemo/packages/pyclutter/trunk/debian&lt;br /&gt;
&lt;br /&gt;
In this example the source, .diff.gz and .dsc files are taken from Debian, and the Maemo-specific packaging is taken from the (former) PyMaemo repository. pymaemo-tools will assemble the package prior to build, as explained in the Overview section.&lt;br /&gt;
&lt;br /&gt;
=== Modifying PyMaemo packages ===&lt;br /&gt;
&lt;br /&gt;
The PyMaemo packages are all in Gitorious now, allowing easy customization of any package you desire. The high-level steps for the process are listed below.&lt;br /&gt;
&lt;br /&gt;
* Create a clone of the the repository at Gitorious for the package you want to modify, and git-clone it;&lt;br /&gt;
* Modify the packages-fremantle.ini repository section of the package to point to the repository you just cloned;&lt;br /&gt;
** Use the full path to the directory you cloned in git_url&lt;br /&gt;
* Modify the package at will, and then build it using the same command tools - pymaemo-tools will use your local repository for building;&lt;br /&gt;
** Erase the prepared files of your package from $BASE/workdir prior to the building proper;&lt;br /&gt;
* When you are satisfied with the results, push your local changes to your Gitorious clone, and file a merge request.&lt;br /&gt;
&lt;br /&gt;
As said before, there are two types of packages: native and taken from upstream.  If you want to modify a native package, you can do anything you want, as the entire package is contained in the repository. However, if the package is taken from upstream, the only changes you can make will be located in the Maemo packaging - you&#039;ll have to use patches to actually modify any upstream file in build time.&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
=== Create Debian repository with one line ===&lt;br /&gt;
&lt;br /&gt;
If you want to quickly make a Debian repository for easy installation, &lt;br /&gt;
run the following command at $BASE/pymaemo-tools/workdir/fremantle_&amp;lt;target&amp;gt;/repo:&lt;br /&gt;
&lt;br /&gt;
 $ apt-ftparchive packages . | gzip -9c &amp;gt; Packages.gz &lt;br /&gt;
&lt;br /&gt;
Now you have to expose the packages&#039; path to the Web server and add the repository&lt;br /&gt;
in the target machine accordingly.&lt;br /&gt;
&lt;br /&gt;
=== Tracking build in real time ===&lt;br /&gt;
&lt;br /&gt;
If you want to accompany the build log of any package in real time, you can just use the tail command in the following log files:&lt;br /&gt;
&lt;br /&gt;
* Prep and setup: &lt;br /&gt;
 $ tail -F $BASE/workdir/fremantle_&amp;lt;target&amp;gt;/repo/root.log&lt;br /&gt;
* Build: &lt;br /&gt;
 $ tail -F $BASE/workdir/fremantle_&amp;lt;target&amp;gt;/repo/build.log&lt;/div&gt;</summary>
		<author><name>189.2.128.130</name></author>
	</entry>
	<entry>
		<id>https://maemo.octonezd.me/index.php?title=PyMaemo/How_to_build&amp;diff=33391</id>
		<title>PyMaemo/How to build</title>
		<link rel="alternate" type="text/html" href="https://maemo.octonezd.me/index.php?title=PyMaemo/How_to_build&amp;diff=33391"/>
		<updated>2010-01-15T18:31:42Z</updated>

		<summary type="html">&lt;p&gt;189.2.128.130: /* Tips */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= How to build PyMaemo packages=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
To build PyMaemo packages from the source, you&#039;ll need:&lt;br /&gt;
&lt;br /&gt;
* Maemo 5 SDK &lt;br /&gt;
* Rootstraps for X86 and ARMEL targets&lt;br /&gt;
* grep-dctrl&lt;br /&gt;
* pymaemo-builder&lt;br /&gt;
&lt;br /&gt;
The scripts from pymaemo-builder are used to download packages&#039; sources and build them using sbdmock, one at a time. sbdmock, in turn, uses the SDK and the rootstraps to create a clean environment for building every package. More information about sbdmock can be obtained [[Building_packages_with_sbdmock|here]], although pymaemo-builder uses a slightly modified of sbdmock - see pymaemo-builder README if you want to know which modifications were made.&lt;br /&gt;
&lt;br /&gt;
The scripts from pymaemo-builder can be used to build the entire set of packages or only some of them, for X86 or ARMEL targets. It is advised to first build and (if possible) test in the X86 target and use ARMEL target only for cross-compiling for the device.&lt;br /&gt;
&lt;br /&gt;
== Overview of the build process ==&lt;br /&gt;
&lt;br /&gt;
The build process is composed of three phases: download, preparation and the proper build. A high-level description of the process follows:&lt;br /&gt;
&lt;br /&gt;
* Download phase:&lt;br /&gt;
** If the package is originally from Debian or Ubuntu:&lt;br /&gt;
*** The original source is taken from upstream;&lt;br /&gt;
*** The Debian packaging for Maemo is taken from the respective repository in PyMaemo project.&lt;br /&gt;
** If the package is Maemo-specific:&lt;br /&gt;
*** The source package is taken from the respective repository in PyMaemo project&lt;br /&gt;
* Preparation phase:&lt;br /&gt;
** If the package is taken from upstream, assemble package&lt;br /&gt;
** Verify if dependencies are satisfied&lt;br /&gt;
* Build phase:&lt;br /&gt;
** Call sbdmock with proper parameters&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
The base directory for these instructions, refered as $BASE, is /scratchbox/users/&amp;lt;user&amp;gt;/home/&amp;lt;user&amp;gt;/pymaemo, &lt;br /&gt;
where &amp;lt;user&amp;gt; is your username in Scratchbox. All operations are made &#039;&#039;&#039;outside&#039;&#039;&#039; Scratchbox.&lt;br /&gt;
&lt;br /&gt;
First, download the rootstraps for X86 and ARMEL targets and put them in $BASE/rootstraps:&lt;br /&gt;
&lt;br /&gt;
* http://repository.maemo.org/stable/5.0/armel/maemo-sdk-rootstrap_5.0_armel.tgz&lt;br /&gt;
* http://repository.maemo.org/stable/5.0/i386/maemo-sdk-rootstrap_5.0_i386.tgz&lt;br /&gt;
&lt;br /&gt;
Clone the pymaemo-builder project inside $BASE:&lt;br /&gt;
&lt;br /&gt;
 $ git clone [git repo]&lt;br /&gt;
&lt;br /&gt;
This will create the directory pymaemo-builder under $BASE.&lt;br /&gt;
&lt;br /&gt;
Edit the fremantle_i386.cfg and fremantle_armel.cfg under $BASE/pymaemo-builder/sbdmock,&lt;br /&gt;
putting the rootstrap path correspondent to each in the following key:&lt;br /&gt;
* i386: config_opts[&#039;rootstrap&#039;] = &amp;quot;$BASE/rootstraps/maemo-sdk-rootstrap_5.0_i386.tgz&amp;quot;&lt;br /&gt;
* armel: config_opts[&#039;rootstrap&#039;] = &amp;quot;$BASE/rootstraps/maemo-sdk-rootstrap_5.0_armel.tgz&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Building ==&lt;br /&gt;
&lt;br /&gt;
For building all the packages for the X86 target, enter $BASE/pymaemo-builder and run:&lt;br /&gt;
&lt;br /&gt;
 $ ./build_packages.sh sbdmock:fremantle_i386 packages_fremantle.ini&lt;br /&gt;
&lt;br /&gt;
The same can be done to ARMEL target, just replacing &amp;quot;i386&amp;quot; with &amp;quot;armel&amp;quot;. The file packages_fremantle.ini contains all data necessary for obtaining the sources. &lt;br /&gt;
&lt;br /&gt;
You can build individual packages too, specifying them as parameters. If you want to build only, let&#039;s say, pyopenssl and pycurl for the ARMEL target, run:&lt;br /&gt;
&lt;br /&gt;
 $ ./build_packages.sh sbdmock:fremantle_armel packages_fremantle.ini pyopenssl,pycurl&lt;br /&gt;
&lt;br /&gt;
Be advised that any PyMaemo dependency for these packages must be built first, as build_packages.sh will attempt to build only the packages provided at the command line.&lt;br /&gt;
&lt;br /&gt;
There are other options for the build; for more information, run build_packages.sh &lt;br /&gt;
with no parameters or refer to the README file inside pymaemo-builder.&lt;br /&gt;
&lt;br /&gt;
When the build finishes the resultant Debian packages will be placed at &lt;br /&gt;
$BASE/pymaemo-builder/workdir/fremantle_&amp;lt;target&amp;gt;/repo, where &amp;lt;target&amp;gt; is i386 or armel,and the build logs placed in $BASE/pymaemo-builder/workdir/fremantle_&amp;lt;target&amp;gt;/logs.&lt;br /&gt;
From that point on, they can be installed on the targets and the ARMEL ones&lt;br /&gt;
can be copied to the device to be installed there.&lt;br /&gt;
&lt;br /&gt;
=== Directories created ===&lt;br /&gt;
&lt;br /&gt;
* $BASE/pymaemo-builder/download_cache: all downloaded files are placed here, one directory by package, so you don&#039;t have to download everything again in every build. If the sources are updated, though, you will have to erase the corresponding entries on download_cache for allow them to be downloaded again.&lt;br /&gt;
* $BASE/pymaemo-builder/workdir: the generated files (prepared sources, logs, built packages) are placed under this directory, grouped by the name of the sbdmock config file used to build them. Inside each group, the logs and repo directories will contain, respectively, the build logs and the built packages.&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
=== Create Debian repository with one line ===&lt;br /&gt;
&lt;br /&gt;
If you want to quickly make a Debian repository for easy installation, &lt;br /&gt;
run the following command at $BASE/pymaemo-builder/workdir/fremantle_&amp;lt;target&amp;gt;/repo:&lt;br /&gt;
&lt;br /&gt;
 $ apt-ftparchive packages . | gzip -9c &amp;gt; Packages.gz &lt;br /&gt;
&lt;br /&gt;
Now you have to expose the packages&#039; path to the Web server and add the repository&lt;br /&gt;
in the target machine accordingly.&lt;br /&gt;
&lt;br /&gt;
=== Tracking build in real time ===&lt;br /&gt;
&lt;br /&gt;
If you want to accompany the build log of any package in real time, you can just use the tail command in the following log files:&lt;br /&gt;
&lt;br /&gt;
* Dependency download: &lt;br /&gt;
 $ tail -F $BASE/workdir/fremantle_&amp;lt;target&amp;gt;/repo/root.log&lt;br /&gt;
* Build: &lt;br /&gt;
 $ tail -F $BASE/workdir/fremantle_&amp;lt;target&amp;gt;/repo/build.log&lt;/div&gt;</summary>
		<author><name>189.2.128.130</name></author>
	</entry>
	<entry>
		<id>https://maemo.octonezd.me/index.php?title=PyMaemo/How_to_build&amp;diff=33392</id>
		<title>PyMaemo/How to build</title>
		<link rel="alternate" type="text/html" href="https://maemo.octonezd.me/index.php?title=PyMaemo/How_to_build&amp;diff=33392"/>
		<updated>2010-01-15T16:03:10Z</updated>

		<summary type="html">&lt;p&gt;189.2.128.130: /* Directories created */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= How to build PyMaemo packages=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
To build PyMaemo packages from the source, you&#039;ll need:&lt;br /&gt;
&lt;br /&gt;
* Maemo 5 SDK &lt;br /&gt;
* Rootstraps for X86 and ARMEL targets&lt;br /&gt;
* grep-dctrl&lt;br /&gt;
* pymaemo-builder&lt;br /&gt;
&lt;br /&gt;
The scripts from pymaemo-builder are used to download packages&#039; sources and build them using sbdmock, one at a time. sbdmock, in turn, uses the SDK and the rootstraps to create a clean environment for building every package. More information about sbdmock can be obtained [[Building_packages_with_sbdmock|here]], although pymaemo-builder uses a slightly modified of sbdmock - see pymaemo-builder README if you want to know which modifications were made.&lt;br /&gt;
&lt;br /&gt;
The scripts from pymaemo-builder can be used to build the entire set of packages or only some of them, for X86 or ARMEL targets. It is advised to first build and (if possible) test in the X86 target and use ARMEL target only for cross-compiling for the device.&lt;br /&gt;
&lt;br /&gt;
== Overview of the build process ==&lt;br /&gt;
&lt;br /&gt;
The build process is composed of three phases: download, preparation and the proper build. A high-level description of the process follows:&lt;br /&gt;
&lt;br /&gt;
* Download phase:&lt;br /&gt;
** If the package is originally from Debian or Ubuntu:&lt;br /&gt;
*** The original source is taken from upstream;&lt;br /&gt;
*** The Debian packaging for Maemo is taken from the respective repository in PyMaemo project.&lt;br /&gt;
** If the package is Maemo-specific:&lt;br /&gt;
*** The source package is taken from the respective repository in PyMaemo project&lt;br /&gt;
* Preparation phase:&lt;br /&gt;
** If the package is taken from upstream, assemble package&lt;br /&gt;
** Verify if dependencies are satisfied&lt;br /&gt;
* Build phase:&lt;br /&gt;
** Call sbdmock with proper parameters&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
The base directory for these instructions, refered as $BASE, is /scratchbox/users/&amp;lt;user&amp;gt;/home/&amp;lt;user&amp;gt;/pymaemo, &lt;br /&gt;
where &amp;lt;user&amp;gt; is your username in Scratchbox. All operations are made &#039;&#039;&#039;outside&#039;&#039;&#039; Scratchbox.&lt;br /&gt;
&lt;br /&gt;
First, download the rootstraps for X86 and ARMEL targets and put them in $BASE/rootstraps:&lt;br /&gt;
&lt;br /&gt;
* http://repository.maemo.org/stable/5.0/armel/maemo-sdk-rootstrap_5.0_armel.tgz&lt;br /&gt;
* http://repository.maemo.org/stable/5.0/i386/maemo-sdk-rootstrap_5.0_i386.tgz&lt;br /&gt;
&lt;br /&gt;
Clone the pymaemo-builder project inside $BASE:&lt;br /&gt;
&lt;br /&gt;
 $ git clone [git repo]&lt;br /&gt;
&lt;br /&gt;
This will create the directory pymaemo-builder under $BASE.&lt;br /&gt;
&lt;br /&gt;
Edit the fremantle_i386.cfg and fremantle_armel.cfg under $BASE/pymaemo-builder/sbdmock,&lt;br /&gt;
putting the rootstrap path correspondent to each in the following key:&lt;br /&gt;
* i386: config_opts[&#039;rootstrap&#039;] = &amp;quot;$BASE/rootstraps/maemo-sdk-rootstrap_5.0_i386.tgz&amp;quot;&lt;br /&gt;
* armel: config_opts[&#039;rootstrap&#039;] = &amp;quot;$BASE/rootstraps/maemo-sdk-rootstrap_5.0_armel.tgz&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Building ==&lt;br /&gt;
&lt;br /&gt;
For building all the packages for the X86 target, enter $BASE/pymaemo-builder and run:&lt;br /&gt;
&lt;br /&gt;
 $ ./build_packages.sh sbdmock:fremantle_i386 packages_fremantle.ini&lt;br /&gt;
&lt;br /&gt;
The same can be done to ARMEL target, just replacing &amp;quot;i386&amp;quot; with &amp;quot;armel&amp;quot;. The file packages_fremantle.ini contains all data necessary for obtaining the sources. &lt;br /&gt;
&lt;br /&gt;
You can build individual packages too, specifying them as parameters. If you want to build only, let&#039;s say, pyopenssl and pycurl for the ARMEL target, run:&lt;br /&gt;
&lt;br /&gt;
 $ ./build_packages.sh sbdmock:fremantle_armel packages_fremantle.ini pyopenssl,pycurl&lt;br /&gt;
&lt;br /&gt;
Be advised that any PyMaemo dependency for these packages must be built first, as build_packages.sh will attempt to build only the packages provided at the command line.&lt;br /&gt;
&lt;br /&gt;
There are other options for the build; for more information, run build_packages.sh &lt;br /&gt;
with no parameters or refer to the README file inside pymaemo-builder.&lt;br /&gt;
&lt;br /&gt;
When the build finishes the resultant Debian packages will be placed at &lt;br /&gt;
$BASE/pymaemo-builder/workdir/fremantle_&amp;lt;target&amp;gt;/repo, where &amp;lt;target&amp;gt; is i386 or armel,and the build logs placed in $BASE/pymaemo-builder/workdir/fremantle_&amp;lt;target&amp;gt;/logs.&lt;br /&gt;
From that point on, they can be installed on the targets and the ARMEL ones&lt;br /&gt;
can be copied to the device to be installed there.&lt;br /&gt;
&lt;br /&gt;
=== Directories created ===&lt;br /&gt;
&lt;br /&gt;
* $BASE/pymaemo-builder/download_cache: all downloaded files are placed here, one directory by package, so you don&#039;t have to download everything again in every build. If the sources are updated, though, you will have to erase the corresponding entries on download_cache for allow them to be downloaded again.&lt;br /&gt;
* $BASE/pymaemo-builder/workdir: the generated files (prepared sources, logs, built packages) are placed under this directory, grouped by the name of the sbdmock config file used to build them. Inside each group, the logs and repo directories will contain, respectively, the build logs and the built packages.&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
If you want to quickly make a Debian repository for easy installation, &lt;br /&gt;
run the following command at $BASE/pymaemo-builder/workdir/fremantle_&amp;lt;target&amp;gt;/repo:&lt;br /&gt;
&lt;br /&gt;
 $ apt-ftparchive packages . | gzip -9c &amp;gt; Packages.gz &lt;br /&gt;
&lt;br /&gt;
Now you have to expose the packages&#039; path to the Web server and add the repository&lt;br /&gt;
in the target machine accordingly.&lt;/div&gt;</summary>
		<author><name>189.2.128.130</name></author>
	</entry>
	<entry>
		<id>https://maemo.octonezd.me/index.php?title=PyMaemo/How_to_build&amp;diff=33393</id>
		<title>PyMaemo/How to build</title>
		<link rel="alternate" type="text/html" href="https://maemo.octonezd.me/index.php?title=PyMaemo/How_to_build&amp;diff=33393"/>
		<updated>2010-01-15T16:00:40Z</updated>

		<summary type="html">&lt;p&gt;189.2.128.130: /* Building */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= How to build PyMaemo packages=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
To build PyMaemo packages from the source, you&#039;ll need:&lt;br /&gt;
&lt;br /&gt;
* Maemo 5 SDK &lt;br /&gt;
* Rootstraps for X86 and ARMEL targets&lt;br /&gt;
* grep-dctrl&lt;br /&gt;
* pymaemo-builder&lt;br /&gt;
&lt;br /&gt;
The scripts from pymaemo-builder are used to download packages&#039; sources and build them using sbdmock, one at a time. sbdmock, in turn, uses the SDK and the rootstraps to create a clean environment for building every package. More information about sbdmock can be obtained [[Building_packages_with_sbdmock|here]], although pymaemo-builder uses a slightly modified of sbdmock - see pymaemo-builder README if you want to know which modifications were made.&lt;br /&gt;
&lt;br /&gt;
The scripts from pymaemo-builder can be used to build the entire set of packages or only some of them, for X86 or ARMEL targets. It is advised to first build and (if possible) test in the X86 target and use ARMEL target only for cross-compiling for the device.&lt;br /&gt;
&lt;br /&gt;
== Overview of the build process ==&lt;br /&gt;
&lt;br /&gt;
The build process is composed of three phases: download, preparation and the proper build. A high-level description of the process follows:&lt;br /&gt;
&lt;br /&gt;
* Download phase:&lt;br /&gt;
** If the package is originally from Debian or Ubuntu:&lt;br /&gt;
*** The original source is taken from upstream;&lt;br /&gt;
*** The Debian packaging for Maemo is taken from the respective repository in PyMaemo project.&lt;br /&gt;
** If the package is Maemo-specific:&lt;br /&gt;
*** The source package is taken from the respective repository in PyMaemo project&lt;br /&gt;
* Preparation phase:&lt;br /&gt;
** If the package is taken from upstream, assemble package&lt;br /&gt;
** Verify if dependencies are satisfied&lt;br /&gt;
* Build phase:&lt;br /&gt;
** Call sbdmock with proper parameters&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
The base directory for these instructions, refered as $BASE, is /scratchbox/users/&amp;lt;user&amp;gt;/home/&amp;lt;user&amp;gt;/pymaemo, &lt;br /&gt;
where &amp;lt;user&amp;gt; is your username in Scratchbox. All operations are made &#039;&#039;&#039;outside&#039;&#039;&#039; Scratchbox.&lt;br /&gt;
&lt;br /&gt;
First, download the rootstraps for X86 and ARMEL targets and put them in $BASE/rootstraps:&lt;br /&gt;
&lt;br /&gt;
* http://repository.maemo.org/stable/5.0/armel/maemo-sdk-rootstrap_5.0_armel.tgz&lt;br /&gt;
* http://repository.maemo.org/stable/5.0/i386/maemo-sdk-rootstrap_5.0_i386.tgz&lt;br /&gt;
&lt;br /&gt;
Clone the pymaemo-builder project inside $BASE:&lt;br /&gt;
&lt;br /&gt;
 $ git clone [git repo]&lt;br /&gt;
&lt;br /&gt;
This will create the directory pymaemo-builder under $BASE.&lt;br /&gt;
&lt;br /&gt;
Edit the fremantle_i386.cfg and fremantle_armel.cfg under $BASE/pymaemo-builder/sbdmock,&lt;br /&gt;
putting the rootstrap path correspondent to each in the following key:&lt;br /&gt;
* i386: config_opts[&#039;rootstrap&#039;] = &amp;quot;$BASE/rootstraps/maemo-sdk-rootstrap_5.0_i386.tgz&amp;quot;&lt;br /&gt;
* armel: config_opts[&#039;rootstrap&#039;] = &amp;quot;$BASE/rootstraps/maemo-sdk-rootstrap_5.0_armel.tgz&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Building ==&lt;br /&gt;
&lt;br /&gt;
For building all the packages for the X86 target, enter $BASE/pymaemo-builder and run:&lt;br /&gt;
&lt;br /&gt;
 $ ./build_packages.sh sbdmock:fremantle_i386 packages_fremantle.ini&lt;br /&gt;
&lt;br /&gt;
The same can be done to ARMEL target, just replacing &amp;quot;i386&amp;quot; with &amp;quot;armel&amp;quot;. The file packages_fremantle.ini contains all data necessary for obtaining the sources. &lt;br /&gt;
&lt;br /&gt;
You can build individual packages too, specifying them as parameters. If you want to build only, let&#039;s say, pyopenssl and pycurl for the ARMEL target, run:&lt;br /&gt;
&lt;br /&gt;
 $ ./build_packages.sh sbdmock:fremantle_armel packages_fremantle.ini pyopenssl,pycurl&lt;br /&gt;
&lt;br /&gt;
Be advised that any PyMaemo dependency for these packages must be built first, as build_packages.sh will attempt to build only the packages provided at the command line.&lt;br /&gt;
&lt;br /&gt;
There are other options for the build; for more information, run build_packages.sh &lt;br /&gt;
with no parameters or refer to the README file inside pymaemo-builder.&lt;br /&gt;
&lt;br /&gt;
When the build finishes the resultant Debian packages will be placed at &lt;br /&gt;
$BASE/pymaemo-builder/workdir/fremantle_&amp;lt;target&amp;gt;/repo, where &amp;lt;target&amp;gt; is i386 or armel,and the build logs placed in $BASE/pymaemo-builder/workdir/fremantle_&amp;lt;target&amp;gt;/logs.&lt;br /&gt;
From that point on, they can be installed on the targets and the ARMEL ones&lt;br /&gt;
can be copied to the device to be installed there.&lt;br /&gt;
&lt;br /&gt;
=== Directories created ===&lt;br /&gt;
&lt;br /&gt;
* $BASE/pymaemo-builder/download_cache: all downloaded files are placed here, one directory by package, so you don&#039;t have to download everything again in every build. If the sources are updated, though, you will have to erase the corresponding entry on download_cache for allow them to be downloaded again.&lt;br /&gt;
* $BASE/pymaemo-builder/workdir: the generated files (prepared sources, logs, built packages) are placed under this directory, grouped by the name of the sbdmock config file used to build them. Inside each group, the logs and repo directories will contain, respectively, the build logs and the built packages.&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
If you want to quickly make a Debian repository for easy installation, &lt;br /&gt;
run the following command at $BASE/pymaemo-builder/workdir/fremantle_&amp;lt;target&amp;gt;/repo:&lt;br /&gt;
&lt;br /&gt;
 $ apt-ftparchive packages . | gzip -9c &amp;gt; Packages.gz &lt;br /&gt;
&lt;br /&gt;
Now you have to expose the packages&#039; path to the Web server and add the repository&lt;br /&gt;
in the target machine accordingly.&lt;/div&gt;</summary>
		<author><name>189.2.128.130</name></author>
	</entry>
	<entry>
		<id>https://maemo.octonezd.me/index.php?title=PyMaemo/How_to_build&amp;diff=33394</id>
		<title>PyMaemo/How to build</title>
		<link rel="alternate" type="text/html" href="https://maemo.octonezd.me/index.php?title=PyMaemo/How_to_build&amp;diff=33394"/>
		<updated>2010-01-15T15:57:48Z</updated>

		<summary type="html">&lt;p&gt;189.2.128.130: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= How to build PyMaemo packages=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
To build PyMaemo packages from the source, you&#039;ll need:&lt;br /&gt;
&lt;br /&gt;
* Maemo 5 SDK &lt;br /&gt;
* Rootstraps for X86 and ARMEL targets&lt;br /&gt;
* grep-dctrl&lt;br /&gt;
* pymaemo-builder&lt;br /&gt;
&lt;br /&gt;
The scripts from pymaemo-builder are used to download packages&#039; sources and build them using sbdmock, one at a time. sbdmock, in turn, uses the SDK and the rootstraps to create a clean environment for building every package. More information about sbdmock can be obtained [[Building_packages_with_sbdmock|here]], although pymaemo-builder uses a slightly modified of sbdmock - see pymaemo-builder README if you want to know which modifications were made.&lt;br /&gt;
&lt;br /&gt;
The scripts from pymaemo-builder can be used to build the entire set of packages or only some of them, for X86 or ARMEL targets. It is advised to first build and (if possible) test in the X86 target and use ARMEL target only for cross-compiling for the device.&lt;br /&gt;
&lt;br /&gt;
== Overview of the build process ==&lt;br /&gt;
&lt;br /&gt;
The build process is composed of three phases: download, preparation and the proper build. A high-level description of the process follows:&lt;br /&gt;
&lt;br /&gt;
* Download phase:&lt;br /&gt;
** If the package is originally from Debian or Ubuntu:&lt;br /&gt;
*** The original source is taken from upstream;&lt;br /&gt;
*** The Debian packaging for Maemo is taken from the respective repository in PyMaemo project.&lt;br /&gt;
** If the package is Maemo-specific:&lt;br /&gt;
*** The source package is taken from the respective repository in PyMaemo project&lt;br /&gt;
* Preparation phase:&lt;br /&gt;
** If the package is taken from upstream, assemble package&lt;br /&gt;
** Verify if dependencies are satisfied&lt;br /&gt;
* Build phase:&lt;br /&gt;
** Call sbdmock with proper parameters&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
The base directory for these instructions, refered as $BASE, is /scratchbox/users/&amp;lt;user&amp;gt;/home/&amp;lt;user&amp;gt;/pymaemo, &lt;br /&gt;
where &amp;lt;user&amp;gt; is your username in Scratchbox. All operations are made &#039;&#039;&#039;outside&#039;&#039;&#039; Scratchbox.&lt;br /&gt;
&lt;br /&gt;
First, download the rootstraps for X86 and ARMEL targets and put them in $BASE/rootstraps:&lt;br /&gt;
&lt;br /&gt;
* http://repository.maemo.org/stable/5.0/armel/maemo-sdk-rootstrap_5.0_armel.tgz&lt;br /&gt;
* http://repository.maemo.org/stable/5.0/i386/maemo-sdk-rootstrap_5.0_i386.tgz&lt;br /&gt;
&lt;br /&gt;
Clone the pymaemo-builder project inside $BASE:&lt;br /&gt;
&lt;br /&gt;
 $ git clone [git repo]&lt;br /&gt;
&lt;br /&gt;
This will create the directory pymaemo-builder under $BASE.&lt;br /&gt;
&lt;br /&gt;
Edit the fremantle_i386.cfg and fremantle_armel.cfg under $BASE/pymaemo-builder/sbdmock,&lt;br /&gt;
putting the rootstrap path correspondent to each in the following key:&lt;br /&gt;
* i386: config_opts[&#039;rootstrap&#039;] = &amp;quot;$BASE/rootstraps/maemo-sdk-rootstrap_5.0_i386.tgz&amp;quot;&lt;br /&gt;
* armel: config_opts[&#039;rootstrap&#039;] = &amp;quot;$BASE/rootstraps/maemo-sdk-rootstrap_5.0_armel.tgz&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Building ==&lt;br /&gt;
&lt;br /&gt;
For building all the packages for the X86 target, enter $BASE/pymaemo-builder and run:&lt;br /&gt;
&lt;br /&gt;
 $ ./build_packages.sh sbdmock:fremantle_i386 packages_fremantle.ini&lt;br /&gt;
&lt;br /&gt;
The same can be done to ARMEL target, just replacing &amp;quot;i386&amp;quot; with &amp;quot;armel&amp;quot;. The file packages_fremantle.ini contains all data necessary for obtaining the sources. &lt;br /&gt;
&lt;br /&gt;
You can build individual packages too, specifying them as parameters. If you want to build only, let&#039;s say, pyopenssl and pycurl for the ARMEL target, run:&lt;br /&gt;
&lt;br /&gt;
 $ ./build_packages.sh sbdmock:fremantle_armel packages_fremantle.ini pyopenssl,pycurl&lt;br /&gt;
&lt;br /&gt;
Be advised that any PyMaemo dependency for these packages must be built first, as build_packages.sh will attempt to build only the packages provided at the command line.&lt;br /&gt;
&lt;br /&gt;
There are other options for the build; for more information, run ./build_packages.sh &lt;br /&gt;
with no parameters or refer to the README file inside pymaemo-builder.&lt;br /&gt;
&lt;br /&gt;
When the build finishes the resultant Debian packages will be placed at &lt;br /&gt;
$BASE/pymaemo-builder/workdir/fremantle_&amp;lt;target&amp;gt;/repo, where &amp;lt;target&amp;gt; is i386 or armel,and the build logs placed in $BASE/pymaemo-builder/workdir/fremantle_&amp;lt;target&amp;gt;/logs.&lt;br /&gt;
From that point on, they can be installed on the targets and the ARMEL ones&lt;br /&gt;
can be copied to the device to be installed there.&lt;br /&gt;
&lt;br /&gt;
=== Directories created ===&lt;br /&gt;
&lt;br /&gt;
* $BASE/pymaemo-builder/download_cache: all downloaded files are placed here, one directory by package, so you don&#039;t have to download everything again in every build. If the sources are updated, though, you will have to erase the corresponding entry on download_cache for allow them to be downloaded again.&lt;br /&gt;
* $BASE/pymaemo-builder/workdir: the generated files (prepared sources, logs, built packages) are placed under this directory, grouped by the name of the sbdmock config file used to build them. Inside each group, the logs and repo directories will contain, respectively, the build logs and the built packages.&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
If you want to quickly make a Debian repository for easy installation, &lt;br /&gt;
run the following command at $BASE/pymaemo-builder/workdir/fremantle_&amp;lt;target&amp;gt;/repo:&lt;br /&gt;
&lt;br /&gt;
 $ apt-ftparchive packages . | gzip -9c &amp;gt; Packages.gz &lt;br /&gt;
&lt;br /&gt;
Now you have to expose the packages&#039; path to the Web server and add the repository&lt;br /&gt;
in the target machine accordingly.&lt;/div&gt;</summary>
		<author><name>189.2.128.130</name></author>
	</entry>
	<entry>
		<id>https://maemo.octonezd.me/index.php?title=PyMaemo/How_to_build&amp;diff=33395</id>
		<title>PyMaemo/How to build</title>
		<link rel="alternate" type="text/html" href="https://maemo.octonezd.me/index.php?title=PyMaemo/How_to_build&amp;diff=33395"/>
		<updated>2010-01-15T15:50:35Z</updated>

		<summary type="html">&lt;p&gt;189.2.128.130: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= How to build PyMaemo packages=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
To build PyMaemo packages from the source, you&#039;ll need:&lt;br /&gt;
&lt;br /&gt;
* Maemo 5 SDK &lt;br /&gt;
* Rootstraps for X86 and ARMEL targets&lt;br /&gt;
* grep-dctrl&lt;br /&gt;
* pymaemo-builder&lt;br /&gt;
&lt;br /&gt;
The scripts from pymaemo-builder are used to download packages&#039; sources and build them using sbdmock, one at a time. sbdmock, in turn, uses the SDK and the rootstraps to create a clean environment for building every package. More information about sbdmock can be obtained [[Building_packages_with_sbdmock|here]], altough pymaemo-builder uses a slightly modified of sbdmock - see pymaemo-builder README if you want to know which modifications were made.&lt;br /&gt;
&lt;br /&gt;
The scripts from pymaemo-builder can be used to build the entire set of packages or only some of them, for X86 or ARMEL targets. It is advised to first build and (if possible) test in the X86 target and use ARMEL target only for cross-compiling for the device.&lt;br /&gt;
&lt;br /&gt;
== Overview of the build process ==&lt;br /&gt;
&lt;br /&gt;
The build process is composed of three phases: download, preparation and the proper build. A high-level description of the process follows:&lt;br /&gt;
&lt;br /&gt;
* Download phase:&lt;br /&gt;
** If the package is originally from Debian or Ubuntu:&lt;br /&gt;
*** The original source is taken from upstream;&lt;br /&gt;
*** The Debian packaging for Maemo is taken from the respective repository in PyMaemo project.&lt;br /&gt;
** If the package is Maemo-specific:&lt;br /&gt;
*** The source package is taken from the respective repository in PyMaemo project&lt;br /&gt;
* Preparation phase:&lt;br /&gt;
** If the package is taken from upstream, assemble package&lt;br /&gt;
** Verify if dependencies are satisfied&lt;br /&gt;
* Build phase:&lt;br /&gt;
** Call sbdmock with proper parameters&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
The base directory for these instructions, refered as $BASE, is /scratchbox/users/&amp;lt;user&amp;gt;/home/&amp;lt;user&amp;gt;/pymaemo, &lt;br /&gt;
where &amp;lt;user&amp;gt; is your username in Scratchbox. All operations are made &#039;&#039;&#039;outside&#039;&#039;&#039; Scratchbox.&lt;br /&gt;
&lt;br /&gt;
First, download the rootstraps for X86 and ARMEL targets and put them in $BASE/rootstraps:&lt;br /&gt;
&lt;br /&gt;
* http://repository.maemo.org/stable/5.0/armel/maemo-sdk-rootstrap_5.0_armel.tgz&lt;br /&gt;
* http://repository.maemo.org/stable/5.0/i386/maemo-sdk-rootstrap_5.0_i386.tgz&lt;br /&gt;
&lt;br /&gt;
Clone the pymaemo-builder project inside $BASE:&lt;br /&gt;
&lt;br /&gt;
 $ git clone [git repo]&lt;br /&gt;
&lt;br /&gt;
This will create the directory pymaemo-builder under $BASE.&lt;br /&gt;
&lt;br /&gt;
Edit the fremantle_i386.cfg and fremantle_armel.cfg under $BASE/pymaemo-builder/sbdmock,&lt;br /&gt;
putting the rootstrap path correspondent to each in the following key:&lt;br /&gt;
* i386: config_opts[&#039;rootstrap&#039;] = &amp;quot;$BASE/rootstraps/maemo-sdk-rootstrap_5.0_i386.tgz&amp;quot;&lt;br /&gt;
* armel: config_opts[&#039;rootstrap&#039;] = &amp;quot;$BASE/rootstraps/maemo-sdk-rootstrap_5.0_armel.tgz&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Building ==&lt;br /&gt;
&lt;br /&gt;
For building all the packages for the X86 target, enter $BASE/pymaemo-builder and run:&lt;br /&gt;
&lt;br /&gt;
 $ ./build_packages.sh sbdmock:fremantle_i386 packages_fremantle.ini&lt;br /&gt;
&lt;br /&gt;
The same can be done to ARMEL target, just replacing &amp;quot;i386&amp;quot; with &amp;quot;armel&amp;quot;. The file packages_fremantle.ini contains all data necessary for obtaining the sources. &lt;br /&gt;
&lt;br /&gt;
You can build individual packages too, specifying them as parameters. If you want to build only, let&#039;s say, pyopenssl and pycurl for the ARMEL target, run:&lt;br /&gt;
&lt;br /&gt;
 $ ./build_packages.sh sbdmock:fremantle_armel packages_fremantle.ini pyopenssl,pycurl&lt;br /&gt;
&lt;br /&gt;
Be advised that any PyMaemo dependency for these packages must be built first, as build_packages.sh will attempt to build only the packages provided at the command line.&lt;br /&gt;
&lt;br /&gt;
There are other options for the build; for more information, run ./build_packages.sh &lt;br /&gt;
with no parameters or refer to the README file inside pymaemo-builder.&lt;br /&gt;
&lt;br /&gt;
When the build finishes the resultant Debian packages will be placed at &lt;br /&gt;
$BASE/pymaemo-builder/workdir/fremantle_&amp;lt;target&amp;gt;/repo, where &amp;lt;target&amp;gt; is i386 or armel,and the build logs placed in $BASE/pymaemo-builder/workdir/fremantle_&amp;lt;target&amp;gt;/logs.&lt;br /&gt;
From that point on, they can be installed on the targets and the ARMEL ones&lt;br /&gt;
can be copied to the device to be installed there.&lt;br /&gt;
&lt;br /&gt;
=== Directories created ===&lt;br /&gt;
&lt;br /&gt;
* $BASE/pymaemo-builder/download_cache: all downloaded files are placed here, one directory by package, so you don&#039;t have to download everything again in every build. If the sources are updated, though, you will have to erase the corresponding entry on download_cache for allow them to be downloaded again.&lt;br /&gt;
* $BASE/pymaemo-builder/workdir: the generated files (prepared sources, logs, built packages) are placed under this directory, grouped by the name of the sbdmock config file used to build them. Inside each group, the logs and repo directories will contain, respectively, the build logs and the built packages.&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
If you want to quickly make a Debian repository for easy installation, &lt;br /&gt;
run the following command at $BASE/pymaemo-builder/workdir/fremantle_&amp;lt;target&amp;gt;/repo:&lt;br /&gt;
&lt;br /&gt;
 $ apt-ftparchive packages . | gzip -9c &amp;gt; Packages.gz &lt;br /&gt;
&lt;br /&gt;
Now you have to expose the packages&#039; path to the Web server and add the repository&lt;br /&gt;
in the target machine accordingly.&lt;/div&gt;</summary>
		<author><name>189.2.128.130</name></author>
	</entry>
	<entry>
		<id>https://maemo.octonezd.me/index.php?title=PyMaemo/How_to_build&amp;diff=33396</id>
		<title>PyMaemo/How to build</title>
		<link rel="alternate" type="text/html" href="https://maemo.octonezd.me/index.php?title=PyMaemo/How_to_build&amp;diff=33396"/>
		<updated>2010-01-15T15:50:06Z</updated>

		<summary type="html">&lt;p&gt;189.2.128.130: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= How to build PyMaemo packages=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
To build PyMaemo packages from the source, you&#039;ll need:&lt;br /&gt;
&lt;br /&gt;
* Maemo 5 SDK &lt;br /&gt;
* Rootstraps for X86 and ARMEL targets&lt;br /&gt;
* grep-dctrl&lt;br /&gt;
* pymaemo-builder&lt;br /&gt;
&lt;br /&gt;
The scripts from pymaemo-builder are used to download packages&#039; sources and build them using sbdmock, one at a time. sbdmock, in turn, uses the SDK and the rootstraps to create a clean environment for building every package. More information about sbdmock can be obtained [Building_packages_with_sbdmock|here]], altough pymaemo-builder uses a slightly modified of sbdmock - see pymaemo-builder README if you want to know which modifications were made.&lt;br /&gt;
&lt;br /&gt;
The scripts from pymaemo-builder can be used to build the entire set of packages or only some of them, for X86 or ARMEL targets. It is advised to first build and (if possible) test in the X86 target and use ARMEL target only for cross-compiling for the device.&lt;br /&gt;
&lt;br /&gt;
== Overview of the build process ==&lt;br /&gt;
&lt;br /&gt;
The build process is composed of three phases: download, preparation and the proper build. A high-level description of the process follows:&lt;br /&gt;
&lt;br /&gt;
* Download phase:&lt;br /&gt;
** If the package is originally from Debian or Ubuntu:&lt;br /&gt;
*** The original source is taken from upstream;&lt;br /&gt;
*** The Debian packaging for Maemo is taken from the respective repository in PyMaemo project.&lt;br /&gt;
** If the package is Maemo-specific:&lt;br /&gt;
*** The source package is taken from the respective repository in PyMaemo project&lt;br /&gt;
* Preparation phase:&lt;br /&gt;
** If the package is taken from upstream, assemble package&lt;br /&gt;
** Verify if dependencies are satisfied&lt;br /&gt;
* Build phase:&lt;br /&gt;
** Call sbdmock with proper parameters&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
The base directory for these instructions, refered as $BASE, is /scratchbox/users/&amp;lt;user&amp;gt;/home/&amp;lt;user&amp;gt;/pymaemo, &lt;br /&gt;
where &amp;lt;user&amp;gt; is your username in Scratchbox. All operations are made &#039;&#039;&#039;outside&#039;&#039;&#039; Scratchbox.&lt;br /&gt;
&lt;br /&gt;
First, download the rootstraps for X86 and ARMEL targets and put them in $BASE/rootstraps:&lt;br /&gt;
&lt;br /&gt;
* http://repository.maemo.org/stable/5.0/armel/maemo-sdk-rootstrap_5.0_armel.tgz&lt;br /&gt;
* http://repository.maemo.org/stable/5.0/i386/maemo-sdk-rootstrap_5.0_i386.tgz&lt;br /&gt;
&lt;br /&gt;
Clone the pymaemo-builder project inside $BASE:&lt;br /&gt;
&lt;br /&gt;
 $ git clone [git repo]&lt;br /&gt;
&lt;br /&gt;
This will create the directory pymaemo-builder under $BASE.&lt;br /&gt;
&lt;br /&gt;
Edit the fremantle_i386.cfg and fremantle_armel.cfg under $BASE/pymaemo-builder/sbdmock,&lt;br /&gt;
putting the rootstrap path correspondent to each in the following key:&lt;br /&gt;
* i386: config_opts[&#039;rootstrap&#039;] = &amp;quot;$BASE/rootstraps/maemo-sdk-rootstrap_5.0_i386.tgz&amp;quot;&lt;br /&gt;
* armel: config_opts[&#039;rootstrap&#039;] = &amp;quot;$BASE/rootstraps/maemo-sdk-rootstrap_5.0_armel.tgz&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Building ==&lt;br /&gt;
&lt;br /&gt;
For building all the packages for the X86 target, enter $BASE/pymaemo-builder and run:&lt;br /&gt;
&lt;br /&gt;
 $ ./build_packages.sh sbdmock:fremantle_i386 packages_fremantle.ini&lt;br /&gt;
&lt;br /&gt;
The same can be done to ARMEL target, just replacing &amp;quot;i386&amp;quot; with &amp;quot;armel&amp;quot;. The file packages_fremantle.ini contains all data necessary for obtaining the sources. &lt;br /&gt;
&lt;br /&gt;
You can build individual packages too, specifying them as parameters. If you want to build only, let&#039;s say, pyopenssl and pycurl for the ARMEL target, run:&lt;br /&gt;
&lt;br /&gt;
 $ ./build_packages.sh sbdmock:fremantle_armel packages_fremantle.ini pyopenssl,pycurl&lt;br /&gt;
&lt;br /&gt;
Be advised that any PyMaemo dependency for these packages must be built first, as build_packages.sh will attempt to build only the packages provided at the command line.&lt;br /&gt;
&lt;br /&gt;
There are other options for the build; for more information, run ./build_packages.sh &lt;br /&gt;
with no parameters or refer to the README file inside pymaemo-builder.&lt;br /&gt;
&lt;br /&gt;
When the build finishes the resultant Debian packages will be placed at &lt;br /&gt;
$BASE/pymaemo-builder/workdir/fremantle_&amp;lt;target&amp;gt;/repo, where &amp;lt;target&amp;gt; is i386 or armel,and the build logs placed in $BASE/pymaemo-builder/workdir/fremantle_&amp;lt;target&amp;gt;/logs.&lt;br /&gt;
From that point on, they can be installed on the targets and the ARMEL ones&lt;br /&gt;
can be copied to the device to be installed there.&lt;br /&gt;
&lt;br /&gt;
=== Directories created ===&lt;br /&gt;
&lt;br /&gt;
* $BASE/pymaemo-builder/download_cache: all downloaded files are placed here, one directory by package, so you don&#039;t have to download everything again in every build. If the sources are updated, though, you will have to erase the corresponding entry on download_cache for allow them to be downloaded again.&lt;br /&gt;
* $BASE/pymaemo-builder/workdir: the generated files (prepared sources, logs, built packages) are placed under this directory, grouped by the name of the sbdmock config file used to build them. Inside each group, the logs and repo directories will contain, respectively, the build logs and the built packages.&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
If you want to quickly make a Debian repository for easy installation, &lt;br /&gt;
run the following command at $BASE/pymaemo-builder/workdir/fremantle_&amp;lt;target&amp;gt;/repo:&lt;br /&gt;
&lt;br /&gt;
 $ apt-ftparchive packages . | gzip -9c &amp;gt; Packages.gz &lt;br /&gt;
&lt;br /&gt;
Now you have to expose the packages&#039; path to the Web server and add the repository&lt;br /&gt;
in the target machine accordingly.&lt;/div&gt;</summary>
		<author><name>189.2.128.130</name></author>
	</entry>
	<entry>
		<id>https://maemo.octonezd.me/index.php?title=PyMaemo/How_to_build&amp;diff=33404</id>
		<title>PyMaemo/How to build</title>
		<link rel="alternate" type="text/html" href="https://maemo.octonezd.me/index.php?title=PyMaemo/How_to_build&amp;diff=33404"/>
		<updated>2010-01-15T13:30:12Z</updated>

		<summary type="html">&lt;p&gt;189.2.128.130: New page: = How to build PyMaemo packages=   == Introduction ==  To build PyMaemo packages from the source, you&amp;#039;ll need:  * Maemo 5 SDK x86/ARMEL * Rootstraps for X86 and ARMEL targets * sbdmock * g...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= How to build PyMaemo packages=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
To build PyMaemo packages from the source, you&#039;ll need:&lt;br /&gt;
&lt;br /&gt;
* Maemo 5 SDK x86/ARMEL&lt;br /&gt;
* Rootstraps for X86 and ARMEL targets&lt;br /&gt;
* sbdmock&lt;br /&gt;
* grep-dctrl&lt;br /&gt;
* pymaemo-builder&lt;br /&gt;
&lt;br /&gt;
The scripts from pymaemo-builder are used to download packages&#039; sources and build them using sbdmock, one at a time. sbdmock, in turn, uses the SDK and the rootstraps to create a clean environment for building every package.&lt;br /&gt;
&lt;br /&gt;
The scripts can be used to build the entire set of packages or only some of them, for x86 or ARMEL targets. It is advised to first build and test in the X86 target and use ARMEL target only for cross-compiling for the device.&lt;br /&gt;
&lt;br /&gt;
== Overview of the build process ==&lt;br /&gt;
&lt;br /&gt;
* Download phase:&lt;br /&gt;
** If the package is originally from Debian or Ubuntu:&lt;br /&gt;
*** The original source is taken from upstream;&lt;br /&gt;
*** The Debian packaging for Maemo is taken from the respective repository in PyMaemo project.&lt;br /&gt;
** If the package is Maemo-specific:&lt;br /&gt;
*** The source package is taken from the respective repository in PyMaemo project&lt;br /&gt;
* Preparation phase:&lt;br /&gt;
** If the package is taken from upstream, assemble package&lt;br /&gt;
** Verify if dependencies are satisfied&lt;br /&gt;
* Build phase:&lt;br /&gt;
** Call sbdmock with proper parameters&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
The base directory for these instructions, refered as $BASE, is /scratchbox/users/&amp;lt;user&amp;gt;/home/&amp;lt;user&amp;gt;/pymaemo, &lt;br /&gt;
where &amp;lt;user&amp;gt; is your username in Scratchbox. All operations are made &#039;&#039;&#039;outside&#039;&#039;&#039; Scratchbox.&lt;br /&gt;
&lt;br /&gt;
First, download the rootstraps for X86 and ARMEL targets and put them in $BASE/rootstraps:&lt;br /&gt;
&lt;br /&gt;
* http://repository.maemo.org/stable/5.0/armel/maemo-sdk-rootstrap_5.0_armel.tgz&lt;br /&gt;
* http://repository.maemo.org/stable/5.0/i386/maemo-sdk-rootstrap_5.0_i386.tgz&lt;br /&gt;
&lt;br /&gt;
Clone the pymaemo-builder project inside $BASE:&lt;br /&gt;
&lt;br /&gt;
 $ git clone [git repo]&lt;br /&gt;
&lt;br /&gt;
This will create the directory pymaemo-builder under $BASE.&lt;br /&gt;
&lt;br /&gt;
Edit the fremantle_i386.cfg and fremantle_armel.cfg under $BASE/pymaemo-builder/sbdmock,&lt;br /&gt;
putting the rootstrap path correspondent to each:&lt;br /&gt;
* i386: config_opts[&#039;rootstrap&#039;] = &amp;quot;$BASE/rootstraps/maemo-sdk-rootstrap_5.0_i386.tgz&amp;quot;&lt;br /&gt;
* armel: config_opts[&#039;rootstrap&#039;] = &amp;quot;$BASE/rootstraps/maemo-sdk-rootstrap_5.0_armel.tgz&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Building ==&lt;br /&gt;
&lt;br /&gt;
For building all the packages for the X86 target, enter $BASE/pymaemo-builder and run:&lt;br /&gt;
&lt;br /&gt;
 $ ./build_packages.sh sbdmock:fremantle_i386 packages_fremantle.ini&lt;br /&gt;
&lt;br /&gt;
The same can be done to ARMEL target, just replacing &amp;quot;i386&amp;quot; with &amp;quot;armel&amp;quot;. The &lt;br /&gt;
build script does everything automatically: it downloads all the sources and&lt;br /&gt;
builds the packages with sbdmock in the proper order. The file packages_fremantle.ini contains all data necessary for obtaining the sources. &lt;br /&gt;
&lt;br /&gt;
You can build individual packages too, specifying them as parameters. If you want to build only, let&#039;s say, pyopenssl and pycurl for the ARMEL target, run:&lt;br /&gt;
&lt;br /&gt;
 $ ./build_packages.sh sbdmock:fremantle_armel packages_fremantle.ini pyopenssl,pycurl&lt;br /&gt;
&lt;br /&gt;
Be advised that any PyMaemo dependency for these packages must be built first, as build_packages.sh will attempt to build only the packages provided at the command line.&lt;br /&gt;
&lt;br /&gt;
There are other options for the build; for more information, run ./build_packages.sh &lt;br /&gt;
with no parameters or refer to the README file inside pymaemo-builder.&lt;br /&gt;
&lt;br /&gt;
When the build finishes the resultant Debian packages will be placed at &lt;br /&gt;
$BASE/pymaemo-builder/workdir/fremantle_&amp;lt;target&amp;gt;/repo, where &amp;lt;target&amp;gt; is i386 or armel,and the build logs placed in $BASE/pymaemo-builder/workdir/fremantle_&amp;lt;target&amp;gt;/logs.&lt;br /&gt;
From that point on, they can be installed on the targets and the ARMEL ones&lt;br /&gt;
can be copied to the device to be installed there.&lt;br /&gt;
&lt;br /&gt;
== Directories created ==&lt;br /&gt;
&lt;br /&gt;
* $BASE/pymaemo-builder/download_cache: all downloaded files are placed here, one directory by package, so you don&#039;t have to download everything again in &lt;br /&gt;
every build. If the sources are updated, though, you will have to erase the corresponding&lt;br /&gt;
 entry on download_cache for allow them to be downloaded again.&lt;br /&gt;
* $BASE/pymaemo-builder/workdir: the generated files (prepared sources, logs, built packages) are placed under this directory, grouped by the name of the &lt;br /&gt;
sbdmock config file used to build them. Inside each group, the logs and repo &lt;br /&gt;
directories will contain, respectively, the build logs and the built packages.&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
If you want to quickly make a Debian repository for easy installation, &lt;br /&gt;
run the following command at $BASE/pymaemo-builder/workdir/fremantle_&amp;lt;target&amp;gt;/repo:&lt;br /&gt;
&lt;br /&gt;
 $ apt-ftparchive packages . | gzip -9c &amp;gt; Packages.gz &lt;br /&gt;
&lt;br /&gt;
Now you have to expose the packages&#039; path to the Web server and add the repository&lt;br /&gt;
in the target machine accordingly.&lt;/div&gt;</summary>
		<author><name>189.2.128.130</name></author>
	</entry>
	<entry>
		<id>https://maemo.octonezd.me/index.php?title=PyMaemo/Quick_start_guide&amp;diff=33473</id>
		<title>PyMaemo/Quick start guide</title>
		<link rel="alternate" type="text/html" href="https://maemo.octonezd.me/index.php?title=PyMaemo/Quick_start_guide&amp;diff=33473"/>
		<updated>2010-01-11T19:17:11Z</updated>

		<summary type="html">&lt;p&gt;189.2.128.130: /* Advanced tips */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Started: Setting Up Python Development Environment for N900 =&lt;br /&gt;
&lt;br /&gt;
A basic development environment for Python development for Maemo consists of:&lt;br /&gt;
&lt;br /&gt;
* A source code editor&lt;br /&gt;
* Some way to transfer application files to the tablet&lt;br /&gt;
* Easily run the application (without installing it)&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can try other more complex development environments, briefly described at the end of this article.&lt;br /&gt;
&lt;br /&gt;
This article will cover:&lt;br /&gt;
&lt;br /&gt;
* Installation of necessary packages and USB connectivity setup&lt;br /&gt;
* Some suggestions for Python code editors&lt;br /&gt;
* How to transfer the application files to the N900&lt;br /&gt;
* How to run the application&lt;br /&gt;
&lt;br /&gt;
Application packaging and final deployment will be discussed separately at a later date.&lt;br /&gt;
&lt;br /&gt;
Finally, there is a [http://www.youtube.com/watch?v=onAkb_7U5pk screencast] demonstrating the instructions from this guide, which should help clarifying some of the steps in a real setup session.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
Before continuing, make sure you have:&lt;br /&gt;
&lt;br /&gt;
Tablet requirements:&lt;br /&gt;
&lt;br /&gt;
* Some kind of connectivity to the tablet (e.g. WLAN or GPRS), so that you can install required packages.&lt;br /&gt;
* The N900 USB cable, which will be used to transfer files to the tablet.&lt;br /&gt;
&lt;br /&gt;
Host requirements:&lt;br /&gt;
&lt;br /&gt;
* A SSH client. For Linux, OpenSSH (through the &amp;quot;ssh&amp;quot; command) is enough. For Windows, [http://en.sourceforge.jp/projects/ttssh2/releases/ Tera Term] can be used. For Mac you can use &amp;quot;ssh&amp;quot; command in the Terminal.&lt;br /&gt;
* A SCP/SFTP client. For Linux, OpenSSH (through the &amp;quot;scp&amp;quot; command) is enough. The KDE/GNOME environments also have built-in support for these protocols. For Windows, you can try [http://winscp.net/eng/index.php WinSCP] or [http://filezilla-project.org/ FileZilla].&lt;br /&gt;
&lt;br /&gt;
For the purposes of this tutorial, you will &#039;&#039;&#039;not&#039;&#039;&#039; need Scratchbox installed. Scratchbox would only be necessary if you are unable to test your applications on the actual tablet.&lt;br /&gt;
&lt;br /&gt;
== Installing required packages on N900 ==&lt;br /&gt;
&lt;br /&gt;
You will need to install two applications on the tablet:&lt;br /&gt;
&lt;br /&gt;
* OpenSSH Server&lt;br /&gt;
* rootsh&lt;br /&gt;
&lt;br /&gt;
OpenSSH is needed to run commands remotely on your N900. This will make testing on the device a lot easier.&lt;br /&gt;
&lt;br /&gt;
rootsh is needed to allow to run commands as root on the X Terminal (using &amp;quot;sudo gainroot&amp;quot;). See http://wiki.maemo.org/Root_access for other options to enable root access.&lt;br /&gt;
&lt;br /&gt;
To install these applications, follow these steps:&lt;br /&gt;
&lt;br /&gt;
# Enable extras repository. See http://wiki.maemo.org/Extras#Using_Extras for how to do it.&lt;br /&gt;
# Install the packages listed above.&lt;br /&gt;
# The installation will ask for a new root password for SSH access. Choose a good one.&lt;br /&gt;
# Wait for installation to complete.&lt;br /&gt;
&lt;br /&gt;
== Enabling USB networking ==&lt;br /&gt;
&lt;br /&gt;
USB networking allows to easily and quickly transfer files to the device and connect to it using SSH. To enable it, follow these steps (you need to repeat them every time you reboot the device):&lt;br /&gt;
&lt;br /&gt;
# If the USB cable is plugged and in &amp;quot;Mass storage mode&amp;quot;, unplug the cable and plug it again, now selecting &amp;quot;PC Suite Mode&amp;quot;.&lt;br /&gt;
# On N900, open &amp;quot;X Terminal&amp;quot; and run:&lt;br /&gt;
 rootsh ifup usb0&lt;br /&gt;
# Now you need to configure the host. This is dependent on which OS (or Linux distro) you use, see http://wiki.maemo.org/USB_networking#Host_USB_Network_Configuration for detailed instructions for various OSes and Linux distros.&lt;br /&gt;
&lt;br /&gt;
From now on you can connect to the N900 using any SSH client and the following information:&lt;br /&gt;
 Host: 192.168.2.15&lt;br /&gt;
 Port: 22&lt;br /&gt;
 User: root&lt;br /&gt;
 Password: the password setup earlier&lt;br /&gt;
&lt;br /&gt;
For instance, from a Linux terminal, you can connect to the tablet using this command:&lt;br /&gt;
&lt;br /&gt;
 ssh root@192.168.2.15&lt;br /&gt;
&lt;br /&gt;
== Preparing the N900 for Python Development ==&lt;br /&gt;
&lt;br /&gt;
To enable the full power for Python development for Maemo, you must enable the &amp;quot;extras-devel&amp;quot; repository on your device. &#039;&#039;Be advised that this might be a risky operation&#039;&#039; because extras-devel contains many untested and possibly broken packages. But it also contains the latest versions of all available Python bindings for Maemo, which we are interested on.&lt;br /&gt;
&lt;br /&gt;
Note that the requirement to enable the &amp;quot;extras-devel&amp;quot; repository might be removed later.&lt;br /&gt;
&lt;br /&gt;
To enable extras-devel add a new catalogue to the Application Manager, as instructed in http://wiki.maemo.org/Extras-devel (did you see the big warning on that page?)&lt;br /&gt;
&lt;br /&gt;
After extras-devel is enabled, you will see on Application Manager a package called &amp;quot;maemo-python-device-env&amp;quot;. Installing it will also install the basic environment necessary to run most Python applications on Maemo.&lt;br /&gt;
&lt;br /&gt;
== Writing your code ==&lt;br /&gt;
&lt;br /&gt;
Any good programmer oriented editor will be enough for development. If you have some development experience, you most probably already have chosen your favorite code editor and you can simply use it.&lt;br /&gt;
&lt;br /&gt;
Here we list some options, both for Linux and Windows:&lt;br /&gt;
&lt;br /&gt;
* [http://projects.gnome.org/gedit/ gedit]: the GNOME Editor has syntax highlight support for Python (Linux only)&lt;br /&gt;
* [http://www.vim.org/ VIM] and [http://www.gnu.org/software/emacs/ Emacs]: the most popular editors, with many advanced features and versions for both Linux and Windows&lt;br /&gt;
* [http://wiki.netbeans.org/Python NetBeans + Python plugin]: NetBeans is a multi-platform IDE, which with help of a plugin, supports development for Python&lt;br /&gt;
&lt;br /&gt;
Note that none of these editors will support code completion for PyMaemo modules out of box.&lt;br /&gt;
&lt;br /&gt;
For testing purposes, you can try the following code (the classic &amp;quot;hello world&amp;quot; example):&lt;br /&gt;
&lt;br /&gt;
 import gtk&lt;br /&gt;
 from gtk import Window, Button, Widget&lt;br /&gt;
 if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
     window = Window(gtk.WINDOW_TOPLEVEL)&lt;br /&gt;
     window.connect(&amp;quot;destroy&amp;quot;, gtk.main_quit)&lt;br /&gt;
     button = Button(&amp;quot;Hello World&amp;quot;)&lt;br /&gt;
     button.connect_object(&amp;quot;clicked&amp;quot;, Widget.destroy, window)&lt;br /&gt;
     window.add(button)&lt;br /&gt;
     window.show_all()&lt;br /&gt;
     gtk.main()&lt;br /&gt;
&lt;br /&gt;
Once you have your code written, you can proceed to copying application files to the device.&lt;br /&gt;
&lt;br /&gt;
== Running the Python application on the device ==&lt;br /&gt;
&lt;br /&gt;
Now that you have the N900 properly setup and the code to run, you just need to copy the application files to the device and run it.&lt;br /&gt;
&lt;br /&gt;
The simplest way to copy files it to use a SFTP or SCP client. There are many free clients available for most OSes (we listed some examples on the &amp;quot;Requirements&amp;quot; section). On the Linux command line, you can use:&lt;br /&gt;
&lt;br /&gt;
 scp -pr my_application/ root@192.168.2.15:/root/my_application/&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;my_application/&amp;quot; with the path to the directory which contains your application files.&lt;br /&gt;
&lt;br /&gt;
Finally, to run the application on the tablet, use (from a SSH terminal):&lt;br /&gt;
&lt;br /&gt;
 cd /root/my_application&lt;br /&gt;
 python my_application.py&lt;br /&gt;
&lt;br /&gt;
== Alternative development environments ==&lt;br /&gt;
&lt;br /&gt;
Besides the environment described on this article, there are two alternative development environments that might or might not be more appropriate for your purposes:&lt;br /&gt;
&lt;br /&gt;
; PluThon (Eclipse based)&lt;br /&gt;
: [http://pluthon.garage.maemo.org/ PluThon] is a full Python IDE for Maemo, based on Eclipse. While PluThon is easy to use and provides a complete solution, it is not necessary for basic Python development for Maemo. If you already use Eclipse for your development, PluThon might be your best option.&lt;br /&gt;
; Official Maemo SDK (Scratchbox based)&lt;br /&gt;
: [http://www.scratchbox.org/ Scratchbox] is a cross-compilation toolkit used for native Maemo development. Although it can be used in Python development as well (and comes very handy if you do not have access to a real device), it has a non-trivial learning curve and is not needed for pure Python development. However, if you plan to write new Python extensions (for instance, using [http://www.cython.org/ Cython] or [http://docs.python.org/c-api/index.html Python/C API] directly), Scratchbox is needed to cross-compile the C code. See the [http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/Development_Environment/Maemo_SDK Maemo SDK section] on Maemo 5 developer guide for more details on it.&lt;br /&gt;
&lt;br /&gt;
Note that PluThon has built-in support for transferring and running code on the device. On the other hand, the Maemo SDK has no such support (unless you use some IDE like [http://esbox.garage.maemo.org/ ESbox]), so you need to follow steps similar to the ones described on this guide to copy and run your code on the tablet, if you choose to use the Maemo SDK.&lt;br /&gt;
&lt;br /&gt;
== Advanced tips ==&lt;br /&gt;
&lt;br /&gt;
If you want to activate USB networking automatically upon connecting the device to the computer, just create a file called /etc/event.d/usbnet on the device with the following contents:&lt;br /&gt;
&lt;br /&gt;
 start on G_NOKIA_READY&lt;br /&gt;
 &lt;br /&gt;
 console output&lt;br /&gt;
 exec ifconfig usb0 192.168.2.15 up&lt;br /&gt;
&lt;br /&gt;
This way you just have to select &amp;quot;PC Suite mode&amp;quot; when plugging the device in.&lt;br /&gt;
&lt;br /&gt;
[[Category:N900]]&lt;br /&gt;
[[Category:Python]]&lt;/div&gt;</summary>
		<author><name>189.2.128.130</name></author>
	</entry>
	<entry>
		<id>https://maemo.octonezd.me/index.php?title=PyMaemo/Quick_start_guide&amp;diff=33474</id>
		<title>PyMaemo/Quick start guide</title>
		<link rel="alternate" type="text/html" href="https://maemo.octonezd.me/index.php?title=PyMaemo/Quick_start_guide&amp;diff=33474"/>
		<updated>2010-01-11T19:15:57Z</updated>

		<summary type="html">&lt;p&gt;189.2.128.130: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Getting Started: Setting Up Python Development Environment for N900 =&lt;br /&gt;
&lt;br /&gt;
A basic development environment for Python development for Maemo consists of:&lt;br /&gt;
&lt;br /&gt;
* A source code editor&lt;br /&gt;
* Some way to transfer application files to the tablet&lt;br /&gt;
* Easily run the application (without installing it)&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can try other more complex development environments, briefly described at the end of this article.&lt;br /&gt;
&lt;br /&gt;
This article will cover:&lt;br /&gt;
&lt;br /&gt;
* Installation of necessary packages and USB connectivity setup&lt;br /&gt;
* Some suggestions for Python code editors&lt;br /&gt;
* How to transfer the application files to the N900&lt;br /&gt;
* How to run the application&lt;br /&gt;
&lt;br /&gt;
Application packaging and final deployment will be discussed separately at a later date.&lt;br /&gt;
&lt;br /&gt;
Finally, there is a [http://www.youtube.com/watch?v=onAkb_7U5pk screencast] demonstrating the instructions from this guide, which should help clarifying some of the steps in a real setup session.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
Before continuing, make sure you have:&lt;br /&gt;
&lt;br /&gt;
Tablet requirements:&lt;br /&gt;
&lt;br /&gt;
* Some kind of connectivity to the tablet (e.g. WLAN or GPRS), so that you can install required packages.&lt;br /&gt;
* The N900 USB cable, which will be used to transfer files to the tablet.&lt;br /&gt;
&lt;br /&gt;
Host requirements:&lt;br /&gt;
&lt;br /&gt;
* A SSH client. For Linux, OpenSSH (through the &amp;quot;ssh&amp;quot; command) is enough. For Windows, [http://en.sourceforge.jp/projects/ttssh2/releases/ Tera Term] can be used. For Mac you can use &amp;quot;ssh&amp;quot; command in the Terminal.&lt;br /&gt;
* A SCP/SFTP client. For Linux, OpenSSH (through the &amp;quot;scp&amp;quot; command) is enough. The KDE/GNOME environments also have built-in support for these protocols. For Windows, you can try [http://winscp.net/eng/index.php WinSCP] or [http://filezilla-project.org/ FileZilla].&lt;br /&gt;
&lt;br /&gt;
For the purposes of this tutorial, you will &#039;&#039;&#039;not&#039;&#039;&#039; need Scratchbox installed. Scratchbox would only be necessary if you are unable to test your applications on the actual tablet.&lt;br /&gt;
&lt;br /&gt;
== Installing required packages on N900 ==&lt;br /&gt;
&lt;br /&gt;
You will need to install two applications on the tablet:&lt;br /&gt;
&lt;br /&gt;
* OpenSSH Server&lt;br /&gt;
* rootsh&lt;br /&gt;
&lt;br /&gt;
OpenSSH is needed to run commands remotely on your N900. This will make testing on the device a lot easier.&lt;br /&gt;
&lt;br /&gt;
rootsh is needed to allow to run commands as root on the X Terminal (using &amp;quot;sudo gainroot&amp;quot;). See http://wiki.maemo.org/Root_access for other options to enable root access.&lt;br /&gt;
&lt;br /&gt;
To install these applications, follow these steps:&lt;br /&gt;
&lt;br /&gt;
# Enable extras repository. See http://wiki.maemo.org/Extras#Using_Extras for how to do it.&lt;br /&gt;
# Install the packages listed above.&lt;br /&gt;
# The installation will ask for a new root password for SSH access. Choose a good one.&lt;br /&gt;
# Wait for installation to complete.&lt;br /&gt;
&lt;br /&gt;
== Enabling USB networking ==&lt;br /&gt;
&lt;br /&gt;
USB networking allows to easily and quickly transfer files to the device and connect to it using SSH. To enable it, follow these steps (you need to repeat them every time you reboot the device):&lt;br /&gt;
&lt;br /&gt;
# If the USB cable is plugged and in &amp;quot;Mass storage mode&amp;quot;, unplug the cable and plug it again, now selecting &amp;quot;PC Suite Mode&amp;quot;.&lt;br /&gt;
# On N900, open &amp;quot;X Terminal&amp;quot; and run:&lt;br /&gt;
 rootsh ifup usb0&lt;br /&gt;
# Now you need to configure the host. This is dependent on which OS (or Linux distro) you use, see http://wiki.maemo.org/USB_networking#Host_USB_Network_Configuration for detailed instructions for various OSes and Linux distros.&lt;br /&gt;
&lt;br /&gt;
From now on you can connect to the N900 using any SSH client and the following information:&lt;br /&gt;
 Host: 192.168.2.15&lt;br /&gt;
 Port: 22&lt;br /&gt;
 User: root&lt;br /&gt;
 Password: the password setup earlier&lt;br /&gt;
&lt;br /&gt;
For instance, from a Linux terminal, you can connect to the tablet using this command:&lt;br /&gt;
&lt;br /&gt;
 ssh root@192.168.2.15&lt;br /&gt;
&lt;br /&gt;
== Preparing the N900 for Python Development ==&lt;br /&gt;
&lt;br /&gt;
To enable the full power for Python development for Maemo, you must enable the &amp;quot;extras-devel&amp;quot; repository on your device. &#039;&#039;Be advised that this might be a risky operation&#039;&#039; because extras-devel contains many untested and possibly broken packages. But it also contains the latest versions of all available Python bindings for Maemo, which we are interested on.&lt;br /&gt;
&lt;br /&gt;
Note that the requirement to enable the &amp;quot;extras-devel&amp;quot; repository might be removed later.&lt;br /&gt;
&lt;br /&gt;
To enable extras-devel add a new catalogue to the Application Manager, as instructed in http://wiki.maemo.org/Extras-devel (did you see the big warning on that page?)&lt;br /&gt;
&lt;br /&gt;
After extras-devel is enabled, you will see on Application Manager a package called &amp;quot;maemo-python-device-env&amp;quot;. Installing it will also install the basic environment necessary to run most Python applications on Maemo.&lt;br /&gt;
&lt;br /&gt;
== Writing your code ==&lt;br /&gt;
&lt;br /&gt;
Any good programmer oriented editor will be enough for development. If you have some development experience, you most probably already have chosen your favorite code editor and you can simply use it.&lt;br /&gt;
&lt;br /&gt;
Here we list some options, both for Linux and Windows:&lt;br /&gt;
&lt;br /&gt;
* [http://projects.gnome.org/gedit/ gedit]: the GNOME Editor has syntax highlight support for Python (Linux only)&lt;br /&gt;
* [http://www.vim.org/ VIM] and [http://www.gnu.org/software/emacs/ Emacs]: the most popular editors, with many advanced features and versions for both Linux and Windows&lt;br /&gt;
* [http://wiki.netbeans.org/Python NetBeans + Python plugin]: NetBeans is a multi-platform IDE, which with help of a plugin, supports development for Python&lt;br /&gt;
&lt;br /&gt;
Note that none of these editors will support code completion for PyMaemo modules out of box.&lt;br /&gt;
&lt;br /&gt;
For testing purposes, you can try the following code (the classic &amp;quot;hello world&amp;quot; example):&lt;br /&gt;
&lt;br /&gt;
 import gtk&lt;br /&gt;
 from gtk import Window, Button, Widget&lt;br /&gt;
 if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
     window = Window(gtk.WINDOW_TOPLEVEL)&lt;br /&gt;
     window.connect(&amp;quot;destroy&amp;quot;, gtk.main_quit)&lt;br /&gt;
     button = Button(&amp;quot;Hello World&amp;quot;)&lt;br /&gt;
     button.connect_object(&amp;quot;clicked&amp;quot;, Widget.destroy, window)&lt;br /&gt;
     window.add(button)&lt;br /&gt;
     window.show_all()&lt;br /&gt;
     gtk.main()&lt;br /&gt;
&lt;br /&gt;
Once you have your code written, you can proceed to copying application files to the device.&lt;br /&gt;
&lt;br /&gt;
== Running the Python application on the device ==&lt;br /&gt;
&lt;br /&gt;
Now that you have the N900 properly setup and the code to run, you just need to copy the application files to the device and run it.&lt;br /&gt;
&lt;br /&gt;
The simplest way to copy files it to use a SFTP or SCP client. There are many free clients available for most OSes (we listed some examples on the &amp;quot;Requirements&amp;quot; section). On the Linux command line, you can use:&lt;br /&gt;
&lt;br /&gt;
 scp -pr my_application/ root@192.168.2.15:/root/my_application/&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;my_application/&amp;quot; with the path to the directory which contains your application files.&lt;br /&gt;
&lt;br /&gt;
Finally, to run the application on the tablet, use (from a SSH terminal):&lt;br /&gt;
&lt;br /&gt;
 cd /root/my_application&lt;br /&gt;
 python my_application.py&lt;br /&gt;
&lt;br /&gt;
== Alternative development environments ==&lt;br /&gt;
&lt;br /&gt;
Besides the environment described on this article, there are two alternative development environments that might or might not be more appropriate for your purposes:&lt;br /&gt;
&lt;br /&gt;
; PluThon (Eclipse based)&lt;br /&gt;
: [http://pluthon.garage.maemo.org/ PluThon] is a full Python IDE for Maemo, based on Eclipse. While PluThon is easy to use and provides a complete solution, it is not necessary for basic Python development for Maemo. If you already use Eclipse for your development, PluThon might be your best option.&lt;br /&gt;
; Official Maemo SDK (Scratchbox based)&lt;br /&gt;
: [http://www.scratchbox.org/ Scratchbox] is a cross-compilation toolkit used for native Maemo development. Although it can be used in Python development as well (and comes very handy if you do not have access to a real device), it has a non-trivial learning curve and is not needed for pure Python development. However, if you plan to write new Python extensions (for instance, using [http://www.cython.org/ Cython] or [http://docs.python.org/c-api/index.html Python/C API] directly), Scratchbox is needed to cross-compile the C code. See the [http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/Development_Environment/Maemo_SDK Maemo SDK section] on Maemo 5 developer guide for more details on it.&lt;br /&gt;
&lt;br /&gt;
Note that PluThon has built-in support for transferring and running code on the device. On the other hand, the Maemo SDK has no such support (unless you use some IDE like [http://esbox.garage.maemo.org/ ESbox]), so you need to follow steps similar to the ones described on this guide to copy and run your code on the tablet, if you choose to use the Maemo SDK.&lt;br /&gt;
&lt;br /&gt;
== Advanced tips ==&lt;br /&gt;
&lt;br /&gt;
If you want to activate USB networking automatically upon connecting the device to the computer, just create a file called /etc/event.d/usbnet on the device with the following contents:&lt;br /&gt;
&lt;br /&gt;
 start on G_NOKIA_READY&lt;br /&gt;
 &lt;br /&gt;
 console output&lt;br /&gt;
 exec ifconfig usb0 192.168.2.15 up&lt;br /&gt;
&lt;br /&gt;
This way you just have to select &amp;quot;PC Suite mode&amp;quot; when connecting the device and you&#039;re done.&lt;br /&gt;
&lt;br /&gt;
[[Category:N900]]&lt;br /&gt;
[[Category:Python]]&lt;/div&gt;</summary>
		<author><name>189.2.128.130</name></author>
	</entry>
	<entry>
		<id>https://maemo.octonezd.me/index.php?title=PyMaemo/UI_tutorial/Data_selection&amp;diff=33627</id>
		<title>PyMaemo/UI tutorial/Data selection</title>
		<link rel="alternate" type="text/html" href="https://maemo.octonezd.me/index.php?title=PyMaemo/UI_tutorial/Data_selection&amp;diff=33627"/>
		<updated>2009-10-16T16:15:32Z</updated>

		<summary type="html">&lt;p&gt;189.2.128.130: /* Picker dialog and picker buttons */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Data selection =&lt;br /&gt;
Hildon provides a set of widgets for data selection specially designed for touchscreens that allows to build simple and easy-to-use interfaces.&lt;br /&gt;
&lt;br /&gt;
The key widget is a selector widget that allows users to select items from one to many predefined lists. It is similar to a combo box but allows several individual pannable columns.&lt;br /&gt;
&lt;br /&gt;
In addition, Hildon also provides a specialized dialog and a specialized button to be used in combination with a selector.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Touch selector ==&lt;br /&gt;
HildonTouchSelector is the mentioned selector widget. This widget can display several pannable columns. Each column is represented by a GtkTreeModel and single or multiple selection is allowed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Text Columns Example===&lt;br /&gt;
Let us see the simplest possible example. A selector that shows a single text column.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 6.1. Example of a single-column selector&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:example-single-text-column-selector.png|400px]]&lt;br /&gt;
&lt;br /&gt;
    # Based on C code from:&lt;br /&gt;
    # &amp;quot;Hildon Tutorial&amp;quot; version 2009-04-28&lt;br /&gt;
    # Example 5.6, &amp;quot;Example of a single-column selector&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
    import gtk&lt;br /&gt;
    import hildon&lt;br /&gt;
    &lt;br /&gt;
    def selection_changed(selector, user_data):&lt;br /&gt;
        current_selection = selector.get_current_text()&lt;br /&gt;
        print &amp;quot;Current selection : %s&amp;quot; % (current_selection)&lt;br /&gt;
    &lt;br /&gt;
    def create_simple_selector():&lt;br /&gt;
        #Create a HildonTouchSelector with a single text column&lt;br /&gt;
        # selector = hildon.TouchSelector()&lt;br /&gt;
        selector = hildon.hildon_touch_selector_new_text()&lt;br /&gt;
    &lt;br /&gt;
        # Set selection mode to allow multiple selection&lt;br /&gt;
        selector.set_column_selection_mode(hildon.TOUCH_SELECTOR_SELECTION_MODE_MULTIPLE)&lt;br /&gt;
    &lt;br /&gt;
        # Set a handler to &amp;quot;changed&amp;quot; signal &lt;br /&gt;
        selector.connect(&amp;quot;changed&amp;quot;, selection_changed)&lt;br /&gt;
    &lt;br /&gt;
        # Populate selector &lt;br /&gt;
        for i in range(10):&lt;br /&gt;
            label = &amp;quot;Item %d&amp;quot; % i&lt;br /&gt;
            # Add item to the column &lt;br /&gt;
            selector.append_text(label)&lt;br /&gt;
    &lt;br /&gt;
        return selector&lt;br /&gt;
    &lt;br /&gt;
    def app_quit(widget, data=None):&lt;br /&gt;
        gtk.main_quit()&lt;br /&gt;
    &lt;br /&gt;
    def main():&lt;br /&gt;
        program = hildon.hildon_program_get_instance()&lt;br /&gt;
        gtk.set_application_name(&amp;quot;hildon-touch-selector example program&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
        window = hildon.StackableWindow()&lt;br /&gt;
        program.add_window(window)&lt;br /&gt;
    &lt;br /&gt;
        # Create touch selector&lt;br /&gt;
        selector = create_simple_selector()&lt;br /&gt;
        window.add(selector)&lt;br /&gt;
    &lt;br /&gt;
        window.connect(&amp;quot;destroy&amp;quot;, app_quit)&lt;br /&gt;
    &lt;br /&gt;
        window.show_all()&lt;br /&gt;
    &lt;br /&gt;
        gtk.main()&lt;br /&gt;
    &lt;br /&gt;
    if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
        main()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A HildonTouchSelector with a single text column is created in this program using the following convenience constructor.&lt;br /&gt;
&lt;br /&gt;
    hildon.touch_selector_new_text()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To add text to a selector created by calling the constructor above, use the function.&lt;br /&gt;
&lt;br /&gt;
    def append(self, text):&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can use &amp;lt;code&amp;gt;prepend_text()&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;insert_text()&amp;lt;/code&amp;gt; to add text to the selector in different positions.&lt;br /&gt;
&lt;br /&gt;
You can set the desired selection with the function. In the example, the mode was set to allow multiple selection.&lt;br /&gt;
&lt;br /&gt;
    def set_column_selection_mode(self, mode):&lt;br /&gt;
&lt;br /&gt;
This example shows a very common use case of this widget. Next section shows how to build a more complex selector with several columns of different types.&lt;br /&gt;
&lt;br /&gt;
Also a simple function was set as a handler for the &amp;quot;changed&amp;quot; signal which is emitted each time the selected items change.&lt;br /&gt;
&lt;br /&gt;
The callback retrieves a text representation of the currently selected items in the selector by calling &amp;lt;code&amp;gt;get_current_text()&amp;lt;/code&amp;gt;. By default this function returns a concatenation of the items selected, separated by a comma.&lt;br /&gt;
&lt;br /&gt;
To change how the text representation is generated, set your own function by  calling &amp;lt;code&amp;gt;set_print_func()&amp;lt;/code&amp;gt; and using the following signature for the function:&lt;br /&gt;
&lt;br /&gt;
     def user_function (selector):&lt;br /&gt;
&lt;br /&gt;
===Custom columns===&lt;br /&gt;
&lt;br /&gt;
In the previous section, a selector with a text column was created. That is probably the most common use case of touch selectors. Convenience functions to deal with text columns was used. However, you can also set other type of columns.&lt;br /&gt;
&lt;br /&gt;
Because each column is basically a treeview, you can use the same display to different data and in different ways as you would do with a GtkTreeview. Thus, you can use the GtkCellRenderers available in GTK+ to display the data on each cell.&lt;br /&gt;
&lt;br /&gt;
This section explains how to build a selector within a column displaying stock icons. Firstly, let us take a look on the function which used for appending new columns to a touchable selector.&lt;br /&gt;
&lt;br /&gt;
     def append_column(self, model, cell_renderer, ...):&lt;br /&gt;
&lt;br /&gt;
This functions adds a new column to the widget whose data is obtained from the passed model. Pass also a GtkCellRenderer and a list of pairs property/value which is set as attributes of the renderer.&lt;br /&gt;
&lt;br /&gt;
This function basically adds a GtkTreeView to the widget. For more information on how GtkTreeviews work, see [http://library.gnome.org/devel/pygtk/stable/class-gtktreeview.html GTK+ widgets] before.&lt;br /&gt;
The following example shows how to set a column to display images in a selector. For clarity, only the function which creates the selector is shown.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 6.2. Example of a selector with a custom column&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Image:example-single-column-selector.png|400px]]&lt;br /&gt;
&lt;br /&gt;
    # Based on C code from:&lt;br /&gt;
    # &amp;quot;Hildon Tutorial&amp;quot; version 2009-04-28&lt;br /&gt;
    # Example 6.2 &amp;quot;Example of a selector with a custom column&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
    import gtk&lt;br /&gt;
    import hildon&lt;br /&gt;
    import gobject&lt;br /&gt;
    &lt;br /&gt;
    def selection_changed(selector, user_data):&lt;br /&gt;
        current_selection = selector.get_current_text()&lt;br /&gt;
        print &amp;quot;Current selection : %s&amp;quot; % (current_selection)&lt;br /&gt;
    &lt;br /&gt;
    def create_customized_selector():&lt;br /&gt;
        # Create a touch selector &lt;br /&gt;
        selector = hildon.TouchSelector()&lt;br /&gt;
    &lt;br /&gt;
        # Stock icons will be used for the example&lt;br /&gt;
        icon_list = gtk.stock_list_ids()&lt;br /&gt;
    &lt;br /&gt;
        # Create model to store selector&#039;s items &lt;br /&gt;
        store_icons = gtk.ListStore(gobject.TYPE_STRING);&lt;br /&gt;
    &lt;br /&gt;
        # Populate model&lt;br /&gt;
        for item in icon_list:&lt;br /&gt;
            new_iter = store_icons.append()&lt;br /&gt;
            store_icons.set(new_iter, 0, item)&lt;br /&gt;
    &lt;br /&gt;
        # Create and set up a pixbuf renderer to use in the selector &lt;br /&gt;
        renderer = gtk.CellRendererPixbuf() &lt;br /&gt;
        renderer.set_fixed_size(-1, 100)&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
        # Add the column to the selector&lt;br /&gt;
        # FIXME: bug 4646&lt;br /&gt;
        #column = selector.append_column(store_icons, renderer, &amp;quot;stock-id&amp;quot;, 0)&lt;br /&gt;
    &lt;br /&gt;
        # Set the selection mode&lt;br /&gt;
        selector.set_column_selection_mode(hildon.TOUCH_SELECTOR_SELECTION_MODE_MULTIPLE)&lt;br /&gt;
    &lt;br /&gt;
        # Set the property &amp;quot;text-column&amp;quot; that indicates the column&lt;br /&gt;
        # of the model to get the string from&lt;br /&gt;
        column.set_property(&amp;quot;text-column&amp;quot;, 0)&lt;br /&gt;
    &lt;br /&gt;
        return selector&lt;br /&gt;
    &lt;br /&gt;
    def app_quit(widget, data=None):&lt;br /&gt;
        gtk.main_quit()&lt;br /&gt;
    &lt;br /&gt;
    def main():&lt;br /&gt;
        program = hildon.hildon_program_get_instance()&lt;br /&gt;
        gtk.set_application_name(&amp;quot;hildon-touch-selector example program&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
        window = hildon.StackableWindow()&lt;br /&gt;
        program.add_window(window)&lt;br /&gt;
    &lt;br /&gt;
        # Create touch selector&lt;br /&gt;
        selector = create_customized_selector()&lt;br /&gt;
        window.add(selector)&lt;br /&gt;
    &lt;br /&gt;
        window.connect(&amp;quot;destroy&amp;quot;, app_quit)&lt;br /&gt;
    &lt;br /&gt;
        window.show_all()&lt;br /&gt;
&lt;br /&gt;
        gtk.main()&lt;br /&gt;
    &lt;br /&gt;
    if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
        main()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first step in the example is to create and populate a GtkTreeModel. A GtkListStore is used in the example. In most use cases of the touchable selectors a GtkListStore fits well as selectors were designed to allow users to select from a list of items.&lt;br /&gt;
&lt;br /&gt;
In this case, the model stores a list of GTK+ stock icons identifiers. The following call creates a list store with one column to store strings.&lt;br /&gt;
&lt;br /&gt;
    store_icons = gtk.ListStore(G_TYPE_STRING);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following loop appends all stock identifiers in the newly created model. The identifiers were previously retrieved using&lt;br /&gt;
&lt;br /&gt;
    for item in icon_list:&lt;br /&gt;
        new_iter = store_icons.append()&lt;br /&gt;
        store_icons.set(new_iter, 0, item)&lt;br /&gt;
&lt;br /&gt;
The next step is to set up the renderer which renders each row of the new column. We need a GtkCellRendererPixbuf to display the stock icons.&lt;br /&gt;
&lt;br /&gt;
    renderer = gtk.CellRendererPixbuf()&lt;br /&gt;
&lt;br /&gt;
Finally, we create and append the new column, using the model and renderer previously created.&lt;br /&gt;
&lt;br /&gt;
This call also sets the property &amp;quot;stock-id&amp;quot; of the GtkCellrendererPixbuf. The value is set to 0 which is the number of the column in the GtkTreeModel that stores the stock-id.&lt;br /&gt;
&lt;br /&gt;
    column = selector.append_column(store_icons, renderer, &amp;quot;stock-id&amp;quot;, 0)&lt;br /&gt;
&lt;br /&gt;
To summarize, setting a new custom column in a touchable selector is quite similar to setting a new column in a normal GtkTreeview. Create a model to store the data and a cell renderer to properly show this data in each row, and finally add the new column.&lt;br /&gt;
&lt;br /&gt;
==Picker dialog and picker buttons ==&lt;br /&gt;
Normally, you use HildonTouchSelector together with a HildonPickerDialog activated from a button. For most common cases you use HildonPickerButton.&lt;br /&gt;
&lt;br /&gt;
This is the usual way to present a selector to the user. The picker button opens a dialog which presents the selector and properly manages user interaction.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Previous sections showed you how to create a touchable selector. In most cases the next step is to attach the selector to a HildonPickerButton.&lt;br /&gt;
&lt;br /&gt;
A HildonPickerButton is a special GtkButton which displays two labels, title and value, and brings up a HildonPickerDialog. The user chooses one or several items. A string representation of the chosen items is displayed in the value label of the picker button.&lt;br /&gt;
&lt;br /&gt;
Below, a modified version of the previous main function is shown, in which you can check how a HildonPickerButton is created and attached to a selector. Also a callback to catch the signal &amp;quot;value-changed&amp;quot; emitted is added.&lt;br /&gt;
&lt;br /&gt;
[[Image:example-picker-button.png|400px]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 6.3. Example of a Hildon picker button&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
    # Based on C code from:&lt;br /&gt;
    # &amp;quot;Hildon Tutorial&amp;quot; version 2009-04-28&lt;br /&gt;
    # Example 6.3, &amp;quot;Example of a Hildon picker button&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
    import gtk&lt;br /&gt;
    import hildon&lt;br /&gt;
    import gobject&lt;br /&gt;
    &lt;br /&gt;
    def on_picker_value_changed(button, user_data=None):&lt;br /&gt;
        print &amp;quot;Newly selected value: %s\n&amp;quot; % button.get_value()&lt;br /&gt;
    &lt;br /&gt;
    def app_quit(widget, data=None):&lt;br /&gt;
        gtk.main_quit()&lt;br /&gt;
    &lt;br /&gt;
    def create_customized_selector():&lt;br /&gt;
        # Create a touch selector &lt;br /&gt;
        selector = hildon.TouchSelector()&lt;br /&gt;
    &lt;br /&gt;
        # Stock icons will be used for the example&lt;br /&gt;
        icon_list = gtk.stock_list_ids()&lt;br /&gt;
        &lt;br /&gt;
        print icon_list&lt;br /&gt;
    &lt;br /&gt;
        # Create model to store selector&#039;s items&lt;br /&gt;
        store_icons = gtk.ListStore(gobject.TYPE_STRING)&lt;br /&gt;
    &lt;br /&gt;
        # Populate model&lt;br /&gt;
        for item in icon_list:&lt;br /&gt;
            new_iter = store_icons.append()&lt;br /&gt;
            store_icons.set_value(new_iter, 0, item)&lt;br /&gt;
    &lt;br /&gt;
        # Create and set up a text renderer to use in the selector&lt;br /&gt;
        renderer = gtk.CellRendererPixbuf()&lt;br /&gt;
        renderer.set_fixed_size(-1, 100)&lt;br /&gt;
    &lt;br /&gt;
        # Add the column to the selector&lt;br /&gt;
        column = selector.append_column(store_icons, renderer, stock_id=0)&lt;br /&gt;
    &lt;br /&gt;
        # Set the selection mode&lt;br /&gt;
        selector.set_column_selection_mode(hildon.TOUCH_SELECTOR_SELECTION_MODE_MULTIPLE)&lt;br /&gt;
    &lt;br /&gt;
        # Set the property &amp;quot;text-column&amp;quot; that indicates the column&lt;br /&gt;
        # of the model to get the string from&lt;br /&gt;
        column.set_property(&amp;quot;text-column&amp;quot;, 0)&lt;br /&gt;
    &lt;br /&gt;
        return selector&lt;br /&gt;
    &lt;br /&gt;
    def main ():&lt;br /&gt;
        program = hildon.Program.get_instance()&lt;br /&gt;
        gtk.set_application_name(&amp;quot;hildon-touch-selector example program&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
        window = hildon.StackableWindow()&lt;br /&gt;
        program.add_window(window)&lt;br /&gt;
    &lt;br /&gt;
        # Create touch selector&lt;br /&gt;
        selector = create_customized_selector()&lt;br /&gt;
    &lt;br /&gt;
        # Create a picker button&lt;br /&gt;
        picker_button = hildon.PickerButton(gtk.HILDON_SIZE_AUTO,&lt;br /&gt;
                                            hildon.BUTTON_ARRANGEMENT_VERTICAL)&lt;br /&gt;
    &lt;br /&gt;
        # Set a title to the button &lt;br /&gt;
        picker_button.set_title(&amp;quot;Select an item&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
        # Attach the touch selector to the picker button&lt;br /&gt;
        picker_button.set_selector(selector)&lt;br /&gt;
    &lt;br /&gt;
        # Attach callback to the &amp;quot;value-changed&amp;quot; signal&lt;br /&gt;
        picker_button.connect(&amp;quot;value-changed&amp;quot;, on_picker_value_changed)&lt;br /&gt;
    &lt;br /&gt;
        # Add button to main window&lt;br /&gt;
        window.add(picker_button)&lt;br /&gt;
    &lt;br /&gt;
        window.connect(&amp;quot;destroy&amp;quot;, app_quit)&lt;br /&gt;
        window.show_all()&lt;br /&gt;
        gtk.main()&lt;br /&gt;
    &lt;br /&gt;
    if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
        main()&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
In the above example a picker button is created. The reference to the attached selector is stored in the property &amp;quot;touch-selector&amp;quot; of the picker button. To retrieve the attached selector , use function &amp;lt;code&amp;gt;hildon.PickerButton()&amp;lt;/code&amp;gt;. To attach the selector, use the function &amp;lt;code&amp;gt;picker_button.set_selector()&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note that you do not need to take care of the HildonPickerDialog. The dialog is automatically brought up when users click the picker button and closed when the selection is done.&lt;br /&gt;
&lt;br /&gt;
The dialog shows a button &amp;quot;Done&amp;quot; to allow users finish the selection when the touchable selector allows multiple selection. When the selector allows only single selection, the dialog does not show any button and closes when the user taps on one item.&lt;br /&gt;
&lt;br /&gt;
The label of the button &amp;quot;Done&amp;quot; can be set by using &amp;lt;code&amp;gt;set_done_button_text()&amp;lt;/code&amp;gt; and retrieved by using &amp;lt;code&amp;gt;get_done_button_text()&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
When users finish their selection, the value label on the button automatically changes to show a textual representation of the item or items selected.&lt;br /&gt;
&lt;br /&gt;
In most cases you want to perform any action when selection is finished. To do that, add a handler to the signal &amp;quot;value-changed&amp;quot; of the picker button. In this example the handler attached to &amp;quot;value-changed&amp;quot; signal retrieves the value label of the button and prints a debug message.&lt;br /&gt;
&lt;br /&gt;
==Touch selector entry ==&lt;br /&gt;
The HildonTouchSelectorEntry is a selector widget with a text entry that allows users to select an item from a predefined list or to enter a different one in a HildonEntry. Items can also be searched and selected by typing in the entry.&lt;br /&gt;
&lt;br /&gt;
An additional feature is that the HildonEntry is auto-completed with the list&#039;s items as the user types their name.&lt;br /&gt;
&lt;br /&gt;
Example below shows how to build a selector to pick a word in a list of words.&lt;br /&gt;
&lt;br /&gt;
[[Image:Touch_selector_entry.png|400px]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 6.4. Example of a Hildon picker button with a selector entry&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
    # Based on C code from:&lt;br /&gt;
    # &amp;quot;Hildon Tutorial&amp;quot; version 2009-04-28&lt;br /&gt;
    # Example 6.4, &amp;quot;Hildon picker button with a selector entry&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
    import gtk&lt;br /&gt;
    import hildon&lt;br /&gt;
    &lt;br /&gt;
    def app_quit(widget, data=None):&lt;br /&gt;
        gtk.main_quit()&lt;br /&gt;
    &lt;br /&gt;
    def main ():&lt;br /&gt;
        artists = [&lt;br /&gt;
            &amp;quot;AC/DC&amp;quot;,&lt;br /&gt;
            &amp;quot;Aerosmith&amp;quot;,&lt;br /&gt;
            &amp;quot;Alice in Chains&amp;quot;,&lt;br /&gt;
            &amp;quot;Black Sabbath&amp;quot;,&lt;br /&gt;
            &amp;quot;Carcass&amp;quot;,&lt;br /&gt;
            &amp;quot;Danzig&amp;quot;,&lt;br /&gt;
            &amp;quot;Deep Purple&amp;quot;,&lt;br /&gt;
            &amp;quot;Dream Theater&amp;quot;,&lt;br /&gt;
            &amp;quot;Eric Clapton&amp;quot;,&lt;br /&gt;
        ]&lt;br /&gt;
    &lt;br /&gt;
        program = hildon.hildon_program_get_instance()&lt;br /&gt;
        gtk.set_application_name(&amp;quot;hildon-touch-selector example program&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
        window = hildon.StackableWindow()&lt;br /&gt;
        program.add_window(window)&lt;br /&gt;
    &lt;br /&gt;
        # Create a picker button&lt;br /&gt;
        picker_button = hildon.PickerButton(gtk.HILDON_SIZE_AUTO,&lt;br /&gt;
                                            hildon.BUTTON_ARRANGEMENT_VERTICAL)&lt;br /&gt;
    &lt;br /&gt;
        # Set a title to the button &lt;br /&gt;
        picker_button.set_title(&amp;quot;Pick a band!&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
        # Create a touch selector entry */&lt;br /&gt;
        # FIXME: bug 4647&lt;br /&gt;
        selector = hildon.hildon_touch_selector_entry_new_text()&lt;br /&gt;
           &lt;br /&gt;
        # Populate the selector&lt;br /&gt;
        for artist in artists:&lt;br /&gt;
            selector.append_text(artist)&lt;br /&gt;
    &lt;br /&gt;
        # Attach the touch selector to the picker button&lt;br /&gt;
        picker_button.set_selector(selector)&lt;br /&gt;
    &lt;br /&gt;
        # Add button to main window&lt;br /&gt;
        window.add(picker_button)&lt;br /&gt;
    &lt;br /&gt;
        window.connect(&amp;quot;destroy&amp;quot;, app_quit)&lt;br /&gt;
        window.show_all()&lt;br /&gt;
        gtk.main()&lt;br /&gt;
    &lt;br /&gt;
    if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
        main()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As you can see in the example above, the use of this widget is similar to using a normal touchable selector.&lt;br /&gt;
&lt;br /&gt;
You can also use custom columns in a HildonTouchableEntry but at least one column must be a text column. The text column is indicated by the property &amp;quot;text_column&amp;quot; which you set with &amp;lt;code&amp;gt;set_text_column()&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Pre-built selectors ==&lt;br /&gt;
The widgets HildonDateButton and HildonTimeButton are buttons displaying and allowing the selection of date and time, respectively. Developers can use them directly instead of building their own date or time selectors.&lt;br /&gt;
&lt;br /&gt;
Both widgets are specialized picker buttons with a convenient touchable selector attached that you can use directly in your application.&lt;br /&gt;
&lt;br /&gt;
Here a simple application using a HildonDateButton.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 6.5. Example of a Hildon date button&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
    # Based on C code from:&lt;br /&gt;
    # &amp;quot;Hildon Tutorial&amp;quot; version 2009-04-28&lt;br /&gt;
    # Example 6.5, &amp;quot;Example of a Hildon date button&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
    import gtk&lt;br /&gt;
    import hildon&lt;br /&gt;
    &lt;br /&gt;
    def app_quit(widget, data=None):&lt;br /&gt;
        gtk.main_quit()&lt;br /&gt;
    &lt;br /&gt;
    def main ():&lt;br /&gt;
        program = hildon.hildon_program_get_instance()&lt;br /&gt;
        gtk.set_application_name(&amp;quot;hildon-touch-selector example program&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
        window = hildon.StackableWindow()&lt;br /&gt;
        program.add_window(window)&lt;br /&gt;
    &lt;br /&gt;
        # Create a date picker&lt;br /&gt;
        date_button = hildon.DateButton(gtk.HILDON_SIZE_AUTO,&lt;br /&gt;
                                        hildon.BUTTON_ARRANGEMENT_VERTICAL)&lt;br /&gt;
    &lt;br /&gt;
        # Set a title to the button&lt;br /&gt;
        date_button.set_title(&amp;quot;Select an item&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
        # Add button to main window &lt;br /&gt;
        window.add(date_button)&lt;br /&gt;
    &lt;br /&gt;
            &lt;br /&gt;
        window.connect(&amp;quot;destroy&amp;quot;, app_quit)&lt;br /&gt;
        window.show_all()&lt;br /&gt;
        gtk.main()&lt;br /&gt;
    &lt;br /&gt;
    if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
        main()&lt;/div&gt;</summary>
		<author><name>189.2.128.130</name></author>
	</entry>
	<entry>
		<id>https://maemo.octonezd.me/index.php?title=PyMaemo/UI_tutorial/Getting_started&amp;diff=33641</id>
		<title>PyMaemo/UI tutorial/Getting started</title>
		<link rel="alternate" type="text/html" href="https://maemo.octonezd.me/index.php?title=PyMaemo/UI_tutorial/Getting_started&amp;diff=33641"/>
		<updated>2009-10-16T12:28:41Z</updated>

		<summary type="html">&lt;p&gt;189.2.128.130: /* Getting started */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Getting started=&lt;br /&gt;
Before starting to develop your Hildon applications you need to get, install and properly configure the Maemo SDK. You can download and learn how to use the latest SDK in [http://maemo.org/development/sdks/ Maemo SDK Releases].&lt;br /&gt;
&lt;br /&gt;
To begin our introduction to Hildon, we start with the simplest program possible - base.py. This program creates a window and has no way of exiting except to be killed by using the shell.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 1.1. Simple Hildon program&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
    # Based on C code from:&lt;br /&gt;
    # &amp;quot;Hildon Tutorial&amp;quot; version 2009-04-28&lt;br /&gt;
    # Example 1.1, &amp;quot;Simple Hildon program&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
    import gtk&lt;br /&gt;
    import hildon&lt;br /&gt;
    &lt;br /&gt;
    def main():&lt;br /&gt;
        gtk.set_application_name(&amp;quot;Simplest example&amp;quot;)&lt;br /&gt;
        &lt;br /&gt;
        window = hildon.Window()&lt;br /&gt;
        window.show()&lt;br /&gt;
        &lt;br /&gt;
        gtk.main()&lt;br /&gt;
        &lt;br /&gt;
    if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
        main()&lt;br /&gt;
&lt;br /&gt;
To run the program you can use:&lt;br /&gt;
&lt;br /&gt;
    run-standalone.sh python2.5 base.py&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
All programs will import hildon which declares the variables, functions, structures, etc. that will be used in your Hildon application.&lt;br /&gt;
&lt;br /&gt;
The next two lines of code create and display a window.&lt;br /&gt;
&lt;br /&gt;
    window = hildon.Window()&lt;br /&gt;
    window.show()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The hildon.Window used in this example represents a top-level window in the Hildon framework. It is derived from gtk.Window and provides additional commodities specific to the Hildon framework.&lt;br /&gt;
&lt;br /&gt;
In very simple applications, hildon.Window could be enough. However, in most of the applications a hildon.StackableWindow should be used. Next chapters will clarify this.&lt;br /&gt;
&lt;br /&gt;
The show() shows the widget (makes it visible) that would not be otherwise displayed.&lt;br /&gt;
&lt;br /&gt;
The last line enters the GTK+ main processing loop.&lt;br /&gt;
&lt;br /&gt;
    gtk.main();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This call can be found in every GTK+ application and therefore, in every Hildon application. When control reaches this point, GTK+ will sleep waiting for X events (such as button or key presses), timeouts, or file IO notifications to occur. In our simple example, however, events are ignored.&lt;br /&gt;
&lt;br /&gt;
==Hello World in Hildon ==&lt;br /&gt;
&lt;br /&gt;
To begin our introduction to Hildon, we introduce the classic Hello World, Hildon style. This program will create a window with a widget (a button).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example 1.2. Hildon Hello World program&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
    # Based on C code from:&lt;br /&gt;
    # &amp;quot;Hildon Tutorial&amp;quot; version 2009-04-28&lt;br /&gt;
    # Example 1.2, &amp;quot;Hildon Hello World program&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
    import gtk&lt;br /&gt;
    import hildon&lt;br /&gt;
    &lt;br /&gt;
    # This is a callback function. The data arguments are ignored in this example.&lt;br /&gt;
    def hello(widget, data):&lt;br /&gt;
        print &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
    def main():&lt;br /&gt;
        # Get an instance of HildonProgram. It is an object used to represent an&lt;br /&gt;
        # application running in the Hildon framework.&lt;br /&gt;
        program = hildon.Program.get_instance()&lt;br /&gt;
    &lt;br /&gt;
        # create a new hildon window&lt;br /&gt;
        window = hildon.Window()&lt;br /&gt;
    &lt;br /&gt;
        # Registers a window as belonging to the program&lt;br /&gt;
        program.add_window(window)&lt;br /&gt;
    &lt;br /&gt;
        # When the window is given the &amp;quot;delete_event&amp;quot; signal (this is given by the&lt;br /&gt;
        # window manager, usually by the &amp;quot;close&amp;quot; option, or on the titlebar), we&lt;br /&gt;
        # ask it to call the delete_event () function as defined above. The data&lt;br /&gt;
        # passed to the callback function is None and is ignored in the callback&lt;br /&gt;
        # function.&lt;br /&gt;
        window.connect(&amp;quot;delete_event&amp;quot;, gtk.main_quit, None)&lt;br /&gt;
    &lt;br /&gt;
        button = hildon.Button(gtk.HILDON_SIZE_AUTO, hildon.BUTTON_ARRANGEMENT_VERTICAL, &amp;quot;Hello world!&amp;quot;)&lt;br /&gt;
    &lt;br /&gt;
        # When the button is given the &amp;quot;clicked&amp;quot; signal, we ask it to call the&lt;br /&gt;
        # hello () function as defined above. The data passed to the callback&lt;br /&gt;
        # function is None and is ignored in the callback function.&lt;br /&gt;
        button.connect(&amp;quot;clicked&amp;quot;, hello, None)&lt;br /&gt;
    &lt;br /&gt;
        # This packs the button into the window (a GTK+ container).&lt;br /&gt;
        window.add(button)&lt;br /&gt;
    &lt;br /&gt;
        # The final step is to display this newly created widget and all widgets it&lt;br /&gt;
        # contains.&lt;br /&gt;
        window.show_all()&lt;br /&gt;
    &lt;br /&gt;
        # All GTK+ applications must have a gtk_main(). Control ends here and waits&lt;br /&gt;
        # for an event to occur (like a key press or mouse event).&lt;br /&gt;
        gtk.main()&lt;br /&gt;
    &lt;br /&gt;
    if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
        main()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As you can see in this simple example, writing Hildon applications is slightly different from writing standard GTK+ applications. We are going to review these differences through the next chapters.&lt;br /&gt;
&lt;br /&gt;
==Running Hello World ==&lt;br /&gt;
&lt;br /&gt;
To run use:&lt;br /&gt;
&lt;br /&gt;
    run-standalone.sh python2.5 hello-world.py&lt;br /&gt;
&lt;br /&gt;
==Stepping through Hello World ==&lt;br /&gt;
&lt;br /&gt;
This section explains the Hello World example above step-by-step.&lt;br /&gt;
&lt;br /&gt;
The following lines define the callback function that is called when the button is clicked. We ignore both the widget and the data in this example, but usually developers would need to handle events from them.&lt;br /&gt;
&lt;br /&gt;
    def hello(widget, data):&lt;br /&gt;
        print &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here starts the definition of the main function like it is usually done in programs written in Python.&lt;br /&gt;
&lt;br /&gt;
    if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
        main()&lt;br /&gt;
&lt;br /&gt;
Before using Hildon, it is needed to import it. This import connects to the window system display.&lt;br /&gt;
&lt;br /&gt;
  import hildon&lt;br /&gt;
&lt;br /&gt;
Only one HildonProgram can be created per process. Use &amp;lt;code&amp;gt;hildon.Program.get_instance()&amp;lt;/code&amp;gt; to access it.&lt;br /&gt;
&lt;br /&gt;
    program = hildon.Program.get_instance()&lt;br /&gt;
&lt;br /&gt;
In this simple example, a new HildonWindow is created. In cases with nested views, use a HildonStackableWindow. &lt;br /&gt;
&lt;br /&gt;
    window = hildon.Window()&lt;br /&gt;
&lt;br /&gt;
This call registers a window as belonging to the program. This allows applying program-wide settings to all the registered windows, such as assigning a common menu to all the registered windows by setting it to the program.&lt;br /&gt;
&lt;br /&gt;
    program.add_window(window)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following code is an example of connecting a signal handler to an object, in this case, the window. The function gtk.main_quit() is set as a handler to the “delete_event” signal. This function tells GTK+ that it must exit from gtk.main() when control is returned to it, making the program terminate.&lt;br /&gt;
&lt;br /&gt;
   window.connect(&amp;quot;delete_event&amp;quot;, gtk.main_quit)&lt;br /&gt;
&lt;br /&gt;
This call creates a new HildonButton. This button allows to set two labels, one main label and another secondary one. You can also set the size of the button and the order of the labels. Notice that you can use GtkButton&#039;s in Hildon applications in case you do not need the additional features that Hildon provides.&lt;br /&gt;
&lt;br /&gt;
    button = hildon.Button(gtk.HILDON_SIZE_AUTO, hildon.BUTTON_ARRANGEMENT_VERTICAL, &amp;quot;Hello world!&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Here, a signal handler is attached to the newly created button so that when it emits the &amp;quot;clicked&amp;quot; signal, our &amp;lt;code&amp;gt;hello()&amp;lt;/code&amp;gt; function is called. The data is ignored, so we simply pass in NULL to the &amp;lt;code&amp;gt;hello()&amp;lt;/code&amp;gt; callback function. Obviously, the &amp;quot;clicked&amp;quot; signal is emitted when the button is pressed.&lt;br /&gt;
&lt;br /&gt;
    button.connect(&amp;quot;clicked&amp;quot;, hello, None)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This packing call tells GTK+ to place the button in the window. For more information, see the Packing Widgets section of the [http://library.gnome.org/devel/pygtk/stable/] Tutorial.&lt;br /&gt;
&lt;br /&gt;
    window.add(button)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When everything is set up with all signal handlers in place and the button placed in the window, we ask GTK to &amp;quot;show&amp;quot; the widgets on the screen.&lt;br /&gt;
&lt;br /&gt;
    window.show_all()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And of course, we call gtk_main() which waits for events to come from the X server and will call on the widgets to emit signals when these events come.&lt;br /&gt;
&lt;br /&gt;
    gtk.main()&lt;/div&gt;</summary>
		<author><name>189.2.128.130</name></author>
	</entry>
	<entry>
		<id>https://maemo.octonezd.me/index.php?title=PyMaemo&amp;diff=33219</id>
		<title>PyMaemo</title>
		<link rel="alternate" type="text/html" href="https://maemo.octonezd.me/index.php?title=PyMaemo&amp;diff=33219"/>
		<updated>2009-10-15T19:51:49Z</updated>

		<summary type="html">&lt;p&gt;189.2.128.130: /* Ye Olde Documentation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is PyMaemo? ==&lt;br /&gt;
&lt;br /&gt;
The [http://pymaemo.garage.maemo.org/ PyMaemo] (Python for Maemo) project maintains a set of packages necessary to run and develop Python applications on the Maemo platform.&lt;br /&gt;
&lt;br /&gt;
== Supported Software ==&lt;br /&gt;
&lt;br /&gt;
We currently maintain support for the python interpreter, bindings and a few applications in the Maemo platform. A detailed list can be found in [[PyMaemo/Components]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== In progress documentation ===&lt;br /&gt;
&lt;br /&gt;
This section contains links to documentation that is still being written.&lt;br /&gt;
&lt;br /&gt;
* [[PyMaemo/Python26PortingGuide|Python 2.6 porting guide]]&lt;br /&gt;
* [[PyMaemo/PythonOssoExamples|Python OSSO Examples]]&lt;br /&gt;
&lt;br /&gt;
== Using it ==&lt;br /&gt;
&lt;br /&gt;
[[PyMaemo/Installation]]&lt;br /&gt;
&lt;br /&gt;
[[PyMaemo/ManualInstallation]]&lt;br /&gt;
&lt;br /&gt;
[[PyMaemo/SDKInstallation]]&lt;br /&gt;
&lt;br /&gt;
[[PyMaemo/FAQ]]&lt;br /&gt;
&lt;br /&gt;
== Screenshots ==&lt;br /&gt;
&lt;br /&gt;
[[PyMaemo/Screenshots]]&lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
&lt;br /&gt;
* [[PyMaemo/UITutorial|Graphical UI Tutorial]]&lt;br /&gt;
&lt;br /&gt;
== Ye Olde Documentation ==&lt;br /&gt;
&lt;br /&gt;
This section contains documentation that is quite old (770, Chinook, etc).&lt;br /&gt;
&lt;br /&gt;
* [[PyMaemo/UsingPythonInMaemo|Using Python in Maemo]]&lt;br /&gt;
* [http://maemo.org/development/documentation/apis/3-x/python-maemo-3.x/ API Documentation (Maemo 3.x Bora)]&lt;br /&gt;
* [http://www.teemuharju.net/2006/01/26/coding-for-nokia-770-using-python-part-1/ Coding for Nokia 770 using Python part 1]&lt;br /&gt;
* [http://www.teemuharju.net/2006/02/08/coding-for-nokia-770-using-python-part-2/ Coding for Nokia 770 using Python part 2]&lt;br /&gt;
* [http://my.opera.com/monroe/blog/pymaemo-tips Jason&#039;s useful tips for PyMaemo development]&lt;br /&gt;
* [http://pycage.blogspot.com/2007/12/tablet-python-1-relocatable-software.html Martin&#039;s useful tips for PyMaemo development]&lt;br /&gt;
* [[PyMaemo/Python-GPSbt|python-gpsbt introduction and example (only applicable to Maemo 4.x)]]&lt;/div&gt;</summary>
		<author><name>189.2.128.130</name></author>
	</entry>
	<entry>
		<id>https://maemo.octonezd.me/index.php?title=PyMaemo/HildonDesktop&amp;diff=33354</id>
		<title>PyMaemo/HildonDesktop</title>
		<link rel="alternate" type="text/html" href="https://maemo.octonezd.me/index.php?title=PyMaemo/HildonDesktop&amp;diff=33354"/>
		<updated>2009-09-28T14:48:57Z</updated>

		<summary type="html">&lt;p&gt;189.2.128.130: /* Testing the example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Python bindings for libhildondesktop ==&lt;br /&gt;
&lt;br /&gt;
These bindings allow to create the so called Hildon Home and Status Menu applets (or widgets, in Maemo 5). It consists of two binary packages:&lt;br /&gt;
&lt;br /&gt;
* python-hildondesktop: the actual Python bindings. Can be used to write standalone widgets, or ones that can be added by the user using the &amp;quot;Add widget&amp;quot; option in Maemo 5.&lt;br /&gt;
* hildon-desktop-python-loader: this is a Hildon Desktop loader for Python plugins.&lt;br /&gt;
&lt;br /&gt;
=== API changes for Fremantle ===&lt;br /&gt;
&lt;br /&gt;
The libhildondesktop version in Fremantle contains some API changes that also reflect on the Python bindings. Namely, you should pay attention to the following differences when migrating Home Widgets from older Maemo releases to Fremantle:&lt;br /&gt;
&lt;br /&gt;
* The base class for Home Widgets is now called &amp;quot;HomePluginItem&amp;quot;, instead of the older &amp;quot;HomeItem&amp;quot; name.&lt;br /&gt;
* The base class for Status menu widgets is now called &amp;quot;StatusMenuItem&amp;quot;, instead of the older &amp;quot;StatusBarItem&amp;quot;.&lt;br /&gt;
* The callback function that is called by the load is now called &amp;quot;hd_plugin_get_object&amp;quot;, instead of the older &amp;quot;hd_plugin_get_objects&amp;quot;. This is so because in fremantle the plugin is can create only one plugin object.&lt;br /&gt;
* Also note that the &amp;quot;hd_plugin_get_object&amp;quot; function should return a single object, instead of a list.&lt;br /&gt;
* The returned object must be instantiated using the gobject.new() function (see the example below). This is necessary because the plugin-id property needs to be set, otherwise the hildon-home process will crash.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;NOTE:&amp;lt;/b&amp;gt; this last requirement might change in future, to avoid the mentioned crash.&lt;br /&gt;
&lt;br /&gt;
=== Example - Home widgets (Fremantle only) ===&lt;br /&gt;
&lt;br /&gt;
The code below was based on the C example that can be found on the maemo-examples package sources [https://garage.maemo.org/svn/maemoexamples/branches/fremantle-sdk-testing/maemo-examples/hello-world-home.c].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import gobject&lt;br /&gt;
import gtk&lt;br /&gt;
import hildondesktop&lt;br /&gt;
&lt;br /&gt;
class HelloWorldButton(gtk.Button):&lt;br /&gt;
    def __init__(self, padding):&lt;br /&gt;
        gtk.Button.__init__(self)&lt;br /&gt;
        icon_theme = gtk.icon_theme_get_default()&lt;br /&gt;
        icon = icon_theme.load_icon(&amp;quot;hello&amp;quot;, 40, 0)&lt;br /&gt;
        if icon is None:&lt;br /&gt;
            icon = icon_theme.load_icon(&amp;quot;qgn_list_gene_default_app&amp;quot;, 40, 0)&lt;br /&gt;
        icon_image = gtk.Image()&lt;br /&gt;
        icon_image.set_from_pixbuf(icon)&lt;br /&gt;
        icon_image.set_padding(padding, padding)&lt;br /&gt;
        self.add(icon_image)&lt;br /&gt;
        self.show_all()&lt;br /&gt;
&lt;br /&gt;
class HelloWorldDialog(gtk.Dialog):&lt;br /&gt;
    def __init__(self):&lt;br /&gt;
        gtk.Dialog.__init__(self, &amp;quot;Hello World&amp;quot;, None,&lt;br /&gt;
                            gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_NO_SEPARATOR,&lt;br /&gt;
                            (&amp;quot;Close&amp;quot;, gtk.RESPONSE_OK))&lt;br /&gt;
        self.vbox.add(gtk.Label(&amp;quot;Hello World!&amp;quot;))&lt;br /&gt;
        self.show_all()&lt;br /&gt;
&lt;br /&gt;
def hello_world_dialog_show(button):&lt;br /&gt;
    dialog = HelloWorldDialog()&lt;br /&gt;
    dialog.run()&lt;br /&gt;
    dialog.destroy()&lt;br /&gt;
&lt;br /&gt;
class HelloHomePlugin(hildondesktop.HomePluginItem):&lt;br /&gt;
    __gtype_name__ = &#039;HelloHomePlugin&#039;&lt;br /&gt;
&lt;br /&gt;
    def __init__(self):&lt;br /&gt;
        hildondesktop.HomePluginItem.__init__(self)&lt;br /&gt;
        button = HelloWorldButton(10)&lt;br /&gt;
        button.connect(&amp;quot;clicked&amp;quot;, hello_world_dialog_show)&lt;br /&gt;
        button.show_all()&lt;br /&gt;
        self.add(button)&lt;br /&gt;
&lt;br /&gt;
def hd_plugin_get_object():&lt;br /&gt;
    return gobject.new(HelloHomePlugin, plugin_id=&amp;quot;hello_world_home&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
    obj = hd_plugin_get_object()&lt;br /&gt;
    obj.show_all()&lt;br /&gt;
    gtk.main()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Testing the example ===&lt;br /&gt;
&lt;br /&gt;
First, add Fremantle extras-devel to the /etc/apt/sources.list in your scratchbox target and install the required packages:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[sbox]&amp;gt; fakeroot apt-get install python-hildondesktop hildon-desktop-python-loader&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the example code shown above as &amp;lt;b&amp;gt;/usr/lib/hildon-desktop/hello_world_home.py&amp;lt;/b&amp;gt; inside your FREMANTLE_X86 target. Next, save the following text as &amp;lt;b&amp;gt;/usr/share/applications/hildon-home/hello_world_home.desktop&amp;lt;/b&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Hello, World! (Python)&lt;br /&gt;
Comment=Example Home Python plugin&lt;br /&gt;
Type=python&lt;br /&gt;
X-Path=hello_world_home.py&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the hildon desktop and hildon-home are running. For that, you can use the following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[sbox]&amp;gt; export DISPLAY=:2 # if you are using scratchbox + Xephyr&lt;br /&gt;
[sbox]&amp;gt; af-sb-init.sh start&lt;br /&gt;
[sbox]&amp;gt; run-standalone.sh maemo-summoner /usr/bin/hildon-home.launch &amp;amp;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you need to add the newly installed home widget to the desktop. For that you can either manually add it to the &amp;lt;b&amp;gt;~/.config/hildon-desktop/home.plugins&amp;lt;/b&amp;gt; file, or follow these instructions to add it using the Hildon Desktop interface:&lt;br /&gt;
&lt;br /&gt;
# Click anywhere on the Maemo desktop background.&lt;br /&gt;
# You should see a &amp;quot;engine&amp;quot; icon on the top right. Click on it.&lt;br /&gt;
# It will be shown a menu bar containing &amp;quot;Desktop menu&amp;quot; and &amp;quot;Done&amp;quot;. Click on &amp;quot;Desktop menu&amp;quot;.&lt;br /&gt;
# You should now see a menu with 4 buttons. Click on the &amp;quot;Add widget&amp;quot; button.&lt;br /&gt;
# A menu containing the list of installed widgets will appear. Select the one we installed, called &amp;quot;Hello, World! (Python)&amp;quot;.&lt;br /&gt;
# Finally, click on &amp;quot;Done&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
You should then see the following (the images look distorted because they were taken on Xephyr):&lt;br /&gt;
&lt;br /&gt;
[[Image:Hello_world_home_python1.png]]&lt;br /&gt;
&lt;br /&gt;
After clicking on the widget button, you should see:&lt;br /&gt;
&lt;br /&gt;
[[Image:Hello_world_home_python2.png]]&lt;br /&gt;
&lt;br /&gt;
=== Example - Status menu widgets (Fremantle only) ===&lt;br /&gt;
&lt;br /&gt;
The code below was based on the C example that can be found on the Maemo 5 Developer Guide [http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/Application_Development/Writing_Desktop_Widgets#Status_Menu_widgets].&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import gobject&lt;br /&gt;
import gtk&lt;br /&gt;
import hildondesktop&lt;br /&gt;
&lt;br /&gt;
class ExampleStatusPlugin(hildondesktop.StatusMenuItem):&lt;br /&gt;
    __gtype_name__ = &#039;ExampleStatusPlugin&#039;&lt;br /&gt;
&lt;br /&gt;
    def __init__(self):&lt;br /&gt;
        hildondesktop.StatusMenuItem.__init__(self)&lt;br /&gt;
        &lt;br /&gt;
        STATUS_AREA_EXAMPLE_ICON_SIZE = 22&lt;br /&gt;
        icon_theme = gtk.icon_theme_get_default()&lt;br /&gt;
        pixbuf = icon_theme.load_icon(&amp;quot;general_email&amp;quot;, STATUS_AREA_EXAMPLE_ICON_SIZE, gtk.ICON_LOOKUP_NO_SVG)&lt;br /&gt;
        self.set_status_area_icon(pixbuf)&lt;br /&gt;
        &lt;br /&gt;
        label = gtk.Label(&amp;quot;Example message&amp;quot;)&lt;br /&gt;
        self.add(label)&lt;br /&gt;
        self.show_all()&lt;br /&gt;
&lt;br /&gt;
def hd_plugin_get_object():&lt;br /&gt;
    return gobject.new(ExampleStatusPlugin, plugin_id=&amp;quot;example_status_plugin&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
    obj = hd_plugin_get_object()&lt;br /&gt;
    obj.show_all()&lt;br /&gt;
    gtk.main()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Testing the example ===&lt;br /&gt;
&lt;br /&gt;
First, install the same packages needed for Home widgets, then save the example above as as &amp;lt;b&amp;gt;/usr/lib/hildon-desktop/hello_world_status_menu.py&amp;lt;/b&amp;gt; inside your FREMANTLE_X86 target. Next, save the following text as &amp;lt;b&amp;gt;/usr/share/applications/hildon-status-menu/hello_world_status_menu.desktop&amp;lt;/b&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Name=Hello, World! (Python)&lt;br /&gt;
Comment=Example Status Menu Python plugin&lt;br /&gt;
Type=python&lt;br /&gt;
X-Path=hello_world_status_menu.py&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure the hildon desktop and hildon-status-menu are running. For that, you can use the following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[sbox]&amp;gt; export DISPLAY=:2 # if you are using scratchbox + Xephyr&lt;br /&gt;
[sbox]&amp;gt; af-sb-init.sh start&lt;br /&gt;
[sbox]&amp;gt; run-standalone.sh maemo-summoner /usr/bin/hildon-status-menu.launch &amp;amp;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The example status menu widget should appear as soon as hildon-status-menu process is started, as the plugin used in this example is of the permanent category. See [http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/Application_Development/Writing_Desktop_Widgets#Status_Menu_widgets] for more information of status menu widgets categories.&lt;br /&gt;
&lt;br /&gt;
This is a screenshot taken on Xephyr showing how the widget will look like:&lt;br /&gt;
&lt;br /&gt;
[[Image:Status-menu-1.png]]&lt;br /&gt;
&lt;br /&gt;
When clicked, it will show the specified message, enclosed in a gtk.Label:&lt;br /&gt;
&lt;br /&gt;
[[Image:Status-menu-2.png]]&lt;/div&gt;</summary>
		<author><name>189.2.128.130</name></author>
	</entry>
</feed>