Skip to content

Commit 4397404

Browse files
committed
Update docs, s/GObject.MainLoop/GLib.MainLoop/
1 parent f2f11a1 commit 4397404

File tree

8 files changed

+39
-33
lines changed

8 files changed

+39
-33
lines changed

README.rst

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,17 @@ pydbus
77

88
Pythonic DBus library.
99

10-
It's based on PyGI_, the Python GObject Introspection bindings, which is the recommended way to use GLib from Python. Unfortunately, PyGI is not packaged on pypi, so you need to install it from your distribution's repository (usually called python-gi, python-gobject or pygobject3).
11-
12-
It's pythonic!
10+
Changelog: https://github.com/LEW21/pydbus/releases
1311

14-
And now, it can also publish objects! However, publication support requires GLib 2.46 or newer.
12+
Requirements
13+
------------
14+
* Python 2.7+ - but works best on 3.4+ (help system is nicer there)
15+
* PyGI_ (not packaged on pypi, you need to install it from your distribution's repository - it's usually called python-gi, python-gobject or pygobject)
16+
* GLib_ 2.46+ and girepository_ 1.46+ (Ubuntu 16.04+) - for object publication support
1517

16-
Changelog: https://github.com/LEW21/pydbus/releases
18+
.. _PyGI: https://wiki.gnome.org/Projects/PyGObject
19+
.. _GLib: https://developer.gnome.org/glib/
20+
.. _girepository: https://wiki.gnome.org/Projects/GObjectIntrospection
1721

1822
Examples
1923
--------
@@ -46,18 +50,18 @@ Watch for new systemd jobs
4650
.. code-block:: python
4751
4852
from pydbus import SystemBus
49-
from gi.repository import GObject
53+
from gi.repository import GLib
5054
5155
bus = SystemBus()
5256
systemd = bus.get(".systemd1")
5357
5458
systemd.JobNew.connect(print)
55-
GObject.MainLoop().run()
59+
GLib.MainLoop().run()
5660
5761
# or
5862
5963
systemd.onJobNew = print
60-
GObject.MainLoop().run()
64+
GLib.MainLoop().run()
6165
6266
View object's API
6367
~~~~~~~~~~~~~~~~~
@@ -75,7 +79,6 @@ More examples & documentation
7579

7680
The Tutorial_ contains more examples and docs.
7781

78-
.. _PyGI: https://wiki.gnome.org/PyGObject
7982
.. _Tutorial: https://github.com/LEW21/pydbus/blob/master/doc/tutorial.rst
8083

8184
Copyright Information

doc/tutorial.rst

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
pydbus tutorial
33
===============
44

5-
:Author: `Janusz Lewandowski`_
5+
:Author: `Linus Lewandowski`_
66
:Based on: python-dbus tutorial by Simon McVittie, `Collabora Ltd.`_ (2006-06-14)
7-
:Date: 2016-04-08
7+
:Date: 2016-09-26
88

99
.. _`Collabora Ltd.`: http://www.collabora.co.uk/
10-
.. _`Janusz Lewandowski`: http://lew21.net/
10+
.. _`Linus Lewandowski`: http://lew21.net/
1111

12-
This tutorial requires Python 2.7 or up, and ``pydbus`` 0.5 or up.
12+
This tutorial requires Python 2.7 or up, and ``pydbus`` 0.6 or up.
1313

1414
.. contents::
1515

@@ -86,13 +86,16 @@ Setting up an event loop
8686

8787
To handle signals emitted by exported objects, or to export your own objects, you need to setup an event loop.
8888

89-
The only main loop supported by ``pydbus`` is GLib's GObject.MainLoop.
89+
The only main loop supported by ``pydbus`` is GLib.MainLoop.
90+
91+
GLib.MainLoop
92+
-------------
9093

9194
To create the loop object use::
9295

93-
from gi.repository import GObject
96+
from gi.repository import GLib
9497

95-
loop = GObject.MainLoop()
98+
loop = GLib.MainLoop()
9699

97100
To execute the loop use::
98101

@@ -315,7 +318,7 @@ See also
315318

316319
See the example in ``pydbus/examples/clientserver/server.py``.
317320

318-
.. _bus.own_name:
321+
.. _bus.request_name:
319322
.. _bus.register_object:
320323

321324
Lower level API
@@ -324,8 +327,8 @@ Lower level API
324327
Sometimes, you can't just publish everything in one call, you need more control
325328
over the process of binding a name and exporting single objects.
326329

327-
In this case, you can use ``bus.own_name()`` and ``bus.register_object()`` yourself.
328-
See ``help(bus.own_name)`` and ``help(bus.register_object)`` for details.
330+
In this case, you can use ``bus.request_name()`` and ``bus.register_object()`` yourself.
331+
See ``help(bus.request_name)`` and ``help(bus.register_object)`` for details.
329332

330333
.. --------------------------------------------------------------------
331334
@@ -380,7 +383,7 @@ License for this document
380383

381384
Copyright 2006-2007 `Collabora Ltd.`_
382385

383-
Copyright 2016 `Janusz Lewandowski`_
386+
Copyright 2016 `Linus Lewandowski`_
384387

385388
Permission is hereby granted, free of charge, to any person
386389
obtaining a copy of this software and associated documentation

pydbus/bus_names.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ def own_name(self, name, flags=0, name_aquired=None, name_lost=None):
2828
Starts acquiring name on the bus specified by bus_type and calls
2929
name_acquired and name_lost when the name is acquired respectively lost.
3030
31-
To receive name_aquired and name_lost callbacks, you need GLib main loop.
32-
You can execute it with GObject.MainLoop().run().
31+
To receive name_aquired and name_lost callbacks, you need an event loop.
32+
https://github.com/LEW21/pydbus/blob/master/doc/tutorial.rst#setting-up-an-event-loop
3333
3434
Parameters
3535
----------
@@ -68,8 +68,8 @@ def watch_name(self, name, flags=0, name_appeared=None, name_vanished=None):
6868
name_appeared and name_vanished when the name is known to have a owner
6969
respectively known to lose its owner.
7070
71-
To receive name_appeared and name_vanished callbacks, you need GLib main loop.
72-
You can execute it with GObject.MainLoop().run().
71+
To receive name_appeared and name_vanished callbacks, you need an event loop.
72+
https://github.com/LEW21/pydbus/blob/master/doc/tutorial.rst#setting-up-an-event-loop
7373
7474
Parameters
7575
----------

pydbus/examples/clientserver/server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
# Python DBUS Test Server
66
# runs until the Quit() method is called via DBUS
77

8-
from gi.repository import GObject
8+
from gi.repository import GLib
99
from pydbus import SessionBus
1010

11-
loop = GObject.MainLoop()
11+
loop = GLib.MainLoop()
1212

1313
class MyDBUSService(object):
1414
"""

pydbus/examples/polkit/service.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from pydbus import SystemBus
2-
from gi.repository import GObject
2+
from gi.repository import GLib
33
import logging
44

5-
loop = GObject.MainLoop()
5+
loop = GLib.MainLoop()
66

77
class TestObject(object):
88
dbus = '''

pydbus/proxy_method.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from gi.repository import GLib, GObject
1+
from gi.repository import GLib
22
from .generic import bound_method
33
from .identifier import filter_identifier
44
from .timeout import timeout_to_glib

pydbus/subscription.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ def subscribe(self, sender=None, iface=None, signal=None, object=None, arg0=None
1919
Subscribes to signals on connection and invokes signal_fired callback
2020
whenever the signal is received.
2121
22-
To receive signal_fired callback, you need GLib main loop.
23-
You can execute it with GObject.MainLoop().run().
22+
To receive signal_fired callback, you need an event loop.
23+
https://github.com/LEW21/pydbus/blob/master/doc/tutorial.rst#setting-up-an-event-loop
2424
2525
Parameters
2626
----------

pydbus/tests/gnome_music.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
from __future__ import print_function
22
from pydbus import SessionBus
3-
from gi.repository import GObject, GLib
3+
from gi.repository import GLib
44
import subprocess
55
from time import sleep
66

7-
loop = GObject.MainLoop()
7+
loop = GLib.MainLoop()
88

99
subprocess.Popen("gnome-music")
1010
sleep(5)

0 commit comments

Comments
 (0)