%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__/wx.cpython-310.pyc

o

8g+^��@s�dZddlmZmZmZmZddlmZmZddl	m
Z
ddlZe
�\ZZ
Gdd�de�Ze
�\ZZe
�\ZZe
�\ZZe
�\ZZGdd	�d	e�ZdS)
a�pyudev.wx
    =========

    Wx integration.

    :class:`MonitorObserver` integrates device monitoring into the wxPython\_
    mainloop by turing device events into wx events.

    :mod:`wx` from wxPython\_ must be available when importing this module.

    .. _wxPython: http://wxpython.org/

    .. moduleauthor::  Tobias Eberle  <tobias.eberle@gmx.de>
    .. versionadded:: 0.14

�)�print_function�division�unicode_literals�absolute_import)�
EvtHandler�	PostEvent)�NewEventNc@sJeZdZdZdd�Zedd��Zejdd��Zdd�Zd	d
�Z	dd�Z
d
S)�MonitorObservera�
    An observer for device events integrating into the :mod:`wx` mainloop.

    This class inherits :class:`~wx.EvtHandler` to turn device events into
    wx events:

    >>> from pyudev import Context, Monitor
    >>> from pyudev.wx import MonitorObserver
    >>> context = Context()
    >>> monitor = Monitor.from_netlink(context)
    >>> monitor.filter_by(subsystem='input')
    >>> observer = MonitorObserver(monitor)
    >>> def device_event(event):
    ...     print('action {0} on device {1}'.format(event.device.action, event.device))
    >>> observer.Bind(EVT_DEVICE_EVENT, device_event)
    >>> monitor.start()

    This class is a child of :class:`wx.EvtHandler`.

    .. versionadded:: 0.17
    cCs"t�|�||_d|_|��dS�N)r�__init__�monitor�_observer_thread�start)�selfr�r�+/usr/lib/python3/dist-packages/pyudev/wx.pyrCs
zMonitorObserver.__init__cCs
|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.
        N)r
�rrrr�enabledIs
zMonitorObserver.enabledcCs|r|��dS|��dSr
)r�stop)r�valuerrrrSscCs2|jdurdStj|j|jdd�|_|j��dS)z`
        Enable this observer.

        Do nothing, if the observer is already enabled.
        Nzwx-observer-thread)�callback�name)r
�pyudevr	r�_emit_eventrrrrrrZs

�zMonitorObserver.startcCs|jdurdS|j��dS)zb
        Disable this observer.

        Do nothing, if the observer is already disabled.
        N)r
rrrrrrfs
zMonitorObserver.stopcCst|t|d��dS)N��device)r�DeviceEvent)rrrrrrpszMonitorObserver._emit_eventN)�__name__�
__module__�__qualname__�__doc__r�propertyr�setterrrrrrrrr	,s
	

r	c@s.eZdZdZeeeed�Zdd�Z	dd�Z
dS)�WxUDevMonitorObserverz�An observer for device events integrating into the :mod:`wx` mainloop.

    .. deprecated:: 0.17
       Will be removed in 1.0.  Use :class:`MonitorObserver` instead.
    )�add�remove�change�movecCs$t�||�ddl}|�dt�dS)Nrz>Will be removed in 1.0. Use pyudev.wx.MonitorObserver instead.)r	r�warnings�warn�DeprecationWarning)rrr(rrrr�s
�zWxUDevMonitorObserver.__init__cCsBt|t|j|d��|j�|j�}|durt|||d��dSdS)N)�actionrr)rrr+�_action_event_map�get)rr�event_classrrrr�s
�z!WxUDevMonitorObserver._emit_eventN)rrrr �DeviceAddedEvent�DeviceRemovedEvent�DeviceChangedEvent�DeviceMovedEventr,rrrrrrr#zs�r#)r �
__future__rrrr�wxrr�wx.lib.neweventrrr�EVT_DEVICE_EVENTr	r/�EVT_DEVICE_ADDEDr0�EVT_DEVICE_REMOVEDr1�EVT_DEVICE_CHANGEDr2�EVT_DEVICE_MOVEDr#rrrr�<module>s

H




Zerion Mini Shell 1.0