2005-08-25 00:20:41 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
import sys
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
builddir = os.environ["DBUS_TOP_BUILDDIR"]
|
|
|
|
|
pydir = builddir + "/python"
|
|
|
|
|
|
|
|
|
|
sys.path.insert(0, pydir)
|
2005-08-26 04:23:33 +00:00
|
|
|
sys.path.insert(0, pydir + '/.libs')
|
2005-08-25 00:20:41 +00:00
|
|
|
|
|
|
|
|
import dbus
|
|
|
|
|
|
|
|
|
|
if not dbus.__file__.startswith(pydir):
|
|
|
|
|
raise Exception("DBus modules are not being picked up from the package")
|
|
|
|
|
|
|
|
|
|
import dbus.service
|
|
|
|
|
import dbus.glib
|
|
|
|
|
import gobject
|
|
|
|
|
|
|
|
|
|
class TestObject(dbus.service.Object):
|
|
|
|
|
def __init__(self, bus_name, object_path="/org/freedesktop/DBus/TestSuitePythonObject"):
|
|
|
|
|
dbus.service.Object.__init__(self, bus_name, object_path)
|
|
|
|
|
|
|
|
|
|
""" Echo whatever is sent
|
|
|
|
|
"""
|
|
|
|
|
@dbus.service.method("org.freedesktop.DBus.TestSuiteInterface")
|
|
|
|
|
def Echo(self, arg):
|
|
|
|
|
return arg
|
|
|
|
|
|
|
|
|
|
session_bus = dbus.SessionBus()
|
|
|
|
|
name = dbus.service.BusName("org.freedesktop.DBus.TestSuitePythonService", bus=session_bus)
|
|
|
|
|
object = TestObject(name)
|
|
|
|
|
loop = gobject.MainLoop()
|
|
|
|
|
loop.run()
|