dbus/python/examples example-service.py, 1.6,
1.7 example-signal-emitter.py, 1.1,
1.2 list-system-services.py, 1.2, 1.3
John Palmieri
johnp@freedesktop.org
Fri Jan 28 11:09:58 PST 2005
Update of /cvs/dbus/dbus/python/examples
In directory gabe:/tmp/cvs-serv3953/python/examples
Modified Files:
example-service.py example-signal-emitter.py
list-system-services.py
Log Message:
* python/dbus_bindings.pyx.in: Updated to handle new D-BUS type system
- BUS_ACTIVATION -> BUS_STARTER
- DBUS_BUS_ACTIVATION -> DBUS_BUS_STARTER
- class MessageIter (__init__): Added recursion checking
so we throw a nice error instead of just disconnecting from the
bus.
(get): Added arg_type parameter for recursion.
Removed the nil type
Added signiture type placeholder (not implemented)
Added struct type placeholder (not implemented)
Added varient type placeholder (not implemented)
Commented out dict type for now
(get_element_type): renamed from get_array_type
(get_*): changed to use the dbus_message_iter_get_basic API
(get_*_array): removed in favor of recursive get_array method
(get_array): new recursive method which calls get to marshal
the elements of the array
(value_to_dbus_sig): New method returns the corrasponding
dbus signiture to a python value
(append): Comment out dict handling for now
Handle lists with the new recursive API
Comment out None handling for now
(append_nil): removed
(append_*): changed to use dbus_message_iter_append_basic API
(append_*_array): removed in favor of recursive append_array
method
(__str__): Make it easier to print out recursive iterators
for debugging
- class Message (__str__): moved type inspection to the
MessageIter class' __str__ method
(get_iter): Added an append parameter wich defaults to False
If True use the new API's to create an append iterator
* python/dbus.py: Update to use new bindings API
- TYPE_ACTIVATION -> TYPE_STARTER
- class Bus (_get_match_rule): GetServiceOwner -> GetNameOwner
- class ActivationBus -> class StarterBus
- class RemoteObject (__call__): get an append iterator
- (_dispatch_dbus_method_call): get an append iterator
- class Object (emit_signal): get an append iterator
* python/examples/: Fixed up the examples to work with the new API
Index: example-service.py
===================================================================
RCS file: /cvs/dbus/dbus/python/examples/example-service.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- example-service.py 11 Jul 2004 03:02:14 -0000 1.6
+++ example-service.py 28 Jan 2005 19:09:55 -0000 1.7
@@ -8,8 +8,8 @@
dbus.Object.__init__(self, "/SomeObject", service, [self.HelloWorld])
def HelloWorld(self, message, hello_message):
- print (hello_message)
- return ["Hello", "from example-service.py"]
+ print (str(hello_message))
+ return ["Hello", " from example-service.py"]
session_bus = dbus.SessionBus()
service = dbus.Service("org.designfu.SampleService", bus=session_bus)
Index: example-signal-emitter.py
===================================================================
RCS file: /cvs/dbus/dbus/python/examples/example-signal-emitter.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- example-signal-emitter.py 11 Jul 2004 03:02:14 -0000 1.1
+++ example-signal-emitter.py 28 Jan 2005 19:09:55 -0000 1.2
@@ -3,7 +3,7 @@
class TestObject(dbus.Object):
def __init__(self, service):
- dbus.Object.__init__(self, "/object", service, [self.HelloWorld])
+ dbus.Object.__init__(self, "/org/designfu/TestService/object", service, [self.emitHelloSignal])
def emitHelloSignal(self, message):
# Emit the signal
@@ -15,4 +15,3 @@
object = TestObject(service)
gtk.main()
-A
Index: list-system-services.py
===================================================================
RCS file: /cvs/dbus/dbus/python/examples/list-system-services.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- list-system-services.py 29 May 2004 22:37:13 -0000 1.2
+++ list-system-services.py 28 Jan 2005 19:09:55 -0000 1.3
@@ -17,8 +17,5 @@
# One of the member functions in the org.freedesktop.DBus interface
# is ListServices(), which provides a list of all the other services
# registered on this bus. Call it, and print the list.
-system_service_list = dbus_object.ListServices()
-
-for service in system_service_list:
- if service[0] != ':':
- print (service)
+system_service_list = dbus_object.ListNames()
+print str(system_service_list)
More information about the dbus-commit
mailing list