diff options
author | John (J5) Palmieri <johnp@redhat.com> | 2006-07-14 16:20:12 +0000 |
---|---|---|
committer | John (J5) Palmieri <johnp@redhat.com> | 2006-07-14 16:20:12 +0000 |
commit | a929c9a3b465db8b7e17b9b39936c612c2621a7c (patch) | |
tree | d1764257d1bd56f8e6a044516ccfc9bc44f7f9f5 /python/examples | |
parent | 5efe8e7f1d97931710558495a951e0b35afbfb72 (diff) |
* Remove all bindings
Diffstat (limited to 'python/examples')
-rw-r--r-- | python/examples/.cvsignore | 2 | ||||
-rw-r--r-- | python/examples/Makefile.am | 13 | ||||
-rw-r--r-- | python/examples/example-client.py | 22 | ||||
-rw-r--r-- | python/examples/example-service.py | 30 | ||||
-rw-r--r-- | python/examples/example-signal-emitter.py | 29 | ||||
-rw-r--r-- | python/examples/example-signal-recipient.py | 54 | ||||
-rw-r--r-- | python/examples/gconf-proxy-client.py | 13 | ||||
-rw-r--r-- | python/examples/gconf-proxy-service.py | 43 | ||||
-rw-r--r-- | python/examples/gconf-proxy-service2.py | 39 | ||||
-rw-r--r-- | python/examples/list-system-services.py | 22 |
10 files changed, 0 insertions, 267 deletions
diff --git a/python/examples/.cvsignore b/python/examples/.cvsignore deleted file mode 100644 index 282522db..00000000 --- a/python/examples/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/python/examples/Makefile.am b/python/examples/Makefile.am deleted file mode 100644 index f7a1b22e..00000000 --- a/python/examples/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -NULL= - -EXTRA_DIST = \ - example-service.py \ - example-client.py \ - example-signal-emitter.py \ - example-signal-recipient.py \ - gconf-proxy-client.py \ - gconf-proxy-service.py \ - gconf-proxy-service2.py \ - list-system-services.py \ - $(NULL) - diff --git a/python/examples/example-client.py b/python/examples/example-client.py deleted file mode 100644 index 3d170bd4..00000000 --- a/python/examples/example-client.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python - -import dbus - -bus = dbus.SessionBus() -remote_object = bus.get_object("org.designfu.SampleService", "/SomeObject") -iface = dbus.Interface(remote_object, "org.designfu.SampleInterface") - -hello_reply_list = remote_object.HelloWorld("Hello from example-client.py!", dbus_interface = "org.designfu.SampleInterface") - -hello_reply_tuple = iface.GetTuple() - -hello_reply_dict = iface.GetDict() - -print (hello_reply_list) - -print str(hello_reply_tuple) - -print str(hello_reply_dict) - -print remote_object.Introspect(dbus_interface="org.freedesktop.DBus.Introspectable") - diff --git a/python/examples/example-service.py b/python/examples/example-service.py deleted file mode 100644 index cb25d203..00000000 --- a/python/examples/example-service.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env python - -import dbus -import dbus.service -import dbus.glib -import gobject - -class SomeObject(dbus.service.Object): - 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): - print (str(hello_message)) - return ["Hello", " from example-service.py"] - - @dbus.service.method("org.designfu.SampleInterface") - def GetTuple(self): - return ("Hello Tuple", " from example-service.py") - - @dbus.service.method("org.designfu.SampleInterface") - def GetDict(self): - return {"first": "Hello Dict", "second": " from example-service.py"} - -session_bus = dbus.SessionBus() -name = dbus.service.BusName("org.designfu.SampleService", bus=session_bus) -object = SomeObject(name) - -mainloop = gobject.MainLoop() -mainloop.run() diff --git a/python/examples/example-signal-emitter.py b/python/examples/example-signal-emitter.py deleted file mode 100644 index 02eff893..00000000 --- a/python/examples/example-signal-emitter.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python - -import dbus -import dbus.service -import dbus.glib -import gobject - -class TestObject(dbus.service.Object): - 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): - # The signal is emitted when this method exits - # You can have code here if you wish - pass - - @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' - -session_bus = dbus.SessionBus() -name = dbus.service.BusName('org.designfu.TestService', bus=session_bus) -object = TestObject(name) - -loop = gobject.MainLoop() -loop.run() diff --git a/python/examples/example-signal-recipient.py b/python/examples/example-signal-recipient.py deleted file mode 100644 index a06d4943..00000000 --- a/python/examples/example-signal-recipient.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env python - -import dbus -import dbus.decorators -import dbus.glib -import gobject - -def handle_reply(msg): - print msg - -def handle_error(e): - print str(e) - -def emit_signal(): - #call the emitHelloSignal method - object.emitHelloSignal(dbus_interface="org.designfu.TestService") - #reply_handler = handle_reply, error_handler = handle_error) - return True - -bus = dbus.SessionBus() -object = bus.get_object("org.designfu.TestService","/org/designfu/TestService/object") - -def hello_signal_handler(hello_string): - print ("Received signal and it says: " + hello_string) - -@dbus.decorators.explicitly_pass_message -def catchall_signal_handler(*args, **keywords): - #The dbus.handler directive passes in the special __dbus_message__ variable - dbus_message = keywords["dbus_message"] - print "Caught signal " + dbus_message.get_member() - for arg in args: - print " " + str(arg) - -def catchall_hello_signals_handler(hello_string): - print ("Received a hello signal and it says ") + hello_string - -@dbus.decorators.explicitly_pass_message -def catchall_testservice_interface_handler(hello_string, dbus_message): - print "org.designfu.TestService interface says " + hello_string + " when it sent signal " + dbus_message.get_member() - -object.connect_to_signal("HelloSignal", hello_signal_handler, dbus_interface="org.designfu.TestService", arg0="Hello") - -#lets make a catchall -bus.add_signal_receiver(catchall_signal_handler) -bus.add_signal_receiver(catchall_hello_signals_handler, dbus_interface = "org.designfu.TestService", signal_name = "HelloSignal") -bus.add_signal_receiver(catchall_testservice_interface_handler, dbus_interface = "org.designfu.TestService") - - -gobject.timeout_add(2000, emit_signal) - -# Tell the remote object to emit the signal - -loop = gobject.MainLoop() -loop.run() diff --git a/python/examples/gconf-proxy-client.py b/python/examples/gconf-proxy-client.py deleted file mode 100644 index f763e3fa..00000000 --- a/python/examples/gconf-proxy-client.py +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env python - -import dbus - -gconf_key = "/desktop/gnome/file_views/icon_theme" - -bus = dbus.SessionBus() -gconf_service = bus.get_service("org.gnome.GConf") -gconf_key_object = gconf_service.get_object("/org/gnome/GConf" + gconf_key, "org.gnome.GConf") - -value = gconf_key_object.getString() - -print ("Value of GConf key %s is %s" % (gconf_key, value)) diff --git a/python/examples/gconf-proxy-service.py b/python/examples/gconf-proxy-service.py deleted file mode 100644 index a899cf21..00000000 --- a/python/examples/gconf-proxy-service.py +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env python -#FIXME: Doesn't work with the new bindings -import dbus - -import gobject -import gconf - -class GConfService(dbus.Service): - - def __init__(self): - dbus.Service.__init__(self, "org.gnome.GConf", dbus.SessionBus()) - - gconf_object_tree = self.GConfObjectTree(self) - - class GConfObjectTree(dbus.ObjectTree): - def __init__(self, service): - dbus.ObjectTree.__init__(self, "/org/gnome/GConf", service, dbus_methods=[ self.getString, self.setString, self.getInt, self.setInt ]) - - self.client = gconf.client_get_default() - - 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, 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, message, object_path): - print ("getInt called on GConf key %s" % (object_path)) - return self.client.get_int(object_path) - - 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) - -gconf_service = GConfService() - -print ("GConf Proxy service started.") -print ("Run 'gconf-proxy-client.py' to fetch a GConf key through the proxy...") - -mainloop = gobject.MainLoop() -mainloop.run() diff --git a/python/examples/gconf-proxy-service2.py b/python/examples/gconf-proxy-service2.py deleted file mode 100644 index 5731ab28..00000000 --- a/python/examples/gconf-proxy-service2.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env python -#FIXME: doesn't work with the new bindings -import dbus - -import gobject -import gconf - -class GConfService(dbus.Service): - - def __init__(self): - dbus.Service.__init__(self, "org.gnome.GConf", dbus.SessionBus()) - - gconf_object_tree = self.GConfObjectTree(self) - - class GConfObjectTree(dbus.ObjectTree): - def __init__(self, service): - dbus.ObjectTree.__init__(self, "/org/gnome/GConf", service) - - self.client = gconf.client_get_default() - - 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: - return self.client.get_string(object_path) - elif "setString" == method_name: - self.client.set_int(object_path, argument_list[0]) - elif "getInt" == method_name: - return self.client.get_int(object_path) - elif "setInt" == method_name: - self.client.set_int(object_path, argument_list[0]) - -gconf_service = GConfService() - -print ("GConf Proxy service started.") -print ("Run 'gconf-proxy-client.py' to fetch a GConf key through the proxy...") - -mainloop = gobject.MainLoop() -mainloop.run() diff --git a/python/examples/list-system-services.py b/python/examples/list-system-services.py deleted file mode 100644 index 4cad8717..00000000 --- a/python/examples/list-system-services.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python - -"""Lists services on the system bus -""" - -import dbus - -# Get a connection to the SYSTEM bus -bus = dbus.SystemBus() - -# Get a reference to the desktop bus' standard object, denoted -# by the path /org/freedesktop/DBus. -dbus_object = bus.get_object('org.freedesktop.DBus', '/org/freedesktop/DBus') - -# The object /org/freedesktop/DBus -# implements the 'org.freedesktop.DBus' interface -dbus_iface = dbus.Interface(dbus_object, 'org.freedesktop.DBus') - -# 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. -print dbus_object.ListNames() |