| 1 |
:mod:`pyudev.glib` – Glib/Gtk 2 integration |
| 2 |
=========================================== |
| 3 |
|
| 4 |
.. automodule:: pyudev.glib |
| 5 |
:platform: Linux |
| 6 |
:synopsis: Glib integration |
| 7 |
|
| 8 |
.. autoclass:: MonitorObserver |
| 9 |
|
| 10 |
.. attribute:: monitor |
| 11 |
|
| 12 |
The :class:`~pyudev.Monitor` observed by this object. |
| 13 |
|
| 14 |
.. attribute:: event_source |
| 15 |
|
| 16 |
The event source, which represents the watch on the :attr:`monitor` |
| 17 |
(as returned by :func:`glib.io_add_watch`), or ``None``, if |
| 18 |
:attr:`enabled` is ``False``. |
| 19 |
|
| 20 |
.. autoattribute:: enabled |
| 21 |
|
| 22 |
.. rubric:: Signals |
| 23 |
|
| 24 |
This class emits the following GObject signal: |
| 25 |
|
| 26 |
.. method:: device-event(observer, action, device) |
| 27 |
|
| 28 |
Emitted upon any device event. |
| 29 |
|
| 30 |
``observer`` is the :class:`MonitorObserver`, which emitted the |
| 31 |
signal. ``device`` is the :class:`~pyudev.Device`, which caused this |
| 32 |
event. |
| 33 |
|
| 34 |
Use :attr:`~pyudev.Device.action` to get the type of event. |
| 35 |
|
| 36 |
|
| 37 |
Deprecated API |
| 38 |
-------------- |
| 39 |
|
| 40 |
.. autoclass:: GUDevMonitorObserver |
| 41 |
|
| 42 |
.. attribute:: monitor |
| 43 |
|
| 44 |
The :class:`~pyudev.Monitor` observed by this object. |
| 45 |
|
| 46 |
.. attribute:: event_source |
| 47 |
|
| 48 |
The event source, which represents the watch on the :attr:`monitor` |
| 49 |
(as returned by :func:`glib.io_add_watch`), or ``None``, if |
| 50 |
:attr:`enabled` is ``False``. |
| 51 |
|
| 52 |
.. autoattribute:: enabled |
| 53 |
|
| 54 |
.. rubric:: Signals |
| 55 |
|
| 56 |
This class emits the following GObject signals: |
| 57 |
|
| 58 |
.. method:: device-event(observer, action, device) |
| 59 |
|
| 60 |
Emitted upon any device event. ``observer`` is the |
| 61 |
:class:`GUDevMonitorObserver`, which emitted the signal. ``action`` |
| 62 |
is a unicode string containing the action name, and ``device`` is the |
| 63 |
:class:`~pyudev.Device`, which caused this event. |
| 64 |
|
| 65 |
Basically the last two arguments of this signal are simply the |
| 66 |
return value of :meth:`~pyudev.Monitor.receive_device` |
| 67 |
|
| 68 |
.. method:: device-added(observer, device) |
| 69 |
|
| 70 |
Emitted if a :class:`~pyudev.Device` is added (e.g a USB device was |
| 71 |
plugged). |
| 72 |
|
| 73 |
.. method:: device-removed(observer, device) |
| 74 |
|
| 75 |
Emitted if a :class:`~pyudev.Device` is removed (e.g. a USB device was |
| 76 |
unplugged). |
| 77 |
|
| 78 |
.. method:: device-changed(observer, device) |
| 79 |
|
| 80 |
Emitted if a :class:`~pyudev.Device` was somehow changed (e.g. a |
| 81 |
change of a property) |
| 82 |
|
| 83 |
.. method:: device-moved(observer, device) |
| 84 |
|
| 85 |
Emitted if a :class:`~pyudev.Device` was renamed, moved or |
| 86 |
re-parented. |