%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /snap/core20/2582/usr/lib/python3/dist-packages/pyudev/__pycache__/
Upload File :
Create Path :
Current File : //snap/core20/2582/usr/lib/python3/dist-packages/pyudev/__pycache__/glib.cpython-38.pyc

U

u1�W��@s|dZddlmZmZmZmZddlZddlZGdd�de�Z	Gdd�dej
e	�Ze�e�Gdd	�d	ej
e	�Z
e�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)rrrr
r	8s
z_ObserverMixin.enabledcCsD|r&|jdkr&t�|jtj|j�|_n|s@|jdk	r@t�|j�dS�N)r�glibZio_add_watchr�IO_IN�_process_udev_eventZ
source_remove)r�valuerrr
r	Ds�cCs.|tjkr*|jjdd�}|dk	r*|�|�dS)Nr)ZtimeoutT)rrrZpoll�_emit_event)r�sourceZ	condition�devicerrr
rMs


z"_ObserverMixin._process_udev_eventcCs|�d|�dS�N�device-event)�emit)rrrrr
rUsz_ObserverMixin._emit_eventN)
�__name__�
__module__�__qualname__�__doc__r�propertyr	�setterrrrrrr
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`.
    rcCstj�|�|�|�dSr)�gobject�GObject�__init__rr
rrr
r#yszMonitorObserver.__init__N)rrrr�strr!�SIGNAL_RUN_LAST�	TYPE_NONE�
TYPE_PYOBJECT�__gsignals__r#rrrr
r Ys��r c@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�removeZchangeZmovercCs.tj�|�|�|�ddl}|�dt�dS)Nrz@Will be removed in 1.0. Use pyudev.glib.MonitorObserver instead.)r!r"r#r�warnings�warn�DeprecationWarning)rrr,rrr
r#�s
�zGUDevMonitorObserver.__init__cCs6|�d|j|�|j�|j�}|dk	r2|�||�dSr)r�action�_action_signal_map�get)rr�signalrrr
r�sz GUDevMonitorObserver._emit_eventN)rrrrr0r$r!r%r&ZTYPE_STRINGr'r(r#rrrrr
r)�s:�
������
r))rZ
__future__rrrrrr!�objectrr"r Z
type_registerr)rrrr
�<module>s+%
(

Zerion Mini Shell 1.0