Multiple-in-One Objects with Python
Robert McQueen
robert.mcqueen at collabora.co.uk
Sat Sep 24 16:55:58 PDT 2005
On Sat, Sep 24, 2005 at 02:54:57PM -0700, Theodore Reed wrote:
> Is it possible, with dbus, to implement one object which acts as multiple
> objects, and the exact object is known when the method is called? If not, is
> this planned? I can't imagine the Gnumeric guys would want to implement a
> separate object for each cell in a spreadsheet either. It seems that it
> should be possible, on some level, but it appears that there's no way to do
> it with the Python bindings.
By design, the Python bindings abstract away all concept of bus
messages, and enforce that each object represents one object on the bus.
This is cool for the common case, but a definite lose for you. Under the
bonnet, dbus lets you recieve messages (signals or method invocations)
for entire subtrees of the object hierachy, so it makes sense to try and
work out a sensible way of representing this in the python bindings.
The first thing that comes to mind is adding a dbus.service.ObjectMatch
object which you specify an object subtree path to, and which concrete
object names to register, and it will give you all matching method
invocations along with the path of the object. This shouldn't be too
hard to hack up in theory, and would use the low-level matching and
filter functionality, although the matching stuff in the python bindings
is geared wholly towards handling signal rather than method invocations,
it can probably be re-used.
> Thanks in advance.
>
> -- Ted Reed
Regards,
Rob
More information about the dbus
mailing list