Ë
    g
f�  ã                   óŽ   — d Z dZdZdZdZdZddlZ ej                  dd	«       dd
lm	Z	 ddl
mZ ddlmZ ddlmZ  G d„ d«      Zy)aÄ  
Utilities for obtaining information about accessible text.
These utilities are app-type- and toolkit-agnostic. Utilities that might have
different implementations or results depending on the type of app (e.g. terminal,
chat, web) or toolkit (e.g. Qt, Gtk) should be in script_utilities.py file(s).

N.B. There are currently utilities that should never have custom implementations
that live in script_utilities.py files. These will be moved over time.
z$Id$z
$Revision$z$Date$zGCopyright (c) 2024 Igalia, S.L.Copyright (c) 2024 GNOME Foundation Inc.ÚLGPLé    NÚAtspiz2.0)r   é   )Údebug)ÚAXObject)ÚAXUtilitiesc                   ón  — e Zd ZdZed7d„«       Zed„ «       Zed7d„«       Zed7d„«       Zed„ «       Z	ed7d„«       Z
ed7d	„«       Zed
„ «       Zed7d„«       Zed7d„«       Zed„ «       Zed7d„«       Zed„ «       Zed7d„«       Zed„ «       Zed7d„«       Zed„ «       Zed„ «       Zed„ «       Zed„ «       Zed„ «       Zed„ «       Zed„ «       Zed„ «       Zed„ «       Zed„ «       Zed„ «       Zed„ «       Z ed„ «       Z!ed „ «       Z"ed!„ «       Z#ed"„ «       Z$ed#„ «       Z%ed$„ «       Z&ed8d%„«       Z'ed&„ «       Z(ed7d'„«       Z)ed9d(„«       Z*ed)„ «       Z+ed7d*„«       Z,ed+„ «       Z-ed,„ «       Z.ed-„ «       Z/ed.„ «       Z0ed/„ «       Z1ed0„ «       Z2ed7d1„«       Z3ed2„ «       Z4ed3„ «       Z5ed4„ «       Z6ed5„ «       Z7ed6„ «       Z8y):ÚAXTextz:Utilities for obtaining information about accessible text.Nc           	      óÜ  — t         j                  | «      }|sy|€t         j                  | «      }d|cxk  r|k  s.n d|› d�}t        j                  t        j
                  |d«       y	 t        j                  j                  | |t        j                  j                  «      }|j                  j                  d	d
«      }d|› d�| d|› d|j                   › d|j"                  › d�g}t        j$                  t        j
                  |d«       |j                  |j                   |j"                  fS # t        $ r´}	 t        j                  j                  | |t        j                  j                  «      }d|› �}t        j                  t        j
                  |d«       nD# t        $ r8}d|› �}t        j                  t        j
                  |d«       Y d}~Y d}~yd}~ww xY wY d}~�ŒCd}~ww xY w)zJReturns the character, start, and end for the current or specified offset.©Ú r   r   Nr   zWARNING: Offset z, is not valid. No character can be provided.Tú<WARNING: String at offset failed; text at offset succeeded: z.AXText: Exception in get_character_at_offset: ú
ú\nzAXText: Character at offset ú inú'ú' (ú-ú))r
   Úget_character_countÚget_caret_offsetr   ÚprintMessageÚ
LEVEL_INFOr   ÚTextÚget_string_at_offsetÚTextGranularityÚCHARÚ	ExceptionÚget_text_at_offsetÚTextBoundaryTypeÚcontentÚreplaceÚstart_offsetÚ
end_offsetÚprintTokens)	ÚobjÚoffsetÚlengthÚmsgÚresultÚerrorÚerror2Údebug_stringÚtokenss	            ú./usr/lib/python3/dist-packages/orca/ax_text.pyÚget_character_at_offsetzAXText.get_character_at_offset2   sÁ  € ô ×+Ñ+¨CÓ0ˆÙØàˆ>Ü×,Ñ,¨SÓ1ˆFà�FÔ$˜fÔ$Ø$ V HÐ,XÐYˆCÜ×Ñœu×/Ñ/°°dÔ;Øð	@Ü—Z‘Z×4Ñ4°S¸&Ä%×BWÑBW×B\ÑB\Ó]ˆFð —~‘~×-Ñ-¨d°EÓ:ˆØ0°°¸Ð<¸cØ�l�^ 3 v×':Ñ':Ð&;¸1¸V×=NÑ=NÐ<OÈqÐQðSˆä×Ñœ%×*Ñ*¨F°DÔ9Ø�~‰~˜v×2Ñ2°F×4EÑ4EÐEÐEøô! ò 
	@ð	@ÜŸ™×6Ñ6°s¸FÄE×DZÑDZ×D_ÑD_Ó`�ð UÐUZÐT[Ð\�Ü×"Ñ"¤5×#3Ñ#3°S¸$Õ?øô ò  ØFÀvÀhÐO�Ü×"Ñ"¤5×#3Ñ#3°S¸$Ô?ß�xûð úõ @ûð
	@ús<   Á*9D. Ä.	G+Ä89FÅ1+G&Æ	GÆ%*GÇG&ÇGÇG&Ç&G+c                 óž   — t         j                  | ||«      }d|cxk  rt         j                  | «      k  sy yt         j                  | |«      S )z=Returns the character, start, and end at the specified point.r   r   )r
   Úget_offset_at_pointr   r0   ©r&   ÚxÚyr'   s       r/   Úget_character_at_pointzAXText.get_character_at_pointV   óN   € ô ×+Ñ+¨C°°AÓ6ˆØ�FÔ<œV×7Ñ7¸Ó<Ò<Øð =Øä×-Ñ-¨c°6Ó:Ð:ó    c              #   ó  K  — |€t         j                  | «      }d}t         j                  | «      }||k  rKt         j                  | |«      \  }}}|€|sy|r|||f|k7  r|||f–— t	        ||dz   «      }|||f}||k  rŒJyy­w)zOGenerator to iterate by character in obj starting with the character at offset.Nr   )r
   r   r   r0   Úmax)r&   r'   Úlast_resultr(   Ú	characterÚstartÚends          r/   Úiter_characterzAXText.iter_character`   ó    è ø€ ð ˆ>Ü×,Ñ,¨SÓ1ˆFàˆÜ×+Ñ+¨CÓ0ˆØ�vŠoÜ$*×$BÑ$BÀ3ÈÓ$OÑ!ˆI�u˜cØÐ"©9ØÙ˜i¨°Ð4¸ÒCØ ¨Ð+Ò+Ü˜˜f q™jÓ)ˆFØ# U¨CÐ/ˆKð �v�oùó   ‚A=BÂ Bc           	      óx  — t         j                  | «      }|sy|€t         j                  | «      }t        t	        d|«      |dz
  «      }	 t
        j                  j                  | |t
        j                  j                  «      }d|› d	�| d
|j"                  › d|j$                  › d|j&                  › d�g}t        j(                  t        j                   |d«       |j"                  |j$                  |j&                  fS # t        $ r´}	 t
        j                  j                  | |t
        j                  j                  «      }d|› �}t        j                  t        j                   |d«       nD# t        $ r8}d|› �}t        j                  t        j                   |d«       Y d}~Y d}~yd}~ww xY wY d}~�Œ1d}~ww xY w)zEReturns the word, start, and end for the current or specified offset.r   Nr   r   r   Tz)AXText: Exception in get_word_at_offset: zAXText: Word at offset r   r   r   r   r   )r
   r   r   Úminr:   r   r   r   r   ÚWORDr   r   r    Ú
WORD_STARTr   r   r   r!   r#   r$   r%   ©r&   r'   r(   r*   r+   r)   r,   r.   s           r/   Úget_word_at_offsetzAXText.get_word_at_offsetr   s”  € ô ×+Ñ+¨CÓ0ˆÙØàˆ>Ü×,Ñ,¨SÓ1ˆFä”S˜˜F“^ V¨a¡ZÓ0ˆð	@Ü—Z‘Z×4Ñ4°S¸&Ä%×BWÑBW×B\ÑB\Ó]ˆFð ,¨F¨8°3Ð7¸Ø�f—n‘nÐ% S¨×)<Ñ)<Ð(=¸Q¸v×?PÑ?PÐ>QÐQRÐSðUˆä×Ñœ%×*Ñ*¨F°DÔ9Ø�~‰~˜v×2Ñ2°F×4EÑ4EÐEÐEøô! ò 	@ð
@ÜŸ™×6Ñ6Ø˜¤×!7Ñ!7×!BÑ!BóD�ð UÐUZÐT[Ð\�Ü×"Ñ"¤5×#3Ñ#3°S¸$Õ?øô ò  ØAÀ&ÀÐJ�Ü×"Ñ"¤5×#3Ñ#3°S¸$Ô?ß�xûð úõ @ûð	@úó<   Á
9C< Ã<	F9Ä9E*Ä?+F4Å*	F+Å3*F&ÆF4Æ&F+Æ+F4Æ4F9c                 óž   — t         j                  | ||«      }d|cxk  rt         j                  | «      k  sy yt         j                  | |«      S )z8Returns the word, start, and end at the specified point.r   r   )r
   r2   r   rG   r3   s       r/   Úget_word_at_pointzAXText.get_word_at_point’   óN   € ô ×+Ñ+¨C°°AÓ6ˆØ�FÔ<œV×7Ñ7¸Ó<Ò<Øð =Øä×(Ñ(¨¨fÓ5Ð5r8   c              #   ó  K  — |€t         j                  | «      }d}t         j                  | «      }||k  rKt         j                  | |«      \  }}}|€|sy|r|||f|k7  r|||f–— t	        ||dz   «      }|||f}||k  rŒJyy­w)zEGenerator to iterate by word in obj starting with the word at offset.Nr   )r
   r   r   rG   r:   )r&   r'   r;   r(   Úwordr=   r>   s          r/   Ú	iter_wordzAXText.iter_wordœ   ó    è ø€ ð ˆ>Ü×,Ñ,¨SÓ1ˆFàˆÜ×+Ñ+¨CÓ0ˆØ�vŠoÜ%×8Ñ8¸¸fÓEÑˆD�%˜ØÐ"©4ØÙ˜˜u cÐ*¨kÒ9Ø˜E 3Ð&Ò&Ü˜˜f q™jÓ)ˆFØ  sÐ*ˆKð �v�oùrA   c           	      óà  — t         j                  | «      }|sy|€t         j                  | «      }t        j                  | «      st        t        d|«      |dz
  «      }nt        d|«      }	 t        j                  j                  | |t        j                  j                  «      }|j&                  j)                  dd	«      }d
|› d�| d|› d|j*                  › d|j,                  › d�g}t!        j.                  t         j$                  |d«       |j&                  |j*                  |j,                  fS # t        $ r´}	 t        j                  j                  | |t        j                  j                  «      }d|› �}t!        j"                  t         j$                  |d«       nD# t        $ r8}d|› �}t!        j"                  t         j$                  |d«       Y d}~Y d}~yd}~ww xY wY d}~�ŒCd}~ww xY w)zEReturns the line, start, and end for the current or specified offset.r   Nr   r   r   Tz)AXText: Exception in get_line_at_offset: r   r   zAXText: Line at offset r   r   r   r   r   )r
   r   r   r   Úis_multi_linerC   r:   r   r   r   r   ÚLINEr   r   r    Ú
LINE_STARTr   r   r   r!   r"   r#   r$   r%   )	r&   r'   r(   r*   r+   r)   r,   r-   r.   s	            r/   Úget_line_at_offsetzAXText.get_line_at_offset®   s¿  € ô ×+Ñ+¨CÓ0ˆÙØàˆ>Ü×,Ñ,¨SÓ1ˆFô ×(Ñ(¨Ô-Üœ˜Q ›¨°!©Ó4‰Fä˜˜F“^ˆFð	@Ü—Z‘Z×4Ñ4°S¸&Ä%×BWÑBW×B\ÑB\Ó]ˆFð —~‘~×-Ñ-¨d°EÓ:ˆØ+¨F¨8°3Ð7¸Ø�l�^ 3 v×':Ñ':Ð&;¸1¸V×=NÑ=NÐ<OÈqÐQðSˆä×Ñœ%×*Ñ*¨F°DÔ9Ø�~‰~˜v×2Ñ2°F×4EÑ4EÐEÐEøô# ò 	@ð
@ÜŸ™×6Ñ6Ø˜¤×!7Ñ!7×!BÑ!BóD�ð UÐUZÐT[Ð\�Ü×"Ñ"¤5×#3Ñ#3°S¸$Õ?øô ò  ØAÀ&ÀÐJ�Ü×"Ñ"¤5×#3Ñ#3°S¸$Ô?ß�xûð úõ @ûð	@ús<   Á,9D0 Ä0	G-Ä:9FÅ3+G(Æ	GÆ'*GÇG(ÇGÇG(Ç(G-c                 óž   — t         j                  | ||«      }d|cxk  rt         j                  | «      k  sy yt         j                  | |«      S )z8Returns the line, start, and end at the specified point.r   r   )r
   r2   r   rT   r3   s       r/   Úget_line_at_pointzAXText.get_line_at_pointÓ   rK   r8   c              #   ó  K  — |€t         j                  | «      }d}t         j                  | «      }||k  rKt         j                  | |«      \  }}}|€|sy|r|||f|k7  r|||f–— t	        ||dz   «      }|||f}||k  rŒJyy­w)zEGenerator to iterate by line in obj starting with the line at offset.Nr   )r
   r   r   rT   r:   )r&   r'   r;   r(   Úliner=   r>   s          r/   Ú	iter_linezAXText.iter_lineÝ   rO   rA   c           	      óx  — t         j                  | «      }|sy|€t         j                  | «      }t        t	        d|«      |dz
  «      }	 t
        j                  j                  | |t
        j                  j                  «      }d|› d	�| d
|j"                  › d|j$                  › d|j&                  › d�g}t        j(                  t        j                   |d«       |j"                  |j$                  |j&                  fS # t        $ r´}	 t
        j                  j                  | |t
        j                  j                  «      }d|› �}t        j                  t        j                   |d«       nD# t        $ r8}d|› �}t        j                  t        j                   |d«       Y d}~Y d}~yd}~ww xY wY d}~�Œ1d}~ww xY w)zIReturns the sentence, start, and end for the current or specified offset.r   Nr   r   r   Tz-AXText: Exception in get_sentence_at_offset: zAXText: Sentence at offset r   r   r   r   r   )r
   r   r   rC   r:   r   r   r   r   ÚSENTENCEr   r   r    ÚSENTENCE_STARTr   r   r   r!   r#   r$   r%   rF   s           r/   Úget_sentence_at_offsetzAXText.get_sentence_at_offsetï   s”  € ô ×+Ñ+¨CÓ0ˆÙØàˆ>Ü×,Ñ,¨SÓ1ˆFä”S˜˜F“^ V¨a¡ZÓ0ˆð	@Ü—Z‘Z×4Ñ4°S¸&Ä%×BWÑBW×B`ÑB`ÓaˆFð 0°¨x°sÐ;¸SØ�f—n‘nÐ% S¨×)<Ñ)<Ð(=¸Q¸v×?PÑ?PÐ>QÐQRÐSðUˆä×Ñœ%×*Ñ*¨F°DÔ9Ø�~‰~˜v×2Ñ2°F×4EÑ4EÐEÐEøô! ò 	@ð
@ÜŸ™×6Ñ6Ø˜¤×!7Ñ!7×!FÑ!FóH�ð UÐUZÐT[Ð\�Ü×"Ñ"¤5×#3Ñ#3°S¸$Õ?øô ò  ØEÀfÀXÐN�Ü×"Ñ"¤5×#3Ñ#3°S¸$Ô?ß�xûð úõ @ûð	@úrH   c                 óž   — t         j                  | ||«      }d|cxk  rt         j                  | «      k  sy yt         j                  | |«      S )z<Returns the sentence, start, and end at the specified point.r   r   )r
   r2   r   r]   r3   s       r/   Úget_sentence_at_pointzAXText.get_sentence_at_point  sN   € ô ×+Ñ+¨C°°AÓ6ˆØ�FÔ<œV×7Ñ7¸Ó<Ò<Øð =Øä×,Ñ,¨S°&Ó9Ð9r8   c              #   ó  K  — |€t         j                  | «      }d}t         j                  | «      }||k  rKt         j                  | |«      \  }}}|€|sy|r|||f|k7  r|||f–— t	        ||dz   «      }|||f}||k  rŒJyy­w)zMGenerator to iterate by sentence in obj starting with the sentence at offset.Nr   )r
   r   r   r]   r:   )r&   r'   r;   r(   Úsentencer=   r>   s          r/   Úiter_sentencezAXText.iter_sentence  s    è ø€ ð ˆ>Ü×,Ñ,¨SÓ1ˆFàˆÜ×+Ñ+¨CÓ0ˆØ�vŠoÜ#)×#@Ñ#@ÀÀfÓ#MÑ ˆH�e˜SØÐ"©8ØÙ˜X u¨cÐ2°kÒAØ  sÐ*Ò*Ü˜˜f q™jÓ)ˆFØ" E¨3Ð.ˆKð �v�oùrA   c                 óè   — t        j                  | «      syt        j                  | d«      \  }}}|xr d|cxk  xr |k  nc }d| d|› �g}t	        j
                  t        j                  |d«       |S )z7Returns True if sentence iteration is supported on obj.Fr   z'AXText: Sentence iteration supported onú: T)r   Úsupports_textr
   r]   r   r%   r   ©r&   Ústringr=   r>   r*   r.   s         r/   Úsupports_sentence_iterationz"AXText.supports_sentence_iteration+  sq   € ô ×%Ñ% cÔ*Øä#×:Ñ:¸3ÀÓBÑˆ��sØÒ,˜A Ö,¨Ô,ˆØ;¸SÀBÀvÀhÀ-ÐPˆÜ×Ñœ%×*Ñ*¨F°DÔ9Øˆr8   c           	      óx  — t         j                  | «      }|sy|€t         j                  | «      }t        t	        d|«      |dz
  «      }	 t
        j                  j                  | |t
        j                  j                  «      }d|› d�| d	|j                  › d
|j                  › d|j                   › d�g}t        j"                  t        j                  |d«       |j                  |j                  |j                   fS # t        $ r4}d|› �}t        j                  t        j                  |d«       Y d}~yd}~ww xY w)zJReturns the paragraph, start, and end for the current or specified offset.r   Nr   r   z.AXText: Exception in get_paragraph_at_offset: TzAXText: Paragraph at offset r   r   r   r   r   )r
   r   r   rC   r:   r   r   r   r   Ú	PARAGRAPHr   r   r   r   r!   r#   r$   r%   )r&   r'   r(   r*   r+   r)   r.   s          r/   Úget_paragraph_at_offsetzAXText.get_paragraph_at_offset8  s   € ô ×+Ñ+¨CÓ0ˆÙØàˆ>Ü×,Ñ,¨SÓ1ˆFä”S˜˜F“^ V¨a¡ZÓ0ˆð	Ü—Z‘Z×4Ñ4°S¸&Ä%×BWÑBW×BaÑBaÓbˆFð 1°°¸Ð<¸cØ�f—n‘nÐ% S¨×)<Ñ)<Ð(=¸Q¸v×?PÑ?PÐ>QÐQRÐSðUˆä×Ñœ%×*Ñ*¨F°DÔ9Ø�~‰~˜v×2Ñ2°F×4EÑ4EÐEÐEøô ò 	ØBÀ5À'ÐJˆCÜ×Ñœu×/Ñ/°°dÔ;Üûð	ús   Á
9C< Ã<	D9Ä*D4Ä4D9c                 óž   — t         j                  | ||«      }d|cxk  rt         j                  | «      k  sy yt         j                  | |«      S )z=Returns the paragraph, start, and end at the specified point.r   r   )r
   r2   r   rk   r3   s       r/   Úget_paragraph_at_pointzAXText.get_paragraph_at_pointP  r7   r8   c              #   ó  K  — |€t         j                  | «      }d}t         j                  | «      }||k  rKt         j                  | |«      \  }}}|€|sy|r|||f|k7  r|||f–— t	        ||dz   «      }|||f}||k  rŒJyy­w)zOGenerator to iterate by paragraph in obj starting with the paragraph at offset.Nr   )r
   r   r   rk   r:   )r&   r'   r;   r(   Ú	paragraphr=   r>   s          r/   Úiter_paragraphzAXText.iter_paragraphZ  r@   rA   c                 óè   — t        j                  | «      syt        j                  | d«      \  }}}|xr d|cxk  xr |k  nc }d| d|› �g}t	        j
                  t        j                  |d«       |S )z8Returns True if paragraph iteration is supported on obj.Fr   z(AXText: Paragraph iteration supported onrd   T)r   re   r
   rk   r   r%   r   rf   s         r/   Úsupports_paragraph_iterationz#AXText.supports_paragraph_iterationl  sq   € ô ×%Ñ% cÔ*Øä#×;Ñ;¸CÀÓCÑˆ��sØÒ,˜A Ö,¨Ô,ˆØ<¸cÀRÈÀxÀ=ÐQˆÜ×Ñœ%×*Ñ*¨F°DÔ9Øˆr8   c                 óN  — t        j                  | «      sy	 t        j                  j	                  | «      }d| d|› d�g}t        j                  t        j                  |d«       |S # t
        $ r4}d|› �}t        j                  t        j                  |d«       Y d}~yd}~ww xY w)z#Returns the character count of obj.r   z*AXText: Exception in get_character_count: TNúAXText:úreports z characters.)
r   re   r   r   r   r   r   r   r   r%   )r&   Úcountr+   r)   r.   s        r/   r   zAXText.get_character_county  s›   € ô ×%Ñ% cÔ*Øð	Ü—J‘J×2Ñ2°3Ó7ˆEð ˜S H¨U¨G°<Ð"@ÐAˆÜ×Ñœ%×*Ñ*¨F°DÔ9Øˆøô ò 	Ø>¸u¸gÐFˆCÜ×Ñœu×/Ñ/°°dÔ;Üûð	úó   ˜A' Á'	B$Á0*BÂB$c                 óN  — t        j                  | «      sy	 t        j                  j	                  | «      }d| d|› d�g}t        j                  t        j                  |d«       |S # t
        $ r4}d|› �}t        j                  t        j                  |d«       Y d}~yd}~ww xY w)z Returns the caret offset of obj.éÿÿÿÿz'AXText: Exception in get_caret_offset: TNrt   zreports caret offset of ú.)
r   re   r   r   r   r   r   r   r   r%   )r&   r'   r+   r)   r.   s        r/   r   zAXText.get_caret_offset‹  sœ   € ô ×%Ñ% cÔ*Øð	Ü—Z‘Z×0Ñ0°Ó5ˆFð ˜SÐ$<¸V¸HÀAÐ"FÐGˆÜ×Ñœ%×*Ñ*¨F°DÔ9Øˆøô ò 	Ø;¸E¸7ÐCˆCÜ×Ñœu×/Ñ/°°dÔ;Üûð	úrw   c                 óV  — t        j                  | «      sy	 t        j                  j	                  | |«      }d|› d�| d|› �g}t        j                  t        j                  |d«       |S # t
        $ r4}d|› �}t        j                  t        j                  |d«       Y d}~yd}~ww xY w)úPReturns False if we definitely failed to set the offset. True cannot be trusted.Fz'AXText: Exception in set_caret_offset: TNz-AXText: Reported result of setting offset to r   rd   )
r   re   r   r   Úset_caret_offsetr   r   r   r   r%   ©r&   r'   r*   r+   r)   r.   s         r/   r}   zAXText.set_caret_offset�  s¨   € ô ×%Ñ% cÔ*Øð	Ü—Z‘Z×0Ñ0°°fÓ=ˆFð BÀ&ÀÈÐMÈsÐVXÐY_ÐX`ÐTaÐbˆÜ×Ñœ%×*Ñ*¨F°DÔ9Øˆøô ò 	Ø;¸E¸7ÐCˆCÜ×Ñœu×/Ñ/°°dÔ;Üûð	ús   ˜ A+ Á+	B(Á4*B#Â#B(c                 ó.   — t         j                  | d«      S )r|   r   )r
   r}   ©r&   s    r/   Úset_caret_offset_to_startz AXText.set_caret_offset_to_start¯  s   € ô ×&Ñ& s¨AÓ.Ð.r8   c                 óT   — t         j                  | t         j                  | «      «      S )r|   )r
   r}   r   r€   s    r/   Úset_caret_offset_to_endzAXText.set_caret_offset_to_endµ  s"   € ô ×&Ñ& s¬F×,FÑ,FÀsÓ,KÓLÐLr8   c           	      ó^  — t        j                  | «      sy	 t        j                  j	                  | ||«      }d| d|› d|› d|› d	�g}t        j                  t        j                  |d«       |S # t
        $ r4}d|› �}t        j                  t        j                  |d«       Y d}~yd}~ww xY w)
z5Returns the text of obj within the specified offsets.r   z$AXText: Exception in get_substring: TNúAXText: Text ofú(r   z): 'r   )
r   re   r   r   Úget_textr   r   r   r   r%   )r&   r#   r$   r*   r+   r)   r.   s          r/   Úget_substringzAXText.get_substring»  s¬   € ô ×%Ñ% cÔ*Øð	Ü—Z‘Z×(Ñ(¨¨l¸JÓGˆFð $ S¨A¨l¨^¸1¸Z¸LÈÈVÈHÐTUÐ*VÐWˆÜ×Ñœ%×*Ñ*¨F°DÔ9Øˆøô ò 	Ø8¸¸Ð@ˆCÜ×Ñœu×/Ñ/°°dÔ;Üûð	ús   ˜!A/ Á/	B,Á8*B'Â'B,c                 ó  — t         j                  | «      }|sy	 t        j                  j	                  | d|«      }|j                  «       }t        |«      dkD  r,dj                  |dd «      › d	dj                  |d
d «      › �}n|}|j                  dd«      }d| d|› d�g}t        j                  t        j                  |d«       |S # t
        $ r4}d|› �}t        j                  t        j                  |d«       Y d}~yd}~ww xY w)z Returns the text content of obj.r   r   z#AXText: Exception in get_all_text: TNé
   ú é   ú ... éûÿÿÿr   r   r…   r   )r
   r   r   r   r‡   r   r   r   r   ÚsplitÚlenÚjoinr"   r%   )r&   r(   r*   r+   r)   Úwordsr-   r.   s           r/   Úget_all_textzAXText.get_all_textÍ  s  € ô ×+Ñ+¨CÓ0ˆÙØð	Ü—Z‘Z×(Ñ(¨¨a°Ó8ˆFð —‘“ˆÜˆu‹:˜Š?Ø!Ÿh™h u¨R¨a yÓ1Ð2°%¸¿¹ÀÀrÀsÀÓ8LÐ7MÐN‰Là!ˆLà#×+Ñ+¨D°%Ó8ˆØ# S¨A¨l¨^¸1Ð*=Ð>ˆÜ×Ñœ%×*Ñ*¨F°DÔ9Øˆøô ò 	Ø7¸°wÐ?ˆCÜ×Ñœu×/Ñ/°°dÔ;Üûð	ús   š!C	 Ã		DÃ*DÄDc                 óN  — t        j                  | «      sy	 t        j                  j	                  | «      }d| d|› d�g}t        j                  t        j                  |d«       |S # t
        $ r4}d|› �}t        j                  t        j                  |d«       Y d}~yd}~ww xY w)z:Returns the number of reported selected substrings in obj.r   z(AXText: Exception in _get_n_selections: TNrt   ru   z selection(s).)
r   re   r   r   Úget_n_selectionsr   r   r   r   r%   )r&   r*   r+   r)   r.   s        r/   Ú_get_n_selectionszAXText._get_n_selectionsç  s›   € ô ×%Ñ% cÔ*Øð	Ü—Z‘Z×0Ñ0°Ó5ˆFð ˜S H¨V¨H°NÐ"CÐDˆÜ×Ñœ%×*Ñ*¨F°DÔ9Øˆøô ò 	Ø<¸U¸GÐDˆCÜ×Ñœu×/Ñ/°°dÔ;Üûð	úrw   c                 óò   — t        j                  | «      sy	 t        j                  j	                  | |«       y# t
        $ r4}d|› �}t        j                  t        j                  |d«       Y d}~yd}~ww xY w)z+Attempts to remove the specified selection.Nz(AXText: Exception in _remove_selection: T)	r   re   r   r   Úremove_selectionr   r   r   r   )r&   Úselection_numberr+   r)   s       r/   Ú_remove_selectionzAXText._remove_selectionù  sf   € ô ×%Ñ% cÔ*Øð	Ü�J‰J×'Ñ'¨Ð-=Õ>øÜò 	Ø<¸U¸GÐDˆCÜ×Ñœu×/Ñ/°°dÔ;Üûð	ús   ˜ 9 ¹	A6Á*A1Á1A6c                 ó>   — t        t        j                  | «      «      S )z&Returns True if obj has selected text.)Úboolr
   Úget_selected_rangesr€   s    r/   Úhas_selected_textzAXText.has_selected_text  s   € ô ”F×.Ñ.¨sÓ3Ó4Ð4r8   c                 ó’   — t         j                  | «      }|syt         j                  | «      }|sy|d   d   dk(  xr |d   d   |k(  S )z0Returns True of all the text in obj is selected.Fr   ry   r   )r
   r   r�   )r&   r(   Úrangess      r/   Úis_all_text_selectedzAXText.is_all_text_selected  sU   € ô ×+Ñ+¨CÓ0ˆÙØä×+Ñ+¨CÓ0ˆÙØà�a‰y˜‰|˜qÑ Ò< V¨B¡Z°¡]°fÑ%<Ð<r8   c                 óv   — t        t        j                  | «      «      D ]  }t        j                  | |«       Œ y)z$Attempts to clear the selected text.N)Úranger
   r–   rš   )r&   Úis     r/   Úclear_all_selected_textzAXText.clear_all_selected_text  s3   € ô ”v×/Ñ/°Ó4Ó5ò 	-ˆAÜ×$Ñ$ S¨!Õ,ñ	-r8   c                 óB   — t         j                  | «      }|r|d   d   S y)z1Returns the leftmost offset of the selected text.r   ry   ©r
   r�   ©r&   r    s     r/   Úget_selection_start_offsetz!AXText.get_selection_start_offset"  s(   € ô ×+Ñ+¨CÓ0ˆÙØ˜!‘9˜Q‘<Ðàr8   c                 óB   — t         j                  | «      }|r|d   d   S y)z2Returns the rightmost offset of the selected text.ry   r   r§   r¨   s     r/   Úget_selection_end_offsetzAXText.get_selection_end_offset,  s(   € ô ×+Ñ+¨CÓ0ˆÙØ˜"‘:˜a‘=Ð àr8   c                 ó  — t         j                  | «      }|sg S g }t        |«      D ]m  }	 t        j                  j                  | |«      }d|j                  cxk  r|j                  k  sŒDn ŒG|j                  |j                  |j                  f«       Œo d| d|› �g}t        j                  t        j                  |d«       |S # t        $ r5}d|› �}t        j                  t        j                  |d«       Y d}~ Œhd}~ww xY w)zQReturns a list of (start_offset, end_offset) tuples reflecting the selected text.z*AXText: Exception in get_selected_ranges: TNr   rt   zreports selected ranges: )r
   r–   r£   r   r   Úget_selectionr   r   r   r   r#   r$   Úappendr%   )r&   rv   Ú
selectionsr¤   r*   r+   r)   r.   s           r/   r�   zAXText.get_selected_ranges6  sø   € ô ×(Ñ(¨Ó-ˆÙØˆIàˆ
Ü�u“ò 	LˆAðÜŸ™×1Ñ1°#°qÓ9�ð
 �F×'Ñ'Ô;¨&×*;Ñ*;Ö;Ø×!Ñ! 6×#6Ñ#6¸×8IÑ8IÐ"JÕKð	Lð ˜SÐ$=¸j¸\Ð"JÐKˆÜ×Ñœ%×*Ñ*¨F°DÔ9ØÐøô ò ØBÀ5À'ÐJ�Ü×"Ñ"¤5×#3Ñ#3°S¸$Ô?Ýûðús   « CÃ	DÃ*C?Ã?Dc           	      ó   — t         j                  | «      }|syg }d}d}t        t        |«      «      D ]4  }|j	                  t        j
                  | g|¢­Ž «       |d   }|�Œ0|d   }Œ6 dj                  |«      }|j                  «       }t        |«      dkD  r,dj                  |dd «      › ddj                  |d	d «      › �}n|}d
| d|› d|› d|› d�g}	t        j                  t        j                  |	d«       |||fS )z4Returns the selected string, start, and end for obj.r   Nr   r   r‹   rŠ   rŒ   r�   rŽ   zAXText: Selected text ofr   r   r   r   T)r
   r�   ÚsortedÚsetr®   rˆ   r‘   r�   r�   r   r%   r   )
r&   r¯   Ústringsr#   r$   Ú	selectionÚtextr’   r-   r.   s
             r/   Úget_selected_textzAXText.get_selected_textM  s  € ô ×/Ñ/°Ó4ˆ
ÙØàˆØˆØˆ
Ü¤ J£Ó0ò 	,ˆIØ�N‰Nœ6×/Ñ/°Ð@°iÒ@ÔAØ" 1™ˆJØÑ#Ø(¨™|‘ð		,ð �x‰x˜Ó ˆØ—
‘
“ˆÜˆt‹9�rŠ>Ø!Ÿh™h u¨R¨a yÓ1Ð2°%¸¿¹ÀÀrÀsÀÓ8LÐ7MÐN‰LàˆLà,¨cØ�l�^ 3 | n°A°j°\ÀÐCðEˆä×Ñœ%×*Ñ*¨F°DÔ9Ø�\ :Ð-Ð-r8   c                 óö   — t        j                  | «      sy	 t        j                  j	                  | ||«      }|S # t
        $ r4}d|› �}t        j                  t        j                  |d«       Y d}~yd}~ww xY w)z7Creates a new selection for the specified range in obj.Fz%AXText: Exception in _add_selection: TN)	r   re   r   r   Úadd_selectionr   r   r   r   )r&   r#   r$   r*   r+   r)   s         r/   Ú_add_new_selectionzAXText._add_new_selectionj  sr   € ô ×%Ñ% cÔ*Øð	Ü—Z‘Z×-Ñ-¨c°<ÀÓLˆFð ˆøô ò 	Ø9¸%¸ÐAˆCÜ×Ñœu×/Ñ/°°dÔ;Üûð	ús   ˜!; »	A8Á*A3Á3A8c                 óø   — t        j                  | «      sy	 t        j                  j	                  | |||«      }|S # t
        $ r4}d|› �}t        j                  t        j                  |d«       Y d}~yd}~ww xY w)z;Modifies specified selection in obj to the specified range.Fz(AXText: Exception in set_selected_text: TN)	r   re   r   r   Úset_selectionr   r   r   r   )r&   r#   r$   r™   r*   r+   r)   s          r/   Ú_update_existing_selectionz!AXText._update_existing_selectionz  sv   € ô ×%Ñ% cÔ*Øð	Ü—Z‘Z×-Ñ-¨cÐ3CÀ\ÐS]Ó^ˆFð ˆøô ò 	Ø<¸U¸GÐDˆCÜ×Ñœu×/Ñ/°°dÔ;Üûð	ús   ˜"< ¼	A9Á*A4Á4A9c                 ó�  — t         j                  | «      dkD  rt         j                  | ||«      }nt         j                  | ||«      }|r|t        j
                  t        j                  k\  r[t         j                  | ||«      }t         j                  | «      d   }||k7  r'd}t	        j                  t        j
                  |d«       |S )zSReturns False if we definitely failed to set the selection. True cannot be trusted.r   z1AXText: Substring and selected text do not match.T)
r
   r–   r¼   r¹   r   r   Ú
debugLevelrˆ   r¶   r   )r&   r#   r$   r*   Ú	substringr´   r)   s          r/   Úset_selected_textzAXText.set_selected_textŠ  s¨   € ô ×#Ñ# CÓ(¨1Ò,Ü×6Ñ6°s¸LÈ*ÓU‰Fä×.Ñ.¨s°LÀ*ÓMˆFá”e×&Ñ&¬%×*:Ñ*:Ò:Ü×,Ñ,¨S°,À
ÓKˆIÜ×0Ñ0°Ó5°aÑ8ˆIØ˜IÒ%ØI�Ü×"Ñ"¤5×#3Ñ#3°S¸$Ô?àˆr8   c                 ó  — t        j                  | «      si ddfS |€t        j                  | «      }	 t        j
                  j                  | |d¬«      }d| d|› d|› �g}t        j                  t        j                  |d«       |d   xs i |d	   xs d|d
   xs t        j                  | «      fS # t        $ rL}d|› �}t        j                  t        j                  |d«       i dt        j                  | «      fcY d}~S d}~ww xY w)zCReturns a (dict, start, end) tuple for attributes at offset in obj.r   NT)Úinclude_defaultsz4AXText: Exception in get_text_attributes_at_offset: zAXText: Attributes forz
at offset z : r   é   )r   re   r
   r   r   r   Úget_attribute_runr   r   r   r   r   r%   r~   s         r/   Úget_text_attributes_at_offsetz$AXText.get_text_attributes_at_offsetŸ  s  € ô ×%Ñ% cÔ*Ø�q˜!�8ˆOàˆ>Ü×,Ñ,¨SÓ1ˆFð	:Ü—Z‘Z×1Ñ1°#°vÐPTÐ1ÓUˆFð +¨C°:¸f¸XÀSÈÈÐ1QÐRˆÜ×Ñœ%×*Ñ*¨F°DÔ9Ø�a‰yŠ˜B  q¡	¢¨Q°°q±	Ò0\¼V×=WÑ=WÐX[Ó=\Ð\Ð\øô ò 	:ØHÈÈÐPˆCÜ×Ñœu×/Ñ/°°dÔ;Ø�qœ&×4Ñ4°SÓ9Ð9Õ9ûð	:ús   ³"B2 Â2	DÂ;ADÃ<DÄDc                 óB  — t        j                  | «      sg S |dk(  rt        j                  | «      }d| d|› d|› �g}t	        j
                  t        j                  |d«       g }|}||k  r€t        j                  | |«      \  }}}||k  r|j                  t        ||«      ||f«       n-d|› d|› �}	t	        j                  t        j                  |	d«       t        ||dz   «      }||k  rŒ€d	t        |«      › d
�}	t	        j                  t        j                  |	d«       |S )z:Returns a list of (start, end, attrs dict) tuples for obj.ry   zAXText: Getting attributes forzchars: r   TzAXText: Start offset z > end offset r   zAXText: z attribute ranges found.)r   re   r
   r   r   r%   r   rÅ   r®   r:   r   r�   )
r&   r#   r$   r.   Úrvr'   Úattrsr=   r>   r)   s
             r/   Úget_all_text_attributeszAXText.get_all_text_attributes´  s'  € ô ×%Ñ% cÔ*ØˆIà˜ÒÜ×3Ñ3°CÓ8ˆJà2°C¸7À<À.ÐPQÐR\ÐQ]Ð9^Ð_ˆÜ×Ñœ%×*Ñ*¨F°DÔ9àˆØˆØ�zÒ!Ü &× DÑ DÀSÈ&Ó QÑˆE�5˜#Ø˜Š|Ø—	‘	œ3˜u fÓ-¨s°EÐ:Õ;ð .¨e¨W°NÀ3À%ÐH�Ü×"Ñ"¤5×#3Ñ#3°S¸$Ô?Ü˜˜f q™jÓ)ˆFð �zÓ!ð œ˜R›˜	Ð!9Ð:ˆÜ×Ñœ5×+Ñ+¨S°$Ô7Øˆ	r8   c                 óŽ  — t        j                  | «      sy	 t        j                  j	                  | ||t        j
                  j                  «      }d| d|› d|› d|› �g}t        j                  t        j                  |d«       |S # t        $ r4}d|› �}t        j                  t        j                  |d«       Y d}~yd}~ww xY w)	z;Returns the character offset in obj at the specified point.ry   z*AXText: Exception in get_offset_at_point: TNzAXText: Offset inzat ú, z is )r   re   r   r   r2   Ú	CoordTypeÚWINDOWr   r   r   r   r%   )r&   r4   r5   r'   r+   r)   r.   s          r/   r2   zAXText.get_offset_at_pointÑ  sµ   € ô ×%Ñ% cÔ*Øð	Ü—Z‘Z×3Ñ3°C¸¸A¼u¿¹×?UÑ?UÓVˆFð & s¨c°!°°B°q°c¸¸f¸XÐ,FÐGˆÜ×Ñœ%×*Ñ*¨F°DÔ9Øˆøô ò 	Ø>¸u¸gÐFˆCÜ×Ñœu×/Ñ/°°dÔ;Üûð	ús   ˜:B Â	CÂ*B?Â?Cc                 ó   — t        j                  | «      st        j                  «       S |€t        j                  | «      }	 t        j                  j                  | |t        j                  j                  «      }d|› d�| d|g}t        j                  t        j                  |d«       |S # t        $ rH}d|› �}t        j                  t        j                  |d«       t        j                  «       cY d}~S d}~ww xY w)zGReturns the Atspi rect of the character at the specified offset in obj.Nz)AXText: Exception in get_character_rect: TzAXText: Offset r   úhas rect)r   re   r   ÚRectr
   r   r   Úget_character_extentsrÌ   rÍ   r   r   r   r   r%   )r&   r'   Úrectr+   r)   r.   s         r/   Úget_character_rectzAXText.get_character_rectã  sÒ   € ô ×%Ñ% cÔ*Ü—:‘:“<Ðàˆ>Ü×,Ñ,¨SÓ1ˆFð	 Ü—:‘:×3Ñ3°C¸ÄÇÁ×AWÑAWÓXˆDð $ F 8¨3Ð/°°jÀ$ÐGˆÜ×Ñœ%×*Ñ*¨F°DÔ9Øˆøô ò 	 Ø=¸e¸WÐEˆCÜ×Ñœu×/Ñ/°°dÔ;Ü—:‘:“<Õûð	 ús   Á9B, Â,	C=Â5=C8Ã2C=Ã8C=c                 óà  — t        j                  | «      st        j                  «       S 	 t        j                  j                  | ||t        j                  j                  «      }d|› d|› d�| d|g}t        j                  t        j                  |d«       |S # t        $ rK}d| d|› �g}t        j                  t        j                  |d«       t        j                  «       cY d}~S d}~ww xY w)	zCReturns the Atspi rect of the string at the specified range in obj.z'AXText: Exception in get_range_rect forú:TNzAXText: Range r   r   rÏ   )r   re   r   rÐ   r   Úget_range_extentsrÌ   rÍ   r   r   r%   r   )r&   r=   r>   rÒ   r+   r.   s         r/   Úget_range_rectzAXText.get_range_rectø  sË   € ô ×%Ñ% cÔ*Ü—:‘:“<Ðð	 Ü—:‘:×/Ñ/°°U¸CÄÇÁ×AWÑAWÓXˆDð # 5 '¨¨3¨%¨sÐ3°S¸*ÀdÐKˆÜ×Ñœ%×*Ñ*¨F°DÔ9Øˆøô ò 	 Ø?ÀÈÈ5ÈÀlÐSˆFÜ×Ñœe×.Ñ.°¸Ô=Ü—:‘:“<Õûð	 ús   «:B Â	C-Â"A C(Ã"C-Ã(C-c                 ó>  — |j                   | j                   k  xrƒ |j                  | j                  k  xrh |j                   |j                  z   | j                   | j                  z   k\  xr3 |j                  |j                  z   | j                  | j                  z   k\  S )z1Returns true if rect1 is fully contained in rect2)r4   r5   ÚwidthÚheight)Úrect1Úrect2s     r/   Ú_rect_is_fully_contained_inz"AXText._rect_is_fully_contained_in
  s   € ð �w‰w˜%Ÿ'™'Ñ!ò A e§g¡g°·±Ñ&8ò AØ—‘˜%Ÿ+™+Ñ%¨¯©°5·;±;Ñ)>Ñ>òAà—‘˜%Ÿ,™,Ñ&¨%¯'©'°E·L±LÑ*@Ñ@ð	Ar8   c                 óü   — t        d|j                  «      |_        | j                  | j                  dz  z   |j                  k  ry| j                  | j                  dz  z   |j                  |j                  z   kD  ryy)zFReturns -1 (line above), 1 (line below), or 0 (line inside) clip_rect.r   rÃ   ry   r   )r:   r5   rÚ   )Ú	line_rectÚ	clip_rects     r/   Ú_line_comparisonzAXText._line_comparison  sj   € ô
 ˜!˜YŸ[™[Ó)ˆ	Œà�;‰;˜×)Ñ)¨AÑ-Ñ-°	·±Ò;Øà�;‰;˜×)Ñ)¨AÑ-Ñ-°	·±¸i×>NÑ>NÑ0NÒNØàr8   c           	      ó”  — d| d|g}t        j                  t         j                  |d«       t        j	                  | |«      \  }}}|j                  dd«      }d| d|› d|› d	|› d
�g}t        j                  t         j                  |d«       |||fg}|}t        j                  | |«      D ]L  \  }}}t        j                  | ||«      }	t        j                  |	|«      dkD  r n|j                  |||f«       ŒN |d   \  }}}|j                  dd«      }d| d|› d|› d	|› d
�g}t        j                  t         j                  |d«       |S )zIReturns a list of (string, start, end) for lines of obj inside clip_rect.z!AXText: Getting visible lines forÚinsideTr   r   zAXText: First visible line inzis: 'r   r   r   r   ry   zAXText: Last visible line in)
r   r%   r   r
   Úfind_first_visible_liner"   rY   r×   rá   r®   )
r&   rà   r.   rX   r=   r>   r-   r*   r'   rß   s
             r/   Úget_visible_lineszAXText.get_visible_lines!  sm  € ð 6°s¸HÀiÐPˆÜ×Ñœ%×*Ñ*¨F°DÔ9ä!×9Ñ9¸#¸yÓIÑˆˆe�SØ—|‘| D¨%Ó0ˆØ1°3¸%À¸~ÈSÐQVÐPWÐWXÐY\ÐX]Ð]^Ð8_Ð`ˆÜ×Ñœ%×*Ñ*¨F°DÔ9à˜ Ð$Ð%ˆØˆÜ &× 0Ñ 0°°fÓ =ò 	.ÑˆD�%˜Ü×-Ñ-¨c°5¸#Ó>ˆIÜ×&Ñ& y°)Ó<¸qÒ@ÙØ�M‰M˜4 ¨Ð,Õ-ð		.ð " "™:Ñˆˆe�SØ—|‘| D¨%Ó0ˆØ0°#¸¸|¸nÈCÐPUÈwÐVWÐX[ÐW\Ð\]Ð7^Ð_ˆÜ×Ñœ%×*Ñ*¨F°DÔ9Øˆr8   c                 óˆ  — d}t         j                  | «      }d|}}||k  �r ||z   dz  }t         j                  | |«      \  }}}	|dk(  r|||	fS |dk  r/d|g}
t        j                  t        j
                  |
d«       |dz   }Œf|||	f}t         j                  | |dz
  «      \  }}}|dk  r|dk  r|S t         j                  | ||	«      }t         j                  ||«      dk  r|dz   }ŒÊt         j                  ||«      dkD  r|}Œæt         j                  | ||«      }t         j                  ||«      dk7  r|S |||f}|}||k  r�Œ |S )zLReturns the first (string, start, end) visible line of obj inside clip_rect.r   r   rÃ   z(AXText: Treating invalid offset as aboveTr   ©r
   r   rT   r   r%   r   r×   rá   )r&   rà   r*   r(   ÚlowÚhighÚmidrX   r=   r>   r.   Úprevious_lineÚprevious_startÚprevious_endÚ	text_rectÚprevious_rects                   r/   rä   zAXText.find_first_visible_line;  s|  € ð ˆÜ×+Ñ+¨CÓ0ˆØ�vˆTˆØ�D‹jØ˜‘: !Ñ#ˆCÜ%×8Ñ8¸¸cÓBÑˆD�%˜Ø˜ŠzØ˜U CÐ'Ð'à�qŠyØDÀiÐP�Ü×!Ñ!¤%×"2Ñ"2°F¸DÔAØ˜A‘g�Øà˜5 #Ð%ˆFÜ:@×:SÑ:SÐTWÐY^ÐabÑYbÓ:cÑ7ˆM˜>¨<Ø Ò" |°qÒ'8Ø�ä×-Ñ-¨c°5¸#Ó>ˆIÜ×&Ñ& y°)Ó<¸qÒ@Ø˜A‘g�Øä×&Ñ& y°)Ó<¸qÒ@Ø�Øä"×1Ñ1°#°~À|ÓTˆMÜ×&Ñ& }°iÓ@ÀAÒEØ�à" N°LÐ@ˆFØˆDð? �DŒjðB ˆr8   c                 ó‚  — d}t         j                  | «      }d|}}||k  �r||z   dz  }t         j                  | |«      \  }}}	|	|k\  r|||	fS |	dk  r,d|g}
t        j                  t        j
                  |
d«       |}Œc|||	f}t         j                  | |	«      \  }}}|dk  r|dk  r|S t         j                  | ||	«      }t         j                  ||«      dk  r|dz   }ŒÄt         j                  ||«      dkD  r|}Œàt         j                  | ||«      }t         j                  ||«      dk7  r|S |||f}|dz   }||k  r�Œ|S )zKReturns the last (string, start, end) visible line of obj inside clip_rect.r   r   rÃ   z(AXText: Treating invalid offset as belowTr   rç   )r&   rà   r*   r(   rè   ré   rê   rX   r=   r>   r.   Ú	next_lineÚ
next_startÚnext_endrî   Ú	next_rects                   r/   Úfind_last_visible_linezAXText.find_last_visible_linee  sr  € ð ˆÜ×+Ñ+¨CÓ0ˆØ�vˆTˆØ�D‹jØ˜‘: !Ñ#ˆCÜ%×8Ñ8¸¸cÓBÑˆD�%˜Ø�fŠ}Ø˜U CÐ'Ð'à�aŠxØDÀiÐP�Ü×!Ñ!¤%×"2Ñ"2°F¸DÔAØ�Øà˜5 #Ð%ˆFÜ.4×.GÑ.GÈÈSÓ.QÑ+ˆI�z 8Ø˜QŠ 8¨q¢=Ø�ä×-Ñ-¨c°5¸#Ó>ˆIÜ×&Ñ& y°)Ó<¸qÒ@Ø˜A‘g�Øä×&Ñ& y°)Ó<¸qÒ@Ø�Øä×-Ñ-¨c°:¸xÓHˆIÜ×&Ñ& y°)Ó<ÀÒAØ�à 
¨HÐ4ˆFØ˜‘'ˆCð? �DŒjðB ˆr8   c                 ó²   — t         j                  | |«      d   }|j                  d«      dk(  ry|j                  d«      dk(  ry|j                  d«      dv ryy	)
z>Returns True if the text attributes indicate a spelling error.r   ÚinvalidÚspellingTztext-spellingÚ
misspelledÚ	underline)r+   rø   F)r
   rÅ   Úget)r&   r'   Ú
attributess      r/   Úis_word_misspelledzAXText.is_word_misspelled�  s[   € ô ×9Ñ9¸#¸vÓFÀqÑIˆ
Ø�>‰>˜)Ó$¨
Ò2ØØ�>‰>˜/Ó*¨lÒ:ØØ�>‰>˜+Ó&Ð*?Ñ?ØØr8   c                 ó   — | dk(  S )u@   Returns True if character is an embedded object character (ï¿¼).u   ï¿¼© )r<   s    r/   Úis_eoczAXText.is_eocœ  s   € ð ˜HÑ$Ð$r8   c                 óT   — t         j                  t         j                  | |«      «      S )uG   Returns True if character in obj is an embedded object character (ï¿¼).)r
   r   r0   )r&   r'   s     r/   Úcharacter_at_offset_is_eocz!AXText.character_at_offset_is_eoc¢  s    € ô �}‰}œV×;Ñ;¸CÀÓHÓIÐIr8   c                 óv   — t        j                  | «      syt        j                  | «      j	                  «        S )z<Returns True if obj lacks text, or contains only whitespace.T)r   re   r
   r“   Ústripr€   s    r/   Úis_whitespace_or_emptyzAXText.is_whitespace_or_empty¨  s2   € ô ×%Ñ% cÔ*Øä×&Ñ& sÓ+×1Ñ1Ó3Ð3Ð3r8   c                 óº  — t         j                  | «      }|sy|€d}|€|dz
  }	 t        j                  j	                  | ||t        j
                  j                  ||«      }d| d|› d	|› d
�|› d|› d|› �g}	t        j                  t        j                  |	d«       |S # t        $ r4}d|› �}t        j                  t        j                  |d«       Y d}~yd}~ww xY w)z.Attempts to scroll obj to the specified point.FNr   r   z0AXText: Exception in scroll_substring_to_point: TúAXText: Scrolledúsubstring (r   ú) torË   rd   )r
   r   r   r   Úscroll_substring_to_pointrÌ   rÍ   r   r   r   r   r%   )
r&   r4   r5   r#   r$   r(   r*   r+   r)   r.   s
             r/   r
  z AXText.scroll_substring_to_point±  sï   € ô ×+Ñ+¨CÓ0ˆÙØàÐØˆLØÐØ !™ˆJð	Ü—Z‘Z×9Ñ9Ø�\ :¬u¯©×/EÑ/EÀqÈ!óMˆFð % c¨[¸¸ÀaÈ
À|ÐSWÐ+XØ�C�r˜!˜˜B˜v˜hÐ'ð)ˆä×Ñœ%×*Ñ*¨F°DÔ9Øˆøô ò 	ØDÀUÀGÐLˆCÜ×Ñœu×/Ñ/°°dÔ;Üûð	ús   ¥<B Â	CÂ&*CÃCc                 ó~  — t         j                  | «      }|sy|€d}|€|dz
  }	 t        j                  j	                  | |||«      }d| d|› d	|› d
�|d|› �g}t        j                  t        j                  |d«       |S # t
        $ r4}d|› �}t        j                  t        j                  |d«       Y d}~yd}~ww xY w)zLAttempts to scroll the substring to the specified Atspi.ScrollType location.FNr   r   z3AXText: Exception in scroll_substring_to_location: Tr  r  r   r	  rd   )
r
   r   r   r   Úscroll_substring_tor   r   r   r   r%   )	r&   Úlocationr#   r$   r(   r*   r+   r)   r.   s	            r/   Úscroll_substring_to_locationz#AXText.scroll_substring_to_locationË  sÕ   € ô ×+Ñ+¨CÓ0ˆÙØàÐØˆLØÐØ !™ˆJð	Ü—Z‘Z×3Ñ3°C¸ÀzÐS[Ó\ˆFð % c¨[¸¸ÀaÈ
À|ÐSWÐ+XØ˜b  ˜Mð+ˆä×Ñœ%×*Ñ*¨F°DÔ9Øˆøô ò 	ØGÈÀwÐOˆCÜ×Ñœu×/Ñ/°°dÔ;Üûð	ús   ¥"A? Á?	B<Â*B7Â7B<)N)r   )r   ry   )9Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ústaticmethodr0   r6   r?   rG   rJ   rN   rT   rV   rY   r]   r_   rb   rh   rk   rm   rp   rr   r   r   r}   r�   rƒ   rˆ   r“   r–   rš   rž   r¡   r¥   r©   r«   r�   r¶   r¹   r¼   rÀ   rÅ   rÉ   r2   rÓ   r×   rÝ   rá   rå   rä   rõ   rý   r   r  r  r
  r  rÿ   r8   r/   r
   r
   /   s)  „ ÙDàò!Fó ð!FðF ñ;ó ð;ð ò0ó ð0ð" òFó ðFð> ñ6ó ð6ð ò+ó ð+ð" ò"Fó ð"FðH ñ6ó ð6ð ò+ó ð+ð" òFó ðFð> ñ:ó ð:ð ò/ó ð/ð" ñ
ó ð
ð òFó ðFð. ñ;ó ð;ð ò0ó ð0ð" ñ
ó ð
ð ñó ðð" ñó ðð" ñó ðð" ñ/ó ð/ð
 ñMó ðMð
 ñó ðð" ñó ðð2 ñó ðð" ñó ðð ñ5ó ð5ð
 ñ=ó ð=ð ñ-ó ð-ð ñó ðð ñó ðð ñó ðð, ñ.ó ð.ð8 ñó ðð òó ðð ñó ðð( ò]ó ð]ð( òó ðð8 ñó ðð" òó ðð( ñó ðð" ñAó ðAð ñó ðð ñó ðð2 ñ'ó ð'ðR ñ'ó ð'ðR ò
ó ð
ð ñ%ó ð%ð
 ñJó ðJð
 ñ4ó ð4ð ñó ðð2 ñó ñr8   r
   )r  Ú__id__Ú__version__Ú__date__Ú__copyright__Ú__license__ÚgiÚrequire_versionÚgi.repositoryr   r   r   Ú	ax_objectr   Úax_utilitiesr   r
   rÿ   r8   r/   ú<module>r     sT   ðñ,ð €Ø€Ø€ð;€à€ã 	Ø €× Ñ �7˜EÔ "Ý å Ý Ý %÷sò sr8   