dbus/python/examples example-service.py, 1.5, 1.6 example-signal-emitter.py, NONE, 1.1 example-signal-recipient.py, NONE, 1.1 example-signals.py, 1.2, NONE gconf-proxy-service.py, 1.2, 1.3 gconf-proxy-service2.py, 1.1, 1.2

Seth Nickell seth at pdx.freedesktop.org
Sat Jul 10 20:02:16 PDT 2004


Update of /cvs/dbus/dbus/python/examples
In directory pdx:/tmp/cvs-serv31639/python/examples

Modified Files:
	example-service.py gconf-proxy-service.py 
	gconf-proxy-service2.py 
Added Files:
	example-signal-emitter.py example-signal-recipient.py 
Removed Files:
	example-signals.py 
Log Message:
2004-07-10  Seth Nickell  <seth at gnome.org>

	* python/dbus.py:

	Add "message" argument to service-side dbus.Object
	methods. This will break existing services written
	using the python bindings, but will allow extraction
	of all the message information (e.g. who its from).

	Add improved "object oriented" signal handling/emission.
	
	* python/examples/example-service.py:

	Nix this example.
	
	* python/examples/example-signal-emitter.py:
	* python/examples/example-signal-recipient.py:

	Two new examples that show how to emit and receive
	signals using the new APIs.
	
	* python/examples/example-signals.py:
	* python/examples/gconf-proxy-service.py:
	* python/examples/gconf-proxy-service2.py:

	Add "message" argument to service methods.



Index: example-service.py
===================================================================
RCS file: /cvs/dbus/dbus/python/examples/example-service.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- example-service.py	30 May 2004 08:20:58 -0000	1.5
+++ example-service.py	11 Jul 2004 03:02:14 -0000	1.6
@@ -7,7 +7,7 @@
     def __init__(self, service):
         dbus.Object.__init__(self, "/SomeObject", service, [self.HelloWorld])
 
-    def HelloWorld(self, hello_message):
+    def HelloWorld(self, message, hello_message):
         print (hello_message)
         return ["Hello", "from example-service.py"]
 

--- NEW FILE: example-signal-emitter.py ---
import dbus
import gtk

class TestObject(dbus.Object):
    def __init__(self, service):
        dbus.Object.__init__(self, "/object", service, [self.HelloWorld])

    def emitHelloSignal(self, message):
        # Emit the signal
        self.emit_signal(interface="org.designfu.TestService",
                              signal_name="hello")

session_bus = dbus.SessionBus()
service = dbus.Service("org.designfu.TestService", bus=session_bus)
object = TestObject(service)

gtk.main()
A

--- NEW FILE: example-signal-recipient.py ---
import gtk
import dbus

bus = dbus.SessionBus()
service = bus.get_service("org.designfu.TestService")
object  = service.get_object("/org/designfu/TestService/object", "org.designfu.TestService")

def hello_signal_handler(interface, signal_name, service, path, message):
        print ("Received signal '%s.%s' from object '%s%s'"
               % (interface, signal_name, service, path))


object.connect_to_signal("hello", hello_signal_handler)

# Tell the remote object to emit the signal
object.emitHelloSignal()

gtk.main()


--- example-signals.py DELETED ---

Index: gconf-proxy-service.py
===================================================================
RCS file: /cvs/dbus/dbus/python/examples/gconf-proxy-service.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- gconf-proxy-service.py	30 May 2004 08:20:58 -0000	1.2
+++ gconf-proxy-service.py	11 Jul 2004 03:02:14 -0000	1.3
@@ -16,19 +16,19 @@
 
             self.client = gconf.client_get_default()
 
-        def getString(self, object_path):
+        def getString(self, message, object_path):
             print ("getString called on GConf key %s" % (object_path))
             return self.client.get_string(object_path)
 
-        def setString(self, object_path, new_value):
+        def setString(self, message, object_path, new_value):
             print ("setString called on GConf key %s" % (object_path))            
             self.client.set_string(object_path, new_value)
 
-        def getInt(self, object_path):
+        def getInt(self, message, object_path):
             print ("getInt called on GConf key %s" % (object_path))
             return self.client.get_int(object_path)
 
-        def setInt(self, object_path, new_value):
+        def setInt(self, message, object_path, new_value):
             print ("setInt called on GConf key %s" % (object_path))
             self.client.set_int(object_path, new_value)
             

Index: gconf-proxy-service2.py
===================================================================
RCS file: /cvs/dbus/dbus/python/examples/gconf-proxy-service2.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- gconf-proxy-service2.py	30 May 2004 08:20:58 -0000	1.1
+++ gconf-proxy-service2.py	11 Jul 2004 03:02:14 -0000	1.2
@@ -16,7 +16,7 @@
 
             self.client = gconf.client_get_default()
 
-        def object_method_called(self, object_path, method_name, argument_list):
+        def object_method_called(self, message, object_path, method_name, argument_list):
             print ("Method %s called on GConf key %s" % (method_name, object_path))
 
             if "getString" == method_name:




More information about the dbus-commit mailing list