%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/orca/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/orca/__pycache__/event_manager.cpython-312.pyc

�

g
f&���
�dZdZdZdZdZddlZejdd�dd	lmZdd
lm	Z	ddl
Z
ddlZddlZddl
mZdd
l
mZddl
mZddl
mZddl
mZddl
mZddl
mZddlmZddlmZGd�d�Ze�Zd�Zy)z$Id$z
$Revision$z$Date$zCopyright (c) 2011. Orca Team.�LGPL�N�Atspiz2.0)r)�GLib�)�debug)�
focus_manager)�input_event)�orca_modifier_manager)�
orca_state)�script_manager)�settings)�AXObject)�AXUtilitiesc��eZdZd�Zd�Zd�Zdd�Zd�Zd�Zdd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zed��Zdd�Zd�Zd�Zd�Zdd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy) �EventManagerc��tjtjdd�i|_d|_d|_t
jd�|_d|_	tj�|_tjj|j �|_dt$_d|_tjtjdd�y)NzEVENT MANAGER: InitializingTFrzEvent manager initialized)r�printMessage�
LEVEL_INFO�_scriptListenerCounts�_active�_paused�queue�Queue�_eventQueue�_gidleId�	threading�Lock�
_gidleLockr�
EventListener�new�_enqueue_object_event�	_listenerr�device�bypassedKey��selfs �4/usr/lib/python3/dist-packages/orca/event_manager.py�__init__zEventManager.__init__0s���
���5�+�+�-J�D�Q�%'��"�������$�{�{�1�~��� ��
�(�~�~�/����,�,�0�0��1K�1K�L��� �
�����
���5�+�+�-H�$�O�c��tjtjdd�tjj�t_dtj_tjj|j�tj_d|_tjtjdd�y)z,Called when this event manager is activated.zEVENT MANAGER: ActivatingTrzEVENT MANAGER: ActivatedN)
rrrr�Devicer rr#�event_count�add_key_watcher�_processKeyboardEvent�key_watcherrr%s r'�activatezEventManager.activate=s���	���5�+�+�-H�$�O�!�L�L�,�,�.�
��()�
���%����-�-�d�.H�.H�I�	���%����
���5�+�+�-G��Nr)c��tjtjdd�d|_t	j
d�|_i|_dt_	tjtjdd�y)z.Called when this event manager is deactivated.zEVENT MANAGER: DeactivatingTFrNzEVENT MANAGER: Deactivated)
rrrrrrrrrr#r%s r'�
deactivatezEventManager.deactivateIs]��	���5�+�+�-J�D�Q���� �;�;�q�>���%'��"� �
��
���5�+�+�-I�4�Pr)c��d|�d|�d|��}tjtj|d�||_|rt	j
d�|_yy)zPauses/unpauses event queuing.zEVENT MANAGER: Pause queueing: z. Clear queue: z. TrN)rrrrrrr)r&�pause�
clearQueue�reason�msgs     r'�pauseQueuingzEventManager.pauseQueuingSsV��0��w�o�j�\�QS�TZ�S[�\��
���5�+�+�S�$�7�����$�{�{�1�~�D��r)c����fd�}�fd�}�fd�}�fd�}|jjj�	tt	|jj
��}|jjj�|D]�}	|	�k(ry||	�r0d�d	|	d
g}
tjtj|
d�|	cS||	�r0d�d	|	dg}
tjtj|
d�|	cS||	�r0d�d	|	dg}
tjtj|
d�|	cS||	�s��d�d	|	d
g}
tjtj|
d�|	cSd�dg}
tjtj|
d�y#t$r7}d|��}tjtj|d�g}Yd}~��xd}~wwxYw#|jjj�wxYw)zMReturns the event which renders this one no longer worthy of being processed.c���|j�jk(xrj|j�jk(xrO|j�jk(xr4|j�jk(xr|j�jk(S�N)�type�source�detail1�detail2�any_data)�x�events �r'�isSamez+EventManager._isObsoletedBy.<locals>.isSame_sp����6�6�U�Z�Z�'�1��H�H����,�1��I�I����.�1��I�I����.�1��J�J�%�.�.�0�	
1r)c����hd�}t�fd�|D��sy�j�jk(xr�j�jk(S)N>	�document:page-changed� object:active-descendant-changed�window�object:state-changed�object:property-change�object:children-changed�object:text-caret-moved�object:selection-changed�object:text-selection-changedc3�T�K�|]}�jj|����!y�wr;�r<�
startswith��.0�etyperAs  �r'�	<genexpr>zTEventManager._isObsoletedBy.<locals>.obsoletesIfSameTypeAndObject.<locals>.<genexpr>r� �����G�E�q�v�v�(�(��/�G���%(F)�anyr=r<�rA�	skippablerBs` �r'�obsoletesIfSameTypeAndObjectzAEventManager._isObsoletedBy.<locals>.obsoletesIfSameTypeAndObjectfsB���
�I��G�Y�G�G���8�8�u�|�|�+�D����%�*�*�0D�Dr)c�����j�jk7sK�j�jk7s2�j�jk7s�j�jk7ryddh}t	�fd�|D��sytj�j�tj�j�k(S)NF�focus�object:state-changed:focusedc3�T�K�|]}�jj|����!y�wr;rOrQs  �r'rTzTEventManager._isObsoletedBy.<locals>.obsoletesIfSameTypeInSibling.<locals>.<genexpr>rUrV)r<r>r?r@rWr�
get_parentr=rXs` �r'�obsoletesIfSameTypeInSiblingzAEventManager._isObsoletedBy.<locals>.obsoletesIfSameTypeInSiblingvs�����v�v����#�q�y�y�E�M�M�'A�Q�Y�Y�RW�R_�R_�E_��*�*����.���.��I��G�Y�G�G���&�&�q�x�x�0�H�4G�4G����4U�U�Ur)c����ddh}t�fd�|D��syt�fd�|D��sy�j�jk(ryy)N�window:activate�window:deactivatec3�T�K�|]}�jj|����!y�wr;rOrQs  �r'rTzLEventManager._isObsoletedBy.<locals>.obsoletesWindowEvent.<locals>.<genexpr>�rUrVFc3�T�K�|]}�jj|����!y�wr;rO)rRrSrBs  �r'rTzLEventManager._isObsoletedBy.<locals>.obsoletesWindowEvent.<locals>.<genexpr>�s �����K��u�z�z�,�,�U�3�K�rVT)rWr=rXs` �r'�obsoletesWindowEventz9EventManager._isObsoletedBy.<locals>.obsoletesWindowEvent�sJ���!�#��I��G�Y�G�G���K��K�K���x�x�5�<�<�'��r)z,EVENT MANAGER: Exception in _isObsoletedBy: TN�EVENT MANAGER:zobsoleted byzmore recent duplicatez.more recent event of same type for same objectz+more recent event of same type from siblingz'more recent window (de)activation eventzis not obsoleted)r�mutex�acquire�list�reversedr�	Exceptionrrr�release�printTokens)r&rBrCrZr`rf�events�errorr7�e�tokenss `         r'�_isObsoletedByzEventManager._isObsoletedBy\s����	1�	E� 	V�	�	
�����&�&�(�	-��(�4�#3�#3�#9�#9�:�;�F�
���"�"�*�*�,��	�A��E�z���a�y�*�E�>�1�1�3���!�!�%�"2�"2�F�D�A���+�A�.�*�E�>�1�J�L���!�!�%�"2�"2�F�D�A���+�A�.�*�E�>�1�G�I���!�!�%�"2�"2�F�D�A���#�A�&�*�E�>�1�C�E���!�!�%�"2�"2�F�D�A���-	�0#�E�+=�>��
���%�*�*�F�D�9���C�	�@���H�C����u�/�/��d�;��F��	��

���"�"�*�*�,�s)�(F � 	G �),G�G#�G � G#�#&H	c��tjtjd�d|g}tjtj|d�|jr|j
r(d}tjtj|d�y|j}|jd�s|jd�ry|j�r9|j|�r(d}tjtj|d�ytj�j�}||jk(stj|j�ry||j k(ry|jd	��r0|j }|�(d
}tjtj|d�yd|vrt#j$|�ryt#j$|�r(d}tjtj|d�ytj&|�stj(|�r(d
}tjtj|d�yt#j*|j�}t#j,|�j/�}d|vr-|dk(r(d}tjtj|d�y|j1d�r-|dk(r(d}tjtj|d�yt3j�j5�}	|	�(d}tjtj|d�y|	j6t#j*|j�k7r(d}tjtj|d�y|jd��rt#j8|j�}
d|v�r�|
t:j<j>t:j<j@t:j<jBt:j<jDt:j<jFt:j<jHt:j<jJt:j<jLt:j<jNt:j<jPt:j<jRt:j<jTt:j<jVt:j<jXfvr(d}tjtj|d�yyd|vr_|
t:j<jZt:j<j\fvr(d}tjtj|d�yy|jd�rHt#j$|j�r(d}tjtj|d�yy|jd��r�t#j8|j�}
|j1d�r�|
t:j<j^t:j<jVt:j<jTt:j<j`t:j<jXt:j<jbfvr(d}tjtj|d�yd|vrHtjd|j�s(d}tjtj|d�yyd|vrR|jfsE|
t:j<jhfvr(d}tjtj|d�yyd |vr_|
t:j<jjt:j<jlfvr(d}tjtj|d�yyd!|vr�|
t:j<jnt:j<jpt:j<jrt:j<jtt:j<jJt:j<jvt:j<jxt:j<jzfvr(d"}tjtj|d�yy|jd#�ret#j8|j�}
|
t:j<j|fvr(d}tjtj|d�yy|jd$�r�d%|j vrD|j jd%d�s(d&}tjtj|d�yd'|vr7|j�d(kDr(d)}tjtj|d�y|j1d�r=tj�|�r(d*}tjtj|d�yyy)+z-Returns True if this event should be ignored.�rgTzKEVENT MANAGER: Ignoring because manager is not active or queueing is pausedrGzmouse:buttonFz0EVENT MANAGER: Ignoring event type due to delugerJz5EVENT_MANAGER: Ignoring due to lack of event.any_data�removez2EVENT_MANAGER: Ignoring due to dead event.any_dataz5EVENT_MANAGER: Ignoring due to role of event.any_datazgnome-shellz3EVENT MANAGER: Ignoring event based on type and app�system�thunderbirdz9EVENT MANAGER: Ignoring because there is no active scriptz<EVENT MANAGER: Ignoring because event is not from active apprI�namezBEVENT MANAGER: Ignoring event type due to role of unfocused source�valuerLz.EVENT MANAGER: Ignoring event from dead sourcerHz2EVENT MANAGER: Ignoring system event based on role�checkedzCEVENT MANAGER: Ignoring event type of unfocused, non-showing source�selectedzDEVENT MANAGER: Ignoring event type due to role of source and detail1�	sensitive�showingz.EVENT MANAGER: Ignoring event type due to rolerK�object:text-changeduzEEVENT MANAGER: Ignoring because changed text is only embedded objects�inserti�zFEVENT MANAGER: Ignoring because inserted text has more than 1000 charsz7EVENT MANAGER: Ignoring because event is suspected spam)Brrrrnrrr<rP�	_inDeluge�_ignoreDuringDeluger�
getManager�get_locus_of_focusr=r�
is_focusedr@r�is_dead�is_menu_related�is_image�get_application�get_name�lower�endswithr�getActiveScript�app�get_roler�Role�CANVAS�	CHECK_BOX�ICON�IMAGE�LIST�	LIST_ITEM�MENU�	MENU_ITEM�PANEL�RADIO_BUTTON�SECTION�	TABLE_ROW�
TABLE_CELL�	TREE_ITEM�
SPLIT_PANE�
SCROLL_BAR�TABLE�TREE�
TREE_TABLE�
is_showingr>�PUSH_BUTTON�TEXT�ENTRY�ALERT�	ANIMATION�DIALOG�INFO_BAR�NOTIFICATION�
STATUS_BAR�TOOL_TIP�LABEL�replacer?�
is_selectable)r&rBrrr7�
event_typer\�childr��app_name�script�roles           r'�_ignorezEventManager._ignore�s���	���5�+�+�R�0�"�E�*��
���%�*�*�F�D�9��|�|�t�|�|�_�C����u�/�/��d�;���Z�Z�
�� � ��*�j�.C�.C�N�.S���>�>��� 8� 8�� ?�D�C����u�/�/��d�;���(�(�*�=�=�?���E�L�L� �K�$:�$:�5�<�<�$H���E�N�N�"��� � �!:�;��N�N�E��}�M���"�"�5�#3�#3�S�$�?���:�%�(�*:�*:�5�*A������&�J���"�"�5�#3�#3�S�$�?���*�*�5�1�[�5I�5I�%�5P�M���"�"�5�#3�#3�S�$�?���*�*�5�<�<�8�C��(�(��-�3�3�5�H��:�%�(�m�*C�K���"�"�5�#3�#3�S�$�?���"�"�8�,��]�1J�K���"�"�5�#3�#3�S�$�?��#�.�.�0�@�@�B�F��~�Q���"�"�5�#3�#3�S�$�?���z�z�X�5�5�e�l�l�C�C�T���"�"�5�#3�#3�S�$�?��� � �!9�:��$�$�U�\�\�2�D���#��E�J�J�-�-�!�J�J�0�0�!�J�J�O�O�!�J�J�,�,�!�J�J�O�O�!�J�J�0�0�!�J�J�O�O�!�J�J�0�0�!�J�J�,�,�!�J�J�3�3�!�J�J�.�.�!�J�J�0�0�!�J�J�1�1�!�J�J�0�0�
2�
2�_�C��&�&�u�'7�'7��d�C����*�$��E�J�J�1�1�5�:�:�3H�3H�I�I�^�C��&�&�u�'7�'7��d�C���� � �!;�<�������-�F���"�"�5�#3�#3�S�$�?���� � �!7�8��$�$�U�\�\�2�D��"�"�8�,��E�J�J�,�,�!�J�J�1�1�!�J�J�0�0�!�J�J�O�O�!�J�J�0�0�!�J�J�1�1�3�3�O�C��&�&�u�'7�'7��d�C���J�&�"�-�-�e�l�l�;�_�C��&�&�u�'7�'7��d�C����Z�'��}�}��%�*�*�2H�2H�1I�)I�`�C��&�&�u�'7�'7��d�C����j�(���
�
������1A�1A�B�B�^�C��&�&�u�'7�'7��d�C����J�&���
�
� 0� 0� %�
�
� 4� 4� %�
�
� 1� 1� %�
�
� 3� 3� %�
�
��� %�
�
� 7� 7� %�
�
� 5� 5� %�
�
� 3� 3� 5�5�K�C��&�&�u�'7�'7��d�C���� � �!:�;��$�$�U�\�\�2�D���
�
�(�(�)�)�Z���"�"�5�#3�#3�S�$�?���� � �!6�7��5�>�>�)�%�.�.�2H�2H��SU�2V�]���"�"�5�#3�#3�S�$�?���:�%�%�-�-�$�*>�^���"�"�5�#3�#3�S�$�?���"�"�8�,��1J�1J�5�1Q�O���"�"�5�#3�#3�S�$�?���r)Nc�`�tjtjkryg}t|tj
�r(|j
|j|jg�n�t|tj�r|j|j�nLtjr)tjj|j�r|j|�ny|rdg|ddn|�dg|ddn|rdg|ddndg|ddtjtj|d�y)z:Convenience method to output queue-related debugging info.NzEVENT MANAGER: PruningrzEVENT MANAGER: Not pruningzEVENT MANAGER: QueueingzEVENT MANAGER: DequeuedT)rr�
debugLevel�
isinstancer	�
KeyboardEvent�extend�event_string�hw_code�BrailleEvent�appendrB�eventDebugFilter�matchr<rn)r&rq�	isEnqueue�isPrunerrs     r'�
_queuePrintlnzEventManager._queuePrintlncs������e�.�.�.�����a��2�2�3��M�M�1�>�>�1�9�9�5�6�
��;�3�3�
4��M�M�!�'�'�"��'�'�5�+A�+A�+G�+G����+O��M�M�!����3�4�F�1�Q�K�
�
 �7�8�F�1�Q�K�
�4�5�F�1�Q�K�4�5�F�1�Q�K�
���%�*�*�F�D�9r)c�>�|j|�ry|j|�|j�rH|j|�r7d}t	j
tj|d�|j�tj|j�}d|g}t	jtj|d�tj�j||j�}|tj�f|j |j"<|j$j'�|j(j+|�|j,s$t/j0|j2�|_|j$j5�y)z!Callback for Atspi object events.N�0EVENT MANAGER: Pruning event queue due to flood.Tz&EVENT MANAGER: App for event source is)r�r��_inFlood�_prioritizeDuringFloodrrr�_pruneEventsDuringFloodrr�r=rnrr��	getScript�time�
eventCacher<rrir�putrr�idle_add�_dequeue_object_eventrm)r&rqr7r�rrr�s      r'r!z"EventManager._enqueue_object_event}s$���<�<��?�����1���=�=�?�t�:�:�1�=�D�C����u�/�/��d�;��(�(�*��&�&�q�x�x�0��:�C�@��
���%�*�*�F�D�9��*�*�,�6�6�s�A�H�H�E��%&��	�	��$4����!�&�&�!������!������Q���}�}� �M�M�$�*D�*D�E�D�M������!r)c�:�tj�j�rytj�j	��Vtj�j�}tj�j
|d�|j�y)NFzNo focus)rr��focus_and_window_are_unknownrr��getDefaultScript�setActiveScript�idleMessage)r&�
defaultScripts  r'�
_onNoFocuszEventManager._onNoFocus�sq���#�#�%�B�B�D���$�$�&�6�6�8�@�*�5�5�7�H�H�J�M��%�%�'�7�7�
�z�R��%�%�'�r)c�v�d}	|jj�}|j|d��|t_tj
xs)tj
j
|j�}|rdtj�}d|j�d|jj��d�}tjtj|d�|j|�|rNdtj�z
d�d	|j�d
�}tjtj|d�dt_|jj�|jj�r)t!j"d|j$�d
|_d}|jj)�|S#t*j,$r4d}tjtj.|d�d
|_d}Y|St0$r'tj2tj.�Y|SwxYw)z/Handles all object events destined for scripts.TF)r�z
vvvvv PROCESS OBJECT EVENT z (queue size: z) vvvvvzTOTAL PROCESSING TIME: z.4fz
^^^^^ PROCESS OBJECT EVENT z ^^^^^
Ni�	rz>EVENT MANAGER: Attempted dequeue, but the event queue is empty)r�
get_nowaitr�r�objEventr�r�r<r��qsizer�eventDebugLevel�_processObjectEventrri�emptyr�timeout_addr�rrmr�Empty�LEVEL_SEVERErl�printException)r&�rerunrB�	debugging�	startTimer7s      r'r�z"EventManager._dequeue_object_event�s�����#	5��$�$�/�/�1�E����u���6�"�E�N�!�2�2�2�D� �1�1�7�7��
�
�C�
�� �I�I�K�	�3�E�J�J�<�@$�$(�$4�$4�$:�$:�$<�#=�W�F���"�"�5�#8�#8�#�u�E��$�$�U�+��-�d�i�i�k�I�.E�c�-J�3�E�J�J�<�x�I���"�"�5�#8�#8�#�u�E�!�E�N��O�O�#�#�%����%�%�'�� � ��t���7� !��
����O�O�#�#�%�����{�{�	�R�C����u�1�1�3��=��D�M��E����	5�� � ��!3�!3�4���	5�s�F=G�AH8�	+H8�7H8c��d|��}tjtj|d�||jvr|j|xxdz
cc<y|jj|�d|j|<y)zwTells this module to listen for the given event type.

        Arguments:
        - eventType: the event type.
        z)EVENT MANAGER: registering listener for: TrN)rrrrr"�register�r&�	eventTyper7s   r'�registerListenerzEventManager.registerListener�sn��:�)��E��
���5�+�+�S�$�7���2�2�2��&�&�y�1�Q�6�1��N�N�#�#�I�.�45�D�&�&�y�1r)c��d|��}tjtj|d�||jvry|j|xxdzcc<|j|dk(r)|jj|�|j|=yy)zTells this module to stop listening for the given event type.

        Arguments:
        - eventType: the event type.
        z+EVENT MANAGER: deregistering listener for: TNrr)rrrrr"�
deregisterr�s   r'�deregisterListenerzEventManager.deregisterListener�s���<�I�;�G��
���5�+�+�S�$�7��D�6�6�6���"�"�9�-��2�-��%�%�i�0�A�5��N�N�%�%�i�0��*�*�9�5�6r)c��d|g}tjtj|d�|jj	�D]}|j|��y)z�Tells the event manager to start listening for all the event types
        of interest to the script.

        Arguments:
        - script: the script.
        z)EVENT MANAGER: Registering listeners for:TN)rrnr�	listeners�keysr��r&r�rrr�s    r'�registerScriptListenersz$EventManager.registerScriptListeners�sR��>�v�F��
���%�*�*�F�D�9��)�)�.�.�0�	-�I��!�!�)�,�	-r)c��d|g}tjtj|d�|jj	�D]}|j|��y)z�Tells the event manager to stop listening for all the event types
        of interest to the script.

        Arguments:
        - script: the script.
        z,EVENT MANAGER: De-registering listeners for:TN)rrnrr�r�r�r�s    r'�deregisterScriptListenersz&EventManager.deregisterScriptListeners�sS��A�&�I��
���%�*�*�F�D�9��)�)�.�.�0�	/�I��#�#�I�.�	/r)c�,���jjd�rytj��}t	j
�j
|j|jd�}d|g}tjtj|d�|Sd}tj�j�}tj |�r+d|dg}tjtj"|d�yhd�}t%�fd	�|D��}d
|d|g}tjtj|d�t	j
�j
|�j|��}d|g}tjtj|d�|S)
z)Returns the script associated with event.�mouse:Fz"EVENT MANAGER: Script for event isTNrgz(is defunct. Cannot get script for event.>
�object:row-reordered�object:column-reordered�object:state-changed:checked�object:state-changed:pressed�object:state-changed:expanded�"object:state-changed:indeterminaterrIrJrL�object:state-changed:showing�object:state-changed:selected�object:state-changed:sensitivec3�T�K�|]}�jj|����!y�wr;rO)rRrArBs  �r'rTz2EventManager._getScriptForEvent.<locals>.<genexpr>-s �����D�Q��
�
�-�-�a�0�D�rVz+EVENT MANAGER: Getting script for event forzcheck:)�sanityCheck)r<rPr	�MouseButtonEventrr�r�r�rGrrnrrr�r=r�
is_defunct�
LEVEL_WARNINGrW)rB�
mouseEventr�rrr��	skipCheck�checks`      r'�_getScriptForEventzEventManager._getScriptForEventsT����:�:� � ��*�$�5�5�e�<�J�#�.�.�0�:�:�:�>�>�:�K\�K\�^c�d�F�:�F�C�F����e�.�.���=��M����&�&�u�|�|�4���!�!�#�&�&��-W�X�F����e�1�1�6�4�@��
�	� �D�)�D�D�D��?��h�PU�V��
���%�*�*�F�D�9��*�*�,�6�6�s�E�L�L�V[�6�\��6��?��
���%�*�*�F�D�9��
r)c��|jsy|s|j|�}|sy|tj�j	�k(ry|j|�sy|j
|�ry|j}|jd�rd}n@|jd�xr-|jxrtj|j�}|r1|jtj�j�k7ry	y
|jd�s|jd�r
|jry
|jd�rK|jr?tj|j�r tj|j�ry|jd�r?tj |j�r tj"|j�ryy)aDetermines if the event is one which should cause us to
        change which script is currently active.

        Returns a (boolean, string) tuple indicating whether or not
        this is an activatable event, and our reason (for the purpose
        of debugging).
        )Fz!event.source? What event.source??)Fz"There is no script for this event.)Fz,The script for this event is already active.)Fz/The script says not to activate for this event.)Tz9The script insists it should be activated for this event.rbT�object:state-changed:active)TzWindow activation)Fz+Window activation for already-active windowr\r])TzEvent source claimed focus.r�)Tz Selection change in focused menur�)TzModal panel is showing.)Fz/No reason found to activate a different script.)r=rrr�r��isActivatableEvent�forceScriptActivationr<rPr>r�is_framer�get_active_window�is_menu�is_focusable�is_panel�is_modal)r&rBr��eType�windowActivations     r'�_isActivatableEventz EventManager._isActivatableEvent6s����|�|�=���,�,�U�3�F��B��^�.�.�0�@�@�B�B�H��(�(��/�K��'�'��.�T��
�
�����-�.�#��$�/�/�0M�N� I��M�M� I�&1�&:�&:�5�<�<�&H�
���|�|�}�7�7�9�K�K�M�M�0�K����G�$���� >�?��=�=�6����;�<�����"�"�5�<�<�0�[�5M�5M�e�l�l�5[�;����:�;��#�#�E�L�L�1�k�6J�6J�5�<�<�6X�2�Gr)c��tj|j�r5d|jdg}t	j
tj|d�yy)NzEVENT MANAGER: source ofzis deadTF)rr�r=r<rrnr)r&rBrrs   r'�_eventSourceIsDeadzEventManager._eventSourceIsDeadosB�����E�L�L�)�0�%�*�*�i�H�F����e�.�.���=��r)c��|j|�rygd�}|j|vry|jtj�j�k7S)z=Returns true if this event should be ignored during a deluge.T�zobject:text-changed:deletezobject:text-changed:insertz!object:text-changed:delete:systemz!object:text-changed:insert:systemzobject:text-attributes-changedrKzobject:children-changed:addz"object:children-changed:add:system�object:children-changed:removez%object:children-changed:remove:systemz&object:property-change:accessible-namez-object:property-change:accessible-descriptionrLr�r�F)rr<r=rr�r�)r&rB�ignores   r'r�z EventManager._ignoreDuringDelugewsN���"�"�5�)��4�� �:�:�V�#���|�|�}�7�7�9�L�L�N�N�Nr)c��|jj�}|dkDr+d|��}tjtj|d�yy)N�dz%EVENT MANAGER: DELUGE! Queue size is TF�rr�rrr�r&�sizer7s   r'r�zEventManager._inDeluge�sG�����%�%�'���#�:�9�$��@�C����u�/�/��d�;��r)c��|j|�rygd�}|j|vry|xs"tj�j	�}|j
|k(S)z>Returns true if this event should be processed during a flood.FrT)rr<rr�r�r=)r&rBr\rs    r'�_processDuringFloodz EventManager._processDuringFlood�sX���"�"�5�)��4�� �:�:�V�#���H��1�1�3�F�F�H���|�|�u�$�$r)c�n�|jjd�r|jS|jjd�r|jS|jjd�ry|jjd�ry|jjd�ry|jjd�r@tj|j
�xstj|j
�S|jjd�ry|jjd	�ryy
)z@Returns true if this event should be prioritized during a flood.r]r�rMTrbrcr
zdocument:load-completezobject:state-changed:busyF)r<rPr>rr
r=�	is_window)r&rBs  r'r�z#EventManager._prioritizeDuringFlood�s����:�:� � �!?�@��=�=� ��:�:� � �!@�A��=�=� ��:�:� � �!@�A���:�:� � �!2�3���:�:� � �!4�5���:�:� � �!>�?��'�'����5�\��9N�9N�u�|�|�9\�\��:�:� � �!9�:���:�:� � �!<�=��r)c��|jj�}tjd�}t	j
�j
�}|jj�s�	|jj�}|j||�r%|j|�|j|d��	|jj�s|jj!�	|jj�s��||_|jj�}d||z
�d|��}tjtj|d�y#t$r4}d|��}tjtj|d�Yd}~��d}~wwxYw#|jj�s|jj!�wwxYw)	z6Gets rid of events we don't care about during a flood.rF)r�z)EVENT MANAGER: Exception pruning events: TN�EVENT MANAGER: z events pruned. New size: )rr�rrrr�r�r��getr"r�r�rlrrr�	task_done)r&�oldSize�newQueuer\rBrpr7�newSizes        r'r�z$EventManager._pruneEventsDuringFlood�s����"�"�(�(�*���;�;�q�>���(�(�*�=�=�?���"�"�(�(�*�
1��(�(�,�,�.��
�+�+�E�5�9��L�L��'��&�&�u�e�&�<��'�'�-�-�/��$�$�.�.�0��"�"�(�(�*�$����"�"�(�(�*����'� 1�2�2L�W�I�V��
���5�+�+�S�$�7���
@�A�%��I���"�"�5�#3�#3�S�$�?�?��
@���'�'�-�-�/��$�$�.�.�0�0�s0�-E �7F � 	F�)*F�F �F�F � 7Gc��|jj�}|dkDr+d|��}tjtj|d�yy)N�2z$EVENT MANAGER: FLOOD? Queue size is TFrrs   r'r�zEventManager._inFlood�sG�����%�%�'���"�9�8���?�C����u�/�/��d�;��r)c�T�||k(r6d|j�d�}tjtj|d�y|jr6d|j�d�}tjtj|d�ytj|j�rWtjtjk(r6d|j�d�}tjtj|d�yd|j�d�}tjtj|d�y)	NzEVENT MANAGER: Processing z: script for event is activeTz%: script handles events when inactivez!: progress bar verbosity is 'all'zEVENT MANAGER: Not processing z due to lack of reasonF)r<rrr�presentIfInactiver�is_progress_barr=r
�progressBarVerbosity�PROGRESS_BAR_ALL)r&rB�eventScript�activeScriptr7s     r'�_shouldProcessEventz EventManager._shouldProcessEvent�s����,�&�.�u�z�z�l�:V�W�C����u�/�/��d�;���(�(�.�u�z�z�l�:_�`�C����u�/�/��d�;���&�&�u�|�|�4��,�,��0I�0I�I�.�u�z�z�l�:[�\�C����u�/�/��d�;��.�u�z�z�l�:P�Q��
���5�+�+�S�$�7�r)c�`�|j|�ry|j}|jd�rD|jt	j
�k(r#t
j�j�ytj|j�st	j|j�r�d|jg}tjtj|d�|jd�s@|jd�rvtj�j!�|jk(rGtj�j#d�t
j�j%dd�y|jd�r4|j'd	�s#t
j�j�nR|jd
�rAt	j(|j�r"t
j�j�t	j*|j�r4d|jg}tjtj|d�y|j-�r�|j/|�s(d}tj0tj|d�y|j3|�r7d
}tj0tj|d�|j5�tj6tj|d��tj8r0tj8j;|�r�|jd�s�d}tj<tj||j�t?|j@tBjD�rXtj0tj|�d��tj<tj||j@d��|jG|�}|s(d}tj0tj|d�y|jI||�\}}d|�d|�d�}tj0tj|d�|r%	t
j�j%||�t
j�jM�}
|jO|||
�sy	|jQ|�tjtjTk\rY|rV|jW�}|jY�D]2\}}
d|�d|
��}tj0tj|d��4yyy#tJ$r?}	d|jd|	g}tjtj|d�Yd}	~	yd}	~	wwxYw#tJ$re}	d|j�d|	��}tj0tj|d�tjRtj�Yd}	~	��/d}	~	wwxYw)zjHandles all object events destined for scripts.

        Arguments:
        - e: an at-spi event.
        Nrz'EVENT MANAGER: Ignoring defunct object:Trczwindow:destroyz Active window is dead or defunctzwindow:�creater
z)EVENT MANAGER: Ignoring iconified object:z6EVENT MANAGER: Not processing this event due to flood.r�)�	timestampr�z                                 z	ANY DATA:F)�
includeAppz%ERROR: Could not get script for eventz%EVENT MANAGER: Change active script: z (�)z2EVENT MANAGER: Exception setting active script for�:z$EVENT MANAGER: Exception processing z: r&)-rsr<rPr=r�get_desktoprr��reclaimScriptsrr�rrrnrrr�clear_stater�r�r
�is_iconifiedr�r"rr�r��printObjectEventr�r��printDetailsr�r@r�
Accessiblerrrlr�r5�processObjectEventr�r��getTransferableAttributes�items)r&rBrrrr7�indentr��setNewActiveScriptr6rpr4�
attributes�keyrzs              r'r�z EventManager._processObjectEvent
s������u�%���
�
�����<�=��|�|�{�6�6�8�8��%�%�'�6�6�8�����E�L�L�)�[�-C�-C�E�L�L�-Q�?����N�F����e�.�.���=���� 3�4��8H�8H�IY�8Z� �+�+�-�?�?�A�U�\�\�Q��(�(�*�6�6�7Y�Z��)�)�+�;�;��<�>�����I�&�u�~�~�h�/G��%�%�'�6�6�8�
�
�
�;�
<��#�#�E�L�L�1��%�%�'�6�6�8��#�#�E�L�L�1�A�5�<�<�P�F����e�.�.���=���=�=�?��+�+�E�2�N���"�"�5�#3�#3�S�$�?���*�*�5�1�H���"�"�5�#3�#3�S�$�?��,�,�.�
���u�/�/��$�G��%�%��)?�)?�)E�)E�e�)L��#�#�H�-��F����u�/�/�����F��%�.�.�%�*:�*:�;��"�"�5�#3�#3��x�y�5I�J��"�"�5�#3�#3�V�U�^�^�X]�^��(�(��/���9�C����u�/�/��d�;��%)�%=�%=�e�V�%L�"��F�5�6H�5I��F�8�ST�U��
���5�+�+�S�$�7��
��)�)�+�;�;�F�F�K�&�0�0�2�B�B�D���'�'��v�|�D��	3��%�%�e�,����u�/�/�/�F��9�9�;�J�(�.�.�0�
@�
��U�'��u�B�u�g�6���"�"�5�#3�#3�S�$�?�
@�5;�/��#�
�N��,�,��U�4���!�!�%�"2�"2�F�D�A���	
���	3�8�����B�u�g�N�C����u�/�/��d�;�� � ��!1�!1�2�2��	3�s1�
$U4�(V?�4	V<�=5V7�7V<�?	X-�AX(�(X-c��tj|||||�}|js�tjtj
d|���t
j�j�}|r�|��|jtjvrY|jtj|j�tj|j=|j|_
n.|j�"|j|j�d|_
|j�t!j�j#|�y)N�
)r	r��is_duplicaterrrrr�r��keyval_namer�grabbedModifiers�remove_key_grabr$�refreshModifierKeyGrab�processr
�update_key_map)	r&r#�pressed�keycode�keysym�state�text�
keyboardEventr�s	         r'r.z"EventManager._processKeyboardEventjs��#�1�1�'�7�F�E�SW�X�
��)�)����u�/�/�2�m�_�1E�F�$�.�.�0�@�@�B�F��6�-� �,�,�
�0K�0K�K��*�*�:�+F�+F�}�G`�G`�+a�b�"�3�3�M�4M�4M�N�'4�'@�'@�D�$��%�%�1��1�1�$�2B�2B�C�'+�D�$�	����	�(�(�*�9�9�-�Hr)c�b�tj|�}|t_|j	�S)zProcesses this BrailleEvent.)r	r�r�lastInputEventrQ)r&rB�
braille_events   r'�process_braille_eventz"EventManager.process_braille_event�s+��$�0�0��7�
�$1�
�!��$�$�&�&r))TFru)TNr;)�__name__�
__module__�__qualname__r(r0r2r8rsr�r�r!r�r�r�r�r�r��staticmethodrrrr�r�r"r�r�r�r5r�r.r\�r)r'rr.s���P�
O�Q�.�X�tk�Z:�4"�4	�)�V6� 6�$-�/��(��(�T7H�r�O�6�%�8�:8�6��*[@�zI�0'r)rc��tSr;)�_managerrar)r'r�r��s���Or))�__id__�__version__�__date__�
__copyright__�__license__�gi�require_version�
gi.repositoryrrrrr�rurrr	r
rrr
�	ax_objectr�ax_utilitiesrrrcr�rar)r'�<module>rnsz��*������0�
���	�����7�E�"���������#�����%�Y
'�Y
'�v�>��r)

Zerion Mini Shell 1.0