%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /snap/core20/2379/lib/python3/dist-packages/pyudev/__pycache__/
Upload File :
Create Path :
Current File : //snap/core20/2379/lib/python3/dist-packages/pyudev/__pycache__/wx.cpython-38.pyc

U

װ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"t�|�||_d|_|��dS�N)r�__init__�monitor�_observer_thread�start)�selfr�r�+/usr/lib/python3/dist-packages/pyudev/wx.pyrEs
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|��n|��dSr
)r�stop)r�valuerrrrUs
cCs2|jdk	rdStj|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_eventrrrrrr\s
�zMonitorObserver.startcCs|jdkrdS|j��dS)zb
        Disable this observer.

        Do nothing, if the observer is already disabled.
        N)r
rrrrrris
zMonitorObserver.stopcCst|t|d��dS)N��device)r�DeviceEvent)rrrrrrsszMonitorObserver._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�removeZchangeZmovecCs$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__cCs>t|t|j|d��|j�|j�}|dk	r:t|||d��dS)N)�actionrr)rrr)�_action_event_map�get)rrZevent_classrrrr�sz!WxUDevMonitorObserver._emit_eventN)rrrr �DeviceAddedEvent�DeviceRemovedEvent�DeviceChangedEvent�DeviceMovedEventr*rrrrrrr#}s�r#)r Z
__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