dbus/python/examples example-service.py, 1.12,
1.13 example-signal-emitter.py, 1.7, 1.8
John Palmieri
johnp at freedesktop.org
Sat Jul 16 04:10:02 EST 2005
Update of /cvs/dbus/dbus/python/examples
In directory gabe:/tmp/cvs-serv14774/python/examples
Modified Files:
example-service.py example-signal-emitter.py
Log Message:
* python/examples/example-service.py,
python/examples/example-signal-emitter.py: Fixed up examples
for API changes
Index: example-service.py
===================================================================
RCS file: /cvs/dbus/dbus/python/examples/example-service.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- example-service.py 13 Jul 2005 18:22:35 -0000 1.12
+++ example-service.py 15 Jul 2005 18:09:59 -0000 1.13
@@ -7,8 +7,8 @@
import gtk
class SomeObject(dbus.service.Object):
- def __init__(self, name):
- dbus.service.Object.__init__(self, "/SomeObject", name)
+ def __init__(self, bus_name, object_path="/SomeObject"):
+ dbus.service.Object.__init__(self, bus_name, object_path)
@dbus.service.method("org.designfu.SampleInterface")
def HelloWorld(self, hello_message):
Index: example-signal-emitter.py
===================================================================
RCS file: /cvs/dbus/dbus/python/examples/example-signal-emitter.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- example-signal-emitter.py 13 Jul 2005 18:22:35 -0000 1.7
+++ example-signal-emitter.py 15 Jul 2005 18:09:59 -0000 1.8
@@ -5,8 +5,8 @@
import gtk
class TestObject(dbus.service.Object):
- def __init__(self, name):
- dbus.service.Object.__init__(self, "/org/designfu/TestService/object", name)
+ def __init__(self, bus_name, object_path='/org/designfu/TestService/object'):
+ dbus.service.Object.__init__(self, bus_name, object_path)
@dbus.service.signal('org.designfu.TestService')
def HelloSignal(self, message):
@@ -17,11 +17,11 @@
@dbus.service.method('org.designfu.TestService')
def emitHelloSignal(self):
#you emit signals by calling the signal's skeleton method
- self.HelloSignal("Hello")
- return "Signal emitted"
+ self.HelloSignal('Hello')
+ return 'Signal emitted'
session_bus = dbus.SessionBus()
-name = dbus.service.BusName("org.designfu.TestService", bus=session_bus)
+name = dbus.service.BusName('org.designfu.TestService', bus=session_bus)
object = TestObject(name)
gtk.main()
More information about the dbus-commit
mailing list