%PDF- %PDF-
Mini Shell

Mini Shell

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

�

g
f�*���dZdZdZdZdZdZddlZddlmZdd	lm	Z	dd
lm
Z
ddlmZddlmZdd
lm
Z
ddlmZddlmZddlmZGd�d�Zy)z:Script-customizable support for application spellcheckers.z$Id$z
$Revision$z$Date$zCopyright (c) 2014 Igalia, S.L.�LGPL�N)�debug)�
focus_manager)�	guilabels)�messages)�object_properties)�settings_manager)�AXObject)�AXText)�AXUtilitiesc���eZdZdd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd d�Zd d�Zd d�Zd!d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)"�
SpellCheckc��||_||_d|_d|_d|_d|_d|_d|_d|_d|_	d|_
y)NF)N���)�_script�_hasChangeToEntry�_window�_errorWidget�_changeToEntry�_suggestionsList�
_activated�_documentPosition�spellErrorCheckButton�spellSuggestionCheckButton�presentContextCheckButton)�self�script�hasChangeToEntrys   �1/usr/lib/python3/dist-packages/orca/spellcheck.py�__init__zSpellCheck.__init__-sW�����!1������ ���"��� $������!)���%)��"�*.��'�)-��&�c��d|g}tjtj|d�|j|�s+d|dg}tjtj|d�y|jrJ|j|�|_|js(d}tjtj|d�y|j|�|_	|js(d}tjtj|d�y|j|�|_|js(d}tjtj|d�y||_d|_
d	}tjtj|d�y)
Nz&SPELL CHECK: Attempting activation forTzSPELL CHECK:zis not spellcheck windowFz&SPELL CHECK: Change-to entry not foundz#SPELL CHECK: Error widget not foundz'SPELL CHECK: Suggestions list not foundz SPELL CHECK: Activation complete)r�printTokens�
LEVEL_INFO�_isCandidateWindowr�_findChangeToEntryr�printMessage�_findErrorWidgetr�_findSuggestionsListrrr)r�window�tokens�msgs    r�activatezSpellCheck.activate;sE��:�F�C��
���%�*�*�F�D�9��&�&�v�.�$�f�.H�I�F����e�.�.���=���!�!�"&�"9�"9�&�"A�D���&�&�>���"�"�5�#3�#3�S�$�?�� �1�1�&�9���� � �7�C����u�/�/��d�;�� $� 9� 9�&� A����$�$�;�C����u�/�/��d�;��������0��
���5�+�+�S�$�7�r!c�$�|j�y�N)�_clearState�rs r�
deactivatezSpellCheck.deactivate\s�����r!c��|jSr/�rr1s r�getDocumentPositionzSpellCheck.getDocumentPosition_s���%�%�%r!c��||f|_yr/r4)r�obj�offsets   r�setDocumentPositionzSpellCheck.setDocumentPositionbs��!$�f���r!c��|jSr/)rr1s r�getErrorWidgetzSpellCheck.getErrorWidgetes��� � � r!c�z�|jsy|jjj|j�S�N��rr�	utilities�
displayedTextr1s r�getMisspelledWordzSpellCheck.getMisspelledWordh�/��� � ���|�|�%�%�3�3�D�4E�4E�F�Fr!c�z�|jsy|jjj|j�Sr=r?r1s r�getCompletionMessagezSpellCheck.getCompletionMessagenrCr!c��|jSr/)rr1s r�getChangeToEntryzSpellCheck.getChangeToEntryts���"�"�"r!c��|jSr/)rr1s r�getSuggestionsListzSpellCheck.getSuggestionsListws���$�$�$r!c��|jSr/)rr1s r�isActivezSpellCheck.isActivezs�����r!c�H�|r||jk(ry|j|�S)NT)rr-�rr*s  r�
isCheckWindowzSpellCheck.isCheckWindow}s"���f����,���}�}�V�$�$r!c�B�tj|j�Sr/)r�is_sensitiverr1s r�
isCompletezSpellCheck.isComplete�s���+�+�D�,?�,?�@�@�@r!c��y�NF�)r�events  r�isAutoFocusEventzSpellCheck.isAutoFocusEvent����r!c�h�|jsy|xr"tj|�|jk(SrS)rr
�
get_parent)rr7s  r�isSuggestionsItemzSpellCheck.isSuggestionsItem�s/���$�$���H�x�*�*�3�/�4�3H�3H�H�Hr!c���|j�sy|j\}}|r|dk\sytj||�d}|sptj||�d}tjd|�}|j��|j��dk(rtt�fd�|��}|d}|sytj|z}|jjj|��}|jj!||��y)	NFrz(?:\.|\!|\?)�c�&��|j��Sr/)�count)�x�words �r�<lambda>z+SpellCheck.presentContext.<locals>.<lambda>�s���a�g�g�d�m�r!��string��voiceT)rKrr�get_sentence_at_offset�get_line_at_offset�re�splitrBr^�list�filterr�MISSPELLED_WORD_CONTEXTr�speechGeneratorre�speakMessage)	rr7r8rc�	sentences�matchr,rer`s	        @r�presentContextzSpellCheck.presentContext�s�����}�}����,�,���V���!����.�.�s�F�;�A�>����.�.�s�F�;�A�>�F�����&�9�I��)�)�+�D��|�|�D�!�Q�&��V�$;�Y�G�H���q������.�.��7�����,�,�2�2�#�2�>�����!�!�#�U�!�3�r!c� �|j�r|j�sy|jj�|j	�}|jj
j
|��}|jj||��y)NFrbrdT)rKrQr�clearBraillerErmre�presentMessage)rr,res   r�presentCompletionMessagez#SpellCheck.presentCompletionMessage�sl���
�
��D�O�O�$5�����!�!�#��'�'�)�����,�,�2�2�#�2�>�����#�#�C�u�#�5�r!c���|j�ry|j|�rG|j|�|s#tj�jd�r|j
�yy)NF�spellcheckPresentContextT)rQ�presentMistake�presentSuggestionr	�
getManager�
getSettingrq)r�detaileds  r�presentErrorDetailszSpellCheck.presentErrorDetails�sX���?�?������x�(��"�"�8�,��+�6�6�8�C�C�D^�_��#�#�%��r!c�x�|j�sy|j�}|sytj|z}|jj
j
|��}|jj||��|s#tj�jd�r|jj|�y)NFrbrd�spellcheckSpellErrorT)rKrBr�MISSPELLED_WORDrrmrernr	rzr{�spellCurrentItem)rr|r`r,res     rrxzSpellCheck.presentMistake�s����}�}����%�%�'�����&�&��-�����,�,�2�2�#�2�>�����!�!�#�U�!�3��'�2�2�4�?�?�@V�W��L�L�)�)�$�/�r!c�\�|js|j|d��S|j�sy|j}|sy|jj
j
|�xstj|�}|jj
j|dd�}|�d|��}|jjj|��}|jj||��|s#tj�jd	�r|jj!|�y)
NT)�includeLabelFrr� rbrd�spellcheckSpellSuggestion)r�presentSuggestionListItemrKrrr@�displayedLabelr
�get_name�	substringrmrernr	rzr{r�)rr|�entry�labelrcr,res       rryzSpellCheck.presentSuggestion�s����%�%��1�1�(��1�N�N��}�}����#�#�������&�&�5�5�e�<�X��@Q�@Q�RW�@X�����'�'�1�1�%��B�?����q���!�����,�,�2�2�#�2�>�����!�!�#�U�!�3��'�2�2�4�?�?�@[�\��L�L�)�)�&�1�r!c��|j�sy|j}|sy|jjj	|�}t|�dk(sy|r=|jjj
|�xstj|�}nd}tj|d�}|�d|��}|jjj|��}|jj|j�|��|s#tj�jd�r|jj!|�tj�jd	�rp|dt#j�j%�k(rH|j'|d�\}	}
t(j*|	|
d
�z}|jj|�y)NFr\r>rr�rbrdr��enablePositionSpeaking)�index�totalT)rKrrr@�selectedChildren�lenr�r
r�rmrern�stripr	rzr{r�r�get_locus_of_focus�_getSuggestionIndexAndPositionr�GROUP_INDEX_SPEECH)rr|r��suggestions�itemsr�rcr,rer�r�s           rr�z$SpellCheck.presentSuggestionListItem�s����}�}����+�+�������&�&�7�7��D���5�z�Q�����L�L�*�*�9�9�+�F�2��$�$�[�1�
��E��"�"�5��8�,����q���!�����,�,�2�2�#�2�>�����!�!�#�)�)�+�U�!�;��'�2�2�4�?�?�@[�\��L�L�)�)�&�1��&�&�(�3�3�4L�M��Q�x�=�3�3�5�H�H�J�J��>�>�u�Q�x�H�L�E�5�#�6�6�5�SX�9Y�Y�C��L�L�%�%�c�*�r!c�J�d|_d|_d|_d|_d|_yrS)rrrrrr1s rr0zSpellCheck._clearStates(����� ���"��� $�����r!c��yrSrTrMs  rr%zSpellCheck._isCandidateWindowrWr!c��yr/rT�r�roots  rr&zSpellCheck._findChangeToEntry���r!c��yr/rTr�s  rr(zSpellCheck._findErrorWidgetr�r!c��yr/rTr�s  rr)zSpellCheck._findSuggestionsListr�r!c��y)N)rrrT)r�
suggestions  rr�z)SpellCheck._getSuggestionIndexAndPositions��r!c���ddlm}|j�}|jdtj
�d���}|j
d�|j|�|jjdddd�}|jddd	d�|j|�|j�}|j|�tj}tj�j!d
�}|j"j%|�|_|j&j)|�|j+|j&dddd�tj,}tj�j!d�}|j"j%|�|_|j.j)|�|j+|j.dddd�tj0}tj�j!d�}|j"j%|�|_|j2j)|�|j+|j2dd
dd�|S)Nr)�Gtkz<b>z</b>)r�Tg�?r\�rr�rw�)�
gi.repositoryr��Frame�Labelr�SPELL_CHECK�set_use_markup�set_label_widget�	Alignment�new�set_padding�add�Grid�SPELL_CHECK_SPELL_ERRORr	rzr{�CheckButton�new_with_mnemonicr�
set_active�attach�SPELL_CHECK_SPELL_SUGGESTIONr�SPELL_CHECK_PRESENT_CONTEXTr)rr��framer��	alignment�grid�values       r�getAppPreferencesGUIzSpellCheck.getAppPreferencesGUIs���%��	�	����	�	�#�i�&;�&;�%<�D� A�	�B��
���T�"�
���u�%��M�M�%�%�c�3��1�5�	����a��B��*�
�	�	�)���x�x�z���
�
�d���1�1�� �+�+�-�8�8�9O�P��%(�_�_�%F�%F�u�%M��"��"�"�-�-�e�4����D�.�.��1�a��;��6�6�� �+�+�-�8�8�9T�U��*-�/�/�*K�*K�E�*R��'��'�'�2�2�5�9����D�3�3�Q��1�a�@��5�5�� �+�+�-�8�8�9S�T��),���)J�)J�5�)Q��&��&�&�1�1�%�8����D�2�2�A�q�!�Q�?��r!c��|jj�|jj�|jj�d�S)z7Returns a dictionary with the app-specific preferences.)rr�rw)r�
get_activerrr1s r�getPreferencesFromGUIz SpellCheck.getPreferencesFromGUI?sD��%)�$>�$>�$I�$I�$K�)-�)H�)H�)S�)S�)U�(,�(F�(F�(Q�(Q�(S�
�	
r!N)T)F)FF) �__name__�
__module__�__qualname__r r-r2r5r9r;rBrErGrIrKrNrQrVrZrqrur}rxryr�r0r%r&r(r)r�r�r�rTr!rrr+s���.��B�&�-�!�G�G�#�%��%�A��I��4�
�� �*�B ������"�H
r!r)�__doc__�__id__�__version__�__date__�
__copyright__�__license__rh�orcarrrrrr	�orca.ax_objectr
�orca.ax_textr�orca.ax_utilitiesrrrTr!r�<module>r�sN��,A�	������1�
���	�����"�!�#��)�[
�[
r!

Zerion Mini Shell 1.0