%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /snap/core18/current/usr/lib/python3/dist-packages/pyudev/__pycache__/
Upload File :
Create Path :
Current File : //snap/core18/current/usr/lib/python3/dist-packages/pyudev/__pycache__/glib.cpython-36.pyc

3

u1�W��@s|dZddlmZmZmZmZddlZddlZGdd�de�Z	Gdd�dej
e	�Zeje�Gdd	�d	ej
e	�Z
eje
�dS)
a�pyudev.glib
    ===========

    Glib integration.

    :class:`MonitorObserver` 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@sBeZdZdZdd�Zedd��Zejdd��Zdd�Zd	d
�Z	dS)�_ObserverMixinz>Mixin to provide observer behavior to the old and the new API.cCs||_d|_d|_dS)NT)�monitor�event_source�enabled)�selfr�r�-/usr/lib/python3/dist-packages/pyudev/glib.py�_setup_observer2sz_ObserverMixin._setup_observercCs
|jdk	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
rrrr	8s
z_ObserverMixin.enabledcCsF|r&|jdkr&tj|jtj|j�|_n|rB|jdk	rBtj|j�dS)N)r�glibZio_add_watchr�IO_IN�_process_udev_eventZ
source_remove)r
�valuerrrr	Ds
cCs.|tjkr*|jjdd�}|dk	r*|j|�dS)Nr)ZtimeoutT)rrrZpoll�_emit_event)r
�sourceZ	condition�devicerrrrMs


z"_ObserverMixin._process_udev_eventcCs|jd|�dS)Nzdevice-event)�emit)r
rrrrrUsz_ObserverMixin._emit_eventN)
�__name__�
__module__�__qualname__�__doc__r
�propertyr	�setterrrrrrrr.s	rc@s2eZdZdZed�ejejejffiZ	dd�Z
dS)�MonitorObservera�
    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 MonitorObserver
    >>> context = Context()
    >>> monitor = Monitor.from_netlink(context)
    >>> monitor.filter_by(subsystem='input')
    >>> observer = MonitorObserver(monitor)
    >>> def device_event(observer, device):
    ...     print('event {0} on device {1}'.format(device.action, device))
    >>> observer.connect('device-event', device_event)
    >>> monitor.start()

    This class is a child of :class:`gobject.GObject`.
    zdevice-eventcCstjj|�|j|�dS)N)�gobject�GObject�__init__r
)r
rrrrryszMonitorObserver.__init__N)rrrr�strr�SIGNAL_RUN_LAST�	TYPE_NONE�
TYPE_PYOBJECT�__gsignals__rrrrrrYs	rc@s�eZdZdZddddd�Zed�ejejej	ej
ffed�ejejej
ffed�ejejej
ffed�ejejej
ffed�ejejej
ffiZdd	�Zd
d�Z
dS)
�GUDevMonitorObserverz�
    An observer for device events integrating into the :mod:`glib` mainloop.

    .. deprecated:: 0.17
       Will be removed in 1.0.  Use :class:`MonitorObserver` instead.
    zdevice-addedzdevice-removedzdevice-changedzdevice-moved)�add�removeZchangeZmovezdevice-eventcCs.tjj|�|j|�ddl}|jdt�dS)Nrz@Will be removed in 1.0. Use pyudev.glib.MonitorObserver instead.)rrrr
�warnings�warn�DeprecationWarning)r
rr(rrrr�s

zGUDevMonitorObserver.__init__cCs6|jd|j|�|jj|j�}|dk	r2|j||�dS)Nzdevice-event)r�action�_action_signal_map�get)r
r�signalrrrr�sz GUDevMonitorObserver._emit_eventN)rrrrr,r rr!r"ZTYPE_STRINGr#r$rrrrrrr%�s
r%)rZ
__future__rrrrrr�objectrrrZ
type_registerr%rrrr�<module>"s+%
(

Zerion Mini Shell 1.0