developing on ubuntu with python for s60


some things I find out while I go along


Packaging a standalone app with libraries using ensymble.py

Having downloaded pys60 1.9.4 I wondered how to create a standalone app that uses a library. I have read the documentation (section 7 ) and their announcement, and I got a bit confused at first. But now, having had a closer look at it, its all so simple. Lets take the example of packing up my ocwallet (a wallet for opencoin.org)

One needs to differentiate between the app itself, and the libraries that it might include

The app itself will either go in a directory, with the file to be run called default.py, or one just leaves the file alone. I do the second, just have a file called ocwallet.py

The library to include is called oc2. This goes into PythonForS60/module-repo/dev-modules :

cd ~/software/PythonForS60/module-repo/dev-modules
mkdir oc2
cd oc2
ln -s ~/projects/opencoin/opencoin/trunk/sandbox/jhb/oc2 .
echo "{'type': 'repo',  'deps': ['socket','btsocket']}" > module_config.cfg

This creates the dev-module named 'oc2', with the actually library symlinked within this directory, and a module_config.cfg file that declares the dependencies.

This library gets include'd in my ocwallet.py file. ensymble.py seems to look for the imports, and automatically includes the oc2 library in the sis that it generates:

cd ~/software/PythonForS60
ln -s ~/projects/opencoin/opencoin/trunk/sandbox/jhb/mobile/ocwallet.py .
python ensymble.py py2sis -H 2M ocwallet.py

The -H 2M tells the mobile that my app needs to 2 Megabytes.


Browse my mobile phone via bluetooth

 So far I have always manually used obexftp to send files to my mobile. Today I came across the right click on my bluetooth icon:


This will allow me to select my mobile phone, and suddenly nautilus gets my mobile phone. Great.


Using bluetooth console

Nothing new (to everybody besides me), all described on the nokia wiki, but for me to copy+pase:

sdptool add --channel=2 SP
rfcomm listen rfcomm2 2

[now start bluetooth console from the menu in the Python Scriptshell)

and in new console

cu -l /dev/rfcomm2