Mon 11 Jul 2005
After fighting with Pyrex and getting modules to share class definitions I was able to rip dbus-glib into its own bindings. In order to integrate a new mainloop all a module writter has to do is:
import dbus
setattr(dbus, "_dbus_mainloop_setup_function", _setup_function)
where the setup function takes a dbus_bindings.Connection object. The setup function then takes that Connection object and in the binding backend, extracts the DBusConnection pointer and runs the method it uses to do the setup. In glib’s case it is dbus_connection_setup_with_g_main. I’ll need to think of a way to pass in extra parameters to the setup function. For instance a person may wish to setup the connection on something other than the main loop context.
Anyway I will check in the code tomorrow. Right now I need some sleep and have a forty minute drive home.
[read this post in: ar de es fr it ja ko pt ru zh-CN ]
July 12th, 2005 at 12:22 am
def mk_setup_function(*args, **kwargs):
def _setup_function(connection):
# do something with args or kwargs
# to set up the main loop
return _setup_function
dbus._dbus_mainloop_setup_function = mk_setup_function()
=====
Just one of a couple of ways of easily passing extra parameters to the setup function.
July 12th, 2005 at 2:40 am
Oh, the problem is not reciving the extra arguments. The problem lies in what is the best way to pass them in. The way things work right now, when you create a connection it automaticly calls the mainloop setup function. I want to devise a clean way of overriding this for power users.