0
0

Testing libmokoui2 python bindings in maemo

Posted on 2008-01-28 19:17:48 UTC.

I was bored and reading moblin mailinglist, when in a message there was a link to the libmokoui2 code, there was mentioned that there were a python bindings. This library has the famous Moko Finger Scroll function.

So I compiled libmokoui2 with its fingerscroll function in maemo. Nothing that other people hadn’t done in the past. But also I verified if the python bindings were functional in maemo, and it worked, in a few minutes I had working a small example with a treeview, so I modified mabugz to test this scroll widget, instead of a normal gtk.Scrolledwindow. Also I did some tests with Mirage and its thumbnail pane.

You can see the test video in youtube: Mabugz with finger scroll.

Let’s go on to the practical part, what do I do to have this widget in a python app?

Firstly to say that I have tested it in Chinook, and I don’t know if it will work in previous versions. I also don’t know if it will work in the device (I can’t test it in a device thanks to the Nokia spanish shop), but I don’t see because it should not :)

1) Download the code from the SVN:

svn co http://svn.openmoko.org/trunk/src/target/OM-2007.2/libraries/libmokoui2/

2) Install some dependences.
fakeroot apt-get install python2.5-gobject-dev python2.5-dev libffi4-dev gtk-doc-tools

I suppose that other python packages already are installed if you are a python developer.

3) The built of the python bindings depends of python-gnome, that’s not available for maemo. But in this case only we need to be deceptive with the configure script, as if we had this library.
To do this, download the following package python-gnome2-dev from debian,
Uncompress it and to copy gnome-python-2.0.pc to the pkgconfig directory:
dpkg -x python-gnome2-dev python-gnome2-dev/
cp python-gnome2/usr/lib/pkgconfig/gnome-python-2.0.pc /usr/lib/pkgconfig/

4) Enter in the libmokoui2 directory and:
./autogen.sh
Probably you will have to execute the autogen.sh from out of scratchbox, since it was giving some error that I couldn’t understand :)

export PYTHON=python2.5
./configure --enable-python --prefix=/usr
make
fakeroot make install

5) We are going to verify that everything works correctly, so go to the console, and write:
python2.5
and into the python interpreter:
import moko
If the module is imported correctly, it won’t show any error.

6) This way now we are going to make it work in a python app, having a program with a
gtk.Treeview into a gtk.ScrolledWindow, we are going to replace the scrolledwindow with the moko finger scroll widget.
I have tried also in a gtk.Textview with the property sensitive in False in Mabugz
This way if our code was something like that:

sw = gtk.ScrolledWindow()
treeview = gtk.Treeview()
sw.add(treeview)
window.add(sw)

now it will have this form:

mokoscroll = moko.FingerScroll()
treeview = gtk.Treeview(
mokoscroll.add(treeview)
window.add(mokoscroll)

And voilá it will work.
This also will work if we do the interface with glade, the only thing we should do is to reparent the new widget.

It would be perfect that someone was packing libmokoui2 with its python bindings for Chinook, some volunteer?
Does Chris have plans to do that?

Back