mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2025-12-22 20:40:07 +01:00
- added new type classes for hinting to the marashaler what type to send over the wire - added int16 and uint16 marshalers - Fixed a bug in the type constants that caused int32 to go out as uint16 over the wire * python/dbus.py: split up into different files and renamed _dbus.py * python/__init__.py, python/_util.py, python/decorators.py, python/exceptions.py, python/proxies.py, python/services.py, python/types.py: new files split off from dbus.py * python/Makefile.am: Add new files, remove dbus.py and install all python files to <python module dir>/dbus * python/examples/*: Added #!/usr/bin/env python to the top of every example. Patch provided by Tatavarty Kalyan
29 lines
790 B
Python
29 lines
790 B
Python
#!/usr/bin/env python
|
|
|
|
import dbus
|
|
|
|
import pygtk
|
|
import gtk
|
|
|
|
class SomeObject(dbus.Object):
|
|
def __init__(self, service):
|
|
dbus.Object.__init__(self, "/SomeObject", service)
|
|
|
|
@dbus.method("org.designfu.SampleInterface")
|
|
def HelloWorld(self, hello_message):
|
|
print (str(hello_message))
|
|
return ["Hello", " from example-service.py"]
|
|
|
|
@dbus.method("org.designfu.SampleInterface")
|
|
def GetTuple(self):
|
|
return ("Hello Tuple", " from example-service.py")
|
|
|
|
@dbus.method("org.designfu.SampleInterface")
|
|
def GetDict(self):
|
|
return {"first": "Hello Dict", "second": " from example-service.py"}
|
|
|
|
session_bus = dbus.SessionBus()
|
|
service = dbus.Service("org.designfu.SampleService", bus=session_bus)
|
|
object = SomeObject(service)
|
|
|
|
gtk.main()
|