diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2007-06-20 18:00:10 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2007-06-20 18:00:10 +0100 |
commit | 39c996ac7439c5c9a61ddb0efc92bada491fa0e5 (patch) | |
tree | 09dc163aadaa17e5e82d1455d066aae8f9d36aaf | |
parent | 9f2e2040c33b09196e438c818379290c9e41a4ca (diff) |
Stop using interactive-Python syntax in tutorial to reduce user confusion.
Closes bugs.fd.o #11209.
-rw-r--r-- | doc/tutorial.txt | 45 |
1 files changed, 19 insertions, 26 deletions
diff --git a/doc/tutorial.txt b/doc/tutorial.txt index b51ff68..fd682f6 100644 --- a/doc/tutorial.txt +++ b/doc/tutorial.txt @@ -104,14 +104,11 @@ interface at object paths like ``/org/freedesktop/NetworkManager/Devices/eth0``. You can get a proxy for the object representing eth0 like this:: - >>> import dbus - >>> bus = dbus.SystemBus() - >>> bus.get_object('org.freedesktop.NetworkManager', - ... '/org/freedesktop/NetworkManager/Devices/eth0') - <ProxyObject wrapping <dbus.Bus on SYSTEM at 0x3007e150> - org.freedesktop.NetworkManager - /org/freedesktop/NetworkManager/Devices/eth0 at 0x301f0ad0> - >>> + import dbus + bus = dbus.SystemBus() + proxy = bus.get_object('org.freedesktop.NetworkManager', + '/org/freedesktop/NetworkManager/Devices/eth0') + # proxy is a dbus.proxies.ProxyObject Interfaces and methods ---------------------- @@ -127,15 +124,12 @@ object representing a network interface implements the interface To call a method, call the method of the same name on the proxy object, passing in the interface name via the ``dbus_interface`` keyword argument:: - >>> import dbus - >>> bus = dbus.SystemBus() - >>> eth0 = bus.get_object('org.freedesktop.NetworkManager', - ... '/org/freedesktop/NetworkManager/Devices/eth0') - >>> eth0.getProperties(dbus_interface='org.freedesktop.NetworkManager.Devices') - (dbus.ObjectPath('/org/freedesktop/NetworkManager/Devices/eth0'), [...]) - >>> - -(I've truncated the list of properties here.) + import dbus + bus = dbus.SystemBus() + eth0 = bus.get_object('org.freedesktop.NetworkManager', + '/org/freedesktop/NetworkManager/Devices/eth0') + props = eth0.getProperties(dbus_interface='org.freedesktop.NetworkManager.Devices') + # props is a tuple of properties, the first of which is the object path .. _dbus.Interface: @@ -143,15 +137,14 @@ As a short cut, if you're going to be calling many methods with the same interface, you can construct a ``dbus.Interface`` object and call methods on that, without needing to specify the interface again:: - >>> import dbus - >>> bus = dbus.SystemBus() - >>> eth0 = bus.get_object('org.freedesktop.NetworkManager', - ... '/org/freedesktop/NetworkManager/Devices/eth0') - >>> eth0_dev_iface = dbus.Interface(eth0, - ... dbus_interface='org.freedesktop.NetworkManager.Devices') - >>> eth0_dev_iface.getProperties() - (dbus.ObjectPath('/org/freedesktop/NetworkManager/Devices/eth0'), [...]) - >>> + import dbus + bus = dbus.SystemBus() + eth0 = bus.get_object('org.freedesktop.NetworkManager', + '/org/freedesktop/NetworkManager/Devices/eth0') + eth0_dev_iface = dbus.Interface(eth0, + dbus_interface='org.freedesktop.NetworkManager.Devices') + props = eth0_dev_iface.getProperties() + # props is the same as before See also ~~~~~~~~ |