%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /snap/core18/current/usr/lib/python3/dist-packages/pyudev/__pycache__/
Upload File :
Create Path :
Current File : //snap/core18/current/usr/lib/python3/dist-packages/pyudev/__pycache__/wx.cpython-36.pyc

3

װVp�@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"tj|�||_d|_|j�dS)N)r�__init__�monitor�_observer_thread�start)�selfr�r�+/usr/lib/python3/dist-packages/pyudev/wx.pyr
Es
zMonitorObserver.__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�enabledKszMonitorObserver.enabledcCs|r|j�n|j�dS)N)r
�stop)r�valuerrrrUs
cCs2|jdk	rdStj|j|jdd�|_|jj�dS)z`
        Enable this observer.

        Do nothing, if the observer is already enabled.
        Nzwx-observer-thread)�callback�name)r�pyudevr	r�_emit_eventr
)rrrrr
\s

zMonitorObserver.startcCs|jdkrdS|jj�dS)zb
        Disable this observer.

        Do nothing, if the observer is already disabled.
        N)rr)rrrrris
zMonitorObserver.stopcCst|t|d��dS)N)�device)r�DeviceEvent)rrrrrrsszMonitorObserver._emit_eventN)�__name__�
__module__�__qualname__�__doc__r
�propertyr�setterr
rrrrrrr	.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�removeZchangeZmovecCs$tj||�ddl}|jdt�dS)Nrz>Will be removed in 1.0. Use pyudev.wx.MonitorObserver instead.)r	r
�warnings�warn�DeprecationWarning)rrr#rrrr
�szWxUDevMonitorObserver.__init__cCs>t|t|j|d��|jj|j�}|dk	r:t|||d��dS)N)�actionr)r)rrr&�_action_event_map�get)rrZevent_classrrrr�sz!WxUDevMonitorObserver._emit_eventN)rrrr�DeviceAddedEvent�DeviceRemovedEvent�DeviceChangedEvent�DeviceMovedEventr'r
rrrrrr }sr )rZ
__future__rrrrZwxrrZwx.lib.neweventrrrZEVT_DEVICE_EVENTr	r)ZEVT_DEVICE_ADDEDr*ZEVT_DEVICE_REMOVEDr+ZEVT_DEVICE_CHANGEDr,ZEVT_DEVICE_MOVEDr rrrr�<module>s
I





Zerion Mini Shell 1.0