%PDF- %PDF-
Direktori : /lib/python3/dist-packages/pyudev/__pycache__/ |
Current File : //lib/python3/dist-packages/pyudev/__pycache__/wx.cpython-312.pyc |
� 9*�b[ � � � d Z ddlmZmZ ddlmZ ddlZ e� \ ZZ G d� de� Z e� \ Z Z e� \ ZZ e� \ ZZ e� \ ZZ G d� de � Zy) 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 � )� EvtHandler� PostEvent)�NewEventNc �\ � e Zd ZdZd� Zed� � Zej d� � Zd� Zd� Z d� Z y) �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 c �j � t j | � || _ d | _ | j � y �N)r �__init__�monitor�_observer_thread�start)�selfr s �+/usr/lib/python3/dist-packages/pyudev/wx.pyr zMonitorObserver.__init__A s( � ����D�!���� $���� � �� c � � | j duS )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 �r s r �enabledzMonitorObserver.enabledG s � � �$�$�D�0�0r c �J � |r| j � y | j � y r )r �stop)r �values r r zMonitorObserver.enabledQ s � ���J�J�L��I�I�Kr c � � | j �yt j | j | j d�� | _ | j j � y)z` Enable this observer. Do nothing, if the observer is already enabled. Nzwx-observer-thread)�callback�name)r �pyudevr r �_emit_eventr r s r r zMonitorObserver.startX sL � � � � �,�� &� 6� 6��L�L�4�#3�#3�:N�! ��� ���#�#�%r c �R � | j �y| j j � y)zb Disable this observer. Do nothing, if the observer is already disabled. N)r r r s r r zMonitorObserver.stope s% � � � � �(�����"�"�$r c �0 � t | t |�� � y )N��device)r �DeviceEvent)r r s r r zMonitorObserver._emit_evento s � ��$��6�2�3r N)�__name__� __module__�__qualname__�__doc__r �propertyr �setterr r r � r r r r * sG � ��,� �1� �1� �^�^�� ��&�%�4r r c �* � e Zd ZdZeeeed�Zd� Z d� Z y)�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�movec �d � t j | |� dd l}|j dt � y )Nr z>Will be removed in 1.0. Use pyudev.wx.MonitorObserver instead.)r r �warnings�warn�DeprecationWarning)r r r/ s r r zWxUDevMonitorObserver.__init__� s'