legoEv3/evdev/__pycache__/events.cpython-35.pyc



ObU@sdZddlmZmZmZmZmZmZmZm    Z    m
Z
GdddeZGdddeZ
GdddeZGd    d
d
eZGdddeZee
eee    ee
eiZdZdS)aY
This module provides the :class:`InputEvent` class, which closely
resembles the ``input_event`` struct defined in ``linux/input.h``:

.. code-block:: c

    struct input_event {
        struct timeval time;
        __u16 type;
        __u16 code;
        __s32 value;
    };

This module also defines several :class:`InputEvent` sub-classes that
know more about the different types of events (key, abs, rel etc). The
:data:`event_factory` dictionary maps event types to these classes.

Assuming you use the :func:`evdev.util.categorize()` function to
categorize events according to their type, adding or replacing a class
for a specific event type becomes a matter of modifying
:data:`event_factory`.

All classes in this module have reasonable ``str()`` and ``repr()``
methods::

    >>> print(event)
    event at 1337197425.477827, code 04, type 04, val 458792
    >>> print(repr(event))
    InputEvent(1337197425L, 477827L, 4, 4, 458792L)

    >>> print(key_event)
    key event at 1337197425.477835, 28 (KEY_ENTER), up
    >>> print(repr(key_event))
    KeyEvent(InputEvent(1337197425L, 477835L, 1, 28, 0L))
)    keysKEYSYNRELABSEV_KEYEV_RELEV_ABSEV_SYNc@sLeZdZdZdZddZd    d
ZddZd
dZdS)
InputEventzA generic input event.secusectypecodevaluecCs1||_||_||_||_||_dS)N)rr
rrr)selfrr
rrrr./usr/lib/python3/dist-packages/evdev/events.py__init__2s
                zInputEvent.__init__cCs|j|jdS)z"Return event timestamp as a float.g.A)rr
)rrrr    timestampBszInputEvent.timestampcCs+d}|j|j|j|j|jS)Nz3event at {:f}, code {:02d}, type {:02d}, val {:02d})formatrrrr)smsgrrr__str__FszInputEvent.__str__cCs7d}|j|jj|j|j|j|j|jS)Nz {}({!r}, {!r}, {!r}, {!r}, {!r}))r    __class____name__rr
rrr)rrrrr__repr__JszInputEvent.__repr__N)rr
rrr)    r
__module____qualname____doc__    __slots__rrrrrrrrr-src@sReZdZdZdZdZdZdZd    d
ZddZ    d
dZ
dS)KeyEventzCAn event generated by a keyboard, button or other key-like devices.rscancodekeycodekeystateeventcCs|jdkrtj|_n9|jdkr<tj|_n|jdkrWtj|_t|j|_|j|_    ||_
dS)Nrr#r")rr!key_upr&key_holdkey_downrrr%r$r')rr'rrrrYszKeyEvent.__init__c
CsWyd|j}Wntk
r+d}YnXd}|j|jj|j|j|S)Nupdownholdunknownzkey event at {:f}, {} ({}), {})r+r,r-)r&
IndexErrorrr'rr$r%)rZksrrrrrgs
zKeyEvent.__str__cCsdj|jj|jS)Nz{}({!r}))rrrr')rrrrrqszKeyEvent.__repr__N)r$r%r&r')rrrrr(r*r)r rrrrrrrr!Ps
r!c@s@eZdZdZdZddZddZddZd    S)
RelEventzAA relative axis event (e.g moving the mouse 5 units to the left).r'cCs
||_dS)N)r')rr'rrrrzszRelEvent.__init__cCs)d}|j|jjt|jjS)Nz relative axis event at {:f}, {} )rr'rrr)rrrrrr~szRelEvent.__str__cCsdj|jj|jS)Nz{}({!r}))rrrr')rrrrrszRelEvent.__repr__N)rrrrr rrrrrrrr0us
r0c@s@eZdZdZdZddZddZddZd    S)
AbsEventzGAn absolute axis event (e.g the coordinates of a tap on a touchscreen).r'cCs
||_dS)N)r')rr'rrrrszAbsEvent.__init__cCs)d}|j|jjt|jjS)Nz absolute axis event at {:f}, {} )rr'rrr)rrrrrrszAbsEvent.__str__cCsdj|jj|jS)Nz{}({!r}))rrrr')rrrrrszAbsEvent.__repr__N)rrrrr rrrrrrrr1s
r1c@s@eZdZdZdZddZddZddZd    S)
SynEventz
    A synchronization event. Synchronization events are used as
    markers to separate event. Used as markers to separate
    events. Events may be separated in time or in space, such as with
    the multitouch protocol.
    r'cCs
||_dS)N)r')rr'rrrrszSynEvent.__init__cCs)d}|j|jjt|jjS)Nz"synchronization event at {:f}, {} )rr'rrr)rrrrrrszSynEvent.__str__cCsdj|jj|jS)Nz{}({!r}))rrrr')rrrrrszSynEvent.__repr__N)rrrrr rrrrrrrr2s
r2
event_factoryN)rr!r0r2r1r3)rZevdev.ecodesrrrrrrrr    r
objectrr!r0r1r2r3__all__rrrr<module>%s@#%