3
WYN%                 @   s^  d dl jZd dlT d dlZG dd deZed ZedZedZedZ	G dd	 d	eZ
e
dZe
dZe
d
Ze
dZG dd deZed ZedZG dd deZed ZedZedZed
ZedZG dd deZedZedZed
ZedZedZedZed ZedZ dd Z!G dd de"Z#G dd de"Z$G dd de"Z%dS )    N)*c               @   s   e Zd ZdddddZdS )PressedEventTypeKEY_PRESSED_EVENTKEY_RELEASED_EVENTBUTTON_PRESSED_EVENTBUTTON_RELEASED_EVENT)r            N)__name__
__module____qualname___enum_lookup r   r   5/usr/lib/python3/dist-packages/pyatspi/deviceevent.pyr      s   r   r   r	   r
   c               @   s   e Zd ZdddddZdS )ControllerEventMaskKEY_PRESSED_EVENT_MASKKEY_RELEASED_EVENT_MASKBUTTON_PRESSED_EVENT_MASKBUTTON_RELEASED_EVENT_MASK)r   r	         N)r   r   r   r   r   r   r   r   r   &   s   r   r   r   c               @   s   e Zd ZdddZdS )KeyEventTypeKEY_PRESSEDKEY_RELEASED)r   r   N)r   r   r   r   r   r   r   r   r   5   s   r   c               @   s   e Zd ZddddddZdS )KeySynthType	KEY_PRESSKEY_RELEASEKEY_PRESSRELEASEKEY_SYM
KEY_STRING)r   r   r	   r
   r   N)r   r   r   r   r   r   r   r   r   ?   s
   r   c            	   @   s"   e Zd Zddddddddd	Zd
S )ModifierTypeMODIFIER_SHIFTMODIFIER_SHIFTLOCKMODIFIER_CONTROLMODIFIER_ALTMODIFIER_METAMODIFIER_META2MODIFIER_META3MODIFIER_NUMLOCK)r   r   r	   r
   r            N)r   r   r   r   r   r   r   r   r!   P   s   r!   r*   r+   r,   c              c   s(   d} x| dt > kr"| V  | d7 } qW dS )z
        Generates all possible keyboard modifiers for use with 
        L{registry.Registry.registerKeystrokeListener}.
        r   r   N)r)   )maskr   r   r   allModifierse   s    r.   c               @   s   e Zd ZdZdd Zdd Zdd Zdd	 Zeeed
Z	dd Z
dd Zee
ed
Zdd Zdd Zeeed
Zdd Zdd Zeeed
Zdd Zdd Zeeed
Zdd Zdd Zeeed
Zdd  Zd!d" Zeeed
Zd#d$ Zd%S )&DeviceEventa  
        Wraps an AT-SPI device event with a more Pythonic interface. Primarily adds
        a consume attribute which can be used to cease propagation of a device event.

        @ivar consume: Should this event be consumed and not allowed to pass on to
                observers further down the dispatch chain in this process or possibly
                system wide?
        @type consume: boolean
        @ivar type: Kind of event, KEY_PRESSED_EVENT or KEY_RELEASED_EVENT
        @type type: Accessibility.EventType
        @ivar id: Serial identifier for this key event
        @type id: integer
        @ivar hw_code: Hardware scan code for the key
        @type hw_code: integer
        @ivar modifiers: Modifiers held at the time of the key event
        @type modifiers: integer
        @ivar timestamp: Time at which the event occurred relative to some platform
                dependent starting point (e.g. XWindows start time)
        @type timestamp: integer
        @ivar event_string: String describing the key pressed (e.g. keysym)
        @type event_string: string
        @ivar is_text: Is the event representative of text to be inserted (True), or 
                of a control key (False)?
        @type is_text: boolean
        c          	   C   s   t j| |||||||fS )N)list__new__)clstypeidhw_code	modifiers	timestampevent_stringis_textr   r   r   r1      s    zDeviceEvent.__new__c          	   C   s$   t j| |||||||f d| _d S )NF)r0   __init__Zconsume)selfr3   r4   r5   r6   r7   r8   r9   r   r   r   r:      s    zDeviceEvent.__init__c             C   s   | d S )Nr   r   )r;   r   r   r   	_get_type   s    zDeviceEvent._get_typec             C   s   || d< d S )Nr   r   )r;   valr   r   r   	_set_type   s    zDeviceEvent._set_type)fgetfsetc             C   s   | d S )Nr   r   )r;   r   r   r   _get_id   s    zDeviceEvent._get_idc             C   s   || d< d S )Nr   r   )r;   r=   r   r   r   _set_id   s    zDeviceEvent._set_idc             C   s   | d S )Nr	   r   )r;   r   r   r   _get_hw_code   s    zDeviceEvent._get_hw_codec             C   s   || d< d S )Nr	   r   )r;   r=   r   r   r   _set_hw_code   s    zDeviceEvent._set_hw_codec             C   s   | d S )Nr
   r   )r;   r   r   r   _get_modifiers   s    zDeviceEvent._get_modifiersc             C   s   || d< d S )Nr
   r   )r;   r=   r   r   r   _set_modifiers   s    zDeviceEvent._set_modifiersc             C   s   | d S )Nr   r   )r;   r   r   r   _get_timestamp   s    zDeviceEvent._get_timestampc             C   s   || d< d S )Nr   r   )r;   r=   r   r   r   _set_timestamp   s    zDeviceEvent._set_timestampc             C   s   | d S )Nr*   r   )r;   r   r   r   _get_event_string   s    zDeviceEvent._get_event_stringc             C   s   || d< d S )Nr*   r   )r;   r=   r   r   r   _set_event_string   s    zDeviceEvent._set_event_stringc             C   s   | d S )Nr+   r   )r;   r   r   r   _get_is_text   s    zDeviceEvent._get_is_textc             C   s   || d< d S )Nr+   r   )r;   r=   r   r   r   _set_is_text   s    zDeviceEvent._set_is_textc             C   sL   ddl }| j|jkrd}n| j|jkr*d}d|| j| j| j| j| j| j	f S )z
                Builds a human readable representation of the event.

                @return: Event description
                @rtype: string
                r   NZpressedZreleasedzT%s
	hw_code: %d
	event_string: %s
	modifiers: %d
	id: %d
	timestamp: %d
	is_text: %s)
	constantsr3   r   r   r5   r8   r6   r4   r7   r9   )r;   rM   Zkindr   r   r   __str__   s    zDeviceEvent.__str__N)r   r   r   __doc__r1   r:   r<   r>   propertyr3   rA   rB   r4   rC   rD   r5   rE   rF   r6   rG   rH   r7   rI   rJ   r8   rK   rL   r9   rN   r   r   r   r   r/   q   s2   r/   c               @   sp   e Zd Zdd Zdd Zdd Zdd Zeeed	Zd
d Z	dd Z
ee	e
d	Zdd Zdd Zeeed	ZdS )EventListenerModec             C   s   t j| |||fS )N)r0   r1   )r2   synchronous
preemptiveglobal_r   r   r   r1      s    zEventListenerMode.__new__c             C   s   t j| |||f d S )N)r0   r:   )r;   rR   rS   rT   r   r   r   r:      s    zEventListenerMode.__init__c             C   s   | d S )Nr   r   )r;   r   r   r   _get_synchronous   s    z"EventListenerMode._get_synchronousc             C   s   || d< d S )Nr   r   )r;   r=   r   r   r   _set_synchronous   s    z"EventListenerMode._set_synchronous)r?   r@   c             C   s   | d S )Nr   r   )r;   r   r   r   _get_preemptive   s    z!EventListenerMode._get_preemptivec             C   s   || d< d S )Nr   r   )r;   r=   r   r   r   _set_preemptive   s    z!EventListenerMode._set_preemptivec             C   s   | d S )Nr	   r   )r;   r   r   r   _get_global_   s    zEventListenerMode._get_global_c             C   s   || d< d S )Nr	   r   )r;   r=   r   r   r   _set_global_   s    zEventListenerMode._set_global_N)r   r   r   r1   r:   rU   rV   rP   rR   rW   rX   rS   rY   rZ   rT   r   r   r   r   rQ      s   rQ   c               @   s   e Zd Zdd Zdd Zdd Zdd Zeeed	Zd
d Z	dd Z
ee	e
d	Zdd Zdd Zeeed	Zdd Zdd Zeeed	ZdS )KeyDefinitionc             C   s   t j| ||||fS )N)r0   r1   )r2   keycodekeysym	keystringunusedr   r   r   r1      s    zKeyDefinition.__new__c             C   s   t j| ||||f d S )N)r0   r:   )r;   r\   r]   r^   r_   r   r   r   r:      s    zKeyDefinition.__init__c             C   s   | d S )Nr   r   )r;   r   r   r   _get_keycode   s    zKeyDefinition._get_keycodec             C   s   || d< d S )Nr   r   )r;   r=   r   r   r   _set_keycode   s    zKeyDefinition._set_keycode)r?   r@   c             C   s   | d S )Nr   r   )r;   r   r   r   _get_keysym   s    zKeyDefinition._get_keysymc             C   s   || d< d S )Nr   r   )r;   r=   r   r   r   _set_keysym   s    zKeyDefinition._set_keysymc             C   s   | d S )Nr	   r   )r;   r   r   r   _get_keystring   s    zKeyDefinition._get_keystringc             C   s   || d< d S )Nr	   r   )r;   r=   r   r   r   _set_keystring   s    zKeyDefinition._set_keystringc             C   s   | d S )Nr
   r   )r;   r   r   r   _get_unused   s    zKeyDefinition._get_unusedc             C   s   || d< d S )Nr
   r   )r;   r=   r   r   r   _set_unused   s    zKeyDefinition._set_unusedN)r   r   r   r1   r:   r`   ra   rP   r\   rb   rc   r]   rd   re   r^   rf   rg   r_   r   r   r   r   r[      s   r[   )&Zpyatspi.registryregistryZpyatspi.atspienum	tracebackZ	AtspiEnumr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r   r!   r%   r$   r&   r'   r(   r)   r"   r#   r.   r0   r/   rQ   r[   r   r   r   r   <module>   sD   
	[