%PDF- %PDF-
| Direktori : /snap/core/17212/usr/lib/python3/dist-packages/pyudev/__pycache__/ |
| Current File : //snap/core/17212/usr/lib/python3/dist-packages/pyudev/__pycache__/glib.cpython-35.pyc |
��P� � @ sj d Z d d l m Z m Z m Z m Z d d l Z d d l Z Gd d � d e j � Z e j
e � d S)a�
pyudev.pygtk
============
Glib integration.
:class:`GUDevMonitorObserver` integrates device monitoring into the Glib
mainloop by turing device events into Glib signals.
:mod:`glib` and :mod:`gobject` from PyGObject_ must be available when
importing this module. PyGtk is not required.
.. _PyGObject: http://www.pygtk.org/
.. moduleauthor:: Sebastian Wiesner <lunaryorn@gmail.com>
.. versionadded:: 0.7
� )�print_function�division�unicode_literals�absolute_importNc @ s$ e Z d Z d Z d d d d d d d d i Z e d
� e j e j e j e j
f f e d � e j e j e j
f f e d � e j e j e j
f f e d � e j e j e j
f f e d � e j e j e j
f f i Z d d � Z e
d
d � � Z e j d d � � Z d d � Z d S)�GUDevMonitorObservera�
An observer for device events integrating into the :mod:`glib` mainloop.
This class inherits :class:`~gobject.GObject` to turn device events into
glib signals.
>>> from pyudev import Context, Monitor
>>> from pyudev.glib import GUDevMonitorObserver
>>> context = Context()
>>> monitor = Monitor.from_netlink(context)
>>> monitor.filter_by(subsystem='input')
>>> observer = GUDevMonitorObserver(monitor)
>>> def device_connected(observer, device):
... print('{0!r} added'.format(device))
>>> observer.connect('device-added', device_connected)
>>> monitor.start()
This class is a child of :class:`gobject.GObject`.
�addzdevice-added�removezdevice-removedZchangezdevice-changedZmovezdevice-movedzdevice-eventc C s/ t j j | � | | _ d | _ d | _ d S)NT)�gobject�GObject�__init__�monitor�event_source�enabled)�selfr � r �-/usr/lib/python3/dist-packages/pyudev/glib.pyr Z s zGUDevMonitorObserver.__init__c C s
| j d k S)z�
Whether this observer is enabled or not.
If ``True`` (the default), this observer is enabled, and emits events.
Otherwise it is disabled and does not emit any events.
.. versionadded:: 0.14
N)r
)r r r r r ` s
zGUDevMonitorObserver.enabledc C sc | r9 | j d k r9 t j | j t j | j � | _ n&