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

�

g
fJ���dZdZdZdZdZdZddlmZddlmZdd	lm	Z	dd
lm
Z
ddlmZddlmZdd
lm
Z
ddlmZGd�d�Zy)z3Provides an Orca-controlled caret for text content.z$Id$z
$Revision$z$Date$z$Copyright (c) 2013-2015 Igalia, S.L.�LGPL�)�cmdnames)�debug)�input_event)�keybindings)�messages)�
orca_state)�settings_manager)�AXTextc��eZdZdZd�Zd�Zdd�Zdd�Zd�Zd�Z	d�Z
dd	�Zd
�Zdd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�CaretNavigationz=Implements the caret navigation support available to scripts.c�~�d|_|jd�|_tj�|_d|_y)NFT)�
_suspended�get_handlers�	_handlersr�KeyBindings�	_bindings�_last_input_event)�selfs �7/usr/lib/python3/dist-packages/orca/caret_navigation.py�__init__zCaretNavigation.__init__*s5�� ����*�*�4�0���$�0�0�2���!%���c�r�||jj�vry|j|jk(ryy)z0Returns True if handler is a navigation command.FT)r�values�function�toggle_enabled)r�handlers  r�handles_navigationz"CaretNavigation.handles_navigation3s6���$�.�.�/�/�1�1�����t�2�2�2��rc��|rCd}tjtj|d�|j�|jS|jj�r|j�|jS)z)Returns the caret-navigation keybindings.z&CARET NAVIGATION: Refreshing bindings.T)r�printMessage�
LEVEL_INFO�_setup_bindingsr�isEmpty)r�refresh�
is_desktop�msgs    r�get_bindingszCaretNavigation.get_bindings>sd���:�C����u�/�/��d�;�� � �"��~�~���^�^�
#�
#�
%�� � �"��~�~�rc��|r7d}tjtj|d�|j�|jS)z&Returns the caret-navigation handlers.z&CARET NAVIGATION: Refreshing handlers.T)rr r!�_setup_handlersr)rr$r&s   rrzCaretNavigation.get_handlersJs:���:�C����u�/�/��d�;�� � �"��~�~�rc�2�i|_tj|jtj
|j��|jd<tj�jd�xr
|j}tj|jtj|��|jd<tj|jtj|��|jd<tj|jtj|��|jd<tj|j tj"|��|jd<tj|j$tj&|��|jd<tj|j(tj*|��|jd	<tj|j,tj.|��|jd
<tj|j0tj2|��|jd<tj|j4tj6|��|jd<tj|j8tj:|��|jd
<d|j��}t=j>t<j@|d�y)z2Sets up the caret-navigation input event handlers.)�enabledr�caretNavigationEnabled�next_character�previous_character�	next_word�
previous_word�	next_line�
previous_line�
start_of_file�end_of_file�
start_of_line�end_of_linez.CARET NAVIGATION: Handlers set up. Suspended: TN)!rr�InputEventHandlerrr�CARET_NAVIGATION_TOGGLErr
�
getManager�
getSetting�_next_character�CARET_NAVIGATION_NEXT_CHAR�_previous_character�CARET_NAVIGATION_PREV_CHAR�
_next_word�CARET_NAVIGATION_NEXT_WORD�_previous_word�CARET_NAVIGATION_PREV_WORD�
_next_line�CARET_NAVIGATION_NEXT_LINE�_previous_line�CARET_NAVIGATION_PREV_LINE�_start_of_file�CARET_NAVIGATION_FILE_START�_end_of_file�CARET_NAVIGATION_FILE_END�_start_of_line�CARET_NAVIGATION_LINE_START�_end_of_line�CARET_NAVIGATION_LINE_ENDrr r!)rr+r&s   rr)zCaretNavigation._setup_handlersTs������
�)�)��#�#��0�0�"�o�o�-�
/�	
���'�(�#�-�-�/�:�:�;S�T�$��O�O�#�	�
�)�)��$�$��3�3�!�
#�	
���'�(�
�)�)��(�(��3�3�!�
#�	
���+�,�
�)�)�����3�3�!�
#�	
���{�#�
�)�)��#�#��3�3�!�
#�	
����'�
�)�)�����3�3�!�
#�	
���{�#�
�)�)��#�#��3�3�!�
#�	
����'�
�)�)��#�#��4�4�!�
#�	
����'�
�)�)��!�!��2�2�!�
#�	
���}�%�
�)�)��#�#��4�4�!�
#�	
����'�
�)�)��!�!��2�2�!�
#�	
���}�%�?�t���>O�P��
���5�+�+�S�$�7rc
��
�tj�|_|jjtjdtj
tj|jjd�d|j��tj�jd�xr
|j}|jjtjdtj
tj|jjd�d|��|jjtjdtj
tj|jjd�d|��|jjtjdtj
tj|jjd	�d|��|jjtjdtj
tj|jjd
�d|��|jjtjdtj
tj|jjd�d|��|jjtjd
tj
tj|jjd�d|��|jjtjdtj
tj|jjd�d|��|jjtjdtj
tj|jjd�d|��|jjtjdtj
tj|jjd�d|��|jjtjdtj
tj|jjd�d|��tj�j|j|jd�|_d|j��}t!j"t j$|d�|jg}t!j&t j$|d�y)z*Sets up the caret-navigation key bindings.�F12rrr,�Rightr-�Leftr.r/r0�Downr1�Upr2�Endr6�Homer5r4r3Fz.CARET NAVIGATION: Bindings set up. Suspended: TN)rrr�add�
KeyBinding�defaultModifierMask�ORCA_MODIFIER_MASKr�getrr
r9r:�NO_MODIFIER_MASK�CTRL_MODIFIER_MASK�overrideKeyBindingsrr r!�printTokens)rr+r&�tokenss    rr"zCaretNavigation._setup_bindings�s*��%�0�0�2���������"�"���/�/��.�.����"�"�#3�4���O�O�#�

%�	&�#�-�-�/�:�:�;S�T�$��O�O�#�	�	
������"�"���/�/��,�,����"�"�#3�4���

�	�	
������"�"���/�/��,�,����"�"�#7�8���

�	�	
������"�"���/�/��.�.����"�"�;�/���

�	�	
������"�"���/�/��.�.����"�"�?�3���

�	�	
������"�"���/�/��,�,����"�"�;�/���

�	�	
������"�"���/�/��,�,����"�"�?�3���

�	�	
������"�"���/�/��,�,����"�"�=�1���

�	�	
������"�"���/�/��,�,����"�"�?�3���

�	�	
������"�"���/�/��.�.����"�"�=�1���

�	�	
������"�"���/�/��.�.����"�"�?�3���

�	�*�4�4�6�J�J��N�N�D�N�N�E�3���?�t���>O�P��
���5�+�+�S�$�7��.�.�!��
���%�*�*�F�D�9rc�b�|jduxrH|jtjk(xs)tjj|j�}|j�|jj	�}nd}d|�d|��}tjt
j|d�|S)z>Returns true if the last input event was a navigation command.N�Nonez)CARET NAVIGATION: Last navigation event (z) is last key event: T)rr	�lastNonModifierKeyEvent�isReleaseFor�asSingleLineStringrr r!)r�result�stringr&s    r�'last_input_event_was_navigation_commandz7CaretNavigation.last_input_event_was_navigation_commands����'�'�t�3�\��'�'�:�+M�+M�M�[��5�5�B�B�4�CY�CY�Z�	��!�!�-��+�+�>�>�@�F��F�9�&��AV�W]�V^�_��
���5�+�+�S�$�7��
rc��d}|r|d|��z
}tjtj|d�|jjD]}|jj|d���!|j
d�|_|jd�|_|jjD]*}|jj||j���,y)z9Refreshes caret navigation bindings and grabs for script.z/CARET NAVIGATION: Refreshing bindings and grabs�: T)�includeGrabsN)rr r!r�keyBindings�removerrr'rWr)r�script�reasonr&�bindings     r�refresh_bindings_and_grabsz*CaretNavigation.refresh_bindings_and_grabs&s���@����R��x�=� �C�
���5�+�+�S�$�7��~�~�1�1�	B�G����%�%�g�D�%�A�	B��*�*�4�0����*�*�4�0����~�~�1�1�	N�G����"�"�7�T�_�_�9L�"�M�	Nrc��|sytj�}|jd�}|rtj}ntj
}|j
|�|jd|�d|_|j|d�y)zToggles caret navigation.Fr,Nztoggling caret navigationT)
r
r9r:r�CARET_CONTROL_ORCA�CARET_CONTROL_APP�presentMessage�
setSettingrrq)rrn�event�_settings_managerr+rgs      rrzCaretNavigation.toggle_enabled7s�����,�7�7�9��'�2�2�3K�L�L����0�0�F��/�/�F����f�%��$�$�%=�w�G�!%����'�'��0K�L�rc���||jk(ryd|��}|r|d|��z
}tjtj|d�||_|j	|d|���y)z=Suspends caret navigation independent of the enabled setting.Nz&CARET NAVIGATION: Commands suspended: rjTzSuspended changed to )rrr r!rq)rrn�	suspendedror&s     r�suspend_commandsz CaretNavigation.suspend_commandsJsi������'��6�y�k�B����R��x�=� �C�
���5�+�+�S�$�7�#����'�'��2G�	�{�0S�Trc���|sy|jj�\}}|sy||_|jj||�|j	�|j|�|j
|�y)zMoves to the next character.FT)�	utilities�nextContextr�setCaretPosition�presentationInterrupt�
updateBraille�sayCharacter�rrnrw�obj�offsets     rr;zCaretNavigation._next_characterXsq�����&�&�2�2�4���V���!&������)�)�#�v�6��$�$�&����S�!����C� �rc���|sy|jj�\}}|sy||_|jj||�|j	�|j|�|j
|�y)z Moves to the previous character.FT)r}�previousContextrrr�r�r�r�s     rr=z#CaretNavigation._previous_characterisq�����&�&�6�6�8���V���!&������)�)�#�v�6��$�$�&����S�!����C� �rc��|sy|jjd��\}}|jj||�}|sy|dd|dd|dd}}}|r|dj�r|dz}||_|jj||�|j
�|j|�|j|�y)	zMoves to the next word.FT��	skipSpace������r)	r}r~�getWordContentsAtOffset�isspacerrr�r��sayWord)rrnrwr�r��contents�endrgs        rr?zCaretNavigation._next_wordzs������&�&�2�2�T�2�B���V��#�#�;�;�C��H����#�B�<��?�H�R�L��O�X�b�\�!�_�&�S���f�R�j�(�(�*��1�H�C�!&������)�)�#�s�3��$�$�&����S�!����s��rc�P�|sy|jjd��\}}|jj||�}|sy||_|dd|dd}}|jj	||�|j�|j
|�|j|�y)zMoves to the previous word.FTr�r�r)r}r�r�rrr�r�r�)rrnrwr�r�r��starts       rrAzCaretNavigation._previous_word�s������&�&�6�6��6�F���V��#�#�;�;�C��H����!&����a�[��^�X�a�[��^�U�����)�)�#�u�5��$�$�&����S�!����s��rc�X�|sy|j�rLtj�}|jd�r'd}t	j
tj|�y|jj�\}}|jj||�}|r|dsy|jj�}|sy||_|dd|dd}	}|jj||	�|j�|j||dd��|j|�y)	zMoves to the next line.F�rewindAndFastForwardInSayAll�FCARET NAVIGATION: inSayAll and rewindAndFastforwardInSayAll is enabledTr�rr�)�priorObj)�inSayAllr
r9r:rr r!r}�getCaretContext�getLineContentsAtOffset�getNextLineContentsrrr��
speakContents�displayContents)
rrnrwrxr&r�r��liner�r�s
          rrCzCaretNavigation._next_line�s�����?�?�� 0� ;� ;� =�� �+�+�,J�K�^���"�"�5�#3�#3�S�9���&�&�6�6�8���V����7�7��V�D����a����#�#�7�7�9����!&����a�[��^�X�a�[��^�U�����)�)�#�u�5��$�$�&����X��R�����<����x�(�rc���|sy|j�rLtj�}|jd�r'd}t	j
tj|�y|jj�}|sy||_	|dd|dd}}|jj||�|j�|j|�|j|�y)zMoves to the previous line.Fr�r�Tr�r)r�r
r9r:rr r!r}�getPreviousLineContentsrrr�r�r�)rrnrwrxr&r�r�r�s        rrEzCaretNavigation._previous_line�s������?�?�� 0� ;� ;� =�� �+�+�,J�K�^���"�"�5�#3�#3�S�9���#�#�;�;�=����!&����a�[��^�X�a�[��^�U�����)�)�#�u�5��$�$�&����X�&����x�(�rc�V�|sy|jj�\}}|jj||�}|r|dsy||_|dd|dd}}|jj	||�|j�|j
|�|j|�y)zMoves to the start of the line.Fr�rT)r}r�r�rrr�r�r�)rrnrwr�r�r�r�s       rrKzCaretNavigation._start_of_line�s������&�&�6�6�8���V����7�7��V�D����a���!&����!�W�Q�Z��a����U�����)�)�#�u�5��$�$�&����C� ����t�$�rc��|sy|jj�\}}|jj||�}|r|dsy|dd|dd|dd}}}|j�r|dj	�r|dz}||_|jj
||�|j�|j|�|j|�y)zMoves to the end of the line.Fr�r�r�r�rT)
r}r�r��stripr�rrr�r�r�)rrnrwr�r�r�r�rgs        rrMzCaretNavigation._end_of_line�s������&�&�6�6�8���V����7�7��V�D����a�����8�A�;��R����T�"�X�a�[�&�S���<�<�>�f�R�j�0�0�2��1�H�C�!&������)�)�#�s�3��$�$�&����C� ����t�$�rc��|sy|jj�}|jj|d�\}}|jj||�}|sy||_|dd|dd}}|jj||�|j
�|j|�|j|�y)zMoves to the start of the file.Fr�rT)	r}�
documentFrame�findFirstCaretContextr�rrr�r�r�)rrnrw�documentr�r�r�s       rrGzCaretNavigation._start_of_files������#�#�1�1�3���&�&�<�<�X�q�I���V��#�#�;�;�C��H����!&����q�k�!�n�h�q�k�!�n�V�����)�)�#�v�6��$�$�&����X�&����x�(�rc��|sy|jj�}d|g}tjtj|d�|jj|�}d|d|g}tjtj|d�t
dtj|�dz
�}|r)|jj||�\}}|sn||}}|r�)|jj||�}	|	sy||_|	dd|	dd	}}|jj||�|j�|j|	�|j|	�y)
zMoves to the end of the file.FzCARET NAVIGATION: Go to end ofTz CARET NAVIGATION: Last object in�isr�rr�r�)r}r�rr_r!�getLastObjectInDocument�maxr�get_character_countr~r�rrr�r�r�)
rrnrwr�r`r�r��lastobj�
lastoffsetr�s
          rrIzCaretNavigation._end_of_filesN�����#�#�1�1�3��2�H�=��
���%�*�*�F�D�9����6�6�x�@��4�h��c�J��
���%�*�*�F�D�9��Q��2�2�3�7�!�;�<���"(�"2�"2�">�">�s�F�"K��G�Z���!�:��C�	��#�#�;�;�C��H����!&����r�l�1�o�x��|�A��V�����)�)�#�v�6��$�$�&����X�&����x�(�rN)FT)F)�)�__name__�
__module__�__qualname__�__doc__rrr'rr)r"rhrqrr{r;r=r?rArCrErKrMrGrI�rrr
r
'so��G�&�	�
��K8�Zs:�j� N�"�&U��"�"�,�&�<�4�&�,�(rr
N)r��__id__�__version__�__date__�
__copyright__�__license__r�rrrrrr	r
�ax_textrr
r�rr�<module>r�sG��*:�	������6�
�����������P�Pr

Zerion Mini Shell 1.0