%PDF- %PDF-
Mini Shell

Mini Shell

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

o

g-`�@s|dZddlmZmZmZmZddlmZmZGdd�de	�Z
Gdd�deje
�Ze�
e�Gdd	�d	eje
�Ze�
e�d
S)a�pyudev.glib
    ===========

    Glib integration.

    :class:`MonitorObserver` integrates device monitoring into the Glib
    mainloop by turing device events into Glib signals.

    :mod:`gi.repository.GLib` and :mod:`gi.repository.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_import)�GLib�GObjectc@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_observer.s
z_ObserverMixin._setup_observercCs
|jduS)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
rrrr4s

z_ObserverMixin.enabledcCsN|r|jdurt�|jtj|j�|_dS|s#|jdur%t�|j�dSdSdS�N)r
r�io_add_watchr	�IO_IN�_process_udev_event�
source_remove)r
�valuerrrr@s
��cCs.|tjkr|jjdd�}|dur|�|�dS)Nr)�timeoutT)rrr	�poll�_emit_event)r
�source�	condition�devicerrrrKs


z"_ObserverMixin._process_udev_eventcCs|�d|�dS�N�device-event)�emit)r
rrrrrTsz_ObserverMixin._emit_eventN)
�__name__�
__module__�__qualname__�__doc__r�propertyr�setterrrrrrrr)s


	rc@s2eZdZdZed�ejejejffiZ	dd�Z
dS)�MonitorObservera�
    An observer for device events integrating into the :mod:`gi.repository.GLib`
    mainloop.

    This class inherits :class:`~gi.repository.GObject.Object` 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:`gi.repository.GObject.Object`.
    rcCstj�|�|�|�dSr)r�Object�__init__rrrrrr(zszMonitorObserver.__init__N)r r!r"r#�strr�SIGNAL_RUN_LAST�	TYPE_NONE�
TYPE_PYOBJECT�__gsignals__r(rrrrr&Xs��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:`gi.repository.GLib`
    mainloop.

    .. deprecated:: 0.17
       Will be removed in 1.0.  Use :class:`MonitorObserver` instead.
    zdevice-addedzdevice-removedzdevice-changedzdevice-moved)�add�remove�change�movercCs.tj�|�|�|�ddl}|�dt�dS)Nrz@Will be removed in 1.0. Use pyudev.glib.MonitorObserver instead.)rr'r(r�warnings�warn�DeprecationWarning)r
r	r3rrrr(�s
�zGUDevMonitorObserver.__init__cCs:|�d|j|�|j�|j�}|dur|�||�dSdSr)r�action�_action_signal_map�get)r
r�signalrrrr�s
�z GUDevMonitorObserver._emit_eventN)r r!r"r#r7r)rr*r+�TYPE_STRINGr,r-r(rrrrrr.�s2	�
������
r.N)r#�
__future__rrrr�
gi.repositoryrr�objectrr'r&�
type_registerr.rrrr�<module>s/
'-

Zerion Mini Shell 1.0