Logo Search packages:      
Sourcecode: ibid version File versions  Download package


#!/usr/bin/env python
# Copyright (c) 2008, Jonathan Hitchcock
# Released under terms of the MIT/X/Expat Licence. See COPYING for details.

import gobject

import dbus
import dbus.service
import dbus.mainloop.glib

class SomeObject(dbus.service.Object):
    @dbus.service.method("org.ibid.IbidInterface", in_signature='s', out_signature='s')
    def HelloWorld(self, hello_message):
        print (str(hello_message))
        return "%s from example-service.py with unique name %s" % (str(hello_message), session_bus.get_unique_name())

    @dbus.service.method("org.ibid.IbidInterface", in_signature='', out_signature='')
    def Exit(self):

def catchall_signal_handler(*args, **kwargs):
    print "Caught-all [%s], {%s}" % (args, kwargs)

def this_signal_handler(*args, **kwargs):
    print "Caught this"
    for x in kwargs:
        print "   %s\t-> %s" % (x, kwargs[x])
    for x in args:
        print "   %s" % x

if __name__ == '__main__':

    bus = dbus.SessionBus()
    #name = dbus.service.BusName("org.ibid.IbidService", bus)
    #object = SomeObject(bus, '/org/ibid/IbidObject')

    bus.add_signal_receiver(this_signal_handler, interface_keyword='dbus_interface', member_keyword='member')

    mainloop = gobject.MainLoop()
    print "Running Ibid service."

# vi: set et sta sw=4 ts=4:

Generated by  Doxygen 1.6.0   Back to index