%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__/object_navigator.cpython-312.pyc

�

g
fy/���dZdZdZdZdZdZddlmZddlmZdd	lm	Z	dd
lm
Z
ddlmZddlmZdd
l
mZddlmZddlmZGd�d�Ze�Zd�Zy)�4Provides ability to navigate objects hierarchically.z$Id$z
$Revision$z$Date$z Copyright (c) 2023 The Orca Team�LGPL�)�cmdnames)�debug)�
focus_manager)�input_event)�keybindings)�messages)�AXEventSynthesizer)�AXObject)�AXUtilitiesc��eZdZdZd�Zdd�Zdd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zy)�ObjectNavigatorrc��d|_d|_d|_d|_|j	d�|_t
j�|_y)NT)	�_navigator_focus�_last_navigator_focus�_last_locus_of_focus�	_simplify�get_handlers�	_handlersr	�KeyBindings�	_bindings)�selfs �7/usr/lib/python3/dist-packages/orca/object_navigator.py�__init__zObjectNavigator.__init__+sC�� $���%)��"�$(��!�����*�*�4�0���$�0�0�2���c��|rCd}tjtj|d�|j�|jS|jj�r|j�|jS)z)Returns the object-navigator keybindings.z&OBJECT NAVIGATOR: Refreshing bindings.T)r�printMessage�
LEVEL_INFO�_setup_bindingsr�isEmpty)r�refresh�
is_desktop�msgs    r�get_bindingszObjectNavigator.get_bindings3sd���:�C����u�/�/��d�;�� � �"��~�~���^�^�
#�
#�
%�� � �"��~�~�rc��|r7d}tjtj|d�|j�|jS)z&Returns the object-navigator handlers.z&OBJECT NAVIGATOR: Refreshing handlers.T)rrr�_setup_handlersr)rr"r$s   rrzObjectNavigator.get_handlers?s:���:�C����u�/�/��d�;�� � �"��~�~�rc
�L�tj�|_|jjtjdtj
tj|jjd���|jjtjdtj
tj|jjd���|jjtjdtj
tj|jjd���|jjtjdtj
tj|jjd���|jjtjd	tj
tj|jjd
���|jjtjdtj
tj|jjd���d
}tjtj|d�y)z*Sets up the object-navigator key bindings.�Up�object_navigator_up�Down�object_navigator_down�Right�object_navigator_next�Left�object_navigator_previous�Return�object_navigator_perform_action�s� object_navigator_toggle_simplifyz"OBJECT NAVIGATOR: Bindings set up.TN)r	rr�add�
KeyBinding�defaultModifierMask�ORCA_CTRL_MODIFIER_MASKr�getrrr�rr$s  rr zObjectNavigator._setup_bindingsIs���%�0�0�2���������"�"���/�/��3�3����"�"�#8�9�	
;�	<�	
������"�"���/�/��3�3����"�"�#:�;�	
=�	>�	
������"�"���/�/��3�3����"�"�#:�;�	
=�	>�	
������"�"���/�/��3�3����"�"�#>�?�	
A�	B�	
������"�"���/�/��3�3����"�"�#D�E�	
G�	H�	
������"�"���/�/��3�3����"�"�#E�F�	
H�	I�3��
���5�+�+�S�$�7rc�$�i|_tj|jtj
�|jd<tj|jtj�|jd<tj|jtj�|jd<tj|jtj�|jd<tj|jtj�|jd<tj|jtj�|jd<d}t!j"t j$|d�y	)
z2Sets up the object-navigator input event handlers.r*r,r.r0r2r4z"OBJECT NAVIGATOR: Handlers set up.TN)rr�InputEventHandler�upr�NAVIGATOR_UP�down�NAVIGATOR_DOWN�next�NAVIGATOR_NEXT�previous�NAVIGATOR_PREVIOUS�perform_action�NAVIGATOR_PERFORM_ACTION�toggle_simplify�NAVIGATOR_TOGGLE_SIMPLIFIEDrrrr:s  rr'zObjectNavigator._setup_handlers{sH�����
�)�)�����%�%�
'�	
���,�-�
�)�)��	�	��'�'�
)�	
���.�/�
�)�)��	�	��'�'�
)�	
���.�/�
�)�)��
�
��+�+�
-�	
���2�3�
�)�)��#�#��1�1�
3�	
���8�9�
�)�)��$�$��4�4�
6�	
���9�:�
3��
���5�+�+�S�$�7rc�,�tj|�S)z<Returns True if obj should be included in simple navigation.)r
�is_paragraph�r�objs  r�_include_in_simple_navigationz-ObjectNavigator._include_in_simple_navigation�s���'�'��,�,rc�Z�|j|�r+d|dg}tjtj|d�y|jj|�r+d|dg}tjtj|d�yd|g}tjtj|d�y)z>Returns True if obj should be excluded from simple navigation.zOBJECT NAVIGATOR: Not excludingz: explicit inclusionTFzOBJECT NAVIGATOR: Excludingz: is layout only)rMr�printTokensr�	utilities�isLayoutOnly)r�scriptrL�tokenss    r�_exclude_from_simple_navigationz/ObjectNavigator._exclude_from_simple_navigation�s����-�-�c�2�7��>T�U�F����e�.�.���=�����(�(��-�3�S�:L�M�F����e�.�.���=��3�S�9��
���%�*�*�F�D�9�rc�(�tj|�sgSttj|��}|js|Sg}|D]G}|j||�r"|j
|j||���7|j|��I|S)zJReturns a list of children for obj, taking simple navigation into account.)	r�get_child_count�list�
iter_childrenrrT�extend�	_children�append)rrRrL�children�functional_children�childs      rrZzObjectNavigator._children�s����'�'��,��I���.�.�s�3�4���~�~��O�!���	2�E��3�3�F�E�B�#�*�*�4�>�>�&�%�+H�I�#�*�*�5�1�		2�#�"rc���tj|�}|js|S|�<|j||�r*tj|�}|�|j||�r�*|S)zBReturns the parent for obj, taking simple navigation into account.)r�
get_parentrrT)rrRrL�parents    r�_parentzObjectNavigator._parent�sg���$�$�S�)���~�~��M�� �T�%I�%I�&�RX�%Y��(�(��0�F�� �T�%I�%I�&�RX�%Y��
rc�4�|j|_||_y)z8Changes the navigator focus, storing the previous focus.N)rrrKs  r�_set_navigator_focusz$ObjectNavigator._set_navigator_focus�s��&*�%:�%:��"� #��rc��tj�j�\}}|xs"tj�j�}|j|k(s|�|tj
k(ry||_||_y)z9Updates the navigator focus to Orca's object of interest.N)r�
getManager�&get_active_mode_and_object_of_interest�get_locus_of_focusr�FLAT_REVIEWr)r�mode�regionrLs    r�updatezObjectNavigator.update�sn��%�/�/�1�X�X�Z���f��G�
�0�0�2�E�E�G���$�$��+��~�$�-�*C�*C�"C�� #���$'��!rc�2�d|jg}tjtj|d�t	j
�j
|jtj��|j|j|j��y)z1Presents the current navigator focus to the user.zOBJECT NAVIGATOR: PresentingT)rj)�priorObjN)
rrrOrrrf�emit_region_changed�OBJECT_NAVIGATOR�
presentObjectr)rrRrSs   r�presentzObjectNavigator.present�sy��1�$�2G�2G�H��
���%�*�*�F�D�9�� � �"�6�6��!�!�
�(F�(F�	7�	H����T�2�2�T�=W�=W��XrNc���|j�|j||j�}|�#|j|�|j	|�y|jtj�y)z=Moves the navigator focus to the parent of the current focus.N)rlrbrrdrr�presentMessager
�NAVIGATOR_NO_PARENT)rrR�eventras    rr=zObjectNavigator.up�sW��	
���
����f�d�&;�&;�<�����%�%�f�-��L�L�� ��!�!�(�">�">�?rc���|j�|j||j�}|s |jtj
�y|j
|d�|j|�y)zBMoves the navigator focus to the first child of the current focus.N�)rlrZrrtr
�NAVIGATOR_NO_CHILDRENrdrr)rrRrvr\s    rr?zObjectNavigator.downs[��	
���
��>�>�&�$�*?�*?�@����!�!�(�"@�"@�A���!�!�(�1�+�.����V�rc��|j�|j||j�}|� |jtj
�y|j
||�}|j|vru|j|j�}|t|�dz
kr)|j||dz�|j|�y|jtj
�y|j|�|j|�y)zCMoves the navigator focus to the next sibling of the current focus.Nr)rlrbrrtr
�NAVIGATOR_NO_NEXTrZ�index�lenrdrr�rrRrvra�siblingsr|s      rrAzObjectNavigator.nexts���	
���
����f�d�&;�&;�<���>��!�!�(�"<�"<�=���>�>�&�&�1��� � �H�,��N�N�4�#8�#8�9�E��s�8�}�q�(�(��)�)�(�5��7�*;�<����V�$��%�%�h�&@�&@�A��%�%�f�-��L�L�� rc��|j�|j||j�}|� |jtj
�y|j
||�}|j|vri|j|j�}|dkDr)|j||dz
�|j|�y|jtj
�y|j|�|j|�y)zGMoves the navigator focus to the previous sibling of the current focus.Nrxr)
rlrbrrtr
�NAVIGATOR_NO_PREVIOUSrZr|rdrrr~s      rrCzObjectNavigator.previous&s���	
���
����f�d�&;�&;�<���>��!�!�(�"@�"@�A���>�>�&�&�1��� � �H�,��N�N�4�#8�#8�9�E��q�y��)�)�(�5��7�*;�<����V�$��%�%�h�&D�&D�E��%�%�f�-��L�L�� rc��|j|_|jr |jtj�y|jtj�y)zToggles simplified navigation.T)rrtr
�NAVIGATOR_SIMPLIFIED_ENABLED�NAVIGATOR_SIMPLIFIED_DISABLED�rrRrvs   rrGzObjectNavigator.toggle_simplify;sK��"�^�^�+����>�>��!�!�(�"G�"G�H��
�!�!�(�"H�"H�I�rc��tj|j�rytj|jd�y)z'Attempts to click on the current focus.Tr)r�try_all_clickable_actionsr�click_objectr�s   rrEzObjectNavigator.perform_actionEs2���7�7��8M�8M�N���'�'��(=�(=�q�A�r)FT)F)N)�__name__�
__module__�__qualname__�__doc__rr%rr r'rMrTrZrbrdrlrrr=r?rArCrGrE�rrrr(sc��>�3�
��08�d$8�L-�
�0#�(�$�
(�Y�	@�
�!�*!�*�rrc��tS)zReturns the Object Navigator)�
_navigatorr�rr�getNavigatorr�Os
���rN)r��__id__�__version__�__date__�
__copyright__�__license__�rrrrr	r
�ax_event_synthesizerr�	ax_objectr�ax_utilitiesr
rr�r�r�rr�<module>r�sZ��*;�������2�
���������4��%�c�c�L	�
�
�r

Zerion Mini Shell 1.0