
    g
f                     v    d Z dZdZdZdZdZddlmZ ddlm	Z	 ddl
mZ dd	lmZ  G d
 de	j                        Zy)z1Customized support for spellcheck in Thunderbird.z$Id$z
$Revision$z$Date$zCopyright (c) 2014 Igalia, S.L.LGPL    N)AXObject)AXUtilitiesc                   F     e Zd Z fdZd Zd Zd Zd Zd Z fdZ	 xZ
S )
SpellCheckc                 ,    t         t        |   |       y N)superr   __init__)selfscript	__class__s     J/usr/lib/python3/dist-packages/orca/scripts/apps/Thunderbird/spellcheck.pyr   zSpellCheck.__init__&   s    j$(0    c                    |j                   | j                  k7  ryt        j                         j	                         }t        j                  |      sy| j                  j                  j                         \  }}| j                  j                  j                  |      }|D ]#  }|j                  |j                               s# y y)NFT)source_changeToEntryfocus_manager
getManagerget_locus_of_focusr   is_push_button_script	utilitieslastKeyAndModifiersmnemonicShortcutAcceleratorendswithupper)r   eventfocuslastKeymodskeyskeys          r   isAutoFocusEventzSpellCheck.isAutoFocusEvent)   s    <<4...((*==?))%0..BBD||%%AA%H 	C||GMMO,	 r   c                 d    t        j                  |      syd }t        j                  ||      ryy)NFc                 Z    t        j                  |       xs t        j                  |       S r	   )r   is_page_tab_listis_split_panexs    r   isNonSpellCheckChildz;SpellCheck._isCandidateWindow.<locals>.isNonSpellCheckChild=   s$    //2Rk6O6OPQ6RRr   T)r   	is_dialogr   find_descendant)r   windowr+   s      r   _isCandidateWindowzSpellCheck._isCandidateWindow9   s2    $$V,	S ##F,@Ar   c                 4    d }t        j                  ||      S )Nc                 Z    t        j                  |       xr t        j                  |       S r	   )r   is_entryis_single_liner)   s    r   isSingleLineEntryz8SpellCheck._findChangeToEntry.<locals>.isSingleLineEntryF   s#    ''*L{/I/I!/LLr   r   r-   )r   rootr4   s      r   _findChangeToEntryzSpellCheck._findChangeToEntryE   s    	M ''.?@@r   c                 4    d }t        j                  ||      S )Nc                     t        j                  |       xr/ dt        j                  |       vxr t        j                  |        S )N:)r   is_labelr   get_nameget_relationsr)   s    r   isErrorz,SpellCheck._findErrorWidget.<locals>.isErrorL   sC    ''* 68#4#4Q#776$221556r   r5   )r   r6   r>   s      r   _findErrorWidgetzSpellCheck._findErrorWidgetK   s    	6
 ''g66r   c                 4    d }t        j                  ||      S )Nc                     t        j                  |       syt        j                  |       xs t        j                  |       S )NF)r   supports_selectionr   is_list_boxis_listr)   s    r   isListz/SpellCheck._findSuggestionsList.<locals>.isListT   s4    ..q1**1-G1D1DQ1GGr   r5   )r   r6   rE   s      r   _findSuggestionsListzSpellCheck._findSuggestionsListS   s    	H
 ''f55r   c                     t        j                  |      }|j                  d      }|j                  d      }||t        |   |      S t        |      t        |      fS )Nposinsetsetsize)r   get_attributes_dictgetr
   _getSuggestionIndexAndPositionint)r   
suggestionattrsindextotalr   s        r   rL   z)SpellCheck._getSuggestionIndexAndPosition[   s[    ,,Z8		*%		)$=EM79*EE5z3u:%%r   )__name__
__module____qualname__r   r$   r/   r7   r?   rF   rL   __classcell__)r   s   @r   r   r   $   s,    1 
A76& &r   r   )__doc____id____version____date____copyright____license__orca.focus_managerr   orca.spellcheck
spellcheckorca.ax_objectr   orca.ax_utilitiesr   r    r   r   <module>rb      sA   , 8	1 * $ # )>&&& >&r   