%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /snap/core/17212/usr/lib/python3/dist-packages/pyudev/__pycache__/
Upload File :
Create Path :
Current File : //snap/core/17212/usr/lib/python3/dist-packages/pyudev/__pycache__/wx.cpython-35.pyc



��P��@s�dZddlmZmZmZmZddlmZmZddl	m
Z
ddlmZe
�\Z
Ze
�\ZZe
�\ZZe
�\ZZe
�\ZZGdd�de�ZdS)	a�
    pyudev.wx
    =========

    Wx integration.

    :class:`WxUDevMonitorObserver` 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)�NewEvent)�MonitorObserverc@s�eZdZdZdedededeiZdd�Z	e
dd	��Zejd
d	��Zdd�Z
d
d�Zdd�ZdS)�WxUDevMonitorObservera�
    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, Device
    >>> from pyudev.wx import WxUDevMonitorObserver
    >>> context = Context()
    >>> monitor = Monitor.from_netlink(context)
    >>> monitor.filter_by(subsystem='input')
    >>> observer = WxUDevMonitorObserver(monitor)
    >>> def device_connected(event):
    ...     print('{0!r} added'.format(event.device))
    >>> observer.Bind(EVT_DEVICE_ADDED, device_connected)
    >>> monitor.start()

    This class is a child of :class:`wx.EvtHandler`.
    �add�removeZchangeZmovecCs-tj|�||_d|_|j�dS)N)r�__init__�monitor�_observer_thread�start)�selfr�r�+/usr/lib/python3/dist-packages/pyudev/wx.pyr
Ls
		zWxUDevMonitorObserver.__init__cCs
|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.
        N)r)rrrr�enabledRszWxUDevMonitorObserver.enabledcCs!|r|j�n
|j�dS)N)r�stop)r�valuerrrr\s
cCsE|jdk	rdSt|jd|jdd�|_|jj�dS)z`
        Enable this observer.

        Do nothing, if the observer is already enabled.
        N�callback�namezwx-observer-thread)rr	r�_emit_eventsr)rrrrrcszWxUDevMonitorObserver.startcCs$|jdkrdS|jj�dS)zb
        Disable this observer.

        Do nothing, if the observer is already disabled.
        N)rr)rrrrrpszWxUDevMonitorObserver.stopcCsZt|td|jd|��|jj|j�}|dk	rVt||d|��dS)N�action�device)r�DeviceEventr�_action_event_map�get)rrZevent_classrrrrzsz"WxUDevMonitorObserver._emit_eventsN)�__name__�
__module__�__qualname__�__doc__�DeviceAddedEvent�DeviceRemovedEvent�DeviceChangedEvent�DeviceMovedEventrr
�propertyr�setterrrrrrrrr
0s


r
N)r"Z
__future__rrrrZwxrrZwx.lib.neweventrZpyudev.monitorr	rZEVT_DEVICE_EVENTr#ZEVT_DEVICE_ADDEDr$ZEVT_DEVICE_REMOVEDr%ZEVT_DEVICE_CHANGEDr&ZEVT_DEVICE_MOVEDr
rrrr�<module>s"

Zerion Mini Shell 1.0