%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/pyudev/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/pyudev/__pycache__/glib.cpython-312.pyc

�

9*�b����dZddlmZmZGd�de�ZGd�deje�Zeje�Gd�deje�Z	eje	�y	)
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

�)�GLib�GObjectc�V�eZdZdZd�Zed��Zejd��Zd�Zd�Z	y)�_ObserverMixinz>Mixin to provide observer behavior to the old and the new API.c�.�||_d|_d|_y)NT)�monitor�event_source�enabled��selfrs  �-/usr/lib/python3/dist-packages/pyudev/glib.py�_setup_observerz_ObserverMixin._setup_observer,s����� ������c��|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s r
r
z_ObserverMixin.enabled2s��� � ��,�,rc��|rK|j�?tj|jtj|j
�|_y|s-|j� tj|j�yyy�N)r	r�io_add_watchr�IO_IN�_process_udev_event�
source_remove)r�values  r
r
z_ObserverMixin.enabled>se���T�&�&�.�!%� 1� 1����d�j�j�$�*B�*B�!�D���4�,�,�8����t�0�0�1�9�rc��|tjk(r/|jjd��}|�|j	|�y)Nr)�timeoutT)rrr�poll�_emit_event)r�source�	condition�devices    r
rz"_ObserverMixin._process_udev_eventJs>����
�
�"��\�\�&�&�q�&�1�F��!�� � ��(�rc�(�|jd|�y�N�device-event)�emit)rrs  r
rz_ObserverMixin._emit_eventSs���	�	�.�&�)rN)
�__name__�
__module__�__qualname__�__doc__r�propertyr
�setterrr�rr
rr's@��H���	-��	-�
�^�^�	2��	2��*rrc�n�eZdZdZed�ejejejffiZ	d�Z
y)�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`.
    r!c�d�tjj|�|j|�yr)r�Object�__init__rrs  r
r.zMonitorObserver.__init__|s"��������%����W�%rN)r#r$r%r&�strr�SIGNAL_RUN_LAST�	TYPE_NONE�
TYPE_PYOBJECT�__gsignals__r.r)rr
r+r+Ws@���8	�N���#�#����
�
"�
"�$�
��L�&rr+c���eZdZdZddddd�Zed�ejejejejffed�ejejejffed�ejejejffed�ejejejffed�ejejejffiZd�Zd	�Z
y
)�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�mover!c��tjj|�|j|�ddl}|jdt�y)Nrz@Will be removed in 1.0. Use pyudev.glib.MonitorObserver instead.)rr-r.r�warnings�warn�DeprecationWarning)rrr;s   r
r.zGUDevMonitorObserver.__init__�s7��������%����W�%���
�
�Q��	
rc��|jd|j|�|jj|j�}|�|j||�yyr )r"�action�_action_signal_map�get)rr�signals   r
rz GUDevMonitorObserver._emit_event�sI���	�	�.�&�-�-��8��(�(�,�,�V�]�]�;�����I�I�f�f�%�rN)r#r$r%r&r@r/rr0r1�TYPE_STRINGr2r3r.rr)rr
r5r5�s����"�"��	��	�N���#�#����
�
 �
 �'�"7�"7�8�
�
	�N���#�#����
�
"�
"�$�
�
	����#�#����
�
"�
"�$� 
�
	����#�#����
�
"�
"�$� 
�
	�N���#�#����
�
"�
"�$�
�+�L�8	
�&rr5N)
r&�
gi.repositoryrr�objectrr-r+�
type_registerr5r)rr
�<module>rGsg��"�&(�-*�V�-*�`'&�g�n�n�n�'&�T����o�&�<&�7�>�>�>�<&�~����*�+r

Zerion Mini Shell 1.0