%PDF- %PDF-
| Direktori : /lib/python3/dist-packages/libevdev/__pycache__/ |
| Current File : //lib/python3/dist-packages/libevdev/__pycache__/event.cpython-312.pyc |
�
�o�Z
� �* � d dl mZmZ G d� de� Zy)� )� EventType� EventCodec �L � e Zd ZdZd d�Zed� � Zed� � Zd
d�Zd� Z d� Z
y)�
InputEventaN
Represents one input event of type struct input_event as defined in
``linux/input.h`` and returned by ``libevdev_next_event()``.
Comparison between events can be done via the :func:`matches()` function
or by comparing two input events. Two events match when their most
precise attribute match and all other attributes are None::
>>> e = InputEvent(libevdev.EV_REL.REL_X, value=1)
>>> e == InputEvent(libevdev.EV_REL)
True
>>> e == InputEvent(libevdev.EV_ABS)
True
>>> e == InputEvent(libevdev.EV_REL.REL_X)
True
>>> e == InputEvent(libevdev.EV_REL.REL_Y)
False
>>> e == InputEvent(libevdev.EV_REL.REL_X, value=1)
True
>>> e == InputEvent(libevdev.EV_REL.REL_X, value=2)
False
.. attribute:: code
The :class:`EventCode` or :class:`EventType` for this input event
.. attribute:: value
The (optional) value for the event's axis
.. attribute:: sec
The timestamp, seconds
.. attribute:: usec
The timestamp, microseconds
Nc �� � t |t � st |t � sJ �t |t � r|j | _ || _ n|| _ d | _ || _ || _ || _ y �N) �
isinstancer r �type�_type�_code�sec�usec�value)�self�coder r
r s �0/usr/lib/python3/dist-packages/libevdev/event.py�__init__zInputEvent.__init__B sZ � ��$� �*�j��y�.I�I�I��d�I�&����D�J��D�J��D�J��D�J������ ���
� c � � | j S )zY
:return: the EventCode for this event or None
:rtype: EventCode
)r �r s r r zInputEvent.codeO � � � �z�z�r c � � | j S )zR
:return: the event type for this event
:rtype: EventType
)r r s r r
zInputEvent.typeW r r c � � |�| j �| j |k7 ryt |t � r| j |k( S | j |k( S )a
:param code: the event type or code
:type code: EventType or EventCode
:param value: optional, the event value
:return: True if the type matches this event's type and this event's
code matches the given code (if any) and this event's value
matches the given value (if any)
Check if an event matches a given event type and/or code. The
following invocations show how to match on an event type, an event
code and an event code with a specific value::
if ev.matches(libevdev.EV_REL):
pass
if ev.matches(libevdev.EV_REL.REL_X):
pass
if ev.matches(libevdev.EV_REL.REL_X, 1):
pass
F)r r r r r )r r r s r �matcheszInputEvent.matches_ sI � �0 �����!7�D�J�J�%�<O���d�I�&��:�:��%�%��:�:��%�%r c �� � t |t � sy| j �|j �&| j |j |j
� S | j |j |j
� S )NF)r r r r r
r )r �others r �__eq__zInputEvent.__eq__ sT � ��%��,���9�9���
�
� 2��<�<��
�
�E�K�K�8�8��|�|�E�J�J����4�4r c � � | j j }d }| j �| j j }dj ||| j � S )NzInputEvent({}, {}, {}))r
�namer �formatr )r �tname�cnames r �__repr__zInputEvent.__repr__� sD � �� � �������9�9� ��I�I�N�N�E�'�.�.�u�e�T�Z�Z�H�Hr )N� r$ r )�__name__�
__module__�__qualname__�__doc__r �propertyr r
r r r# � r r r r sF � �%�N� �� �� �� ��&�@5�Ir r N)�constr r �objectr r* r r �<module>r- s ��. (�sI�� sIr