Ë
    g
f©»  ã                   ó®   — d Z dZdZdZdZdZddlZddlZddlZddl	Z	 e	j                  dd	«       dd
lmZ ddlmZ  G d„ d«      Zej!                  «        y)aÇ  
Utilities for obtaining information about accessible objects.
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$zCopyright (c) 2023 Igalia, S.L.ÚLGPLé    NÚAtspiz2.0)r   é   )Údebugc                   ót  — e Zd ZdZi Zi Zi Zi Z ej                  «       Z
ed„ «       ZedUd„«       ZedUd„«       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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dVd'„«       Z0ed(„ «       Z1ed)„ «       Z2ed*„ «       Z3ed+„ «       Z4ed,„ «       Z5ed-„ «       Z6ed.„ «       Z7ed/„ «       Z8ed0„ «       Z9edWd1„«       Z:ed2„ «       Z;ed3„ «       Z<ed4„ «       Z=ed5„ «       Z>ed6„ «       Z?ed7„ «       Z@ed8„ «       ZAed9„ «       ZBed:„ «       ZCed;„ «       ZDedWd<„«       ZEed=„ «       ZFedWd>„«       ZGed?„ «       ZHed@„ «       ZIedA„ «       ZJedB„ «       ZKedXdC„«       ZLedD„ «       ZMedE„ «       ZNedYdF„«       ZOedYdG„«       ZPedH„ «       ZQedI„ «       ZRedJ„ «       ZSedK„ «       ZTedL„ «       ZUedM„ «       ZVedN„ «       ZWedO„ «       ZXedP„ «       ZYedQ„ «       ZZedR„ «       Z[edS„ «       Z\edT„ «       Z]y&)ZÚAXObjectz=Utilities for obtaining information about accessible objects.c                  óX   — 	 t        j                  d«       t        j                  «        Œ*)z*Clears any data we have cached for objectsé<   )ÚtimeÚsleepr   Ú_clear_all_dictionaries© ó    ú0/usr/lib/python3/dist-packages/orca/ax_object.pyÚ_clear_stored_datazAXObject._clear_stored_data:   s#   € ð Ü�J‰J�rŒNÜ×,Ñ,Ô.ð r   c                 ó¨  — d}| r|d| › �z  }t        j                  t         j                  |d«       t        j                  5  dt        t        j                  «      dg}t        j                  t         j                  |d«       t        j                  j                  «        dt        t        j                  «      dg}t        j                  t         j                  |d«       t        j                  j                  «        dt        t        j                  «      dg}t        j                  t         j                  |d«       t        j                  j                  «        d	t        t        j                  «      dg}t        j                  t         j                  |d«       t        j                  j                  «        d d d «       y # 1 sw Y   y xY w)
NzAXObject: Clearing local cache.ú	 Reason: Tz0AXObject: Clearing known dead-or-alive state forÚobjectszAXObject: Clearingzreal apps for mutter frameszreal frames for mutter framesz/AXObject: Clearing cached object attributes for)r   ÚprintMessageÚ
LEVEL_INFOr   Ú_lockÚlenÚ
KNOWN_DEADÚprintTokensÚclearÚREAL_APP_FOR_MUTTER_FRAMEÚREAL_FRAME_FOR_MUTTER_FRAMEÚOBJECT_ATTRIBUTES)ÚreasonÚmsgÚtokenss      r   r   z AXObject._clear_all_dictionariesB   s`  € à/ˆÙØ�Y˜v˜hÐ'Ñ'ˆCÜ×Ñœ5×+Ñ+¨S°$Ô7ä�^‰^ñ 	/ØHÜœH×/Ñ/Ó0°)ð=ˆFä×Ñœe×.Ñ.°¸Ô=Ü×Ñ×%Ñ%Ô'à*¬C´×0RÑ0RÓ,SØ5ð7ˆFä×Ñœe×.Ñ.°¸Ô=Ü×.Ñ.×4Ñ4Ô6à*¬C´×0TÑ0TÓ,UØ7ð9ˆFä×Ñœe×.Ñ.°¸Ô=Ü×0Ñ0×6Ñ6Ô8àGÜœH×6Ñ6Ó7¸ðDˆFä×Ñœe×.Ñ.°¸Ô=Ü×&Ñ&×,Ñ,Ô.÷'	/÷ 	/ñ 	/ús   ÁE=GÇGc                 ó.   — t         j                  | «       y)z*Clears all cached information immediately.N)r   r   )r   s    r   Úclear_cache_nowzAXObject.clear_cache_now^   s   € ô 	×(Ñ(¨Õ0r   c                  óz   — t        j                  t        j                  ¬«      } d| _        | j                  «        y)z3Starts thread to periodically clear cached details.)ÚtargetTN)Ú	threadingÚThreadr   r   ÚdaemonÚstart)Úthreads    r   Ústart_cache_clearing_threadz$AXObject.start_cache_clearing_threadd   s*   € ô ×!Ñ!¬×)DÑ)DÔEˆØˆŒØ�‰�r   c                 ó¢  — t         j                  | «      t        j                  j                  k(  rŸt         j                  t         j                  | «      «      t        j                  j                  k(  r\t        j                  j                  | «      j                  «       dk(  r,d| dg}t        j                  t        j                  |dd«       yy)z<Hack to ignore certain objects. All entries must have a bug.Úgeckoú	AXObject:z"is bogus. See mozilla bug 1879750.TF)r   Úget_roler   ÚRoleÚSECTIONÚ
get_parentÚFRAMEÚ
AccessibleÚget_toolkit_nameÚlowerr   r   r   )Úobjr!   s     r   Úis_boguszAXObject.is_bogusl   s˜   € ô ×Ñ˜SÓ!¤U§Z¡Z×%7Ñ%7Ò7Ü× Ñ ¤×!4Ñ!4°SÓ!9Ó:¼e¿j¹j×>NÑ>NÒNÜ×Ñ×0Ñ0°Ó5×;Ñ;Ó=ÀÒHØ! 3Ð(LÐMˆFÜ×Ñœe×.Ñ.°¸¸dÔCØàr   c                 ó:   — | du xs t         j                  | «       S )z;Returns False if we know for certain this object is invalidN)r   Úobject_is_known_dead©r7   s    r   Úis_validzAXObject.is_valid}   s!   € ð ˜4�KÒE¤8×#@Ñ#@ÀÓ#EÐFÐFr   c                 ó^   — | xr* t         j                  j                  t        | «      «      du S )z@Returns True if we know for certain this object no longer existsT)r   r   ÚgetÚhashr;   s    r   r:   zAXObject.object_is_known_deadƒ   s)   € ð ÒA”x×*Ñ*×.Ñ.¬t°C«yÓ9¸TÐAÐAr   c                 óN  — | €yt         j                  j                  t        | «      «      }||k(  ry|t         j                  t        | «      <   |r)d}t	        j
                  t        j                  |dd«       y|r+d| dg}t	        j                  t        j                  |d«       yy)z$Updates the known-dead status of objNz&AXObject: Adding to known dead objectsTzAXObject: Removingzfrom known-dead objects)r   r   r>   r?   r   r   r   r   )r7   Úis_deadÚcurrent_statusr    r!   s        r   Ú_set_known_dead_statuszAXObject._set_known_dead_status‰   s—   € ð ˆ;Øä!×,Ñ,×0Ñ0´°c³Ó;ˆØ˜WÒ$Øà)0Œ×ÑœD ›IÑ&ÙØ:ˆCÜ×Ñœu×/Ñ/°°d¸DÔAØáØ*¨CÐ1JÐKˆFÜ×Ñœe×.Ñ.°¸Õ=ð r   c                 ó   — t        |«      }t        j                  d|«      r8|j                  |d«      }t	        j
                  t        j                  |d«       ntt        j                  d|«      r8|j                  |d«      }t	        j
                  t        j                  |d«       n&t	        j
                  t        j                  |d«       yt        j                  j                  t        | «      «      du rt        j                  | d«       yy)z?Parses the exception and potentially updates our status for objzaccessible/\d+ does not existzobject no longer existsTz The application no longer existszapp no longer existsNF)ÚstrÚreÚsearchÚreplacer   r   r   r   r   r>   r?   rC   ©r7   Úerrorr    s      r   Úhandle_errorzAXObject.handle_errorž   sÊ   € ô �E“
ˆÜ�9‰9Ð5°uÔ=Ø—+‘+˜eÐ%>Ó?ˆCÜ×Ñœu×/Ñ/°°dÕ;Ü�Y‰YÐ:¸EÔBØ—+‘+˜eÐ%;Ó<ˆCÜ×Ñœu×/Ñ/°°dÕ;ä×Ñœu×/Ñ/°°dÔ;Øä×Ñ×"Ñ"¤4¨£9Ó-°Ñ6Ü×+Ñ+¨C°Õ6ð 7r   c                 óà   — t         j                  | «      sy	 t        j                  j	                  | «      }|duS # t
        $ r)}d| › d|› �}t         j                  | ||«       Y d}~yd}~ww xY w)z8Returns True if the action interface is supported on objFz0AXObject: Exception calling get_action_iface on ú: N)r   r<   r   r4   Úget_action_ifaceÚ	ExceptionrK   ©r7   ÚifacerJ   r    s       r   Úsupports_actionzAXObject.supports_action°   sv   € ô × Ñ  Ô%Øð	Ü×$Ñ$×5Ñ5°cÓ:ˆEð ˜DÐ Ð øô ò 	ØDÀSÀEÈÈEÈ7ÐSˆCÜ×!Ñ! # u¨cÔ2Üûð	úó   ˜; »	A-ÁA(Á(A-c                 óŽ  — t         j                  | «      syt         j                  t         j                  | «      «      }|dv r+d|dg}t	        j
                  t        j                  |d«       y	 t        j                  j                  | «      }|duS # t        $ r)}d| › d|› �}t         j                  | ||«       Y d}~yd}~ww xY w)	z<Returns True if the collection interface is supported on objF)ÚsofficezAXObject: Treatingzas not supporting collection.Tz4AXObject: Exception calling get_collection_iface on rM   N)r   r<   Úget_nameÚget_applicationr   r   r   r   r4   Úget_collection_ifacerO   rK   )r7   Úapp_namer!   rQ   rJ   r    s         r   Úsupports_collectionzAXObject.supports_collectionÀ   sÂ   € ô × Ñ  Ô%Øä×$Ñ$¤X×%=Ñ%=¸cÓ%BÓCˆØ�{Ñ"Ø*¨HÐ6UÐVˆFÜ×Ñœe×.Ñ.°¸Ô=Øð	Ü×$Ñ$×9Ñ9¸#Ó>ˆEð ˜DÐ Ð øô ò 	ØHÈÈÈRÐPUÈwÐWˆCÜ×!Ñ! # u¨cÔ2Üûð	ús   Á/B Â	CÂB?Â?Cc                 óà   — t         j                  | «      sy	 t        j                  j	                  | «      }|duS # t
        $ r)}d| › d|› �}t         j                  | ||«       Y d}~yd}~ww xY w)z;Returns True if the component interface is supported on objFz3AXObject: Exception calling get_component_iface on rM   N)r   r<   r   r4   Úget_component_ifacerO   rK   rP   s       r   Úsupports_componentzAXObject.supports_componentÖ   óv   € ô × Ñ  Ô%Øð	Ü×$Ñ$×8Ñ8¸Ó=ˆEð ˜DÐ Ð øô ò 	ØGÈÀuÈBÈuÈgÐVˆCÜ×!Ñ! # u¨cÔ2Üûð	úrS   c                 óà   — t         j                  | «      sy	 t        j                  j	                  | «      }|duS # t
        $ r)}d| › d|› �}t         j                  | ||«       Y d}~yd}~ww xY w)z:Returns True if the document interface is supported on objFz2AXObject: Exception calling get_document_iface on rM   N)r   r<   r   r4   Úget_document_ifacerO   rK   rP   s       r   Úsupports_documentzAXObject.supports_documentç   sv   € ô × Ñ  Ô%Øð	Ü×$Ñ$×7Ñ7¸Ó<ˆEð ˜DÐ Ð øô ò 	ØFÀsÀeÈ2ÈeÈWÐUˆCÜ×!Ñ! # u¨cÔ2Üûð	úrS   c                 óà   — t         j                  | «      sy	 t        j                  j	                  | «      }|duS # t
        $ r)}d| › d|› �}t         j                  | ||«       Y d}~yd}~ww xY w)z?Returns True if the editable-text interface is supported on objFz7AXObject: Exception calling get_editable_text_iface on rM   N)r   r<   r   r4   Úget_editable_text_ifacerO   rK   rP   s       r   Úsupports_editable_textzAXObject.supports_editable_text÷   sy   € ô × Ñ  Ô%Øð	Ü×$Ñ$×<Ñ<¸SÓAˆEð ˜DÐ Ð øô ò 	ØKÈCÈ5ÐPRÐSXÐRYÐZˆCÜ×!Ñ! # u¨cÔ2Üûð	úrS   c                 óà   — t         j                  | «      sy	 t        j                  j	                  | «      }|duS # t
        $ r)}d| › d|› �}t         j                  | ||«       Y d}~yd}~ww xY w)z;Returns True if the hyperlink interface is supported on objFz-AXObject: Exception calling get_hyperlink on rM   N)r   r<   r   r4   Úget_hyperlinkrO   rK   rP   s       r   Úsupports_hyperlinkzAXObject.supports_hyperlink  sv   € ô × Ñ  Ô%Øð	Ü×$Ñ$×2Ñ2°3Ó7ˆEð ˜DÐ Ð øô ò 	ØAÀ#ÀÀbÈÈÐPˆCÜ×!Ñ! # u¨cÔ2Üûð	úrS   c                 óà   — t         j                  | «      sy	 t        j                  j	                  | «      }|duS # t
        $ r)}d| › d|› �}t         j                  | ||«       Y d}~yd}~ww xY w)z;Returns True if the hypertext interface is supported on objFz3AXObject: Exception calling get_hypertext_iface on rM   N)r   r<   r   r4   Úget_hypertext_ifacerO   rK   rP   s       r   Úsupports_hypertextzAXObject.supports_hypertext  r^   rS   c                 óà   — t         j                  | «      sy	 t        j                  j	                  | «      }|duS # t
        $ r)}d| › d|› �}t         j                  | ||«       Y d}~yd}~ww xY w)z7Returns True if the image interface is supported on objFz/AXObject: Exception calling get_image_iface on rM   N)r   r<   r   r4   Úget_image_ifacerO   rK   rP   s       r   Úsupports_imagezAXObject.supports_image'  óv   € ô × Ñ  Ô%Øð	Ü×$Ñ$×4Ñ4°SÓ9ˆEð ˜DÐ Ð øô ò 	ØCÀCÀ5ÈÈ5È'ÐRˆCÜ×!Ñ! # u¨cÔ2Üûð	úrS   c                 óà   — t         j                  | «      sy	 t        j                  j	                  | «      }|duS # t
        $ r)}d| › d|› �}t         j                  | ||«       Y d}~yd}~ww xY w)z;Returns True if the selection interface is supported on objFz3AXObject: Exception calling get_selection_iface on rM   N)r   r<   r   r4   Úget_selection_ifacerO   rK   rP   s       r   Úsupports_selectionzAXObject.supports_selection7  r^   rS   c                 óà   — t         j                  | «      sy	 t        j                  j	                  | «      }|duS # t
        $ r)}d| › d|› �}t         j                  | ||«       Y d}~yd}~ww xY w)z7Returns True if the table interface is supported on objFz/AXObject: Exception calling get_table_iface on rM   N)r   r<   r   r4   Úget_table_ifacerO   rK   rP   s       r   Úsupports_tablezAXObject.supports_tableG  rn   rS   c                 óà   — t         j                  | «      sy	 t        j                  j	                  | «      }|duS # t
        $ r)}d| › d|› �}t         j                  | ||«       Y d}~yd}~ww xY w)z<Returns True if the table cell interface is supported on objFz.AXObject: Exception calling get_table_cell on rM   N)r   r<   r   r4   Úget_table_cellrO   rK   rP   s       r   Úsupports_table_cellzAXObject.supports_table_cellW  sv   € ô × Ñ  Ô%Øð	Ü×$Ñ$×3Ñ3°CÓ8ˆEð ˜DÐ Ð øô ò 	ØBÀ3À%ÀrÈ%ÈÐQˆCÜ×!Ñ! # u¨cÔ2Üûð	úrS   c                 óà   — t         j                  | «      sy	 t        j                  j	                  | «      }|duS # t
        $ r)}d| › d|› �}t         j                  | ||«       Y d}~yd}~ww xY w)z6Returns True if the text interface is supported on objFz.AXObject: Exception calling get_text_iface on rM   N)r   r<   r   r4   Úget_text_ifacerO   rK   rP   s       r   Úsupports_textzAXObject.supports_textg  sv   € ô × Ñ  Ô%Øð	Ü×$Ñ$×3Ñ3°CÓ8ˆEð
 ˜DÐ Ð øô	 ò 	ØBÀ3À%ÀrÈ%ÈÐQˆCÜ×!Ñ! # u¨cÔ2Üûð	úrS   c                 óà   — t         j                  | «      sy	 t        j                  j	                  | «      }|duS # t
        $ r)}d| › d|› �}t         j                  | ||«       Y d}~yd}~ww xY w)z7Returns True if the value interface is supported on objFz/AXObject: Exception calling get_value_iface on rM   N)r   r<   r   r4   Úget_value_ifacerO   rK   rP   s       r   Úsupports_valuezAXObject.supports_valuev  rn   rS   c                 óT  — t         j                  | «      syt         j                  dft         j                  dft         j                  dft         j
                  dft         j                  dft         j                  dft         j                  dft         j                  d	ft         j                  d
ft         j                  dft         j                  dft         j                  dft         j                  dfg}|D ��cg c]  \  }} || «      sŒ|‘Œ }}}dj                  |«      S c c}}w )z3Returns the supported interfaces of obj as a stringÚ ÚActionÚ
CollectionÚ	ComponentÚDocumentÚEditableTextÚ	HyperlinkÚ	HypertextÚImageÚ	SelectionÚTableÚ	TableCellÚTextÚValueú, )r   r<   rR   rZ   r]   ra   rd   rg   rj   rm   rq   rt   rw   rz   r}   Újoin)r7   Úiface_checksÚcheckrQ   Úifacess        r   Úsupported_interfaces_as_stringz'AXObject.supported_interfaces_as_string†  s  € ô × Ñ  Ô%Øô ×%Ñ% xÐ0Ü×)Ñ)¨<Ð8Ü×(Ñ(¨+Ð6Ü×'Ñ'¨Ð4Ü×,Ñ,¨nÐ=Ü×(Ñ(¨+Ð6Ü×(Ñ(¨+Ð6Ü×$Ñ$ gÐ.Ü×(Ñ(¨+Ð6Ü×$Ñ$ gÐ.Ü×)Ñ)¨;Ð7Ü×#Ñ# VÐ,Ü×$Ñ$ gÐ.ð
ˆð  -9×G™L˜E 5¹EÀ#½J’%ÐGˆÑGØ�y‰y˜Ó Ð ùó Hs   Ã;D$ÄD$c                 ó\  — t         j                  | «      sg S g }| }|rG	 |j                  t        j                  j                  |«      «       t         j                  |«      }|rŒG|j                  «        |S # t        $ r+}d|› d|› �}t         j                  |||«       g cY d}~S d}~ww xY w)zAReturns the path from application to obj as list of child indicesz0AXObject: Exception getting index in parent for rM   N)
r   r<   Úappendr   r4   Úget_index_in_parentrO   rK   Úget_parent_checkedÚreverse)r7   ÚpathÚaccrJ   r    s        r   Úget_pathzAXObject.get_path   s©   € ô × Ñ  Ô%ØˆIàˆØˆÙðØ—‘œE×,Ñ,×@Ñ@ÀÓEÔFô
 ×-Ñ-¨cÓ2ˆCò ð 	�‰ŒØˆøô ò ØHÈÈÈRÐPUÈwÐW�Ü×%Ñ% c¨5°#Ô6Ø•	ûðús   Ÿ.A7 Á7	B+Â  B&Â B+Â&B+c                 óÖ   — t         j                  | «      sy	 t        j                  j	                  | «      }|S # t
        $ r&}d|› �}t         j                  | ||«       Y d}~yd}~ww xY w)z0Returns the child index of obj within its parentéÿÿÿÿz,AXObject: Exception in get_index_in_parent: N)r   r<   r   r4   r•   rO   rK   )r7   ÚindexrJ   r    s       r   r•   zAXObject.get_index_in_parentµ  sj   € ô × Ñ  Ô%Øð	Ü×$Ñ$×8Ñ8¸Ó=ˆEð ˆøô ò 	Ø@ÀÀÐHˆCÜ×!Ñ! # u¨cÔ2Üûð	úó   ˜9 ¹	A(ÁA#Á#A(c                 ó   — t         j                  | «      sy	 t        j                  j	                  | «      }|| k(  r+d| dg}t        j                  t        j                  |d«       y|€st         j                  | «      t        j                  j                  t        j                  j                  fvr*d| dg}t        j                  t        j                  |d«       |S # t
        $ r&}d|› �}t         j                  | ||«       Y d}~yd}~ww xY w)zBReturns the accessible parent of obj. See also get_parent_checked.Nz#AXObject: Exception in get_parent: r.   zclaims to be its own parentTzclaims to have no parent)r   r<   r   r4   r2   rO   rK   r   r   r   r/   r0   ÚINVALIDÚDESKTOP_FRAME)r7   ÚparentrJ   r    r!   s        r   r2   zAXObject.get_parentÅ  sï   € ô × Ñ  Ô%Øð	Ü×%Ñ%×0Ñ0°Ó5ˆFð �SŠ=Ø! 3Ð(EÐFˆFÜ×Ñœe×.Ñ.°¸Ô=Øàˆ>Ü× Ñ  Ó%¬e¯j©j×.@Ñ.@Ä%Ç*Á*×BZÑBZÐ-[Ñ[Ø! 3Ð(BÐCˆFÜ×Ñœe×.Ñ.°¸Ô=àˆøô ò 	Ø7¸°wÐ?ˆCÜ×!Ñ! # u¨cÔ2Üûð	ús   ˜C Ã	DÃ'DÄDc           	      óf  — t         j                  | «      syt         j                  | «      }|t        j                  j
                  t        j                  j                  fv ryt         j                  | «      }|€yt        j                  t        j                  k  r|S t         j                  | «      r|S t         j                  | «      }t         j                  |«      }|dk  s||k\  r2d| d|d|d|dg	}t        j                  t        j                  |d«       |S t         j                  || «       |S )	z9Returns the parent of obj, doing checks for tree validityNr   r.   z	has indexz; parentÚhasÚchildrenT)r   r<   r/   r   r0   r    ÚAPPLICATIONr2   r   r   Ú
debugLevelrA   r•   Úget_child_countr   Úget_active_descendant_checked)r7   Úroler¢   r�   Ú
n_childrenr!   s         r   r–   zAXObject.get_parent_checkedß  s  € ô × Ñ  Ô%Øä× Ñ  Ó%ˆØ”E—J‘J×&Ñ&¬¯
©
×(>Ñ(>Ð?Ñ?Øä×$Ñ$ SÓ)ˆØˆ>Øä×Ñœe×.Ñ.Ò.ØˆMä×Ñ˜CÔ ØˆMä×,Ñ,¨SÓ1ˆÜ×-Ñ-¨fÓ5ˆ
Ø�1Š9˜ Ò+Ø! 3¨°UØ  &¨%°¸ZðIˆFä×Ñœe×.Ñ.°¸Ô=ØˆMô 	×.Ñ.¨v°sÔ;Øˆr   c                 ó*  — t         j                  | «      sy| g}t         j                  | «      }|rc||v r,d|d|g}t        j                  t        j
                  |d«       y ||«      r|S |j                  |«       t         j                  |«      }|rŒcy)z8Returns the ancestor of obj if the function pred is trueNz4AXObject: Circular tree suspected in find_ancestor. zalready in: T)r   r<   r–   r   r   r   r”   )r7   Úpredr   r¢   r!   s        r   Úfind_ancestorzAXObject.find_ancestor   s—   € ô × Ñ  Ô%Øð �%ˆÜ×,Ñ,¨SÓ1ˆÙØ˜Ñ ØPØ  .°'ð;�ä×!Ñ!¤%×"2Ñ"2°F¸DÔAØá�FŒ|Ø�à�N‰N˜6Ô"Ü×0Ñ0°Ó8ˆFò ð r   c                 ó’   ‡— t         j                  | «      syt         j                  ‰«      syt         j                  | ˆfd„«      duS )z.Returns true if ancestor is an ancestor of objFc                 ó   •— | ‰k(  S ©Nr   )ÚxÚancestors    €r   ú<lambda>z&AXObject.is_ancestor.<locals>.<lambda>#  s   ø€ °Q¸(±]€ r   N)r   r<   r®   )r7   r³   s    `r   Úis_ancestorzAXObject.is_ancestor  s@   ø€ ô × Ñ  Ô%Øä× Ñ  Ô*Øä×%Ñ% cÓ+BÓCÈ4ÐOÐOr   c                 óž  — t         j                  | «      syt         j                  | «      }|dk  ry|dk(  r|dz
  }d|cxk  r|k  sy y	 t        j                  j                  | |«      }|| k(  r+d| dg}t        j                  t        j                  |d«       y|S # t        $ r&}d|› �}t         j                  | ||«       Y d}~yd}~ww xY w)	z9Returns the nth child of obj. See also get_child_checked.Nr   rœ   r   z"AXObject: Exception in get_child: r.   zclaims to be its own childT)r   r<   r¨   r   r4   Úget_child_at_indexrO   rK   r   r   r   )r7   r�   r«   ÚchildrJ   r    r!   s          r   Ú	get_childzAXObject.get_child%  sÝ   € ô × Ñ  Ô%Øä×-Ñ-¨cÓ2ˆ
Ø˜Š?Øà�BŠ;Ø ‘NˆEà�EÔ&˜JÒ&Øð 'Øð	Ü×$Ñ$×7Ñ7¸¸UÓCˆEð �CŠ<Ø! 3Ð(DÐEˆFÜ×Ñœe×.Ñ.°¸Ô=Øàˆøô ò 	Ø6°u°gÐ>ˆCÜ×!Ñ! # u¨cÔ2Üûð	ús   Á B Â	CÂ&CÃCc                 ó2  — t         j                  | «      syt         j                  | |«      }t        j                  t        j
                  k  r|S t         j                  |«      }| |k7  r-d| d|d|g}t        j                  t        j                  |d«       |S )z<Returns the nth child of obj, doing checks for tree validityNr.   Úclaimszas child; child's parent isT)r   r<   r¹   r   r   r§   r2   r   )r7   r�   r¸   r¢   r!   s        r   Úget_child_checkedzAXObject.get_child_checkedD  sˆ   € ô × Ñ  Ô%Øä×"Ñ" 3¨Ó.ˆÜ×Ñœe×.Ñ.Ò.ØˆLä×$Ñ$ UÓ+ˆØ�&Š=Ø! 3¨°%Ð9VÐX^Ð_ˆFÜ×Ñœe×.Ñ.°¸Ô=àˆr   c                 ó¦  — t         j                  | t        j                  j                  «      s|S t         j                  |«      }	 t        j                  j                  | |«      }||k7  r1d| d|› d�|d|g}t        j                  t        j                  |d«       |S # t        $ r(}d|› �}t         j                  | ||«       |cY d}~S d}~ww xY w)zDChecks the reported active descendant and return the real/valid one.z6AXObject: Exception in get_active_descendant_checked: Nú
AXObject: z's child at z is z; not reported childT)r   Ú	has_stater   Ú	StateTypeÚMANAGES_DESCENDANTSr•   r4   r·   rO   rK   r   r   r   )Ú	containerÚreported_childr�   Ú
real_childrJ   r    r!   s          r   r©   z&AXObject.get_active_descendant_checkedV  sÍ   € ô ×!Ñ! )¬U¯_©_×-PÑ-PÔQØ!Ð!ä×,Ñ,¨^Ó<ˆð	"Ü×)Ñ)×<Ñ<¸YÈÓNˆJð ˜Ò'Ø" I°¸e¸WÀDÐ/IÈ:Ø,¨nð>ˆFä×Ñœe×.Ñ.°¸Ô=àÐøô ò 	"ØJÈ5È'ÐRˆCÜ×!Ñ! )¨U°CÔ8Ø!Õ!ûð	"ús   Á B Â	CÂ(CÃCÃCc                 ó  — t         j                  | «      syt        t         j                  | «      «      D ]K  }t         j	                  | |«      }|r ||«      r|c S t         j                  ||«      }|sŒ@ ||«      sŒI|c S  y)ú:Returns the descendant of obj if the function pred is trueN)r   r<   Úranger¨   r¼   Ú_find_descendant)r7   r­   Úir¸   s       r   rÈ   zAXObject._find_descendantl  sy   € ô × Ñ  Ô%Øä”x×/Ñ/°Ó4Ó5ò 	ˆAÜ×.Ñ.¨s°AÓ6ˆEÙ™˜eœØ’ä×-Ñ-¨e°TÓ:ˆEÚ™˜e�Ø’ð	ð r   c                 óâ   — t        j                   «       }t        j                  | |«      }d|dt        j                   «       |z
  d›d�g}t        j                  t        j
                  |d«       |S )rÆ   z AXObject: find_descendant: foundzin ú.4fÚsT)r   r   rÈ   r   r   r   )r7   r­   r)   Úresultr!   s        r   Úfind_descendantzAXObject.find_descendant~  sd   € ô —	‘	“ˆÜ×*Ñ*¨3°Ó5ˆØ4°fÀÄDÇIÁIÃKÐRWÑDWÐX[ÐC\Ð\]Ð>^Ð_ˆÜ×Ñœ%×*Ñ*¨F°DÔ9Øˆr   c                 ó¸   — t         j                  | «      syt         j                  | t         j                  | «      dz
  «      }|€| S t         j	                  |«      S )z%Returns the deepest descendant of objNr   )r   r<   r¹   r¨   Úfind_deepest_descendant)r7   Ú
last_childs     r   rÐ   z AXObject.find_deepest_descendantˆ  sS   € ô × Ñ  Ô%Øä×'Ñ'¨¬X×-EÑ-EÀcÓ-JÈQÑ-NÓOˆ
ØÐØˆJä×/Ñ/°
Ó;Ð;r   c                 ó"  — t         j                  | «      syt         j                  | «      }t        |«      D ]V  }t         j	                  | |«      }|r	 ||«      rŒ$|r ||«      r|j                  |«       t         j                  ||||«       ŒX y)úIReturns all descendants which match the specified inclusion and exclusionN)r   r<   r¨   rÇ   r¹   r”   Ú_find_all_descendants)r7   Ú
include_ifÚ
exclude_ifÚmatchesÚchild_countrÉ   r¸   s          r   rÔ   zAXObject._find_all_descendants•  s„   € ô × Ñ  Ô%Øä×.Ñ.¨sÓ3ˆÜ�{Ó#ò 	SˆAÜ×&Ñ& s¨AÓ.ˆEÙ™j¨Ô/ØÙ™j¨Ô/Ø—‘˜uÔ%Ü×*Ñ*¨5°*¸jÈ'ÕRñ	Sr   Nc                 óü   — t        j                   «       }g }t        j                  | |||«       dt        |«      › dt        j                   «       |z
  d›d�}t	        j
                  t        j                  |d«       |S )rÓ   z AXObject: find_all_descendants: z matches found in rË   rÌ   T)r   r   rÔ   r   r   r   r   )ÚrootrÕ   rÖ   r)   r×   r    s         r   Úfind_all_descendantszAXObject.find_all_descendants¥  sv   € ô —	‘	“ˆØˆÜ×&Ñ& t¨Z¸ÀWÔMà.¬s°7«|¨nð = Ü $§	¡	£¨eÑ 3°CÐ8¸ð;ð 	ô 	×Ñœ5×+Ñ+¨S°$Ô7Øˆr   c                 óh  — t         j                  | «      st        j                  j                  S 	 t        j
                  j                  | «      }t         j                  | d«       |S # t        $ r@}d|› �}t         j                  | ||«       t        j                  j                  cY d}~S d}~ww xY w)z"Returns the accessible role of objz!AXObject: Exception in get_role: NF)
r   r<   r   r0   r    r4   r/   rO   rK   rC   )r7   rª   rJ   r    s       r   r/   zAXObject.get_role³  s”   € ô × Ñ  Ô%Ü—:‘:×%Ñ%Ð%ð	&Ü×#Ñ#×,Ñ,¨SÓ1ˆDô 	×'Ñ'¨¨UÔ3Øˆøô ò 	&Ø5°e°WÐ=ˆCÜ×!Ñ! # u¨cÔ2Ü—:‘:×%Ñ%Õ%ûð	&ús   ±A( Á(	B1Á15B,Â&B1Â,B1c                 óÖ   — t         j                  | «      sy	 t        j                  j	                  | «      }|S # t
        $ r&}d|› �}t         j                  | ||«       Y d}~yd}~ww xY w)z'Returns the accessible role name of objr   z&AXObject: Exception in get_role_name: N)r   r<   r   r4   Úget_role_namerO   rK   )r7   Ú	role_namerJ   r    s       r   rÞ   zAXObject.get_role_nameÄ  sk   € ô × Ñ  Ô%Øð	Ü×(Ñ(×6Ñ6°sÓ;ˆIð Ðøô ò 	Ø:¸5¸'ÐBˆCÜ×!Ñ! # u¨cÔ2Üûð	úrž   c                 ó  — t         j                  | «      sy	 t        j                  j	                  | «      }t         j                  | d«       |S # t
        $ r&}d|› �}t         j                  | ||«       Y d}~yd}~ww xY w)z"Returns the accessible name of objr   z!AXObject: Exception in get_name: NF©r   r<   r   r4   rV   rO   rK   rC   )r7   ÚnamerJ   r    s       r   rV   zAXObject.get_nameÔ  sz   € ô × Ñ  Ô%Øð	Ü×#Ñ#×,Ñ,¨SÓ1ˆDô 	×'Ñ'¨¨UÔ3Øˆøô ò 	Ø5°e°WÐ=ˆCÜ×!Ñ! # u¨cÔ2Üûð	úó   ˜A Á	A>ÁA9Á9A>c                 ób   — t         j                  | «      }|sy|t         j                  |«      k(  S )z;Returns true if obj1 and obj2 share the same non-empty nameF)r   rV   )Úobj1Úobj2Úname1s      r   Úhas_same_non_empty_namez AXObject.has_same_non_empty_nameå  s0   € ô ×!Ñ! $Ó'ˆÙØàœ×)Ñ)¨$Ó/Ñ/Ð/r   c                 óÖ   — t         j                  | «      sy	 t        j                  j	                  | «      }|S # t
        $ r&}d|› �}t         j                  | ||«       Y d}~yd}~ww xY w)z)Returns the accessible description of objr   z(AXObject: Exception in get_description: N)r   r<   r   r4   Úget_descriptionrO   rK   ©r7   ÚdescriptionrJ   r    s       r   rê   zAXObject.get_descriptionï  sk   € ô × Ñ  Ô%Øð	Ü×*Ñ*×:Ñ:¸3Ó?ˆKð Ðøô ò 	Ø<¸U¸GÐDˆCÜ×!Ñ! # u¨cÔ2Üûð	úrž   c                 óÖ   — t         j                  | «      sy	 t        j                  j	                  | «      }|S # t
        $ r&}d|› �}t         j                  | ||«       Y d}~yd}~ww xY w)z/Returns the accessible image description of objr   z.AXObject: Exception in get_image_description: N)r   rm   r   r‡   Úget_image_descriptionrO   rK   rë   s       r   rî   zAXObject.get_image_descriptionÿ  si   € ô ×&Ñ& sÔ+Øð	ÜŸ+™+×;Ñ;¸CÓ@ˆKð Ðøô ò 	ØBÀ5À'ÐJˆCÜ×!Ñ! # u¨cÔ2Üûð	úrž   c                 ó  — t         j                  | «      sy	 t        j                  j	                  | «      }|j                  |j                  fS # t
        $ r&}d|› �}t         j                  | ||«       Y d}~yd}~ww xY w)z3Returns a (width, height) tuple of the image in obj)r   r   z'AXObject: Exception in get_image_size: N)	r   rm   r   r‡   Úget_image_sizerO   rK   r²   Úy)r7   rÍ   rJ   r    s       r   rð   zAXObject.get_image_size  sv   € ô ×&Ñ& sÔ+Øð	Ü—[‘[×/Ñ/°Ó4ˆFð �x‰x˜Ÿ™Ð!Ð!øô ò 	Ø;¸E¸7ÐCˆCÜ×!Ñ! # u¨cÔ2Üûð	úrã   c                 óÆ   — t         j                  | «      sy	 t        j                  j	                  | «      }|S # t
        $ r t         j                  | d«      xs d}Y |S w xY w)z'Returns the accessible help text of objr   Úhelptext)r   r<   r   r4   Úget_help_textrO   Úget_attribute)r7   Útexts     r   rô   zAXObject.get_help_text   sg   € ô × Ñ  Ô%Øð	Aä×#Ñ#×1Ñ1°#Ó6ˆDð
 ˆøô	 ò 	Aä×)Ñ)¨#¨zÓ:Ò@¸b‰Dàˆð		Aús   ˜9 ¹#A ÁA c                 óÖ   — t         j                  | «      sy	 t        j                  j	                  | «      }|S # t
        $ r&}d|› �}t         j                  | ||«       Y d}~yd}~ww xY w)zReturns the child count of objr   z(AXObject: Exception in get_child_count: N)r   r<   r   r4   r¨   rO   rK   ©r7   ÚcountrJ   r    s       r   r¨   zAXObject.get_child_count0  sj   € ô × Ñ  Ô%Øð	Ü×$Ñ$×4Ñ4°SÓ9ˆEð ˆøô ò 	Ø<¸U¸GÐDˆCÜ×!Ñ! # u¨cÔ2Üûð	úrž   c              #   óÒ   K  — t         j                  | «      syt         j                  | «      }t        |«      D ]*  }t         j	                  | |«      }|€Œ|�	 ||«      sŒ'|–— Œ, y­w)z‰Generator to iterate through obj's children. If the function pred is
        specified, children for which pred is False will be skipped.N)r   r<   r¨   rÇ   r¹   )r7   r­   rØ   r�   r¸   s        r   Úiter_childrenzAXObject.iter_children@  sd   è ø€ ô
 × Ñ  Ô%Øä×.Ñ.¨sÓ3ˆÜ˜;Ó'ò 	ˆEÜ×&Ñ& s¨EÓ2ˆEØÑ  d l±d¸5µkØ“ñ	ùs   ‚AA'Á
A'Á A'c                 ó*  — t         j                  | «      syt         j                  | «      }|€yt         j                  | «      }|dk  ryt         j	                  ||dz
  «      }|| k(  r+d| dg}t        j                  t
        j                  |d«       y|S )z;Returns the previous sibling of obj, based on child indicesNr   r   r.   úclaims to be its own siblingT©r   r<   r2   r•   r¹   r   r   r   ©r7   r¢   r�   Úsiblingr!   s        r   Úget_previous_siblingzAXObject.get_previous_siblingN  s‘   € ô × Ñ  Ô%Øä×$Ñ$ SÓ)ˆØˆ>Øä×,Ñ,¨SÓ1ˆØ�AŠ:Øä×$Ñ$ V¨U°Q©YÓ7ˆØ�cŠ>Ø! 3Ð(FÐGˆFÜ×Ñœe×.Ñ.°¸Ô=Øàˆr   c                 ó*  — t         j                  | «      syt         j                  | «      }|€yt         j                  | «      }|dk  ryt         j	                  ||dz   «      }|| k(  r+d| dg}t        j                  t
        j                  |d«       y|S )z7Returns the next sibling of obj, based on child indicesNr   r   r.   rý   Trþ   rÿ   s        r   Úget_next_siblingzAXObject.get_next_siblinge  s‘   € ô × Ñ  Ô%Øä×$Ñ$ SÓ)ˆØˆ>Øä×,Ñ,¨SÓ1ˆØ�1Š9Øä×$Ñ$ V¨U°Q©YÓ7ˆØ�cŠ>Ø! 3Ð(FÐGˆFÜ×Ñœe×.Ñ.°¸Ô=Øàˆr   c                 ó  — t         j                  | «      syt         j                  | «      dz   }t         j                  | «      }|rsd|cxk  rt         j	                  |«      k  sUn |} t         j                  | «      dz   }t         j                  | «      }|r"d|cxk  rt         j	                  |«      k  sŒPn ŒS|€yt         j                  ||«      }|| k(  r+d| dg}t        j                  t        j                  |d«       y|S )z?Returns the next object (depth first) in the accessibility treeNr   r   r.   z claims to be its own next objectT©	r   r<   r•   r2   r¨   r¹   r   r   r   )r7   r�   r¢   Únext_objectr!   s        r   Úget_next_objectzAXObject.get_next_object|  sì   € ô × Ñ  Ô%Øä×,Ñ,¨SÓ1°AÑ5ˆÜ×$Ñ$ SÓ)ˆÙ˜Q ÔI¬×)AÑ)AÀ&Ó)IÔIØˆCÜ×0Ñ0°Ó5¸Ñ9ˆEÜ×(Ñ(¨Ó-ˆFñ ˜Q ÔI¬×)AÑ)AÀ&Ó)IÖIð
 ˆ>Øä×(Ñ(¨°Ó7ˆØ˜#ÒØ! 3Ð(JÐKˆFÜ×Ñœe×.Ñ.°¸Ô=ØàÐr   c                 ó  — t         j                  | «      syt         j                  | «      dz
  }t         j                  | «      }|ryd|cxk  rt         j	                  |«      dz
  k  sXn |} t         j                  | «      dz
  }t         j                  | «      }|r%d|cxk  rt         j	                  |«      dz
  k  sŒSn ŒV|€yt         j                  ||«      }|| k(  r+d| dg}t        j                  t        j                  |d«       y|S )zCReturns the previous object (depth first) in the accessibility treeNr   r   r.   z$claims to be its own previous objectTr  )r7   r�   r¢   Úprevious_objectr!   s        r   Úget_previous_objectzAXObject.get_previous_object•  sö   € ô × Ñ  Ô%Øä×,Ñ,¨SÓ1°AÑ5ˆÜ×$Ñ$ SÓ)ˆÙ˜Q %ÔN¬(×*BÑ*BÀ6Ó*JÈQÑ*NÔNØˆCÜ×0Ñ0°Ó5¸Ñ9ˆEÜ×(Ñ(¨Ó-ˆFñ ˜Q %ÔN¬(×*BÑ*BÀ6Ó*JÈQÑ*NÖNð
 ˆ>Øä"×,Ñ,¨V°UÓ;ˆØ˜cÒ!Ø! 3Ð(NÐOˆFÜ×Ñœe×.Ñ.°¸Ô=ØàÐr   c                 óP  — t         j                  | «      st        j                  «       S 	 t        j                  j                  | «      }t         j                  | d«       |S # t        $ r:}d|› �}t         j                  | ||«       t        j                  «       cY d}~S d}~ww xY w)z)Returns the state set associated with objz&AXObject: Exception in get_state_set: NF)	r   r<   r   ÚStateSetr4   Úget_state_setrO   rK   rC   )r7   Ú	state_setrJ   r    s       r   r  zAXObject.get_state_set®  s�   € ô × Ñ  Ô%Ü—>‘>Ó#Ð#ð	$Ü×(Ñ(×6Ñ6°sÓ;ˆIô 	×'Ñ'¨¨UÔ3ØÐøô ò 	$Ø:¸5¸'ÐBˆCÜ×!Ñ! # u¨cÔ2Ü—>‘>Ó#Õ#ûð	$ús   «A" Á"	B%Á+/B ÂB%Â B%c                 óv   — t         j                  | «      syt         j                  | «      j                  |«      S )z+Returns true if obj has the specified stateF)r   r<   r  Úcontains)r7   Ústates     r   r¿   zAXObject.has_state¿  s1   € ô × Ñ  Ô%Øä×%Ñ% cÓ*×3Ñ3°EÓ:Ð:r   c                 ó¬   — t         j                  | «      syd„ }dj                  t        |t         j	                  | «      j                  «       «      «      S )z5Returns the state set associated with obj as a stringr   c                 ó\   — | j                   dd  j                  dd«      j                  «       S )Né   Ú_ú-©Ú
value_namerH   r6   )r  s    r   Ú	as_stringz/AXObject.state_set_as_string.<locals>.as_stringÏ  s+   € Ø×#Ñ# B CÐ(×0Ñ0°°cÓ:×@Ñ@ÓBÐBr   r�   )r   r<   rŽ   Úmapr  Ú
get_states©r7   r  s     r   Ústate_set_as_stringzAXObject.state_set_as_stringÈ  sG   € ô × Ñ  Ô%Øò	Cð �y‰yœ˜Y¬×(>Ñ(>¸sÓ(C×(NÑ(NÓ(PÓQÓRÐRr   c                 óÜ   — t         j                  | «      sg S 	 t        j                  j	                  | «      }|S # t
        $ r(}d|› �}t         j                  | ||«       g cY d}~S d}~ww xY w)z>Returns the list of Atspi.Relation objects associated with objz&AXObject: Exception in get_relations: N)r   r<   r   r4   Úget_relation_setrO   rK   )r7   Ú	relationsrJ   r    s       r   Úget_relationszAXObject.get_relationsÔ  so   € ô × Ñ  Ô%ØˆIð	Ü×(Ñ(×9Ñ9¸#Ó>ˆIð Ðøô ò 	Ø:¸5¸'ÐBˆCÜ×!Ñ! # u¨cÔ2Ø�Iûð	ús   ™: º	A+ÁA&Á A+Á&A+c                 ó˜   — t         j                  | «      syt         j                  | «      D ]  }|sŒ|j                  «       |k(  sŒ|c S  y)z,Returns the specified Atspi.Relation for objN)r   r<   r!  Úget_relation_type)r7   Úrelation_typeÚrelations      r   Úget_relationzAXObject.get_relationä  sL   € ô × Ñ  Ô%Øä ×.Ñ.¨sÓ3ò 	 ˆHÚ˜H×6Ñ6Ó8¸MÓIØ’ð	 ð r   c                 ó^   — t         j                  | «      syt         j                  | |«      duS )z3Returns true if obj has the specified relation typeFN)r   r<   r&  )r7   r$  s     r   Úhas_relationzAXObject.has_relationñ  s-   € ô × Ñ  Ô%Øä×$Ñ$ S¨-Ó8ÀÐDÐDr   c                 óä  — t         j                  | «      sg S t         j                  | |«      }|€g S t        «       }t	        |j                  «       «      D ]/  }|j                  |«      }|�	 ||«      sŒ|j                  |«       Œ1 t        j                  j                  g}||vrA| |v r=d| d|dg}t        j                  t        j                  |d«       |j                  | «       t        |«      S )z‘Returns the list of targets with the specified relation type to obj.
        If pred is provided, a target will only be included if pred is true.r¾   zis in its ownztarget listT)r   r<   r&  ÚsetrÇ   Úget_n_targetsÚ
get_targetÚaddr   ÚRelationTypeÚ	MEMBER_OFr   r   r   ÚremoveÚlist)	r7   r$  r­   r%  ÚtargetsrÉ   r%   Útype_includes_objectr!   s	            r   Úget_relation_targetszAXObject.get_relation_targetsú  sã   € ô
 × Ñ  Ô%ØˆIä×(Ñ(¨¨mÓ<ˆØÐØˆIä“%ˆÜ�x×-Ñ-Ó/Ó0ò 	$ˆAØ×(Ñ(¨Ó+ˆFØˆ|™t F�|Ø—‘˜FÕ#ð	$ô !&× 2Ñ 2× <Ñ <Ð=ÐØÐ 4Ñ4¸À¹Ø" C¨¸-ÈÐWˆFÜ×Ñœe×.Ñ.°¸Ô=Ø�N‰N˜3Ôä�G‹}Ðr   c                 óp  ‡ — t         j                  ‰ «      syd„ }ˆ fd„}g }t         j                  ‰ «      D ]m  } ||j                  «       «      }t         j	                  ‰ |j                  «       «      }dj                  t        ||«      «      }|j                  |› d|› �«       Œo dj                  |«      S )z5Returns the relations associated with obj as a stringr   c                 ó\   — | j                   dd  j                  dd«      j                  «       S )Né   r  r  r  )r   s    r   r  z/AXObject.relations_as_string.<locals>.as_string  s+   € Ø×'Ñ'¨¨Ð,×4Ñ4°S¸#Ó>×DÑDÓFÐFr   c                 ó‚   •— t         j                  ‰«      }t         j                  ‰«      }|r	|d|› d�z  }|sd}d|› d�S )Nz: 'ú'ÚDEADú[ú])r   rÞ   rV   )r™   rÍ   râ   r7   s      €r   Úobj_as_stringz3AXObject.relations_as_string.<locals>.obj_as_string  sN   ø€ Ü×+Ñ+¨CÓ0ˆFÜ×$Ñ$ SÓ)ˆDÙØ˜C ˜v Q˜-Ñ'�ÙØ�Ø�v�h˜a�=Ð r   ú,rM   ú; )r   r<   r!  r#  r4  rŽ   r  r”   )r7   r  r=  ÚresultsÚrelÚtype_stringr2  Útarget_strings   `       r   Úrelations_as_stringzAXObject.relations_as_string  s­   ø€ ô × Ñ  Ô%Øò	Gô	!ð ˆÜ×)Ñ)¨#Ó.ò 	>ˆCÙ# C×$9Ñ$9Ó$;Ó<ˆKÜ×3Ñ3°C¸×9NÑ9NÓ9PÓQˆGØŸH™H¤S¨¸Ó%@ÓAˆMØ�N‰N˜k˜]¨"¨]¨OÐ<Õ=ð		>ð �y‰y˜Ó!Ð!r   c                 ó¼  — |€ 	 t         j                  j                  | «      }t        j                  |«      dk7  r|| fS t        j                  j                  t        | «      «      }t        j                  j                  t        | «      «      }|�|�||fS d|d| g}t        j                  t        j                  |d«       	 t        j                  d	«      }t        j                  | «      }t        j                  |«      D ]R  }	t        j                  |	«      dk(  rŒt        j                  |	«      D ]  }
|t        j                  |
«      k(  sŒ|	}|
}Œ! ŒT d|d| g}t        j                  t        j                  |d«       || k7  r'd}t        j                   t        j                  |d«       |t        j                  t        | «      <   |t        j                  t        | «      <   ||fS # t        $ r)}d| › d|› �}t        j                  | ||«       Y d}~yd}~ww xY w# t        $ r3}d
|g}t        j                  t        j                  |d«       Y d}~yd}~ww xY w)z<Work around for window events coming from mutter-x11-frames.Nz+AXObject: Exception getting application of rM   ©NNúmutter-x11-framesr.   zis not valid app forTr   z/AXObject: Exception getting desktop from Atspi:zis real app forz.AXObject: Updated frame to frame from real app)r   r4   rW   rO   r   rK   rV   r   r>   r?   r   r   r   r   Úget_desktoprû   r   )r7   ÚapprJ   r    Úreal_appÚ
real_framer!   Údesktoprâ   Údesktop_appÚframes              r   Úfind_real_app_and_window_forz%AXObject.find_real_app_and_window_for2  s4  € ð ˆ;ð"Ü×&Ñ&×6Ñ6°sÓ;�ô ×Ñ˜SÓ!Ð%8Ò8Ø˜�8ˆOä×5Ñ5×9Ñ9¼$¸s»)ÓDˆÜ×9Ñ9×=Ñ=¼dÀ3»iÓHˆ
ØÐ JÐ$:Ø˜ZÐ'Ð'à˜sÐ$:¸CÐ@ˆÜ×Ñœ%×*Ñ*¨F°DÔ9ð	Ü×'Ñ'¨Ó*ˆGô × Ñ  Ó%ˆÜ#×1Ñ1°'Ó:ò 	'ˆKÜ× Ñ  Ó-Ð1DÒDØÜ!×/Ñ/°Ó<ò '�Øœ8×,Ñ,¨UÓ3Ó3Ø*�HØ!&‘Jñ'ð	'ð ˜xÐ):¸CÐ@ˆÜ×Ñœ%×*Ñ*¨F°DÔ9à˜ÒØBˆCÜ×Ñœu×/Ñ/°°dÔ;à8@Œ×*Ñ*¬4°«9Ñ5Ø:DŒ×,Ñ,¬T°#«YÑ7Ø˜Ð#Ð#øôS ò "ØCÀCÀ5ÈÈ5È'ÐR�Ü×%Ñ% c¨5°#Ô6Ü!ûð"ûô$ ò 	ØGÈÐOˆFÜ×Ñœe×.Ñ.°¸Ô=Üûð	ús/   „G* ÃH Ç*	HÇ3HÈHÈ	IÈ()IÉIc                 óœ  — t         j                  | «      syt         j                  j                  t	        | «      «      }|�|S 	 t
        j                  j                  | «      }t         j                  |«      dk7  r|S t         j                  | |«      d   }|�|}|S # t        $ r&}d|› �}t         j                  | ||«       Y d}~yd}~ww xY w)z6Returns the accessible application associated with objNz(AXObject: Exception in get_application: rG  r   )r   r<   r   r>   r?   r   r4   rW   rO   rK   rV   rO  )r7   rI  rJ   r    rJ  s        r   rW   zAXObject.get_applicationd  sÉ   € ô × Ñ  Ô%Øä×0Ñ0×4Ñ4´T¸#³YÓ?ˆØˆ?ØˆJð	Ü×"Ñ"×2Ñ2°3Ó7ˆCô ×Ñ˜SÓ!Ð%8Ò8ØˆJä×8Ñ8¸¸cÓBÀ1ÑEˆØÐØˆCàˆ
øô ò 	Ø<¸U¸GÐDˆCÜ×!Ñ! # u¨cÔ2Üûð	ús   ÁB Â	CÂ%CÃCc                 ó   — t         j                  | «      syt         j                  | «      }|€y	 t        j                  j                  |«      }|S # t        $ r3}d|g}t        j                  t        j                  |d«       Y d}~yd}~ww xY w)z8Returns the toolkit name reported for obj's application.r   Nz4AXObject: Exception in get_application_toolkit_name:T)
r   r<   rW   r   r4   r5   rO   r   r   r   )r7   rI  râ   rJ   r!   s        r   Úget_application_toolkit_namez%AXObject.get_application_toolkit_name  s†   € ô × Ñ  Ô%Øä×&Ñ& sÓ+ˆØˆ;Øð	Ü×#Ñ#×4Ñ4°SÓ9ˆDð ˆøô ò 	ØLÈeÐTˆFÜ×Ñœe×.Ñ.°¸Ô=Üûð	úó   °A Á	BÁ)BÂBc                 ó   — t         j                  | «      syt         j                  | «      }|€y	 t        j                  j                  |«      }|S # t        $ r3}d|g}t        j                  t        j                  |d«       Y d}~yd}~ww xY w)z;Returns the toolkit version reported for obj's application.r   Nz7AXObject: Exception in get_application_toolkit_version:T)
r   r<   rW   r   r4   Úget_toolkit_versionrO   r   r   r   )r7   rI  ÚversionrJ   r!   s        r   Úget_application_toolkit_versionz(AXObject.get_application_toolkit_version“  s‡   € ô × Ñ  Ô%Øä×&Ñ& sÓ+ˆØˆ;Øð	Ü×&Ñ&×:Ñ:¸3Ó?ˆGð ˆøô ò 	ØOÐQVÐWˆFÜ×Ñœe×.Ñ.°¸Ô=Üûð	úrS  c                 óê   — t         j                  | «      syt         j                  | «      }|€yt         j                  |«      › dt         j	                  | «      › dt         j                  | «      › d�}|S )z3Returns the application details of obj as a string.r   ú (ú ú))r   r<   rW   rV   rR  rW  )r7   rI  Ústrings      r   Úapplication_as_stringzAXObject.application_as_string§  s}   € ô × Ñ  Ô%Øä×&Ñ& sÓ+ˆØˆ;Øô × Ñ  Ó%Ð&ð 'Ü×5Ñ5°cÓ:Ð;¸1Ü×7Ñ7¸Ó<Ð=¸Qð@ð 	ð
 ˆr   c                 óü  — | €yd| d|› d�g}|r|j                  d|› �«       t        j                  t        j                  |d«       |s!	 t        j
                  j                  | «       y	 t        j
                  j                  | «       y# t        $ r4}d|› �}t        j                  t        j                  |d«       Y d}~yd}~ww xY w# t        $ r&}d|› �}t        j                  | ||«       Y d}~yd}~ww xY w)	z7Clears the Atspi cached information associated with objNz"AXObject: Clearing AT-SPI cache onzRecursive: ú.r   Tz+AXObject: Exception in clear_cache_single: z$AXObject: Exception in clear_cache: )r”   r   r   r   r   r4   Úclear_cache_singlerO   r   Úclear_cacher   rK   )r7   Ú	recursiver   r!   rJ   r    s         r   ra  zAXObject.clear_cache¹  sû   € ð ˆ;Øà6¸¸{È9È+ÐUVÐ=WÐXˆÙØ�M‰M˜I f XÐ.Ô/Ü×Ñœ%×*Ñ*¨F°DÔ9áð@Ü× Ñ ×3Ñ3°CÔ8ð ð	3Ü×Ñ×(Ñ(¨Õ-øô ò @ØCÀEÀ7ÐK�Ü×"Ñ"¤5×#3Ñ#3°S¸$×?Ð?Øûð@ûô ò 	3Ø8¸¸Ð@ˆCÜ×!Ñ! # u¨c×2Ñ2ûð	3ús0   ÁB Á,C Â	C	Â*CÃC	Ã	C;ÃC6Ã6C;c                 óÖ   — t         j                  | «      sy	 t        j                  j	                  | «      }|S # t
        $ r&}d|› �}t         j                  | ||«       Y d}~yd}~ww xY w)z*Returns the process id associated with objrœ   z'AXObject: Exception in get_process_id: N)r   r<   r   r4   Úget_process_idrO   rK   )r7   ÚpidrJ   r    s       r   rd  zAXObject.get_process_idÓ  sj   € ô × Ñ  Ô%Øð	Ü×"Ñ"×1Ñ1°#Ó6ˆCð ˆ
øô ò 	Ø;¸E¸7ÐCˆCÜ×!Ñ! # u¨cÔ2Üûð	úrž   c                 ó  — | €yt         j                  | «      sy	 t        j                  j	                  | «       t         j                  | d«       y# t
        $ r&}d|› �}t         j                  | ||«       Y d}~yd}~ww xY w)z6Returns true of obj exists but is believed to be dead.NFTzAXObject: Accessible is dead: rá   rI   s      r   rA   zAXObject.is_deadã  s€   € ð ˆ;Øä× Ñ  Ô%Øð	ô ×Ñ×%Ñ% cÔ*ô 	×'Ñ'¨¨UÔ3Øøô ò 	Ø2°5°'Ð:ˆCÜ×!Ñ! # u¨cÔ2Üûð	ús   ›A Á	B ÁA;Á;B c                 óx  — t         j                  | «      si S |r,t         j                  j                  t	        | «      «      }|r|S 	 t
        j                  j                  | «      }|€i S |t         j                  t	        | «      <   |S # t        $ r(}d|› �}t         j                  | ||«       i cY d}~S d}~ww xY w)z5Returns the object attributes of obj as a dictionary.z,AXObject: Exception in get_attributes_dict: N)
r   r<   r   r>   r?   r   r4   Úget_attributesrO   rK   )r7   Ú	use_cacheÚ
attributesrJ   r    s        r   Úget_attributes_dictzAXObject.get_attributes_dictù  s´   € ô × Ñ  Ô%ØˆIáÜ!×3Ñ3×7Ñ7¼¸S»	ÓBˆJÙØ!Ð!ð	Ü×)Ñ)×8Ñ8¸Ó=ˆJð ÐØˆIà0:Œ×"Ñ"¤4¨£9Ñ-ØÐøô ò 	Ø@ÀÀÐHˆCÜ×!Ñ! # u¨cÔ2Ø�Iûð	ús   ÁB Â	B9ÂB4Â.B9Â4B9c                 ó~   — t         j                  | «      syt         j                  | |«      }|j                  |d«      S )z9Returns the value of the specified attribute as a string.r   )r   r<   rk  r>   )r7   Úattribute_nameri  rj  s       r   rõ   zAXObject.get_attribute  s8   € ô × Ñ  Ô%Øä×1Ñ1°#°yÓAˆ
Ø�~‰~˜n¨bÓ1Ð1r   c                 ó¬   — t         j                  | «      syd„ }dj                  t        |t         j	                  | «      j                  «       «      «      S )z1Returns the object attributes of obj as a string.r   c                 ó   — | d   › d| d   › �S )Nr   ú:r   r   )Ú	attributes    r   r  z0AXObject.attributes_as_string.<locals>.as_string#  s   € Ø ‘l�^ 1 Y¨q¡\ NÐ3Ð3r   r�   )r   r<   rŽ   r  rk  Úitemsr  s     r   Úattributes_as_stringzAXObject.attributes_as_string  sF   € ô × Ñ  Ô%Øò	4ð �y‰yœ˜Y¬×(DÑ(DÀSÓ(I×(OÑ(OÓ(QÓRÓSÐSr   c                 óÖ   — t         j                  | «      sy	 t        j                  j	                  | «      }|S # t
        $ r&}d|› �}t         j                  | ||«       Y d}~yd}~ww xY w)z/Returns the number of actions supported on obj.r   z&AXObject: Exception in get_n_actions: N)r   rR   r   r€   Úget_n_actionsrO   rK   rø   s       r   ru  zAXObject.get_n_actions(  sh   € ô ×'Ñ'¨Ô,Øð	Ü—L‘L×.Ñ.¨sÓ3ˆEð ˆøô ò 	Ø:¸5¸'ÐBˆCÜ×!Ñ! # u¨cÔ2Üûð	úrž   c                 ó„   — | syt        j                  dd| «      j                  «       }t        j                  dd|«      }|S )z?Adjusts the name to account for differences in implementations.r   z(?<=[a-z])([A-Z])z-\1z"[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~]r  )rF   Úsubr6   )Úaction_namerâ   s     r   Ú_normalize_action_namezAXObject._normalize_action_name8  s>   € ñ Øä�v‰vÐ*¨F°KÓ@×FÑFÓHˆÜ�v‰vÐ=¸sÀDÓIˆØˆr   c                 ó  — d|cxk  rt         j                  | «      k  sy y	 t        j                  j	                  | |«      }t         j                  |«      S # t
        $ r&}d|› �}t         j                  | ||«       Y d}~yd}~ww xY w)z,Returns the name of obj's action at index i.r   r   z(AXObject: Exception in get_action_name: N)r   ru  r   r€   Úget_action_namerO   rK   ry  )r7   rÉ   râ   rJ   r    s        r   r{  zAXObject.get_action_nameC  sˆ   € ð �AÔ3œ×.Ñ.¨sÓ3Ò3Øð 4Øð	Ü—<‘<×/Ñ/°°QÓ7ˆDô ×.Ñ.¨tÓ4Ð4øô ò 	Ø<¸U¸GÐDˆCÜ×!Ñ! # u¨cÔ2Üûð	ús   £ A Á	BÁ!BÂBc                 ó¤   — g }t        t        j                  | «      «      D ],  }t        j                  | |«      }|sŒ|j	                  |«       Œ. |S )z-Returns the list of actions supported on obj.)rÇ   r   ru  r{  r”   )r7   r@  rÉ   râ   s       r   Úget_action_nameszAXObject.get_action_namesS  sP   € ð ˆÜ”x×-Ñ-¨cÓ2Ó3ò 	%ˆAÜ×+Ñ+¨C°Ó3ˆDÚØ—‘˜tÕ$ð	%ð ˆr   c                 óî   — d|cxk  rt         j                  | «      k  sy y	 t        j                  j	                  | |«      }|S # t
        $ r&}d|› �}t         j                  | ||«       Y d}~yd}~ww xY w)z3Returns the description of obj's action at index i.r   r   z/AXObject: Exception in get_action_description: N)r   ru  r   r€   Úget_action_descriptionrO   rK   )r7   rÉ   rì   rJ   r    s        r   r  zAXObject.get_action_description^  s}   € ð �AÔ3œ×.Ñ.¨sÓ3Ò3Øð 4Øð	ÜŸ,™,×=Ñ=¸cÀ1ÓEˆKð Ðøô ò 	ØCÀEÀ7ÐKˆCÜ×!Ñ! # u¨cÔ2Üûð	úó   £ A Á	A4ÁA/Á/A4c                 óî   — d|cxk  rt         j                  | «      k  sy y	 t        j                  j	                  | |«      }|S # t
        $ r&}d|› �}t         j                  | ||«       Y d}~yd}~ww xY w)z:Returns the key binding string of obj's action at index i.r   r   z/AXObject: Exception in get_action_key_binding: N)r   ru  r   r€   Úget_key_bindingrO   rK   )r7   rÉ   Ú
keybindingrJ   r    s        r   Úget_action_key_bindingzAXObject.get_action_key_bindingn  s}   € ð �AÔ3œ×.Ñ.¨sÓ3Ò3Øð 4Øð	ÜŸ™×5Ñ5°c¸1Ó=ˆJð Ðøô ò 	ØCÀEÀ7ÐKˆCÜ×!Ñ! # u¨cÔ2Üûð	úr€  c                 ó4   — t         j                  | |«      dk\  S )z5Returns true if the named action is supported on obj.r   )r   Úget_action_index)r7   rx  s     r   Ú
has_actionzAXObject.has_action~  s   € ô ×(Ñ(¨¨kÓ:¸aÑ?Ð?r   c                 ó®   — t         j                  |«      }t        t         j                  | «      «      D ]  }|t         j	                  | |«      k(  sŒ|c S  y)z;Returns the index of the named action or -1 if unsupported.rœ   )r   ry  rÇ   ru  r{  )r7   rx  rÉ   s      r   r†  zAXObject.get_action_index„  sR   € ô ×5Ñ5°kÓBˆÜ”x×-Ñ-¨cÓ2Ó3ò 	ˆAØœh×6Ñ6°s¸AÓ>Ó>Ø’ð	ð r   c                 óî   — d|cxk  rt         j                  | «      k  sy y	 t        j                  j	                  | |«      }|S # t
        $ r&}d|› �}t         j                  | ||«       Y d}~yd}~ww xY w)z¾Invokes obj's action at index i. The return value, if true, may be
        meaningless because most implementors return true without knowing if
        the action was successfully performed.r   Fz"AXObject: Exception in do_action: N)r   ru  r   r€   Ú	do_actionrO   rK   )r7   rÉ   rÍ   rJ   r    s        r   rŠ  zAXObject.do_action�  s|   € ð �AÔ3œ×.Ñ.¨sÓ3Ò3Øð 4Øð	Ü—\‘\×+Ñ+¨C°Ó3ˆFð ˆøô ò 	Ø6°u°gÐ>ˆCÜ×!Ñ! # u¨cÔ2Üûð	úr€  c                 ó¼   — t         j                  | |«      }|dk(  r,d|d| g}t        j                  t        j                  |d«       yt         j                  | |«      S )z¾Invokes the named action on obj. The return value, if true, may be
        meaningless because most implementors return true without knowing if
        the action was successfully performed.rœ   zINFO:znot an available action forTF)r   r†  r   r   r   rŠ  )r7   rx  r�   r!   s       r   Údo_named_actionzAXObject.do_named_action¡  sZ   € ô ×)Ñ)¨#¨{Ó;ˆØ�BŠ;Ø˜{Ð,IÈ3ÐOˆFÜ×Ñœe×.Ñ.°¸Ô=Øä×!Ñ! # uÓ-Ð-r   c                 óþ   — g }t        t        j                  | «      «      D ]J  }t        j                  | |«      }t        j	                  | |«      }|r	|d|› d�z  }|j                  |«       ŒL dj                  |«      S )z2Returns information about the actions as a string.rY  r[  r?  )rÇ   r   ru  r{  r„  r”   rŽ   )r7   r@  rÉ   rÍ   rƒ  s        r   Úactions_as_stringzAXObject.actions_as_string¯  s   € ð ˆÜ”x×-Ñ-¨cÓ2Ó3ò 	#ˆAÜ×-Ñ-¨c°1Ó5ˆFÜ!×8Ñ8¸¸aÓ@ˆJÙØ˜B˜z˜l¨!Ð,Ñ,�Ø�N‰N˜6Õ"ð	#ð �y‰y˜Ó!Ð!r   c                 óÐ  — t         j                  | «      sy	 t        j                  j	                  | «      }t        j                  t        j                  k  r|S |rXt         j                  | t        j                  j                  «      s*d| dg}t        j                  t        j                  |d«       |S # t
        $ r&}d|› �}t         j                  | ||«       Y d}~yd}~ww xY w)z:Attempts to grab focus on obj. Returns true if successful.Fz#AXObject: Exception in grab_focus: Nr.   z$lacks focused state after focus grabT)r   r]   r   r‚   Ú
grab_focusrO   rK   r   r   r§   r¿   rÀ   ÚFOCUSEDr   )r7   rÍ   rJ   r    r!   s        r   r�  zAXObject.grab_focus½  sÂ   € ô ×*Ñ*¨3Ô/Øð	Ü—_‘_×/Ñ/°Ó4ˆFô ×Ñœe×.Ñ.Ò.ØˆMáœ(×,Ñ,¨S´%·/±/×2IÑ2IÔJØ! 3Ð(NÐOˆFÜ×Ñœe×.Ñ.°¸Ô=àˆøô ò 	Ø7¸°wÐ?ˆCÜ×!Ñ! # u¨cÔ2Üûð	ús   ˜B6 Â6	C%Â?C Ã C%)r   rF  r±   )Fr   )T)^Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r&   ÚLockr   Ústaticmethodr   r   r#   r+   r8   r<   r:   rC   rK   rR   rZ   r]   ra   rd   rg   rj   rm   rq   rt   rw   rz   r}   r’   rš   r•   r2   r–   r®   rµ   r¹   r¼   r©   rÈ   rÎ   rÐ   rÔ   rÛ   r/   rÞ   rV   rè   rê   rî   rð   rô   r¨   rû   r  r  r  r
  r  r¿   r  r!  r&  r(  r4  rD  rO  rW   rR  rW  r]  ra  rd  rA   rk  rõ   rs  ru  ry  r{  r}  r  r„  r‡  r†  rŠ  rŒ  rŽ  r�  r   r   r   r   r   0   s¢  „ ÙGà€JØ "ÐØ"$ÐØÐàˆI�N‰NÓ€Eàñ/ó ð/ð ò/ó ð/ð6 ò1ó ð1ð
 ñó ðð ñó ðð  ñGó ðGð
 ñBó ðBð
 ñ>ó ð>ð( ñ7ó ð7ð" ñ!ó ð!ð ñ!ó ð!ð* ñ!ó ð!ð  ñ!ó ð!ð ñ!ó ð!ð ñ!ó ð!ð ñ!ó ð!ð ñ!ó ð!ð ñ!ó ð!ð ñ!ó ð!ð ñ!ó ð!ð ñ!ó ð!ð ñ!ó ð!ð ñ!ó ð!ð2 ñó ðð( ñó ðð ñó ðð2 ñó ðð@ ñó ðð0 ñ	Pó ð	Pð ñó ðð< ñó ðð" ñó ðð* ñó ðð" ñó ðð ñ
<ó ð
<ð ñSó ðSð òó ðð ñó ðð  ñó ðð ñó ðð  ñ0ó ð0ð ñó ðð ñó ðð ñ"ó ð"ð  ñó ðð ñó ðð òó ðð ñó ðð, ñó ðð, ñó ðð0 ñó ðð0 ñó ðð  ñ;ó ð;ð ñ	Só ð	Sð ñó ðð ñ
ó ð
ð ñEó ðEð òó ðð4 ñ"ó ð"ð8 ò/$ó ð/$ðb ñó ðð4 ñó ðð& ñó ðð& ñó ðð" ò3ó ð3ð2 ñó ðð ñó ðð* òó ðð0 ò2ó ð2ð ñ	Tó ð	Tð ñó ðð ñó ðð ñ5ó ð5ð ñó ðð ñó ðð ñó ðð ñ@ó ð@ð
 ñó ðð ñó ðð" ñ.ó ð.ð ñ"ó ð"ð ñó ñr   r   )r•  Ú__id__Ú__version__Ú__date__Ú__copyright__Ú__license__rF   r&   r   ÚgiÚrequire_versionÚgi.repositoryr   r   r   r   r+   r   r   r   ú<module>r      sd   ðñ*ð €Ø€Ø€Ø1€Ø€ã 	Û Û ã 	Ø €× Ñ �7˜EÔ "Ý å ÷bñ bðH- 	× $Ñ $Õ &r   