Re: Fso Python binding

rhn rhn at o2.pl
Mon Feb 16 12:58:48 CET 2009


---- Wiadomość Oryginalna ----
Od: Michele Renda <michele.renda at gmail.com>

> Hello to all
> 
> I am writing here to show something I was working today, and I'd like to
> know your opinions.
> I try to explain with a few of words. How someone of you know, I wrote
> Sephora. In lastest day I lost some time to trying to fix sephora with
> the new fso milestone. Where I was working I realized that I hate dbus
> :) Ok, I know it is very important, it is cross language compatibile,
> but I program in python, and I don't like to write too much code. If I
> want to turn on a led I want to do something like:
> 
> device = ODeviced()
> device.getLED().getGta02AuxRed().setBlinking(2, 3)
> 
> Or if I want to react to a function I want to do something like this:
> 
> gps = OGpsd()
> def myfunc(i):
>      # I do something here
> gps.connect('fixStatusChanged', myfunc)
> 
> So, I studied a bit how to use reflection in Python and the source code
> written by Michael Lauer, and I wrote a Python binding for FSO, and I
> called with a lot of fantasy PyFso (It is only a transitory name,
> because I think this name is already used for another project).
> 
> You can have a look here: [1]
> 
> To help the navigation, it also print the structure of the object I
> created [2].
> 
> For now it is only a proof of concept. I would like to know if someone
> else have the same feeling with dbus.
> 
> Thank you
> Michele Renda
> 
> [1] http://dl.getdropbox.com/u/562269/PyFso/pyfso.py
> [2] /home/michele/Dropbox/Public/PyFso/structure.txt
> 

I used to play with dbus and FSO a while ago, and I came to a similar conclusion - writing something simple takes too much time.

Instead of wrapping the interesting methods of FSO, I made a simple dbus object wrapper.
To use it, one would pass the dbus bus name and object name. The resulting object would be a python object with method names corresponding to the dbus method names (I made my own, much simpler parser based on the one in mdbus), while completely ignoring signals.

I used it to get GPS data from Gypsy, worked like a charm.
I could dig it up again and explain, if anyone's interested.




More information about the community mailing list