Current File : //lib/python2.7/site-packages/pyudev/wx.pyo |
�
��:Oc @` s� d Z d d l m Z m Z m Z m Z d d l m Z m Z d d l m
Z
d d l m Z e
� \ Z
Z e
� \ Z Z e
� \ Z Z e
� \ Z Z e
� \ Z Z d e f d � � YZ d S( u>
pyudev.wx
=========
Provides :class:`~pyudev.wx.WXUDevMonitorObserver` to integrate a
:class:`~pyudev.Monitor` into a :meth:`wx.App.MainLoop`.
To use this module, :mod:`wx` from wxPython must be available.
.. moduleauthor:: Tobias Eberle <tobias.eberle@gmx.de>
.. versionadded:: 0.14
i ( t print_functiont divisiont unicode_literalst absolute_import( t
EvtHandlert PostEvent( t NewEvent( t MonitorObservert WxUDevMonitorObserverc B` su e Z d Z i e d 6e d 6e d 6e d 6Z d � Z e d � � Z
e
j d � � Z
d � Z d � Z
d
� Z RS( u�
Observe a :class:`~pyudev.Monitor` and post wx events upon device events:
>>> context = pyudev.Context()
>>> monitor = pyudev.Monitor.from_netlink(context)
>>> monitor.filter_by(subsystem='input')
>>> observer = pyudev.wx.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`.
u addu removeu changeu movec C` s- t j | � | | _ d | _ | j � d S( N( R t __init__t monitort Nonet _observer_threadt start( t selfR
( ( s- /usr/lib/python2.7/site-packages/pyudev/wx.pyR C s
c C` s
| j d k S( u�
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 R ( R ( ( s- /usr/lib/python2.7/site-packages/pyudev/wx.pyt enabledI s c C` s! | r | j � n
| j � d S( N( R
t stop( R t value( ( s- /usr/lib/python2.7/site-packages/pyudev/wx.pyR S s
c C` sB | j d k r d St | j | j d d �| _ | j j � d S( u`
Enable this observer.
Do nothing, if the observer is already enabled.
Nt nameu wx-observer-thread( R R R R
t _emit_eventsR
( R ( ( s- /usr/lib/python2.7/site-packages/pyudev/wx.pyR
Z s
c C` s$ | j d k r d S| j j � d S( ub
Disable this observer.
Do nothing, if the observer is already disabled.
N( R R R ( R ( ( s- /usr/lib/python2.7/site-packages/pyudev/wx.pyR f s c C` sC t | t d | d | � � | j | } t | | d | � � d S( Nt actiont device( R t DeviceEventt _action_event_map( R R R t event_class( ( s- /usr/lib/python2.7/site-packages/pyudev/wx.pyR p s
( t __name__t
__module__t __doc__t DeviceAddedEventt DeviceRemovedEventt DeviceChangedEventt DeviceMovedEventR R t propertyR t setterR
R R ( ( ( s- /usr/lib/python2.7/site-packages/pyudev/wx.pyR , s
N( R t
__future__R R R R t wxR R t wx.lib.neweventR t pyudev.monitorR R t EVT_DEVICE_EVENTR t EVT_DEVICE_ADDEDR t EVT_DEVICE_REMOVEDR t EVT_DEVICE_CHANGEDR t EVT_DEVICE_MOVEDR ( ( ( s- /usr/lib/python2.7/site-packages/pyudev/wx.pyt <module> s "