[python] How can a noob get a simple implementation?

Jakub Piotr Cłapa jpc at pld-linux.org
Tue Aug 30 21:56:32 PDT 2005


Federico Pelloni wrote:
> Hi everybody :-)
> 
> First of all, a bit of scenery:
> 
> - python window manager (today, a wrapper over Pywm)
> - python taskbar (building it on my own)
> 
> They should communicate between them, and since I want this simple
> DE to be modern (the taskbar uses cairo for rendering) I thought
> the best way is DBus.
> 
> My idea:
> 
> 1 - a window is created
> 2 - the WM should emit a signal (let's say "window.created") over dbus
> with no particular destination (it could be useful also for a pager, one 
> day)
> 3 - the taskbar receives the signal "window.created" sent by "org.fredp.wm"
> 4 - it draws the new task using the infos shipping with the signal 
> window.created

Isn't this better handled using some X IPC mechanisms? (you will loose 
network transparency if you do it over DBus, won't you?)

> My questions:
> 
> Either
> A - is it possible to have this done with a few (I mean 2 or 3, not many 
> more)
>    function calls? Maybe a
>    dbus.emit_signal("window.created", (windowobject))
>    in the WM code and a
>    dbus.add_signal_receiver("window.created", self.draw_task)
>    in the taskbar code. Quick and simple, I don't need much more.

DISCLAIMER: It's not obvious if my work is a GoodThing(TM) (I'm not 
totally sure either) so please consider choosing it over the bindings 
very carefully.

If you want quick and simple you could give my experimental pure-python 
implementation a try (you can find it in the archives). The Python 
bindings are quite sophisticated and unfortunately depend on glib (thus 
on pygtk) requiring a glib mainloop in your program.

If you have any questions, don't be afraid to ask (I don't have much 
documentation for my work right now --- just what's written in the 
source + the example dbus_monitor.py).

> OR
> B - is there an up-to-date clear tutorial showing how to do something 
> similar?
>    Often I find code that doesn't work (even that from the official how-to,
>    I can't import dbus.service)

There where some API changes (but I'm afraid I do not remember what it 
was changed into).

-- 
Regards,
Jakub Piotr Cłapa


More information about the dbus mailing list