%PDF- %PDF-
Mini Shell

Mini Shell

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

�

g
f|���dZdZdZdZdZdZddlZejdd	�dd
lm	Z	ddl
Z
ddlZddlm
Z
ddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddl m!Z!ddl"m#Z#ddl$m%Z%ddl&m'Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-ddl.m/Z/ddl0m1Z1ddl2m3Z3ddl4m5Z5dd
l6m7Z7ddl8m9Z9ddl:m;Z;ddl<m=Z=Gd�de%j|�Z>y)z:The default Script for presenting information to the user.z$Id$z
$Revision$z$Date$zOCopyright (c) 2004-2009 Sun Microsystems Inc.Copyright (c) 2010 Joanmarie Diggs�LGPL�N�Atspiz2.0)r)�
AXDocument)�AXObject)�AXTable)�AXText)�AXUtilities)�AXValuec���eZdZdZdZdZdZdZdZdZ	dZ
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�d�Zd�Zd�Zd�Zd�d�Zd�d�Zd�Zd�d�Z�fd�Z�fd�Zd�Zd�Zd�Zd�Zd�d�Z d�Z!d �Z"d�d!�Z#d�d"�Z$d�d#�Z%d�d$�Z&d�d%�Z'd�d&�Z(d�d'�Z)d�d(�Z*d�d)�Z+d�d*�Z,d�d+�Z-d�d,�Z.d-�Z/d�d.�Z0d�d/�Z1d�d0�Z2d1�Z3d2�Z4d3�Z5d4�Z6d5�Z7d6�Z8d7�Z9d8�Z:d9�Z;d:�Z<d;�Z=d<�Z>d=�Z?d>�Z@d?�ZAd@�ZBdA�ZCdB�ZDdC�ZEdD�ZFdE�ZGdF�ZHdG�ZIdH�ZJdI�ZKdJ�ZLdK�ZMdL�ZNdM�ZOdN�ZPdO�ZQdP�ZRdQ�ZSdR�ZTdS�ZUdT�ZVdU�ZWdV�ZXdW�ZYd�dX�ZZd�dY�Z[dZ�Z\d[�Z]d�d\�Z^d]�Z_d^�Z`d_�Zad`�Zbda�Zcdb�Zddc�Zedd�Zfde�Zgd�df�Zhdg�Zid�dh�Zjd�di�Zkd�dj�Zldk�Zmdl�Zndm�Zodn�Zpd�do�Zqdp�Zr		d�dq�Zsdr�Zteud�ds��Zveudt��Zweudu��Zxeudv��Zyeudw��Zzeudx��Z{eud�dy��Z|eud�dz��Z}d{�Z~eud|��Zeud}��Z�eud�d~��Z�eu		d�d��Z�eud�d���Z�eu		d�d���Z�eud���Z�eud���Z�eud�d���Z�eud���Z�eud���Z�d��Z�eu		d�d���Z�eud�d���Z�eud���Z�d��Z�d��Z�d�d��Z�eud���Z�d��Z��xZ�S)��Scriptu� �displayedLabel�
displayedText�
keyBinding�nestingLevel�	nodeLevel�realActiveDescendantc���tjj||�d|_d|_d|_d|_i|_d|_ddg|_	d|_
d|_d|_g|_
g|_y)z�Creates a new script for the given application.

        Arguments:
        - app: the application to create a script for.
        NF�
0123456789z 	

r�)�scriptr�__init__�targetCursorCell�justEnteredFlatReviewMode�digits�
whitespace�attributeNamesDict�lastMouseRoutingTime�oldMouseCoordinates�_lastWordCheckedForSpelling�	_inSayAll�_sayAllIsInterrupted�_sayAllContexts�grab_ids)�self�apps  �6/usr/lib/python3/dist-packages/orca/scripts/default.pyrzScript.__init__Ss~��	�
�
���t�S�)� $���).��&�"���'���
#%���%)��!�
%&�q�6�� �+-��(����$)��!�!�����
�c�B�tjtjtj
�|jd<tjtjtj�|jd<tjtjtj�|jd<tjtjtj�|jd<tjtjtj�|jd<tjtj tj"�|jd<tjtj$tj&�|jd<tjtj(tj*d�|jd	<tjtj,tj.d�|jd
<tjtj0tj2�|jd<tjtj4tj6�|jd<tjtj8tj:�|jd
<tjtj<tj>�|jd<tjtj@tjB�|jd<tjtjDtjF�|jd<tjtjHtjJ�|jd<tjtjLtjN�|jd<tjtjPtjR�|jd<tjtjTtjV�|jd<tjtjXtjZ�|jd<|jj]|j^ja��|jj]|jbja��|jj]|jdja��|jj]|jfja��|jj]|jhja��|jj]|jjja��|jj]|jlja��|jj]|jnja��|jj]|jpja��|jj]|jrja��|jj]|jtja��y)zlDefines InputEventHandler fields for this script that can be
        called by the key and braille bindings.�routePointerToItemHandler�leftClickReviewItemHandler�rightClickReviewItemHandler�
sayAllHandler�findHandler�findNextHandler�findPreviousHandlerF�panBrailleLeftHandler�panBrailleRightHandler�goBrailleHomeHandler�contractedBrailleHandler�processRoutingKeyHandler�processBrailleCutBeginHandler�processBrailleCutLineHandler�shutdownHandler�preferencesSettingsHandler�appPreferencesSettingsHandler�cycleSettingsProfileHandler�cycleDebugLevelHandler�bypassNextCommandHandlerN);�input_event�InputEventHandlerr�routePointerToItem�cmdnames�ROUTE_POINTER_TO_ITEM�inputEventHandlers�leftClickReviewItem�LEFT_CLICK_REVIEW_ITEM�rightClickReviewItem�RIGHT_CLICK_REVIEW_ITEM�sayAll�SAY_ALL�orca�showFindGUI�
SHOW_FIND_GUI�findNext�	FIND_NEXT�findPrevious�
FIND_PREVIOUS�panBrailleLeft�PAN_BRAILLE_LEFT�panBrailleRight�PAN_BRAILLE_RIGHT�
goBrailleHome�GO_BRAILLE_HOME�setContractedBraille�SET_CONTRACTED_BRAILLE�processRoutingKey�PROCESS_ROUTING_KEY�processBrailleCutBegin�PROCESS_BRAILLE_CUT_BEGIN�processBrailleCutLine�PROCESS_BRAILLE_CUT_LINE�quitOrca�	QUIT_ORCA�showPreferencesGUI�SHOW_PREFERENCES_GUI�showAppPreferencesGUI�SHOW_APP_PREFERENCES_GUI�cycleSettingsProfile�CYCLE_SETTINGS_PROFILE�cycleDebugLevel�CYCLE_DEBUG_LEVEL�bypassNextCommand�BYPASS_NEXT_COMMAND�update�notificationPresenter�get_handlers�flatReviewPresenter�speechAndVerbosityManager�systemInformationPresenter�	bookmarks�objectNavigator�tableNavigator�whereAmIPresenter�learnModePresenter�
mouseReviewer�actionPresenter�r%s r'�setupInputEventHandlerszScript.setupInputEventHandlersys}��

�)�)��)�)��.�.�
0�	
��� ;�<�
�)�)��*�*��/�/�
1�	
��� <�=��
*�
*��+�+��0�0�2�	
��� =�>�
�)�)��
�
�� � �
"�	
����0�
�)�)�� � ��&�&�
(�	
���
�.�
�)�)�����"�"�
$�	
��� 1�2�
�)�)��#�#��&�&�
(�	
��� 5�6�
�)�)��%�%��)�)��
�	
��� 7�8�
�)�)��&�&��*�*��
�	
��� 8�9�
�)�)��$�$��(�(�
*�	
��� 6�7�
�)�)��+�+��/�/�
1�	
��� :�;�
�)�)��(�(��,�,�
.�	
��� :�;�
�)�)��-�-��2�2�
4�	
��� ?�@�
�)�)��,�,��1�1�
3�	
��� >�?�
�)�)��
�
��"�"�
$�	
��� 1�2�
�)�)��'�'��-�-�
/�	
��� <�=�
�)�)��*�*��1�1�
3�	
��� ?�@�
�)�)��+�+��/�/�
1�	
��� =�>�
�)�)��&�&��*�*�
,�	
��� 8�9�
�)�)��(�(��,�,�
.�	
��� :�;�
	
���&�&�t�'A�'A�'N�'N�'P�Q����&�&�t�'?�'?�'L�'L�'N�O����&�&�t�'E�'E�'R�'R�'T�U����&�&�t�'F�'F�'S�'S�'U�V����&�&�t�~�~�'B�'B�'D�E����&�&�t�';�';�'H�'H�'J�K����&�&�t�':�':�'G�'G�'I�J����&�&�t�'=�'=�'J�'J�'L�M����&�&�t�'>�'>�'K�'K�'M�N����&�&�t�'9�'9�'F�'F�'H�I����&�&�t�';�';�'H�'H�'J�Kr(c�Z�|jj�D]\}}||k(s�|cSy)zaReturns the name of the key that contains an inputEventHadler
        passed as argument
        N)rC�items)r%�inputEventHandler�keyName�handlers    r'�getInputEventHandlerKeyzScript.getInputEventHandlerKey�s:��
!%� 7� 7� =� =� ?�	��G�W��+�+���	�r(c��tjj|�}|j|d<|j|d<|j
|d<|j|d<|j|d<|j|d<|j|d<|j|d<|j|d	<|j|d
<|j|d<|j|d<|j|d
<|j |d<|j"|d<|j$|d<|j&|d<|j(|d<|j*|d<|j,|d<|j.|d<|j0|d<|j2|d<|j4|d<|j6|d<|j8|d<|j:|d<|j<|d<|j>|d<|j@|d<|jB|d<|jB|d <|jD|d!<|jF|d"<|jH|d#<|jJ|d$<|jL|d%<|jN|d&<|S)'z<Sets up the AT-SPI event listeners for this script.
        zfocus:zdocument:reloadzdocument:attributes-changedzdocument:load-completezdocument:load-stoppedzdocument:page-changedzmouse:buttonzobject:announcementzobject:attributes-changedz&object:property-change:accessible-namez-object:property-change:accessible-descriptionzobject:text-caret-movedzobject:text-changed:deletezobject:text-changed:insertz object:active-descendant-changedzobject:children-changed:addzobject:children-changed:removezobject:state-changed:activezobject:state-changed:busyzobject:state-changed:focusedzobject:state-changed:showingzobject:state-changed:checkedzobject:state-changed:pressedz"object:state-changed:indeterminatezobject:state-changed:expandedzobject:state-changed:selectedzobject:state-changed:sensitivezobject:text-attributes-changedzobject:text-selection-changedzobject:selection-changedz'object:property-change:accessible-valuezobject:value-changedzobject:column-reorderedzobject:row-reorderedzwindow:activatezwindow:deactivatez
window:createzwindow:destroy)(rr�getListeners�onFocus�onDocumentReload�onDocumentAttributesChanged�onDocumentLoadComplete�onDocumentLoadStopped�onDocumentPageChanged�
onMouseButton�onAnnouncement�onObjectAttributesChanged�
onNameChanged�onDescriptionChanged�onCaretMoved�
onTextDeleted�onTextInserted�onActiveDescendantChanged�onChildrenAdded�onChildrenRemoved�onActiveChanged�
onBusyChanged�onFocusedChanged�onShowingChanged�onCheckedChanged�onPressedChanged�onIndeterminateChanged�onExpandedChanged�onSelectedChanged�onSensitiveChanged�onTextAttributesChanged�onTextSelectionChanged�onSelectionChanged�onValueChanged�onColumnReordered�onRowReordered�onWindowActivated�onWindowDeactivated�onWindowCreated�onWindowDestroyed)r%�	listenerss  r'r�zScript.getListeners�s]���M�M�.�.�t�4�	��L�L�	�(��

�!�!�	�#�$�
�,�,�	�/�0�
�'�'�	�*�+�
�&�&�	�)�*�
�&�&�	�)�*�
���	�.�!�
���	�'�(�
�*�*�	�-�.�
���	�:�;�
�%�%�	�A�B�
���	�+�,�
���	�.�/�
���	�.�/�
�*�*�	�4�5�
� � �	�/�0�
�"�"�	�2�3�
� � �	�/�0�
���	�-�.�
�!�!�	�0�1�
�!�!�	�0�1�
�!�!�	�0�1�
�!�!�	�0�1�
�'�'�	�6�7�
�"�"�	�1�2�
�"�"�	�1�2�
�#�#�	�2�3�
�(�(�	�2�3�
�'�'�	�1�2�
�#�#�	�,�-�
���	�;�<�
���	�(�)�
�"�"�	�+�,�
���	�(�)�
�"�"�	�#�$�
�$�$�	�%�&�
� � �	�/�"�
�"�"�	�"�#��r(c��ddlm}tj�}|j	|j
|j�|S)zReturns an instance of keybindings.KeyBindings that use the
        numeric keypad for focus tracking and flat review.
        rN)�orca.desktop_keyboardmap�desktop_keyboardmap�keybindings�KeyBindings�load�keymaprC)r%r��keyBindingss   r'�__getDesktopBindingszScript.__getDesktopBindingsOs8��
	?�!�-�-�/�����,�3�3�T�5L�5L�M��r(c��ddlm}tj�}|j	|j
|j�|S)z�Returns an instance of keybindings.KeyBindings that use the
        the main keyboard keys for focus tracking and flat review.
        rN)�orca.laptop_keyboardmap�laptop_keyboardmapr�r�r�r�rC)r%r�r�s   r'�__getLaptopBindingszScript.__getLaptopBindingsYs8��
	=�!�-�-�/�����+�2�2�D�4K�4K�L��r(c��tj�}tj�j	d�}|t
jk(}|jjd|��}|jD]}|j|��|jjd|��}|jD]}|j|��|jjd|��}|jD]}|j|��|jjd|��}|jD]}|j|��|jjd|��}|jD]}|j|��|jjd|��}|jD]}|j|��|j jd|��}|jD]}|j|��|j"jd|��}|jD]}|j|��|j$jd|��}|jD]}|j|��|j&jd|��}|jD]}|j|��|j(jd|��}|jD]}|j|��|j*jd|��}|jD]}|j|��|S)N�keyboardLayoutT)�refresh�
is_desktop)r�r��settings_manager�
getManager�
getSetting�settings�GENERAL_KEYBOARD_LAYOUT_DESKTOP�sleepModeManager�get_bindingsr��addrlrnrtrurorprrrsrqrvrw)r%r��layout�	isDesktop�bindingsrs      r'�getExtensionBindingszScript.getExtensionBindingscs,��!�-�-�/��!�,�,�.�9�9�:J�K���h�F�F�F�	��(�(�5�5�d�y�5�Y��"�.�.�	(�J��O�O�J�'�	(��-�-�:�:�4�T]�:�^��"�.�.�	(�J��O�O�J�'�	(��+�+�8�8��R[�8�\��"�.�.�	(�J��O�O�J�'�	(��)�)�6�6�t�PY�6�Z��"�.�.�	(�J��O�O�J�'�	(��*�*�7�7��QZ�7�[��"�.�.�	(�J��O�O�J�'�	(��1�1�>�>�t�Xa�>�b��"�.�.�	(�J��O�O�J�'�	(��2�2�?�?��Yb�?�c��"�.�.�	(�J��O�O�J�'�	(��'�'�4�4�T�i�4�X��"�.�.�	(�J��O�O�J�'�	(��&�&�3�3�D�Y�3�W��"�.�.�	(�J��O�O�J�'�	(��>�>�.�.�t�	�.�R��"�.�.�	(�J��O�O�J�'�	(��%�%�2�2�4�I�2�V��"�.�.�	(�J��O�O�J�'�	(��'�'�4�4�T�i�4�X��"�.�.�	(�J��O�O�J�'�	(��r(c��d|g}tjtj|dd�tjj|�}|j
�}|jD]}|j|��|j�}|jD]}|j|��|j�}|jD]}|j|��|j�}|jD]}|j|��	tj�j|j||�}|S#t $r6}d|d|g}tjtj"|d�Yd}~|Sd}~wwxYw)zkDefines the key bindings for this script.

        Returns an instance of keybindings.KeyBindings.
        z DEFAULT: Getting keybindings forTz1DEFAULT: Exception when overriding keybindings in�:N)�debug�printTokens�
LEVEL_INFOrr�getKeyBindings�getDefaultKeyBindingsr�r��getToolkitKeyBindings�getAppKeyBindingsr�r�r��overrideKeyBindingsrC�	Exception�
LEVEL_WARNING)r%�enabledOnly�tokensr�r�r�errors       r'r�zScript.getKeyBindings�sx��5�d�;��
���%�*�*�F�D�$�?��m�m�2�2�4�8���-�-�/��"�.�.�	(�J��O�O�J�'�	(��-�-�/��"�.�.�	(�J��O�O�J�'�	(��)�)�+��"�.�.�	(�J��O�O�J�'�	(��,�,�.��"�.�.�	(�J��O�O�J�'�	(�	A�*�5�5�7�K�K��'�'��k�C�K����	�	A�I�4�QT�V[�\�F����e�1�1�6�4�@�@����		A�s�/E�	F�
+E>�>Fc��tj�}tj�j	d�}|t
jk(r1|j�jD]}|j|��n0|j�jD]}|j|��ddlm}|j|j|j�|S)zyReturns the default script's keybindings, i.e. without any of
        the toolkit or application specific commands added.r�rN)r�r�r�r�r�r�r��_Script__getDesktopBindingsr�r��_Script__getLaptopBindings�orca.common_keyboardmap�common_keyboardmapr�r�rC)r%r�r�rr�s     r'r�zScript.getDefaultKeyBindings�s���"�-�-�/��!�,�,�.�9�9�:J�K���X�=�=�=�"�7�7�9�E�E�
,�
����
�+�
,�#�6�6�8�D�D�
,�
����
�+�
,�	=����+�2�2�D�4K�4K�L��r(c��d}tjtj|d�tjj|�}	|jd|tjj<|jd|tjj<|jd|tjj<|jd|tjj<|jd|tjj<|jd|tjj<|jd|tjj<|jd|tjj <|jd|tjj"<|jd|tjj$<|jd	|tjj&<|jd|tjj<|j.j1�}|j3|�d}tjtj|d�|S#t($r,d
|g}tj*tj|d�Y��t,$r5}d|d|g}tj*tj|d�Yd
}~��d
}~wwxYw)z�Defines the braille bindings for this script.

        Returns a dictionary where the keys are BrlTTY commands and the
        values are InputEventHandler instances.
        z"DEFAULT: Getting braille bindings.Tr1r2r3r4r5r6r7z(DEFAULT: Braille bindings unavailable inz.DEFAULT: Exception getting braille bindings inr�Nz+DEFAULT: Finished getting braille bindings.)r��printMessager�rr�getBrailleBindingsrC�braille�brlapi�KEY_CMD_HWINLT�KEY_CMD_FWINLT�KEY_CMD_FWINLTSKIP�KEY_CMD_HWINRT�KEY_CMD_FWINRT�KEY_CMD_FWINRTSKIP�KEY_CMD_HOME�KEY_CMD_SIXDOTS�
KEY_CMD_ROUTE�KEY_CMD_CUTBEGIN�KEY_CMD_CUTLINE�AttributeErrorr�r�rn�get_braille_bindingsrk)r%�msg�brailleBindingsr�r��reviewBindingss      r'r�zScript.getBrailleBindings�s���3��
���5�+�+�S�$�7� �-�-�:�:�4�@��	>��'�'�(?�@�
�G�N�N�9�9�:��'�'�(?�@�
�G�N�N�9�9�:��'�'�(?�@�
�G�N�N�=�=�>��'�'�(@�A�
�G�N�N�9�9�:��'�'�(@�A�
�G�N�N�9�9�:��'�'�(@�A�
�G�N�N�=�=�>��'�'�(>�?�
�G�N�N�7�7�8��'�'�(B�C�
�G�N�N�:�:�;��'�'�(B�C�
�G�N�N�8�8�9��'�'�(G�H�
�G�N�N�;�;�<��'�'�(F�G�
�G�N�N�:�:�;��'�'�(>�?�
�G�N�N�7�7�8��1�1�F�F�H�����~�.�;��
���5�+�+�S�$�7�����	>�@�$�G�F����e�.�.���=��	>�F��c�SX�Y�F����e�.�.���=�=��	>�s�G8J�2L�L�+L�Lc�P�d|_d|_i|_|jd�y)z'Called when this script is deactivated.Fzscript deactivationN)r!r"�pointOfReference�removeKeyGrabsrxs r'�
deactivatezScript.deactivates*�����$)��!� "������1�2r(c�F�tjs)d}tjtj|dd�ydD]�}|t
jvs�|tjvs�)tj�}tj|�|_d|_
tjj|�tj|<��d}tjtj|d�|j!�|_|j"j%�y)z8 Sets up the key grabs currently needed by this script. z6WARNING: Attempting to add key grabs without a device.TN��Insert�	KP_Insertrz DEFAULT: Setting up key bindings)�
orca_state�devicer�r�r�r��orcaModifierKeys�grabbedModifiersr�
KeyDefinitionr��
getKeycode�keycode�	modifiers�add_key_grabr�r�r��addKeyGrabs)r%�reasonr��modifier�kds     r'r�zScript.addKeyGrabss���� � �J�C����u�2�2�C��t�D��0�	[�H��8�4�4�4��:�#>�#>�>��(�(�*��(�3�3�H�=��
� ���8B�8I�8I�8V�8V�WY�8Z�
�+�+�H�5�
	[�1��
���5�+�+�S�$�7��.�.�0������$�$�&r(c���|jj|�d}tjtj|d�tj�|_tjs)d}tjtj|dd�ydD]V}|tjvs�tjjtj|�tj|=�Xy)z) Removes this script's AT-SPI key grabs. zDEFAULT: Clearing key bindingsTz9WARNING: Attempting to remove key grabs without a device.Nr�)r�r�r�r�r�r�r�r�r�r�r��remove_key_grab)r%rr�rs    r'r�zScript.removeKeyGrabs$s���	
���'�'��/�.��
���5�+�+�S�$�7�&�2�2�4���� � �M�C����u�2�2�C��t�D��0�	:�H��:�6�6�6��!�!�1�1�*�2M�2M�h�2W�X��/�/��9�	:r(c���|tjvrx|tjvrft	j
�}t
j|�|_d|_	tjj|�tj|<y|tjvrU|tjvrBtjjtj|�tj|=yyy)z. Refreshes the key grab for an Orca modifier. rN)
r�r�r�r�rr�r�r�r�r�r�r�r)r%rrs   r'�refreshModifierKeyGrabzScript.refreshModifierKeyGrab8s����x�0�0�0�X�Z�E`�E`�5`��$�$�&�B�$�/�/��9�B�J��B�L�4>�4E�4E�4R�4R�SU�4V�J�'�'��1�
��4�4�
4���Ib�Ib�9b����-�-�j�.I�.I�(�.S�T��+�+�H�5�:c�
4r(c��d}|r|d|��z
}tjtj|d�|jd�|j	d�y)z2 Refreshes the enabled key grabs for this script. zDEFAULT: refreshing key grabsz: T�
refreshingN)r�r�r�r�r�)r%rr�s   r'�refreshKeyGrabszScript.refreshKeyGrabsDsR��.����R��x�=� �C�
���5�+�+�S�$�7�
	
���L�)�����&r(c�V��t�|��|jj�y�N)�super�registerEventListeners�	utilities�connectToClipboard�r%�	__class__s �r'r
zScript.registerEventListenersRs���
��&�(����)�)�+r(c�V��t�|��|jj�yr)r�deregisterEventListenersr�disconnectFromClipboardrs �r'rzScript.deregisterEventListenersVs���
��(�*����.�.�0r(c���|sytj|�}|jjdi�}||t	|�<tj�j�}|r!tj|�|t	|�<||jd<|jjdi�}tj|�|t	|�<||jd<tj|�}|j|td|��|jj|�tj |d��\}}||jd<||jd<t	|�t#j$|�f|jd	<t	|�t#j&|�f|jd
<t	|�t#j(|�f|jd<y)aFSaves some basic information about obj. Note that this method is
        intended to be called primarily (if not only) by locusOfFocusChanged().
        It is expected that accessible event callbacks will update the point
        of reference data specific to that event. The goal here is to weed
        out duplicate events.N�names�descriptionsrT)�	find_cell�
lastColumn�lastRow�
checkedChange�selectedChange�expandedChange)r�get_namer��get�hash�
focus_managerr��get_active_window�get_descriptionr�get_caret_offset�_saveLastCursorPosition�maxr�updateCachedTextSelectionr�get_cell_coordinatesr	�
is_checked�is_selected�is_expanded)	r%�obj�namer�windowr�caretOffset�row�columns	         r'�_saveFocusedObjectInfozScript._saveFocusedObjectInfoZs�����
� � ��%���%�%�)�)�'�2�6����d�3�i���)�)�+�=�=�?���"*�"3�"3�F�";�E�$�v�,��).����g�&��,�,�0�0���D��"*�":�":�3�"?��T�#�Y��0<����n�-�
�-�-�c�2���$�$�S�#�a��*=�>����0�0��5�
�2�2�3�$�G���V�.4����l�+�+.����i�(�15�c��K�<R�<R�SV�<W�1W����o�.�26�s�)�[�=T�=T�UX�=Y�2Y����.�/�26�s�)�[�=T�=T�UX�=Y�2Y����.�/r(c�n�|jj�|stj�t_ytj|�ry||k(r(d}tjtj|d�ytj|�s]tj|�sH|jj||�r,d|d|g}tjtj|d�y	|jry	|jj!�r|jj#�|j$j!�r|j$j#�t'j(�j+|jj-|��|j/|�|j0j3||��}|jj5|||�r|j7�t9j:|d��|j=|�y#t$rY��4wxYw)	aCalled when the visual object with focus changes.

        Arguments:
        - event: if not None, the Event that caused the change
        - oldLocusOfFocus: Accessible that is the old locus of focus
        - newLocusOfFocus: Accessible that is the new locus of focus
        NzDEFAULT: old focus == new focusTzDEFAULT: old focusz believed to be same as new focus��priorObjF��	interrupt)r�presentFocusChangeReason�timer��noFocusTimeStampr	�
is_defunctr�r�r��
is_table_cell�isSameObjectr��findCommandRunr�rn�	is_active�quitrur!r��set_active_window�topLevelObject�
updateBraille�speechGenerator�generateSpeech�$shouldInterruptForLocusOfFocusChange�presentationInterrupt�speech�speakr2)r%�event�oldLocusOfFocus�newLocusOfFocusr�r��
utterancess       r'�locusOfFocusChangedzScript.locusOfFocusChanged�s���	
���/�/�1��*.�)�)�+�J�'���!�!�/�2���o�-�3�C����u�/�/��d�;���(�(��9��,�,�_�=��~�~�*�*�?�O�L�*�O�8�/�K�F����e�.�.���=��	��"�"��	#��#�#�-�-�/��$�$�)�)�+��"�"�,�,�.��#�#�(�(�*�� � �"�4�4�T�^�^�5R�5R�Sb�5c�d����?�+��)�)�8�8��$�9�&�
��>�>�>�>��O�U�4��&�&�(����Z�5�1��#�#�O�4��)�	��	�s�1H'�'	H4�3H4c�L�d|jg}tjtj|d�t	j
�j
|�tj�tj|jj��tj�|jj�|jj!�|j#d�d|jdg}tjtj|d�y)z%Called when this script is activated.zDEFAULT: Activating script forTzscript activationzDEFAULT: Script for�	activatedN)r&r�r�r�r�r��loadAppSettingsr��checkBrailleSetting�setupKeyRangesr��keysrH�checkSpeechSettingro�update_punctuation_level�update_capitalization_styler�)r%r�s  r'�activatezScript.activate�s���3�D�H�H�=��
���%�*�*�F�D�9��#�#�%�5�5�d�;��#�#�%����t�3�3�8�8�:�;��!�!�#��&�&�?�?�A��&�&�B�B�D����,�-�'����;�?��
���%�*�*�F�D�9r(c�h�tj�jd�sItj�jd�s&tjtj
dd�y|sy|jj|fi|��\}}|sy|j�|j�}tj|�|j||�|jd�}|r$|j||�|j|�n|j|�|j!d�y)zoUpdates the braille display to show the give object.

        Arguments:
        - obj: the Accessible
        �
enableBraille�enableBrailleMonitorzBRAILLE: update disabledTN�extraRegion)r�r�r�r�r�r��brailleGenerator�generateBraille�clearBraille�getNewBrailleLiner��addLine�addBrailleRegionsToLiner�addBrailleRegionToLine�setBrailleFocus�refreshBraille)r%r,�args�result�
focusedRegion�liner\s       r'rCzScript.updateBraille�s��� �*�*�,�7�7��H�#�.�.�0�;�;�<R�S����u�/�/�1K�T�R���� E�� 5� 5� E� E�c� R�T� R���
��������%�%�'��������$�$�V�T�2��h�h�}�-����'�'��T�:�� � ��-�� � ��/����D�!r(c�z�|jtj�dt_|jd�y)z�Causes the next keyboard command to be ignored by Orca
        and passed along to the current application.

        Returns True to indicate the input event has been consumed.
        Tzbypass next command)�presentMessage�messages�BYPASS_MODE_ENABLEDr�rir��r%�
inputEvents  r'rizScript.bypassNextCommand�s2��	
���H�8�8�9�'+�
�$����1�2�r(c��tj�}|r d|_d|_|j|�yt	j
�y)a Searches forward for the next instance of the string
        searched for via the Orca Find dialog.  Other than direction
        and the starting point, the search options initially specified
        (case sensitivity, window wrap, and full/partial match) are
        preserved.
        FN��find�getLastQuery�searchBackwards�
startAtToprJrK�r%ro�	lastQuerys   r'rMzScript.findNexts=���%�%�'�	��(-�I�%�#(�I� ��I�I�i� ����r(c��tj�}|r d|_d|_|j|�yt	j
�y)a%Searches backwards for the next instance of the string
        searched for via the Orca Find dialog.  Other than direction
        and the starting point, the search options initially specified
        (case sensitivity, window wrap, and full/or partial match) are
        preserved.
        TFNrqrvs   r'rOzScript.findPreviouss=���%�%�'�	��(,�I�%�#(�I� ��I�I�i� ����r(c��t|tj�rntj�jd�sKtj�jd�s(d}t
jtj|d�y|jj�r�|j�r9|jj||�|jj||�n|j|d��|j�d|_|j#|j �yt%j�j'�}|j�r�|j(j+|�r�t-j.|�d}d}|dkDrt-j0||dz
�}|sjt3j4|�rU|j7�}|j9t:j<j>�|jj||�y|j|d��tAjB�|jEdd�	�y)
a�Pans the braille display to the left.  If panAmount is non-zero,
        the display is panned by that many cells.  If it is 0, the display
        is panned one full display width.  In flat review mode, panning
        beyond the beginning will take you to the end of the previous line.

        In focus tracking mode, the cursor stays at its logical position.
        In flat review mode, the review cursor moves to character
        associated with cell 0.rZr[zCDEFAULT: panBrailleLeft command requires braille or braille monitorT��	panToLeft�Fr��	stopFlash)#�
isinstancer>�
KeyboardEventr�r�r�r�r�r�rnr?�isBrailleBeginningShowing�go_start_of_line�go_previous_character�panBrailleInDirection�0_setFlatReviewContextToBeginningOfBrailleDisplayr�updateBrailleReviewr!�get_locus_of_focusr�
isTextArear�get_line_at_offset�set_caret_offsetr	�is_terminal�getFlatReviewContext�goBegin�flat_review�Context�LINEr��resetFlashTimerre)r%ro�	panAmountr��focus�startOffset�
movedCaret�contexts        r'rQzScript.panBrailleLeft(s����j�+�";�";�<�#�.�.�0�;�;�O�L�#�.�.�0�;�;�<R�S�W�C����u�/�/��d�;���#�#�-�-�/��-�-�/��(�(�9�9�$�
�K��(�(�>�>�t�Z�P��*�*�9��*�E��A�A�C�$%�D�!��$�$�T�%:�%:�;���(�(�*�=�=�?���)�)�+����0I�0I�%�0P�!�3�3�E�:�1�=�K��J��Q��#�4�4�U�K�!�O�L�
��+�"9�"9�%�"@��3�3�5������ 3� 3� 8� 8�9��(�(�>�>�t�Z�P��

�&�&�y�D�&�A�
�#�#�%�������7�r(c�(�|j|d�y)z�Nudges the braille display one character to the left.

        In focus tracking mode, the cursor stays at its logical position.
        In flat review mode, the review cursor moves to character
        associated with cell 0.r|N)rQrns  r'�panBrailleLeftOneCharzScript.panBrailleLeftOneChares��	
���J��*r(c��t|tj�rntj�jd�sKtj�jd�s(d}t
jtj|d�y|jj�r�|j�r9|jj||�|jj||�y|j|d��|j�d|_|j#|j �yt%j�j'�}|j�rb|j(j+|�rGt-j.|�d}|t-j0|�krt-j2||�y|j|d��t5j6�|j9dd�	�y)
a�Pans the braille display to the right.  If panAmount is non-zero,
        the display is panned by that many cells.  If it is 0, the display
        is panned one full display width.  In flat review mode, panning
        beyond the end will take you to the beginning of the next line.

        In focus tracking mode, the cursor stays at its logical position.
        In flat review mode, the review cursor moves to character
        associated with cell 0.rZr[zDDEFAULT: panBrailleRight command requires braille or braille monitorTFrzr|�r})rr>r�r�r�r�r�r�r�rnr?�isBrailleEndShowing�go_end_of_line�go_next_characterr�r�rr�r!r�rr�rr��get_character_countr�r�r�re)r%ror�r�r��	endOffsets      r'rSzScript.panBrailleRightns����j�+�";�";�<�#�.�.�0�;�;�O�L�#�.�.�0�;�;�<R�S�X�C����u�/�/��d�;���#�#�-�-�/��'�'�)��(�(�7�7��j�I��(�(�:�:�4��L���&�&�y�E�&�B��A�A�C�$%�D�!��$�$�T�%:�%:�;���(�(�*�=�=�?���#�#�%�$�.�.�*C�*C�E�*J��1�1�%�8��;�I��6�5�5�e�<�<��'�'��y�9��

�&�&�y�E�&�B�
�#�#�%�������7�r(c�(�|j|d�y)z�Nudges the braille display one character to the right.

        In focus tracking mode, the cursor stays at its logical position.
        In flat review mode, the review cursor moves to character
        associated with cell 0.r|N)rSrns  r'�panBrailleRightOneCharzScript.panBrailleRightOneChar�s��	
���Z��+r(c��|jj�r|jj�ytj|�S)z$Returns to the component with focus.T)rnr?r@r��returnToRegionWithFocusrns  r'rUzScript.goBrailleHome�s<���#�#�-�-�/��$�$�)�)�+���.�.�z�:�:r(c�&�|j|�y)zToggles contracted braille.T)�_setContractedBraillerns  r'rWzScript.setContractedBraille�s��	
�"�"�:�.�r(c�.�tj|�y)zProcesses a cursor routing key.T)r�rYrns  r'rYzScript.processRoutingKey�s��	�!�!�*�-�r(c��|j|�\}}|dkrytj|�|jj	||�y)zcClears the selection and moves the caret offset in the currently
        active text area.
        rT)�getBrailleCaretContextr�clear_all_selected_textr�setCaretOffset)r%ror,�offsets    r'r[zScript.processBrailleCutBegin�sG��
�1�1�*�=���V��A�:���&�&�s�+����%�%�c�6�2�r(c��|j|�\}}|dkrytj|�}tj|�}|dks|dkr-tj|�}t||�}t
||�}tj|||�tj|�d}|jj|�y)zExtends the text selection in the currently active text
        area and also copies the selected text to the system clipboard.rT)r�r�get_selection_start_offset�get_selection_end_offsetr$�minr&�set_selected_text�get_selected_textr�setClipboardText)r%ror,r�r�r�r/�texts        r'r]zScript.processBrailleCutLine�s����1�1�*�=���V��A�:���7�7��<���3�3�C�8�	��!�O�y�1�}� �1�1�#�6�K��f�k�2�K��F�K�0�I�� � ��k�9�=��'�'��,�Q�/�����'�'��-�r(c�6�|jj�|_tj�|_|j
j
�r|j
j||�ytj�j�}|jj|�s|jj|�r |jtj �ytj"}tj$}|j||�y)z,Moves the mouse pointer to the current item.TF)r�absoluteMouseCoordinatesrr9rrnr?�route_pointer_to_objectr!r�r��eventSynthesizer�route_to_character�route_to_objectrkrl�MOUSE_MOVED_SUCCESS�LOCATION_NOT_FOUND_FULL�LOCATION_NOT_FOUND_BRIEF�r%ror��full�briefs     r'r@zScript.routePointerToItem�s���$(�>�>�#J�#J�#L�� �$(�I�I�K��!��#�#�-�-�/��$�$�<�<�T�:�N���(�(�*�=�=�?��� � �3�3�E�:��#�#�3�3�E�:����� <� <�=���/�/���1�1�����D�%�(�r(c�^�|jj�rT|jj||�}|jj	|�ry|jj||�St
j�j�}|jj	|�rytj|�r|jj|d�ry|jj|d�rytj}tj}|j!||�y)z7Performs a left mouse button click on the current item.Tr|F)rnr?�get_current_objectr��try_all_clickable_actions�left_click_on_objectr!r�r�rr��click_character�click_objectrlr�r�rk)r%ror,r�r�r�s      r'rDzScript.leftClickReviewItem�s����#�#�-�-�/��*�*�=�=�d�J�O�C��$�$�>�>�s�C���+�+�@�@��z�R�R��(�(�*�=�=�?��� � �:�:�5�A���%�%�e�,��$�$�4�4�U�A�>��� � �-�-�e�Q�7���/�/���1�1�����D�%�(�r(c��|jj�r|jj||�ytj�j�}|jj|d�ry|jj|d�rytj}tj}|j||�y)z8Performs a right mouse button click on the current item.T�F)
rnr?�right_click_on_objectr!r�r�r�r�r�rlr�r�rkr�s     r'rFzScript.rightClickReviewItems����#�#�-�-�/��$�$�:�:�4��L���(�(�*�=�=�?��� � �0�0���:��� � �-�-�e�Q�7���/�/���1�1�����D�%�(�r(c�4�|D]}|j|��y)zsSpell the current flat review word or line.

        Arguments:
        - itemString: the string to spell.
        N)�speakCharacter)r%�
itemString�	characters   r'�spellCurrentItemzScript.spellCurrentItem#s!��$�	+�I����	�*�	+r(c���|xs"tj�j�}|rtj|�r |jtj�ytj|�r1|jj|�}tj|�y|�tj|�}tj|j!||�|j"�y)NT)r!r�r�r�is_deadrkrlr�r�is_whitespace_or_emptyrDrErHrIr$rH�	textLines�_Script__sayAllProgressCallback)r%ror,r�rMs     r'rHz
Script.sayAll-s����D�]�-�-�/�B�B�D���h�&�&�s�+����� @� @�A���(�(��-��-�-�<�<�S�A�J��L�L��$���>��,�,�S�1�F��
�
�d�n�n�S�&�1�4�3P�3P�Q�r(c�X�tj�j�}|r|ds |jtj
�yd�}t
t||��d}	||j|�dz\}}tj�j|d��tj�tj�tj�|j!�|jtj"|z|�y#t$r|d\}}Y��wxYw)z4Cycle through the user's existing settings profiles.rTc�^�|duxr(|dtj�j�k(S)Nr|)r�r��
getProfile��xs r'�isMatchz,Script.cycleSettingsProfile.<locals>.isMatchFs-���D�=�W�Q�q�T�-=�-H�-H�-J�-U�-U�-W�%W�Wr(r|)�updateLocale)r�r��availableProfilesrkrl�PROFILE_NOT_FOUND�list�filter�index�
IndexError�
setProfiler�rRrH�shutdown�initry�PROFILE_CHANGED)r%ro�profilesr��currentr-�	profileIDs       r'rezScript.cycleSettingsProfile>s��$�.�.�0�B�B�D���X�a�[����� :� :�;��	X��v�g�x�0�1�!�4��	*�&�x�~�~�g�'>��'B�C�O�D�)�	�#�#�%�0�0���0�N��#�#�%��������
�	
�$�$�&����H�4�4�t�;�T�B����	*�&�q�k�O�D�)�	*�s�&D�D)�(D)c��tjdtjdtjdtjdtj
dtjdtjdtjdtjd	g}	|jtj�d
z}|t|�k\rd}	||t_||dz}d
|�d�}|j||�y#t$rd}Y�<wxYw)N�all�finest�finer�fine�
configuration�info�warning�severe�offr�rr|zDebug level �.T)r��	LEVEL_ALL�LEVEL_FINEST�LEVEL_FINER�
LEVEL_FINE�LEVEL_CONFIGURATIONr�r��LEVEL_SEVERE�	LEVEL_OFFr��
debugLevel�lenr�rk)r%ro�levels�
levelIndex�briefMessage�fullMessages      r'rgzScript.cycleDebugLevel]s����/�/�5��$�$�h��#�#�W��"�"�F��+�+�_��"�"�F��%�%�y��$�$�h��/�/�5�*��	����e�&6�&6�7�!�;�J��S��[�(��
�!�*�-����j�1�n�-��%�l�^�1�5�����K��6����	��J�	�s�"C6�6D�Dc��y)zTJust here to capture events.

        Arguments:
        - event: the Event
        N��r%rJs  r'�noOpzScript.noOp}s��	
r(c��|j}tjtj|j��r"tj
|j�d}tj|�stj|��r�|jr$tj�j|�sy|jj|tj�j��}|r�|js�|jj�r(d}t!j"t j$|d�y|jj'|�s(d}t!j"t j$|d�yd}t!j"t j$|d�tj�j)d�y|sY|jrMd}t!j"t j$|d�tj�j)|dd��|j*rd	|_|j-�yy)
z>Callback for object:state-changed:active accessibility events.r|N�!DEFAULT: Ignoring event. In menu.T�9DEFAULT: Not clearing state. Event is not user triggered.z4DEFAULT: Event is for active window. Clearing state.z DEFAULT: Updating active window.)�set_window_as_focus�
notify_scriptF)�sourcer	�is_applicationr�
get_parent�find_real_app_and_window_for�is_dialog_or_alert�is_frame�detail1r!r��can_be_active_windowrr=r"�inMenur�r�r��eventIsUserTriggeredrAr>rr)r%rJr.�sourceIsActiveWindowr�s     r'r�zScript.onActiveChanged�s��������%�%�h�&9�&9�%�,�,�&G�H��:�:�5�<�<�H��K�F��)�)�&�1�[�5I�5I�&�5Q��}�}�]�%=�%=�%?�%T�%T�U[�%\��#'�>�>�#>�#>��
�0�0�2�D�D�F�$H� �#�E�M�M��>�>�(�(�*�=�C��&�&�u�'7�'7��d�C���~�~�:�:�5�A�U�C��&�&�u�'7�'7��d�C��L���"�"�5�#3�#3�S�$�?��(�(�*�<�<�T�B��'�E�M�M�8���"�"�5�#3�#3�S�$�?��(�(�*�<�<���D�=�J����"'�D���I�I�K�r(c�<�|js(d}tjtj|d�yt	j
|j�sGt	j
|j�s(d}tjtj|d�y|j|�r|j�d|jg}tjtj|d�tj�j||j�y)zCCallback for object:active-descendant-changed accessibility events.z%DEFAULT: Ignoring event. No any_data.TNzEDEFAULT: Ignoring event. Neither source nor child have focused state.z+DEFAULT: Setting locus of focus to any_data)
�any_datar�r�r�r	�
is_focusedr�#stopSpeechOnActiveDescendantChangedrGr�r!r��set_locus_of_focus)r%rJr�r�s    r'r�z Script.onActiveDescendantChanged�s����~�~�9�C����u�/�/��d�;���%�%�e�l�l�3��)�)�%�.�.�9�Y�C����u�/�/��d�;���3�3�E�:��&�&�(�?����P��
���%�*�*�F�D�9�� � �"�5�5�e�U�^�^�Lr(c��y)z<Callback for object:state-changed:busy accessibility events.Nrrs  r'r�zScript.onBusyChanged����r(c���|jj|jtj�j��syt
j|j�rytj|j�tjjk(r"|jj�\}}|dvry|jjdd�\}}t!|�t!|j�k(r||j"k(ry|j%|jdd��t!|j�|j"f|jd<y)z?Callback for object:state-changed:checked accessibility events.N)� �spacer�NrT��alreadyFocusedr7)rr=rr!r�r�r	�
is_expandabler�get_roler�Role�RADIO_BUTTON�lastKeyAndModifiersr�rr r�
presentObject)r%rJ�eventString�mods�oldObj�oldStates      r'r�zScript.onCheckedChanged�s
���~�~�*�*��<�<��1�1�3�F�F�H�J���$�$�U�\�\�2�����U�\�\�*�e�j�j�.E�.E�E� $��� B� B� D��K���.�0���0�0�4�4�_�i�P������<�4����-�-�(�e�m�m�2K�����5�<�<����M�15�e�l�l�1C�U�]�]�1R����o�.r(c��tjd�tj|j�rtjd�yy)z>Callback for object:children-changed:add accessibility events.�children-changed event.N�r�clear_cache_nowr	�is_table_relatedrrrs  r'r�zScript.onChildrenAdded��9��	� � �!:�;��'�'����5��#�#�$=�>�6r(c��tjd�tj|j�rtjd�yy)zACallback for object:children-changed:remove accessibility events.r+Nr,rs  r'r�zScript.onChildrenRemoved�r/r(c�t�|jjdd�\}}||jk(r7||jk(r(d}t	j
tj|d�ytj|j�s{d}tj|d|�tj|j�sCd}t	j
tj|d�|jj|�sytj�j�}|j|k7r�tj |j�r�|jj#|j�rcd	|jg}t	j$tj|d�tj�j'||jd�n'd
}t	j
tj|d�|j|k7r5d|jdg}t	j$tj|d�y|j(j+�r|j(j-�t/j0|j�}|j3|j|�t/j4|j�rMd
}t	j
tj|d�|jj7|j�y|jj9|�d}|rC|jj7|�r(d}t	j
tj|d�yd}t	j
tj|d�|j;|�y)z:Callback for object:text-caret-moved accessibility events.�lastCursorPosition�N���z0DEFAULT: Event is for last saved cursor positionTNz5DEFAULT: Event source is not showing. Clearing cache.Fz+DEFAULT: Event source is still not showing.z!DEFAULT: Updating locusOfFocus toz+DEFAULT: Source window is not active windowzDEFAULT: Event source (z) is not locusOfFocusz)DEFAULT: Event source has text selectionsr�z/DEFAULT: Event handled as text selection changez.DEFAULT: Presenting text at new caret position)r�rrrr�r�r�r	�
is_showingr�clear_cacher� presentEventFromNonShowingObjectr!r�r�r�topLevelObjectIsActiveWindowr�rrnr?r@rr$r%�has_selected_text�handleTextSelectionChange�getCachedTextSelection�_presentTextAtNewCaretPosition)r%rJr,r�r�r�r��strings        r'r�zScript.onCaretMoved�s����+�+�/�/�0D�j�Q���V��U�]�]�"�s�e�l�l�':�D�C����u�/�/��d�;���%�%�e�l�l�3�I�C�� � ��e�S�1��)�)�%�,�,�7�C���"�"�5�#3�#3�S�$�?��~�~�F�F�u�M���(�(�*�=�=�?���<�<�5� �[�%;�%;�E�L�L�%I��~�~�:�:�5�<�<�H�=�u�|�|�L���!�!�%�"2�"2�F�D�A��(�(�*�=�=�e�U�\�\�SX�Y�C���"�"�5�#3�#3�S�$�?��<�<�5� �/����?V�W�F����e�.�.���=���#�#�-�-�/��$�$�)�)�+��(�(����6���$�$�U�\�\�6�:��#�#�E�L�L�1�=�C����u�/�/��d�;��N�N�4�4�U�\�\�B�����6�6�s�;�A�>���d�n�n�>�>�s�C�C�C����u�/�/��d�;��>��
���5�+�+�S�$�7��+�+�E�2r(c�4�|j}|jjdi�}|jt|��}||jk(r+d|dg}tjt
j|d�y|tj�j�k7r(d}tjt
j|d�y|j|t|�<||jd<|jr|j|j�yy)zBCallback for object:property-change:accessible-description events.�descriptionzDEFAULT: Old description (z) is the same as new oneTN�8DEFAULT: Event is for object other than the locusOfFocusr)
rr�rr rr�r�r�r!r�r�r�rk)r%rJr,r�oldDescriptionr�r�s       r'r�zScript.onDescriptionChanged$s����l�l���,�,�0�0���C��%�)�)�$�s�)�4���U�^�^�+�2�N�D^�_�F����e�.�.���=���-�*�*�,�?�?�A�A�L�C����u�/�/��d�;��"'�.�.��T�#�Y��0<����n�-��>�>�������/�r(c��y)z>Callback for document:attributes-changed accessibility events.Nrrs  r'r�z"Script.onDocumentAttributesChanged9���	
r(c��y)z2Callback for document:reload accessibility events.Nrrs  r'r�zScript.onDocumentReload>rCr(c��y)z9Callback for document:load-complete accessibility events.Nrrs  r'r�zScript.onDocumentLoadCompleteCrCr(c��y)z8Callback for document:load-stopped accessibility events.Nrrs  r'r�zScript.onDocumentLoadStoppedHrCr(c��|jdkrytj|j�sy|j	t
j|jz�y)z8Callback for document:page-changed accessibility events.rN)rr�did_page_changerrkrl�PAGE_NUMBERrs  r'r�zScript.onDocumentPageChangedMsE���=�=�1����)�)�%�,�,�7�����H�0�0�5�=�=�@�Ar(c�"�tj|j�rtjd�|j
j
|�sy|j}|jjdd�\}}t|�t|�k(r||jk(ry|j|dd��t|�|jf|jd<|j
j|�}|D]}|j|d���y)	z@Callback for object:state-changed:expanded accessibility events.zexpanded-changed event.NrrTrFr6)r	r.rrr-r�!isPresentableExpandedChangedEventr�rr rr%�detailsContentForObject�speakMessage)r%rJr,r(r)�details�details       r'r�zScript.onExpandedChangedXs����'�'����5��#�#�$=�>��~�~�?�?��F���l�l���0�0�4�4�5E�y�Q������<�4��9�$��U�]�]�)B�����3�t�t��D�26�s�)�U�]�]�2J����.�/��.�.�8�8��=���	7�F����f���6�	7r(c��|jsy|j}|jj|t	j
�j
��sy|jjdd�\}}t|�t|�k(r||jk(ry|j|dd��t|�|jf|jd<y)zECallback for object:state-changed:indeterminate accessibility events.N�indeterminateChangerTr)rrrr=r!r�r�r�rr r%�r%rJr,r(r)s     r'r�zScript.onIndeterminateChangedms����}�}���l�l���~�~�*�*�3�
�0H�0H�0J�0]�0]�0_�`���0�0�4�4�5J�I�V������<�4��9�$��U�]�]�)B�����3�t�t��D�7;�C�y�%�-�-�7O����3�4r(c�@�tj|�}|t_|jsy|j�t
j�j�|jk7}|r0t
j�j|jd��yy)z!Callback for mouse:button events.NT)r)r>�MouseButtonEventr��lastInputEvent�pressedrGr!r�r"r.rA)r%rJ�
mouseEvent�
windowChangeds    r'r�zScript.onMouseButton�s���!�1�1�%�8�
�$.�
�!��!�!���"�"�$�%�0�0�2�D�D�F�*�J[�J[�[�
���$�$�&�8�8��!�!�t�
9�
=�r(c�p�t|jt�r|j|j�yy)z(Callback for object:announcement events.N)rr�strrkrs  r'r�zScript.onAnnouncement�s)���e�n�n�c�*�������/�+r(c�:�|jjdi�}|jt|j��}||jk(r+d|dg}tjt
j|d�ytj|j�stj|j�r(d}tjt
j|d�ytj|j�r�|jtj�j�k7r(d}tjt
j|d�ytj�j!�}tj"|�r�t%j&|�r�t%j(|�|jvrd}tjt
j|d�y|jtj�j!�k7r(d	}tjt
j|d�y|j|t|j�<||jd<|jr|j+|j�yy)
z;Callback for object:property-change:accessible-name events.rzDEFAULT: Old name (z) is the same as new nameTNz6DEFAULT: Event is redundant notification for this rolez8DEFAULT: Event is for frame other than the active windowz=DEFAULT: Event is redundant notification for the locusOfFocusr@)r�rr rrr�r�r�r	�is_combo_boxr<r�r
r!r�r"r��is_editablerr��get_all_textrk)r%rJr�oldNamer�r�r�s       r'r�zScript.onNameChanged�s����%�%�)�)�'�2�6���)�)�D����.�/���e�n�n�$�+�W�6Q�R�F����e�.�.���=���#�#�E�L�L�1�[�5N�5N�u�|�|�5\�J�C����u�/�/��d�;��������-��|�|�}�7�7�9�K�K�M�M�P���"�"�5�#3�#3�S�$�?��!�,�,�.�A�A�C�E��&�&�u�-�&�2L�2L�U�2S��&�&�u�-����?�U���"�"�5�#3�#3�S�$�?��
�\�\�]�5�5�7�J�J�L�
L�L�C����u�/�/��d�;��$)�N�N��d�5�<�<� �!�).����g�&��>�>�������/�r(c��tjd�tj|j�rtjd�yy)z<Callback for object:attributes-changed accessibility events.z object-attributes-changed event.Nr,rs  r'r�z Script.onObjectAttributesChanged�s9��	� � �!C�D��'�'����5��#�#�$F�G�6r(c��|j}|jj|tj�j��sy|jjdd�\}}t|�t|�k(r||jk(ry|j|dd��t|�|jf|jd<y)z?Callback for object:state-changed:pressed accessibility events.N�
pressedChangerTr)rrr=r!r�r�r�rr rr%rRs     r'r�zScript.onPressedChanged�s����l�l���~�~�*�*�3�
�0H�0H�0J�0]�0]�0_�`���0�0�4�4�_�i�P������<�4��9�$��U�]�]�)B�����3�t�t��D�15�c��E�M�M�1I����o�.r(c�*�tj|jdd�tj|j�s(d}tjt
j|d�y|jjtj�j�|j�s(d}tjt
j|d�ytj�jd�rytj|j�}||j k7r(d}tjt
j|d�y|j"j%d	d
�\}}t'|�t'|j�k(r7||j k(r(d}tjt
j|d�yd}|jj)�\}}|dk(rd}n%|d
vr!tj*|j�r|}|sy|j r"|j-t.j0d��n!|j-t.j2d��t'|j�|j f|j"d	<y)z@Callback for object:state-changed:selected accessibility events.Fz#Ensuring we have the correct state.z:DEFAULT: Event is not toggling of currently-focused objectTNz&DEFAULT: Event is not for locusOfFocus�onlySpeakDisplayedTextz1DEFAULT: Bogus event: detail1 doesn't match staterrz DEFAULT: Duplicate or spam eventr)�Down�Upr6)rr6rr	rr�r�r�rr=r!r�r�r�r�r*rr�rr r$r<rMrl�
TEXT_SELECTED�TEXT_UNSELECTED)	r%rJr��
isSelectedr(r)�
announceState�	keyStringr's	         r'r�zScript.onSelectedChanged�s���	���U�\�\�5�2W�X��%�%�e�l�l�3�N�C����u�/�/��d�;���~�~�*�*��#�#�%�8�8�:�E�L�L�J�:�C����u�/�/��d�;���&�&�(�3�3�4L�M�� �,�,�U�\�\�:�
�����&�E�C����u�/�/��d�;���0�0�4�4�5E�y�Q������<�4����-�-�(�e�m�m�2K�4�C����u�/�/��d�;���
��.�.�<�<�>��	�4���� �M�
�.�
(�[�-F�-F�u�|�|�-T�&�M����=�=����h�4�4���F����h�6�6�%��H�26�u�|�|�2D�e�m�m�2S����.�/r(c����	�|jj�rU|jj|j�r�t	j
�j
||jd�n�|jj|j�rytj|j�rytj|j�rtj|j�s4d|jg}tjtj|d�ytj|j�r{t	j
�j!��t#j$|j�fd��s6d|jd�g}tjtj|d�y|jj'�\}}|dk(rytj(|j�rXtj*|j�s9tj,|jj/|j��rTytj0|j�r4|j2j5�r|j2j7�|j8j;�}|jj=|j�}t	j
�j?�}|D�]X�	t#j$|�	fd	��r=d
�	dg}tjtj|d�|jA|�y�	|k(r+d
�	dg}tjtj|d���tjB�	�ry|rwt#jD�	�t#jD|�k(rLtj,|j�s-d
�	d|g}tjtj|d�y|jjG�	�r��5t	j
�j
|�	�yy)z;Callback for object:selection-changed accessibility events.FNz:DEFAULT: Ignoring event: source is not showing and visibleTc���|xr|�k(Srr)r��
active_windows �r'�<lambda>z+Script.onSelectionChanged.<locals>.<lambda>s���!�BZ��]�HZ�r(zDEFAULT: Ignoring event:z
is not insiderc���|�k(Srr)r��childs �r'roz+Script.onSelectionChanged.<locals>.<lambda>.s���q�E�z�r(zDEFAULT: Childzis ancestor of locusOfFocuszis current mouse review item�DEFAULT:z's selection redundant to)$r�handlePasteLocusOfFocusChange� topLevelObjectIsActiveAndCurrentrr!r�r�handleContainerSelectionChanger	�manages_descendantsr5�
is_visibler�r�r��is_tree_or_tree_tabler"r�
find_ancestorr$r\r+r�getEntryForEditableComboBox�is_page_tab_listrnr?r@rv�getCurrentItem�selectedChildrenr�r2�is_page_tabr�isLayoutOnly)
r%rJr�rkr'�mouseReviewItemr}r�rnrqs
        @@r'r�zScript.onSelectionChangeds@����>�>�7�7�9��~�~�>�>�u�|�|�L��(�(�*�=�=�e�U�\�\�SX�Y�
�^�^�
:�
:�5�<�<�
H��
�
,�
,�U�\�\�
:���(�(����6�;�;Q�;Q�RW�R^�R^�;_�R�TY�T`�T`�a�F����e�.�.���=���,�,�U�\�\�:�)�4�4�6�H�H�J�M��)�)�%�,�,�8Z�[�4�e�l�l�O�Ub�c���!�!�%�"2�"2�F�D�A���.�.�<�<�>��	�4������#�#�E�L�L�1�+�:Q�:Q�RW�R^�R^�:_��%�%�d�n�n�&P�&P�QV�Q]�Q]�&^�_��
�
)�
)�%�,�,�
7�D�<T�<T�<^�<^�<`�

�$�$�)�)�+��,�,�;�;�=���>�>�:�:�5�<�<�H���(�(�*�=�=�?��%�	�E��%�%�e�-A�B�*�E�3P�Q���!�!�%�"2�"2�F�D�A��+�+�E�2����'�*�E�3Q�R���!�!�%�"2�"2�F�D�A���&�&�u�-�%��$�$�U�+�x�/@�/@��/G�G�"�-�-�e�l�l�;�$�e�-H�%�P���!�!�%�"2�"2�F�D�A���>�>�.�.�u�5��(�(�*�=�=�e�U�K��+	r(c��y)zACallback for object:state-changed:sensitive accessibility events.Nrrs  r'r�zScript.onSensitiveChangedDrr(c��y)z)Callback for focus: accessibility events.Nrrs  r'r�zScript.onFocusHrCr(c���|jsytj|j�sy|j}|jj|�\}}|r&t
j�j|�s|sytj|�r7tj|�s"|jj|�}|r|d}t
j�j||�y)z?Callback for object:state-changed:focused accessibility events.Nr)rr	rrr�frameAndDialogr!r�rr�get_child_countr\r}r)r%rJr,r.�dialogr}s      r'r�zScript.onFocusedChangedMs����}�}���%�%�e�l�l�3���l�l�����6�6�s�;�����-�2�2�4�I�I�&�Q�Z`���#�#�C�(��1I�1I�#�1N�#�~�~�>�>�s�C���&�q�)��� � �"�5�5�e�S�Ar(c�D�|j}tj|�}|tjj
k(r�|jsytj|jj|��|jj|�}|j|tj��|j j#|�y|tjj$k(r�|jj'�\}}|dk7r$t)j*�j-d�sy|jr|j/|d��yt1j*�j3�}|r'|dk(r!|}|j/||jd��yyyy)z?Callback for object:state-changed:showing accessibility events.N��	flashTime�F1�presentToolTipsTr6)r5r7)rrr!rr"�NOTIFICATIONrrHrIrDrEr�getNotificationContent�displayBrailleMessager��brailleFlashTimerl�save_notification�TOOL_TIPr$r�r�r�r%r!r�)r%rJr,�roler�rkr'r�s        r'r�zScript.onShowingChangedbsP���l�l��� � ��%���5�:�:�*�*�*��=�=���L�L��-�-�<�<�S�A�B��.�.�7�7��<�C��&�&�s�h�6O�6O�&�P��&�&�8�8��=���5�:�:�&�&�&�"�n�n�@�@�B�O�I�t��D� �'�2�2�4�?�?�@Q�R���}�}��"�"�3�$�"�7��!�,�,�.�A�A�C�E���d�*����"�"�3�����"�N��+�u�'r(c��|jj|�sytj�j	d�r�tj|j�}tj|j||dz�j�s|dz}tj|j|dz
�s#tj|j|dz�r |jtj�yyy)zACallback for object:text-attributes-changed accessibility events.N�speakMisspelledIndicatorr|)r�,isPresentableTextChangedEventForLocusOfFocusr�r�r�rr$r�
get_substring�isalnum�is_word_misspelledrMrl�
MISSPELLED)r%rJr�s   r'r�zScript.onTextAttributesChanged�s����~�~�J�J�5�Q���&�&�(�3�3�4N�O��,�,�U�\�\�:�F��'�'����f�f�q�j�I�Q�Q�S��!����(�(����v��z�B��+�+�E�L�L�&�1�*�E��!�!�(�"5�"5�6�F�Pr(c��|jj|�sy|jj|�tj�j||jd�|j|j�d\}}|jj|�rHd}tjtj|d�tjtj}}nR|jj|�r7d}tjtj|d�tj }|s|r8|j#||�|jj%|j�y|jj'|�}|jj)|�rJd}tjtj|d�t+j,|j�d}nk|jj/|�r(d	}tjtj|d�n(d
}tjtj|d�yt1|�dk(r|j3|�y|j4j7|��}|jj9|�}|j;||�y)
z=Callback for object:text-changed:delete accessibility events.NF�rrz8DEFAULT: Deletion is believed to be due to clipboard cutTzADEFAULT: Deletion is believed to be due to deleting selected textz9DEFAULT: Deletion is believed to be due to Delete commandrz<DEFAULT: Deletion is believed to be due to BackSpace commandz:DEFAULT: Event is not being presented due to lack of causer|�r=)rr��handleUndoTextEventr!r�rrrC�isClipboardTextChangedEventr�r�r�rl�CLIPBOARD_CUT_FULL�CLIPBOARD_CUT_BRIEF�isSelectedTextDeletionEvent�SELECTION_DELETEDrkr'�deletedText� isDeleteCommandTextDeletionEventr�get_character_at_offset�#isBackSpaceCommandTextDeletionEventr�r�rD�voice�adjustForRepeatsrM)r%rJr�r�r�r=r�s       r'r�zScript.onTextDeleted�s���~�~�J�J�5�Q�����*�*�5�1�� � �"�5�5�e�U�\�\�5�Q����5�<�<�(����e��>�>�5�5�e�<�L�C����u�/�/��d�;�"�5�5�x�7S�7S�%�D�
�^�^�
7�
7��
>�U�C����u�/�/��d�;��-�-�D��5�����e�,��N�N�4�4�U�\�\�B�����+�+�E�2���>�>�:�:�5�A�M�C����u�/�/��d�;��3�3�E�L�L�A�!�D�F�
�^�^�
?�
?��
F�P�C����u�/�/��d�;�N�C����u�/�/��d�;���v�;�!������'��(�(�.�.�f�.�=�E��^�^�4�4�V�<�F����f�e�,r(c�v	�|jj|�sy|jj|�|jt	j
�j
�k(r6|jj|�r|j|j�t	j
�j||jd�|j|j�d\}}|jj|�rHd}tjtj|d�tj tj"}}nR|jj%|�r7d}tjtj|d�tj&}|s|r8|j)||�|jj+|j�yd}|jj-|�}|jj/�r+d}tjtj|d�d}�nx|jj1�r)d}tjtj|d��n5|jj3|�r(d	}tjtj|d�n�|jj5|�r(d
}tjtj|d�n�|jj|�r(d}tjtj|d�nl|jj7|�r(d}tjtj|d�n)d
}tjtj|d�d}|rtt9|�dk(r|j;|�nT|j<j?|j|��}|jjA|�}|jC||�t9|�dk7rytEj
�jGd�r|jI|j�rytEj
�jGd�r|jK|j�yy)z=Callback for object:text-changed:insert accessibility events.NFr�z;DEFAULT: Insertion is believed to be due to clipboard pasteTzCDEFAULT: Insertion is believed to be due to restoring selected textz7DEFAULT: Insertion is believed to be due to page switchz3DEFAULT: Insertion is believed to be due to commandz?DEFAULT: Insertion is believed to be due to middle mouse buttonz-DEFAULT: Insertion is believed to be echoablez4DEFAULT: Insertion is believed to be auto text eventz#DEFAULT: Insertion is also selectedz:DEFAULT: Not speaking inserted string due to lack of causer|�r,r=�enableEchoBySentence�enableEchoByWord)&rr�r�rr!r�r��isAutoTextEventr2rrCr�r�r�r�rl�CLIPBOARD_PASTED_FULL�CLIPBOARD_PASTED_BRIEF�isSelectedTextRestoredEvent�SELECTION_RESTOREDrkr'�insertedText�lastInputEventWasPageSwitch�lastInputEventWasCommand�%isMiddleMouseButtonTextInsertionEvent�isEchoableTextInsertionEvent�isSelectedTextInsertionEventr�r�rDr�r�rMr�r��echoPreviousSentence�echoPreviousWord)r%rJr�r�r��speakStringr=r�s        r'r�zScript.onTextInserted�sw���~�~�J�J�5�Q�����*�*�5�1��<�<�=�3�3�5�H�H�J�J��~�~�-�-�e�4��'�'����5�� � �"�5�5�e�U�\�\�5�Q����5�<�<�(����e��>�>�5�5�e�<�O�C����u�/�/��d�;�"�8�8�(�:Y�:Y�%�D�
�^�^�
7�
7��
>�W�C����u�/�/��d�;��.�.�D��5�����e�,��N�N�4�4�U�\�\�B�������,�,�U�3���>�>�5�5�7�K�C����u�/�/��d�;��K�
�^�^�
4�
4�
6�G�C����u�/�/��d�;�
�^�^�
A�
A�%�
H�S�C����u�/�/��d�;�
�^�^�
8�
8��
?�A�C����u�/�/��d�;�
�^�^�
+�
+�E�
2�H�C����u�/�/��d�;�
�^�^�
8�
8��
?�7�C����u�/�/��d�;�N�C����u�/�/��d�;��K���6�{�a���#�#�F�+��,�,�2�2�u�|�|�F�2�S�����8�8��@���!�!�&�%�0��v�;�!����&�&�(�3�3�4J�K��(�(����6���&�&�(�3�3�4F�G��!�!�%�,�,�/�Hr(c�t�|j}|jj|�|j|�y)z@Callback for object:text-selection-changed accessibility events.N)rrr:rC)r%rJr,s   r'r�zScript.onTextSelectionChangeds/���l�l��	
���0�0��5����3�r(c�j�tjd�|jj�sy|jtj
t
j�j��k7rytj�|jd<|jtj�y)z:Callback for object:column-reordered accessibility events.zcolumn-reordered event.N�last-table-sort-time)rr-r�lastInputEventWasTableSortr�	get_tabler!r�r�r9r�rkrl�TABLE_REORDERED_COLUMNSrs  r'r�zScript.onColumnReordereds}��	��� 9�:��~�~�8�8�:���<�<�7�,�,�]�-E�-E�-G�-Z�-Z�-\�]�]��8<�	�	�����4�5����H�<�<�=r(c�j�tjd�|jj�sy|jtj
t
j�j��k7rytj�|jd<|jtj�y)z7Callback for object:row-reordered accessibility events.zrow-reordered event.Nr�)rr-rr�rr�r!r�r�r9r�rkrl�TABLE_REORDERED_ROWSrs  r'r�zScript.onRowReordered!s}��	��� 6�7��~�~�8�8�:���<�<�7�,�,�]�-E�-E�-G�-Z�-Z�-\�]�]��8<�	�	�����4�5����H�9�9�:r(c�.�tj|j�sy|jj	|j�\}}d|d|g}tjt
j|d�|sW|jtj�j�k7r(d}tjt
j|d�ytj|j�r|j|j�|j|j|��t!j"|j$j'|jd|���|j)|j*j-|jd|���y)z�Called whenever an object's value changes.  Currently, the
        value changes for non-focused objects are ignored.

        Arguments:
        - event: the Event
        Nz DEFAULT: Is progress bar update:�,TzDEFAULT: Source != locusOfFocus)�isProgressBarUpdate)rr�)r
�did_value_changerrr�r�r�r�r!r�r�r�r	�is_spin_buttonr2rCrHrIrDrE�
_Script__play�soundGenerator�
generateSound)r%rJr�r�r�s     r'r�zScript.onValueChanged.s@���'�'����5��#'�>�>�#E�#E�e�l�l�#S� ��S�4�6I�3�PS�T��
���%�*�*�F�D�9�"��|�|�}�7�7�9�L�L�N�N�3�C����u�/�/��d�;���%�%�e�l�l�3��'�'����5����5�<�<�=P��Q����T�)�)�8�8��L�L��CV�9�X�	Y����D�'�'�5�5��L�L��CV�6�X�	Yr(c��tj|j�d}tj�j|�sytj�j
�}|jj||�r(d}tjtj|d�yi|_tj�j|�tj|�dk(rktj|d�}tj |�t"j$j&k(r%tj�j)||�ytj�j)||�y)zgCalled whenever a toplevel window is activated.

        Arguments:
        - event: the Event
        r|Nz$DEFAULT: Event is for active window.Tr)rrrr!r�rr"rr=r�r�r�r�rAr��	get_childr!rr"�MENUr)r%rJr.�activeWindowr�rqs      r'r�zScript.onWindowActivatedLs���6�6�u�|�|�D�Q�G���'�'�)�>�>�v�F��$�/�/�1�C�C�E���>�>�&�&�v�|�<�8�C����u�/�/��d�;�� "���� � �"�4�4�V�<��#�#�F�+�q�0��&�&�v�q�1�E�� � ��'�5�:�:�?�?�:��(�(�*�=�=�e�U�K��� � �"�5�5�e�V�Dr(c��y)z0Callback for window:create accessibility events.Nrrs  r'r�zScript.onWindowCreatedhrCr(c��y)z1Callback for window:destroy accessibility events.Nrrs  r'r�zScript.onWindowDestroyedmrCr(c�(�|jj�r(d}tjtj|d�y|j
t
j�j�k7r(d}tjtj|d�y|jj�r|jj�|jj�r|jj�i|_
|jj|�s(d}tjtj|d�yt
j�jd�t!j�j#dd�y)ziCalled whenever a toplevel window is deactivated.

        Arguments:
        - event: the Event
        rTNz.DEFAULT: Ignoring event. Not for active windowrzWindow deactivated)rrr�r�r�rr!r�r"rnr?r@rur�r�clear_state�script_manager�setActiveScript)r%rJr�s   r'r�zScript.onWindowDeactivatedrs&���>�>� � �"�5�C����u�/�/��d�;���<�<�=�3�3�5�G�G�I�I�B�C����u�/�/��d�;���#�#�-�-�/��$�$�)�)�+��"�"�,�,�.��#�#�(�(�*� "����~�~�2�2�5�9�M�C����u�/�/��d�;��� � �"�.�.�/C�D��!�!�#�3�3�D�:N�Or(c�6�|jj�ry|jj�sy|jj	�sy|jj�r/|j
tjtj�y|jj�sytjtj�j��ry|j
tj tj"�yr)rnr?r�objectContentsAreInClipboardrt�lastInputEventWasCopyrkrl�CLIPBOARD_COPIED_FULL�CLIPBOARD_COPIED_BRIEF�lastInputEventWasCutr	r]r!r�r�r�r�)r%rfs  r'�onClipboardContentsChangedz!Script.onClipboardContentsChanged�s����#�#�-�-�/���~�~�:�:�<���~�~�>�>�@���>�>�/�/�1����� >� >��@_�@_�`���~�~�2�2�4���"�"�=�#;�#;�#=�#P�#P�#R�S�����H�7�7��9U�9U�Vr(c���|xs|j}|j|�|jr(d}tjtj
|d�y|jj�r9d}tjtj
|d�|j|�y|jj�r9d}tjtj
|d�|j|�y|jj�r9d}tjtj
|d�|j|�y|jj�r9d}tjtj
|d�|j|�y|jj�r9d}tjtj
|d�|j|�y|jj�r9d}tjtj
|d�|j|�y|jj!�s|jj#�re|jj%|j�\}}}|s9d	}tjtj
|d�|j|�yyy)
Nz5DEFAULT: Not presenting text because SayAll is activeTz&DEFAULT: Presenting result of line navz&DEFAULT: Presenting result of word navz&DEFAULT: Presenting result of char navz&DEFAULT: Presenting result of page navz/DEFAULT: Presenting result of line boundary navz/DEFAULT: Presenting result of file boundary navz8DEFAULT: Presenting result of primary mouse button event)r� updateBrailleForNewCaretPositionr!r�r�r�r�lastInputEventWasLineNav�sayLine�lastInputEventWasWordNav�sayWord�lastInputEventWasCharNav�sayCharacter�lastInputEventWasPageNav� lastInputEventWasLineBoundaryNav� lastInputEventWasFileBoundaryNav�"lastInputEventWasPrimaryMouseClick�$lastInputEventWasPrimaryMouseReleaser;)r%rJ�otherObjr,r��start�endr=s        r'r<z%Script._presentTextAtNewCaretPosition�s*���&�%�,�,���-�-�c�2��>�>�I�C����u�/�/��d�;���>�>�2�2�4�:�C����u�/�/��d�;��L�L�����>�>�2�2�4�:�C����u�/�/��d�;��L�L�����>�>�2�2�4�:�C����u�/�/��d�;����c�"���>�>�2�2�4�:�C����u�/�/��d�;��L�L�����>�>�:�:�<�C�C����u�/�/��d�;����c�"���>�>�:�:�<�C�C����u�/�/��d�;��L�L�����>�>�<�<�>��n�n�A�A�C�!%���!F�!F�u�|�|�!T��E�3���P���"�"�5�#3�#3�S�$�?����S�!��	�Dr(c�L�tj�jd�sy|jj	|�}|jd||_|jrD|jj�}|j|jz
|kDrn
|jr�Dtj|j|j�r0tj�jd|jd��|jd|j|j�y)N�rewindAndFastForwardInSayAllFr�rT)r�r�r�r#r��popr�r�rr�r,r!rrH)r%r��minCharCountr�s    r'�
_rewindSayAllzScript._rewindSayAll�s����*�*�,�7�7�8V�W���$�$�*�*�7�3��#�3�3�A�e�<����"�"��*�*�.�.�0�G�� � �7�#6�#6�6��E���"�"��"�"�7�;�;��0C�0C�D��$�$�&�9�9�$����[`�9�a����D�'�+�+�w�':�':�;�r(c�N�tj�jd�sytj|j
|j�r0tj�jd|j
d��|jd|j
|j�y)Nr�Fr�T)
r�r�r�rr�r,r�r!rrH)r%r�s  r'�_fastForwardSayAllzScript._fastForwardSayAll�sy���*�*�,�7�7�8V�W���"�"�7�;�;��0A�0A�B��$�$�&�9�9�$����[`�9�a����D�'�+�+�w�'8�'8�9�r(c��tj|j|j�ry|tj
jk(rStj�j|j|j|jtj�y|tj
jk(r�ttjt j"�rOd|_tjj&}|dk(r|j)|�ry|dk(r|j+|�ryd|_g|_tj�j|j|j�tj0|j|j�n�|tj
j2k(r�tj�j5d|jd��tj�j|j|jtj��tj0|j|j�tj6|j�y)NTrerfFr�)�mode)r�character_at_offset_is_eocr,�
currentOffset�speechserver�
SayAllContext�PROGRESSr!r��emit_region_changed�currentEndOffsetrI�INTERRUPTEDrr�rUr>r�r"�event_stringr�r�r!r#r��	COMPLETEDrr�)r%r��progressType�lastKeys    r'�__sayAllProgressCallbackzScript.__sayAllProgressCallbacks���
�,�,�W�[�[�'�:O�:O�P���<�5�5�>�>�>��$�$�&�:�:����W�2�2�G�4L�4L��%�%�
'�
��<�5�5�A�A�A��*�3�3�[�5N�5N�O�,0��)�$�3�3�@�@���f�$��)@�)@��)I����_��);�);�G�)D��"�D�N�#%�D� ��$�$�&�:�:�7�;�;��H]�H]�^��#�#�G�K�K��1F�1F�G�
�\�7�7�A�A�
A��$�$�&�9�9�$����[`�9�a��$�$�&�:�:����W�2�2��9N�9N�
;�
P��#�#�G�K�K��1F�1F�G�
	�&�&�w�{�{�3r(c�$�|jr(d}tjtj|d�y|jr)d}tjtj|d�|Sd}tjtj|d�y)NzDEFAULT: In SayAllTzDEFAULT: SayAll is interruptedzDEFAULT: Not in SayAllF)r!r�r�r�r")r%�treatInterruptedAsInr�s   r'�inSayAllzScript.inSayAll'su���>�>�&�C����u�/�/��d�;���$�$�2�C����u�/�/��d�;�'�'�&��
���5�+�+�S�$�7�r(c��tj|�}tj||dz
�dd\}}tj||dz
�dd\}}|r|jj	||�sytj
||�d}|sy|jj||��}|jj|�}|j||�y)zASpeaks the sentence prior to the caret if at a sentence boundary.r|rr4Fr�T)
rr$r�r�isSentenceDelimiter�get_sentence_at_offsetrDr�r�rM)	r%r,r��charr��previousChar�
previousStart�sentencer�s	         r'r�zScript.echoPreviousSentence6s����(�(��-���4�4�S�&�1�*�E�a��K���e�&,�&D�&D�S�%�RS�)�&T�UV�WY�&Z�#��m�����!C�!C�D�,�!W���0�0��m�D�Q�G�����$�$�*�*�s�8�*�D���>�>�2�2�8�<�����(�E�*�r(c�&�tj|�}|dk(rtj|�}|dkrytj||dz
�dd\}}|jj|�sytj||dz
�dd\}}|jj|�rytj||�d}|sy|jj||��}|jj|�}|j||�y)z9Speaks the word prior to the caret if at a word boundary.r4rFr|r�T)rr$r�r�r�isWordDelimiter�get_word_at_offsetrDr�r�rM)r%r,r�r
r�wordr�s       r'r�zScript.echoPreviousWordHs���(�(��-���R�<��/�/��4�F��Q�;��&,�&D�&D�S�&�ST�*�&U�VW�XZ�&[�#��m��~�~�-�-�l�;��'-�&D�&D�S�-�Z[�J[�&\�]^�_a�&b�#��m��>�>�)�)�,�7���(�(��m�<�Q�?�����$�$�*�*�s�4�*�@���~�~�.�.�t�4�����$��&�r(c���tj|�}|jj�\}}|tj
zr	|dvr|dz}tj||�\}}}tj�j|||tj�|r|dk(rd}tj�jd�}|dk(rNtj|td|��d}	|	r|	dk(r$|r!|jt j"d��y	|d
vr$|r!|jt j"d��y	|j%||�|j'|�d|j(d<y	)
z�Speak the character at the caret.

        Arguments:
        - obj: an Accessible object that implements the AccessibleText
               interface
        )�Rightrer|�
�
�speakBlankLinesrFr6N)rz
r	�lastTextUnitSpoken)rr$rr$r��SHIFT_MODIFIER_MASKr�r!r�r��CARET_TRACKINGr�r�r�r&rMrl�BLANKr�r�r�)
r%r,r�r&r'r�r�r�r�
lineStrings
          r'r�zScript.sayCharacterds]���(�(��-��!�N�N�>�>�@���T��;�2�2�2��/�/��a�K�F�,2�,J�,J�3�PV�,W�)�	�;�	�� � �"�6�6���i��)E�)E�	G��I��-��I�*�5�5�7�B�B�CT�U������2�2�3��A�v��G��J�J���t�!3�#��%�%�h�n�n��%�F����&���!�!�(�.�.�E�!�B���)�)�#�v�6����	�*�6<����2�3r(c��|j|�\}}}t|��r�|dk7�r{|jj|�}|r|j	|�|t|�z}tj�j|||t
j�g}|jj|||�}|D]�\}	}
}}}
|s�|jj||||
��}|jj|||	�}|jj|�}|jj|�r|jj|�}|s|r|j!�}|g}|j#|�|j%|���t'j(|�n|j+|�d|j,d<y)z�Speaks the line of an AccessibleText object that contains the
        caret, unless the line is empty in which case it's ignored.

        Arguments:
        - obj: an Accessible object that implements the AccessibleText
               interface
        r)r,r=�language�dialectrirN)�getTextLineAtCaretr�r�indentationDescriptionrMr!r�r�r�splitSubstringByLanguagerDr��adjustForLinksr��shouldVerbalizeAllPunctuation�verbalizeAllPunctuation�lstrip�extend�appendrHrIr�r�)r%r,rir/r�rr��	utterance�splitr�r�r=rrr�rgs                r'r�zScript.sayLine�s���,0�+B�+B�3�+G�(��{�K��t�9����%)�^�^�%J�%J�4�%P�"�%��!�!�"8�9�#�c�$�i�/�I��$�$�&�:�:��[�)�]�-I�-I�
K��I��N�N�;�;�C��i�X�E�9>�
)�5��s�F�H�g����,�,�2�2��F�X�w�3�P�����6�6�s�F�E�J�����8�8��@���>�>�?�?��D�!�^�^�C�C�F�K�F�!�%;�#�]�]�_�F� ����
�
�e�$�� � ��(�%
)�&
�L�L��#�
���c�"�6<����2�3r(c��|jj|||�}|syt|�dkDs|j�r�|jj	|�}|r|j|�t
j�j|||tj�|jj||��}|jj|�}|jj|�r|jj|�}|g}|j|�t!j"|�n|j%|�d|j&d<y)a^Speaks the text of an Accessible object between the start and
        end offsets, unless the phrase is empty in which case it's ignored.

        Arguments:
        - obj: an Accessible object that implements the AccessibleText
               interface
        - startOffset: the start text offset.
        - endOffset: the end text offset.
        Nr|r��phraser)r�
expandEOCsr�r�rrMr!r�r�rrDr�r�r"r#r%rHrIr�r�)r%r,r�r�r*rgr�r's        r'�	sayPhrasezScript.sayPhrase�s�����*�*�3��Y�G�����v�;��?�f�n�n�.��^�^�:�:�6�B�F���!�!�&�)��$�$�&�:�:��[�)�]�-I�-I�
K��(�(�.�.�3�v�.�F�E��^�^�4�4�V�<�F��~�~�;�;�C�@����?�?��G����I����U�#��L�L��#�����'�6>����2�3r(c	�:�tj|�}|jj||�\}}}d|vrxt	j
�j
d�r|jd�|jd�r|dz
}n|jd�r|dz}tj|||�}ttjd|��}|rO||dj�z
}|t|�|dj!�z
z}tj|||�}|j#dd�}d|�d	|�d
|�d|�d�	}t%j&t$j(|d
�|j+||�|j-|||�d|j.d<y)zNSpeaks the word at the caret, taking into account the previous caret position.r�enableSpeechIndentationr|z\S+rr4z\nzDEFAULT: Final word at offset z is 'z' (�-�)TrrN)rr$r�$getWordAtOffsetAdjustedForNavigationr�r�r�r��
startswith�endswithr�r��re�finditerr�r�r��replacer�r�r�r�r,r�)	r%r,r�rr�r��matchesr=r�s	         r'r�zScript.sayWord�s����(�(��-���N�N�?�?��V�L�	%��k�9��4�<��*�*�,�7�7�8Q�R��#�#�D�)����t�$��q� �����t�$��Q��	��'�'��[�)�D�D��r�{�{�6�4�0�1����7�1�:�+�+�-�-�K���T��W�R�[�_�_�%6�6�6�I��'�'��[�)�D�D����d�E�*��,�V�H�E�&��B��}�A�i�[��
+�	�	���5�+�+�S�$�7��%�%�c�;�7����s�K��3�6<����2�3r(c�0�|jdd�}d|d|g}tjtj|d�|jdd�s|j|fi|��|j
j|fi|��}tj||��y)Nr7FzDEFAULT: Presenting objectz. Interrupt:T�
speechonlyr6)	rr�r�r�rCrDrErHrI)r%r,rfr7r�rMs      r'r%zScript.presentObject
	s����H�H�[�%�0�	�.��^�Y�O��
���%�*�*�F�D�9��x�x��e�,��D���s�+�d�+�8�T�)�)�8�8��E��E�
����Z�9�5r(c��|jsytj�j�}||jk(r\|jjdi�}|jt
|�d�}|r"tj|j�|k(ry|j|cxk(r"tj|j�k(ryyy)z�Whether or not speech should be stopped prior to setting the
        locusOfFocus in onActiveDescendantChanged.

        Arguments:
        - event: the Event

        Returns True if speech should be stopped; False otherwise.
        TrrF)rr!r�r�r�rr rrrr
)r%rJr�rr_s     r'rz*Script.stopSpeechOnActiveDescendantChanged	s����~�~���(�(�*�=�=�?���E�N�N�"��)�)�-�-�g�r�:�E��i�i��U��R�0�G��h�/�/����?�7�J���<�<�5�G�H�$7�$7����$G�G��H�r(c�8�|jj|�S)z;Returns the flat review context, creating one if necessary.)rn�get_or_create_contextrxs r'r�zScript.getFlatReviewContext8	s���'�'�=�=�d�C�Cr(c���tj�jd�sItj�jd�s&tjtj
dd�y|jj|�\}}|sg}d}|j�}|j||�tj|g�|j|d�|rW|sU|j|jz}d|d|g}tjtj
|d�|j!|�|j"r$|j%d|j&�d|_y|j%d|�y)	aAObtains the braille regions for the current flat review line
        and displays them on the braille display.  If the targetCursorCell
        is non-0, then an attempt will be made to position the review cursor
        at that cell.  Otherwise, we will pan in display-sized increments
        to show the review cursor.rZr[zBRAILLE: update review disabledTNFzDEFAULT: Update to�in)r�r�r�r�r�r�rn�get_braille_regionsr`rbr��setLinesrd�
brailleOffset�cursorOffsetr��panBrailleToOffsetrrer)r%r�regions�regionWithFocusrir�r�s       r'r�zScript.updateBrailleReview=	s?�� �*�*�,�7�7��H�#�.�.�0�;�;�<R�S����u�/�/�1R�TX�Y��%)�%=�%=�%Q�%Q�RV�%W�"��/���G�"�O��%�%�'���$�$�W�d�3����$�� ����_�e�4��#3�$�2�2�_�5Q�5Q�Q�F�*�F�D�/�J�F����e�.�.���=��#�#�F�+��)�)�����d�&;�&;�<�-2�D�*�����&6�7r(c��d�}|jj|�d}tt||��}dg}|D]}|j	d|g��tjt
j|d�d�}tt||��}|s(d}tjt
j|d�yd	g}|D]}|j	d|g��tjt
j|d�|d}t|jtjd�}|jr|j||jz
}n||jz
}t|j t"j$�r||j j&z
}d
|��}tjt
j|d�|j j)|�\}	}
|	r�d|	d|
g}tjt
j|d�|j+�}|j-|	j j.j0|	j j0|	j0|
�yd|j g}tjt
j|d�|j+�}|j-|j j.j0|j j0dd�y)
zqSets the character of interest to be the first character showing
        at the beginning of the braille display.c�V�t|tjtjf�Sr)rr��
ReviewText�ReviewComponentr�s r'�isTextOrComponentzRScript._setFlatReviewContextToBeginningOfBrailleDisplay.<locals>.isTextOrComponentc	s ���a�'�"4�"4�g�6M�6M�!N�O�Or(rz(DEFAULT: Text/Component regions on line:rTc�z�|duxr6|jt|j�ztjdkDSr)rAr�r=r��viewportr�s r'r�zHScript._setFlatReviewContextToBeginningOfBrailleDisplay.<locals>.isMatchp	s3���D�=�Z�Q�_�_�s�1�8�8�}�%D�w�GW�GW�XY�GZ�%Z�Zr(zADEFAULT: Could not find review region to move to start of displayNz)DEFAULT: Candidates for start of display:zDEFAULT: Offset for region: z$DEFAULT: Setting start of display toz, )rnr?r�r�r%r�r�r�r�r&rAr�rL�
contracted�inPosr�zoner��TextZoner��getWordAtOffsetr��
setCurrentrir�)r%rJrDr��regionr�r��positionr�r�
charOffsetr�s            r'r�z7Script._setFlatReviewContextToBeginningOfBrailleDisplay^	s���
	P��*�*�>�>�t�D�Q�G���v�/��9�:��<�=���	*�F��M�M�4��.�)�	*�
���%�*�*�F�D�9�
	[��v�g�w�/�0���U�C����u�/�/��d�;��=�>���	*�F��M�M�4��.�)�	*�
���%�*�*�F�D�9������v�+�+�W�-=�-=�a�-@�A������\�\�(�V�-A�-A�"A�B�F��� 4� 4�4�F��f�k�k�;�#7�#7�8��f�k�k�-�-�-�F�,�V�H�5��
���5�+�+�S�$�7�#�[�[�8�8��@���z��<�d�D�*�U�F����e�.�.���=��/�/�1�G�����	�	���$�$��	�	����
�
��	
�=�f�k�k�J�F����e�.�.���=��/�/�1�G������� � �&�&����!�!���	
r(c��|stj�}|r�|j�}|j|�}|s |j	t
j�y|j|j|j|j|j�|jj|�|j�|_yy)z�Searches for the specified query.  If no query is specified,
        it searches for the query specified in the Orca Find dialog.

        Arguments:
        - query: The search query to find.
        N)rrrsr��	findQueryrkrl�STRING_NOT_FOUNDrR�	lineIndex�	zoneIndex�	wordIndex�	charIndexrn�present_item�getBrailleCursorCellr)r%�queryr��locations    r'rrzScript.find�	s�����%�%�'�E���/�/�1�G����w�/�H���#�#�H�$=�$=�>��"�"�8�#5�#5�x�7I�7I�#+�#5�#5�x�7I�7I�K��(�(�5�5�d�;�(,�(A�(A�(C��%�r(c#�K�d|_d|_|}|jj|�}|�r�t	j
|jj||���tj�jd�}|tjk(r&tj|�rtj}ntj }|||�D]�\}}}	|jj#||��}
|
rt%|
t&�r|
d}
|jj)|||�}|jj+|�}t-j.||||	�}d|g}t1j2t0j4|d�|j6j9|�|j:j=|||	�||
g����|}d}|jj?|�}||jj|�k7rn|r���d|_g|_d}
t1j@t0j4|
d�|jC�y	�w)
a�Creates a generator that can be used to iterate over each line
        of a text object, starting at the caret offset.

        Arguments:
        - obj: an Accessible that has a text specialization

        Returns an iterator that produces elements of the form:
        [SayAllContext, acss], where SayAllContext has the text to be
        spoken and acss is an ACSS instance for speaking the text.
        FTr4�sayAllStyler�rrrz4DEFAULT: textLines complete. Verifying SayAll statusN)"r"r!r�getDocumentForObjectrHrIrD�generateContextr�r�r�r��SAYALL_STYLE_SENTENCEr�supports_sentence_iteration�
iter_sentence�	iter_liner�rr�r!r�r�r�r�r�r�r#r&r��scroll_into_view�findNextObjectr�r)r%r,r�r5�document�style�iteratorr=r�r�r�r�r�r�s              r'r�zScript.textLines�	s�����%*��!�������>�>�6�6�s�;����L�L��-�-�=�=�c�H�=�U�V�$�/�/�1�<�<�]�K�E���6�6�6�6�;]�;]�^a�;b�!�/�/��!�+�+��&.�s�F�&;�
'�"���s��,�,�2�2�s�6�2�J���Z��t�4�!�!�H�E����6�6�s�F�E�J�����8�8��@��&�4�4�S�&�%��M��$�g�.���!�!�%�"2�"2�F�D�A��$�$�+�+�G�4��%�%�6�6�s�E�3�G���&�&�
'� �H��F��.�.�/�/��4�C��4�>�>�>�>�s�C�C��;�>���!���D��
���5�+�+�S�$�7��
�
��s
�HI�AIc���tj|�}|dk(rgd�Stj|�}|}|�td|�}||k(r*td|dz
�}tj|||dz�}n|}d}||k(r
|dk(rd}	|}ne|dk(rtj|||dz�}	|}n!|dk(r|}tj
||�\}	}}|	j
d�}	|	j
d�}	|	||gS)	z<To-be-removed. Returns the string, caretOffset, startOffset.r)rrrNr|rrr4r)rr�r$r&r�r��rstrip)
r%r,r�r�r��characterCount�targetOffset�fixedTargetOffsetr�rs
          r'rzScript.getTextLineAtCaret�	s)��
 �3�3�C�8���Q�����(�(��-��"�����q�&�>�L� �>�)� #�A�|�a�'7� 8���,�,�S�2C�EV�YZ�EZ�[�I� ,���I��N�*��d�"��J�+�K��!�#�#�1�1�#�7H�J[�^_�J_�`�
�/��$��*�(6�%��-�-�c�3D�E�3�
�K��$�*�*�4�0�J�#�*�*�4�0�J��F�K�0�0r(c���t|�D]V\}}|jj|��}tj|j��}|j
||��Xy)z�Phonetically spell the current flat review word or line.

        Arguments:
        - itemString: the string to phonetically spell.
        r�N)�	enumeraterDr��	phonnames�getPhoneticName�lowerrM)r%r�r\r�r��phoneticStrings      r'�phoneticSpellCurrentItemzScript.phoneticSpellCurrentItem-
s]��'0�
�&;�	5�"�Y�	��(�(�.�.�i�.�@�E�&�6�6�y���7H�I�N����n�e�4�	5r(c��|jjdd�\}}||f|jd<||f|jd<y)z�Save away the current text cursor position for next time.

        Arguments:
        - obj: the current accessible
        - caretOffset: the cursor position within this object
        r2r3�penultimateCursorPositionN)r�r)r%r,r/�prevObj�
prevOffsets     r'r%zScript._saveLastCursorPosition9
sN��#�3�3�7�7�8L�j�Y����=D�j�=P����9�:�69�;�6F����2�3r(c��td�y)z�Rings the system bell. This is really a hack. Ideally, we want
        a method that will present an earcon (any sound designated for the
        purpose of representing an error, event etc)
        �N)�printrxs r'�
systemBeepzScript.systemBeepE
s��	�d�r(c��tj�jd�sytj||�d}|j�r|jj|�r|d|_ytj||�sytj||�d}||jk7r|jtj�||_y)aSpeaks an announcement indicating that a given word is misspelled.

        Arguments:
        - obj: An accessible which implements the accessible text interface.
        - offset: Offset in the accessible's text for which to retrieve the
          attributes.
        r�Nr)r�r�r�rr��striprrr r�rrMrlr�)r%r,r�r	rs     r'r�zScript.speakMisspelledIndicatorM
s��� �*�*�,�7�7�8R�S���-�-�c�6�:�1�=���z�z�|�t�~�~�=�=�d�C�/3�A�w�D�,���(�(��f�5���(�(��f�5�a�8���4�3�3�3����h�1�1�2�
,0��(r(c��d}tjtj|d�tj�|rtj�yy)zbConvenience method to interrupt presentation of whatever is being
        presented at the moment.z"DEFAULT: Interrupting presentationTN)r�r�r�rH�stopr��	killFlash)r%r�r�s   r'rGzScript.presentationInterruptr
s>��3��
���5�+�+�S�$�7����
������r(c���|j�s!d|_|jj�|jr|j�ryt
jtj�j��}|tjjtjjtjjfvr^tj�j!�}|r:tj�j#d|d�t
j|�}|tjj$k(r|j'�sy|j�syt)j*|�|j-�xr|j�}|j/�r|syd}t1j2t0j4|d�|j7|�y)z{Convenience method to present the KeyboardEvent event. Returns True
        if we fully present the event; False otherwise.FNz"DEFAULT: Presenting keyboard eventT)�isPressedKeyr"r�clearCachedCommandState�
shouldEcho�isOrcaModifiedrr!r!r�r�rr"�DIALOG�FRAME�WINDOW�find_focused_objectr�
PASSWORD_TEXT�isLockingKeyr��displayKeyEvent�isOrcaModifier�isCharacterEchoabler�r�r��
speakKeyEvent)r%rJr��
focusedObject�orcaModifierPressedr�s      r'�presentKeyboardEventzScript.presentKeyboardEvent|
sn���!�!�#�(-�D�%��N�N�2�2�4����5�#7�#7�#9��� � ��!9�!9�!;�!N�!N�!P�Q���E�J�J�%�%�u�z�z�'7�'7����9J�9J�K�K�)�4�4�6�J�J�L�M���(�(�*�=�=�d�M�SX�Y��(�(��7���5�:�:�+�+�+�E�4F�4F�4H���!�!�#������&�#�2�2�4�M��9K�9K�9M���$�$�&�/B��2��
���5�+�+�S�$�7����5�!�r(c��|sy|�|}tj�jd�r?tj�jd�s|}n|}|r|j||||��tj�jd�s$tj�jd��r	tj�jd�r�tj�jd�s|}n|}|syt	|d	t
�r|d	}t	|t
�r1|D�cgc]}t	|t�s�|��}}d
j|�}tj�jd�rd}n#tj�jd
�}tj||��yyycc}w)a�Convenience method to speak a message and 'flash' it in braille.

        Arguments:
        - fullMessage: This can be a string or a list. This will be presented
          as the message for users whose flash or message verbosity level is
          verbose.
        - briefMessage: This can be a string or a list. This will be presented
          as the message for users whose flash or message verbosity level is
          brief. Note that providing no briefMessage will result in the full
          message being used for either. Callers wishing to present nothing as
          the briefMessage should set briefMessage to an empty string.
        - voice: The voice to use when speaking this message. By default, the
          "system" voice will be used.
        N�enableSpeech�messagesAreDetailed)r��resetStyles�forcerZr[�enableFlashMessages�flashIsDetailedrr�flashIsPersistentr4r�r�)
r�r�r�rMrr�rZ�joinr��displayMessage)	r%r�r�r�r�r��message�i�durations	         r'rkzScript.presentMessage�
s|��"����&�L��&�&�(�3�3�N�C�#�.�.�0�;�;�<Q�R�&��%����!�!�'��K�W\�!�]��'�'�)�4�4�_�E� �+�+�-�8�8�9O�P��*�*�,�7�7�8M�N�#�.�.�0�;�;�<M�N�&��%�����'�!�*�d�+�!�!�*���'�4�(�&-�D���A�s�1C�1�D��D��(�(�7�+���*�*�,�7�7�8K�L���+�6�6�8�C�C�DV�W���"�"�7�h�?�'O�Q��Es�+F;�F;c�,�tj�y)zjConvenience method to tell speech and braille engines to hand off
        control to other screen readers.N)r��disableBraillerxs r'�idleMessagezScript.idleMessage�
s��	��� r(c���|syt|t�s|g}tj�}|j	|d|�tdt
|��D]}tj||d���y)Nrr|Fr6)rr��sound�	getPlayer�play�ranger�)�soundsr7�_playerr�s    r'�__playz
Script.__play�
sc�����&�$�'��X�F��/�/�#�����V�A�Y�	�*��q�#�f�+�&�	3�A��J�J�v�a�y�E�2�	3r(c�&�|j|�y)z�Adds the braille region to the line.

        Arguments:
        - region: a braille.Region (e.g. what is returned by the braille
          generator's generateBraille() method.
        - line: a braille.Line
        N)�	addRegion)rSris  r'rczScript.addBrailleRegionToLine�
s��	
���v�r(c�&�|j|�y)aAdds the braille region to the line.

        Arguments:
        - regions: a series of braille.Region instances (a single instance
          being what is returned by the braille generator's generateBraille()
          method.
        - line: a braille.Line
        N)�
addRegions)rDris  r'rbzScript.addBrailleRegionsToLine�
s��	
���� r(c�L�|jtj|��y)z�Creates a Braille Region out of string and adds it to the line.

        Arguments:
        - string: the string to be displayed
        - line: a braille.Line
        N)r�r��Region)r=ris  r'�addToLineAsBrailleRegionzScript.addToLineAsBrailleRegions��	
���w�~�~�f�-�.r(c�`�g}|D]&}|jtj|���(|S)z�Creates a list of braille regions from the list of strings.

        Arguments:
        - strings: a list of strings from which to create the list of
          braille Region instances

        Returns the list of braille Region instances
        )r&r�r�)�strings�brailleRegionsr=s   r'�brailleRegionsFromStringsz Script.brailleRegionsFromStringss7�����	:�F��!�!�'�.�.��"8�9�	:��r(c�,�tj�y)zfClears the logical structure, but keeps the Braille display as is
        (until a refresh operation).N)r��clearrr(r'r_zScript.clearBrailles
��
	�
�
�r(c�
�tj�jd�sItj�jd�s&tjtj
dd�yt
j|||�y)a[Displays a single line, setting the cursor to the given position,
        ensuring that the cursor is in view.

        Arguments:
        - message: the string to display
        - cursor: the 0-based cursor position, where -1 (default) means no
          cursor
        - flashTime:  if non-0, the number of milliseconds to display the
          regions before reverting back to what was there before. A 0 means
          to not do any flashing.  A negative number means to display the
          message until some other message comes along or the user presses
          a cursor routing key.
        rZr[z!BRAILLE: display message disabledTN)r�r�r�r�r�r�r�r�)r��cursorr�s   r'r�zScript.displayBrailleMessage#sb��  �*�*�,�7�7��H�#�.�.�0�;�;�<R�S����u�/�/�1T�VZ�[�����w��	�:r(c��tj�jd�sItj�jd�s&tjtj
dd�yt
j||�y)a�Displays a list of regions on a single line, setting focus to the
        specified region.  The regionInfo parameter is something that is
        typically returned by a call to braille_generator.generateBraille.

        Arguments:
        - regionInfo: a list where the first element is a list of regions
          to display and the second element is the region with focus (must
          be in the list from element 0)
        - flashTime:  if non-0, the number of milliseconds to display the
          regions before reverting back to what was there before. A 0 means
          to not do any flashing. A negative number means to display the
          message until some other message comes along or the user presses
          a cursor routing key.
        rZr[z!BRAILLE: display regions disabledTN)r�r�r�r�r�r�r��displayRegions)�
regionInfor�s  r'�displayBrailleRegionszScript.displayBrailleRegions:s`��" �*�*�,�7�7��H�#�.�.�0�;�;�<R�S����u�/�/�1T�VZ�[�����z�9�5r(c�\�|jj|�}|j|�y)z�Convenience method for scripts combining the call to the braille
        generator for the script with the call to displayBrailleRegions.

        Arguments:
        - obj: the accessible object to display in braille
        N)r]r^r�)r%r,rDs   r'�displayBrailleForObjectzScript.displayBrailleForObjectRs(���'�'�7�7��<���"�"�7�+r(c�,�tj|�S)ahGets the accesible and caret offset associated with the given
        event.  The event should have a BrlAPI event that contains an
        argument value that corresponds to a cell on the display.

        Arguments:
        - event: an instance of input_event.BrailleEvent.  event.event is
          the dictionary form of the expanded BrlAPI event.
        )r��getCaretContext�rJs r'r�zScript.getBrailleCaretContext]s���&�&�u�-�-r(c�"�tjS)zzReturns the value of position of the braille cell which has the
        cursor. A value of 0 means no cell has the cursor.)r��
cursorCellrr(r'r^zScript.getBrailleCursorCelljs��
�!�!�!r(c��|rtj�tj�}|rtj|�|S)z�Creates a new braille Line.

        Arguments:
        - clearBraille: Whether the display should be cleared.
        - addLine: Whether the line should be added to the logical display
          for painting.

        Returns the new Line.
        )r�r��Linera)r_raris   r'r`zScript.getNewBrailleLineqs/����M�M�O��|�|�~����O�O�D�!��r(c�4�tj|||||�S)aBCreates a new braille Component.

        Arguments:
        - accessible: the accessible associated with this region
        - string: the string to be displayed
        - cursorOffset: a 0-based index saying where to draw the cursor
          for this Region if it gets focus

        Returns the new Component.
        )r��	Component)�
accessibler=rB�	indicator�expandOnCursors     r'�getNewBrailleComponentzScript.getNewBrailleComponent�s"��� � ��V�\�!*�N�<�	<r(c�0�tj|||�S)z�Creates a new braille Region.

        Arguments:
        - string: the string to be displayed
        - cursorOffset: a 0-based index saying where to draw the cursor
          for this Region if it gets focus

        Returns the new Region.
        )r�r�)r=rBr�s   r'�getNewBrailleRegionzScript.getNewBrailleRegion�s���~�~�f�l�N�C�Cr(c�4�tj|||||�S)a"Creates a new braille Text region.

        Arguments:
        - accessible: the accessible associated with this region and which
          implements AtkText
        - label: an optional label to display
        - eol: the endOfLine indicator

        Returns the new Text region.
        )r��Text)r��label�eolr�r�s     r'�getNewBrailleTextzScript.getNewBrailleText�s���|�|�J��s�K��K�Kr(c�"�tjS)zMIf True, the beginning of the line is showing on the braille
        display.)r��beginningIsShowingrr(r'r�z Script.isBrailleBeginningShowing�s��
�)�)�)r(c�"�tjS)z?If True, the end of the line is showing on the braille display.)r��endIsShowingrr(r'r�zScript.isBrailleEndShowing�s���#�#�#r(c�Z�|rtj|�Stj|�S)aiPans the display to the left, limiting the pan to the beginning
        of the line being displayed.

        Arguments:
        - panAmount: the amount to pan.  A value of 0 means the entire
          width of the physical display.
        - panToLeft: if True, pan to the left; otherwise to the right

        Returns True if a pan actually happened.
        )r��panLeft�panRight)r�r{s  r'r�zScript.panBrailleInDirection�s'����?�?�9�-�-��#�#�I�.�.r(c�.�tj|�y)zSAutomatically pan left or right to make sure the current offset
        is showing.N)r��panToOffset)r�s r'rCzScript.panBrailleToOffset�s��
	���F�#r(c��tj�}|D])}|jtjd|z���+tj�y)z�Method to braille a list of items. Scripts should call this
        method rather than handling the creation and displaying of a
        braille line directly.

        Arguments:
        - items: a list of strings to be presented
        rN)r��getShowingLiner�r�r�)r{ri�items   r'�presentItemsInBraillezScript.presentItemsInBraille�sF���%�%�'���	7�D��N�N�7�>�>�#��*�5�6�	7�	���r(c���tj�jd�sItj�jd�s&tjtj
dd�yd}t
j�}|jD]Q}t|tj�s�|j|k(s�.|j�r|jd�d}n|r|j|�yy)z@Try to reposition the cursor without having to do a full update.rZr[zBRAILLE: update caret disabledTNF)r�r�r�r�r�r�r�r�rDrr�r��repositionCursorrerC)r%r,�brailleNeedsRepaintingrirSs     r'r�z'Script.updateBrailleForNewCaretPosition�s��� �*�*�,�7�7��H�#�.�.�0�;�;�<R�S����u�/�/�1Q�SW�X��!%���%�%�'���l�l�	�F��&�'�,�,�/�F�4E�4E��4L��*�*�,��'�'��-�-2�*��	�"����s�#�"r(c�4�tj||||�y)a�This is the method scripts should use to refresh braille rather
        than calling self.refreshBraille() directly. The intent is to centralize
        such calls into as few places as possible so that we can easily and
        safely not perform braille-related functions for users who do not
        have braille and/or the braille monitor enabled.

        Arguments:

        - panToCursor: if True, will adjust the viewport so the cursor is
          showing.
        - targetCursorCell: Only effective if panToCursor is True.
          0 means automatically place the cursor somewhere on the display so
          as to minimize movement but show as much of the line as possible.
          A positive value is a 1-based target cell from the left side of
          the display and a negative value is a 1-based target cell from the
          right side of the display.
        - getLinkMask: Whether or not we should take the time to get the
          attributeMask for links. Reasons we might not want to include
          knowing that we will fail and/or it taking an unreasonable
          amount of time (AKA Gecko).
        - stopFlash: if True, kill any flashed message that may be showing.
        N)r�r�)�panToCursorr�getLinkMaskr~s    r'rezScript.refreshBraille�s��4	����%5�{�I�Nr(c�2�tj|||�y)aZSpecififes the region with focus.  This region will be positioned
        at the home position if panToFocus is True.

        Arguments:
        - region: the given region, which much be in a line that has been
          added to the logical display
        - panToFocus: whether or not to position the region at the home
          position
        - getLinkMask: Whether or not we should take the time to get the
          attributeMask for links. Reasons we might not want to include
          knowing that we will fail and/or it taking an unreasonable
          amount of time (AKA Gecko).
        N)r��setFocus)rS�
panToFocusr�s   r'rdzScript.setBrailleFocuss�� 	�����[�9r(c�.�tj|�y)z�Turns contracted braille on or off based upon the event.

        Arguments:
        - event: an instance of input_event.BrailleEvent.  event.event is
          the dictionary form of the expanded BrlAPI event.
        N)r�rWr�s r'r�zScript._setContractedBraille-s��	�$�$�U�+r(c��d}|j�r|j}|jj|��}t	j
||�y)z{Method to speak a keyboard event. Scripts should use this method
        rather than calling speech.speakKeyEvent directly.Nr�)�isPrintableKeyr�rDr�rHr�)r%rJr=r�s    r'r�zScript.speakKeyEvent?sI�������!��'�'�F��$�$�*�*�&�*�9�����U�E�*r(c�h�|jj|��}tj||�y)z~Method to speak a single character. Scripts should use this
        method rather than calling speech.speakCharacter directly.r�N)rDr�rHr�)r%r�r�s   r'r�zScript.speakCharacterJs-���$�$�*�*�)�*�<�����i��/r(c�(�tj�jd�r%tj�jd�r|sytj�jd�}|jtj
�}|xs|}||k(r�|r�tj�jd�}tj�j
dtj�|jj�tj�jd�}	tj�j
dtj�|jj�tj|||�||k(r�|r}tj�j
d�|jj�tj�j
d	�|jj�yyy)arMethod to speak a single string. Scripts should use this
        method rather than calling speech.speak directly.

        - string: The string to be spoken.
        - voice: The voice to use. By default, the "system" voice will
          be used.
        - interrupt: If True, any current speech should be interrupted
          prior to speaking the new text.
        r�rdN�voices�capitalizationStyle�verbalizePunctuationStyle)r�r�r�rr��SYSTEM_VOICE�
setSetting�CAPITALIZATION_STYLE_NONErorW�PUNCTUATION_STYLE_NONErVrHrI)
r%r=r�r7r�r�r��systemVoice�capStyle�
punctStyles
          r'rMzScript.speakMessageQs��� �*�*�,�7�7��G��*�*�,�7�7�8P�Q�Z_��!�,�,�.�9�9�(�C���j�j��!6�!6�7���$����K��K�'�2�2�4�?�?�@U�V�H��'�'�)�4�4�%�x�'I�'I�
K��*�*�F�F�H�)�4�4�6�A�A�B]�^�J��'�'�)�4�4�5P�)1�)H�)H�
J��*�*�C�C�E����V�U�I�.��K��K��'�'�)�4�4�5J�H�U��*�*�F�F�H��'�'�)�4�4�5P�R\�]��*�*�C�C�E�%0�r(c�b�g}|D]}|j|��tj|�y)z�Method to speak a list of items. Scripts should call this
        method rather than handling the creation and speaking of
        utterances directly.

        Arguments:
        - items: a list of strings to be presented
        N)r&rHrI)r{rMr�s   r'�presentItemsInSpeechzScript.presentItemsInSpeechxs4���
��	$�D����d�#�	$�	���Z� r(c��tjtj|jj|�z�y)a Speaks some information about an unicode character.
        At the moment it just announces the character unicode number but
        this information may be changed in the future

        Arguments:
        - character: the character to speak information of
        N)rHrIrl�UNICODEr�unicodeValueString)r%r�s  r'�speakUnicodeCharacterzScript.speakUnicodeCharacter�s1��	���X�%�%����:�:�9�E�F�	Gr()T)rrr)NN)�
)r)NNN)NNTF)r4r)FF)rrF)rF)rrNN)rT)TrTT)TT)NTTF)��__name__�
__module__�__qualname__�EMBEDDED_OBJECT_CHARACTER�NO_BREAK_SPACE_CHARACTER�DISPLAYED_LABEL�DISPLAYED_TEXT�KEY_BINDING�
NESTING_LEVEL�
NODE_LEVEL�REAL_ACTIVE_DESCENDANTrryrr�r�r�r�r�r�r�r�r�r�rr	r
rr2rNrXrCrirMrOrQr�rSr�rUrWrYr[r]r@rDrFr�rHrergrr�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�r�r�r�r�r�r�r�r�r�r<r�r�r�rr�r�r�r�r,r�r%rr�r�r�rrr�rryr%r�r�rGr�rkr��staticmethodr�rcrbr�r�r_r�r�r�r�r^r`r�r�r�r�r�r�rCr�r�rerdr�r�r�rMrr�
__classcell__)rs@r'rrEs���� (�� (��'�O�$�N��K�"�M��J�3��$�LtL�l	�S�j��6�p"�H�&1�f3�'�,:�(
6�'�,�1�)Z�V=5�~:�""�N
�� � ;�z+�1�f,�;�����(�.�2�&+��"�>�@
�%�NM�*
�S�4?�?�53�n0�*
�

�

�

�
	B�7�*P�*=�0�"0�HH�J�3T�j>�@
�
�
B�*�<7�,-�\J0�X
 �>�;�Y�<E�8
�

�
P�BW�83�j�$	�$4�L
��$�8.=�`.=�`"?�H#=�J6��BD�
8�B?�BD�*5�n@1�D
5�
G��0�J � �DVZ�"�4@�l!��
3��
3��	��	��
!��
!��/��/����� �����;��;�,�6��6�.	,��
.��
.��"��"�����&�@A�<A�<��<� �D��D��DH�$(�L��L� �*��*��$��$�
�/��/�"�$��$��
��
�$�(�IM�!%�O��O�6�:��:�"�,��,�"	+�0�%F�N�
!��
!�	Gr(r)?�__doc__�__id__�__version__�__date__�
__copyright__�__license__�gi�require_version�
gi.repositoryrr4r9�orca.brailler��
orca.cmdnamesrA�
orca.debugr��	orca.findrr�orca.focus_managerr!�orca.flat_reviewr��orca.input_eventr>�orca.keybindingsr��
orca.messagesrl�	orca.orcarJ�orca.orca_stater��orca.phonnamesru�orca.scriptr�orca.script_managerr��
orca.settingsr��orca.settings_managerr��
orca.soundr��orca.speechrH�orca.speechserverr��orca.ax_documentr�orca.ax_objectr�
orca.ax_tabler�orca.ax_textr�orca.ax_utilitiesr	�
orca.ax_valuer
rrr(r'�<module>r5s���*A�������5�
���	�����7�E�"��	��� ���*�&�&�&� ��$�"��,� �0���(�'�#�!��)�!�L1G�V�]�]�L1Gr(

Zerion Mini Shell 1.0