+
    QiӜ  c                   s   R t RtRtRtRtRt^ RIt^ RIt^ RIt^ RI	t	^ RI
t
^ RIt]P                  ! RR4       ^ R	IHt ^R
IHt ^RIHt ^RIHt ^RIHt ^RIHt ^RIHt ^RIHt ^RIHt ^RIH t  ^RI!H"t" ^RI#H$t$ ^RI%H&t&  ! R R4      t']PP                  ! ]]PR                  R7       F  w  t*t+],! ]']*]+4       K  	  ]PP                  ! ] ]PR                  R7       F  w  t*t+],! ]']*]+4       K  	  ]PP                  ! ]"]PR                  R7       F  w  t*t+],! ]']*]+4       K  	  ]PP                  ! ]$]PR                  R7       F  w  t*t+],! ]']*]+4       K  	  ]PP                  ! ]&]PR                  R7       F  w  t*t+],! ]']*]+4       K  	  ]PP                  ! ]]PR                  R7       F)  w  t*t+]*P[                  R4      '       g   K  ],! ]']*]+4       K+  	  ]'P]                  4        R# )CUtilities for performing tasks related to accessibility inspection.z$Id$z
$Revision$z$Date$z$Copyright (c) 2023-2025 Igalia, S.L.ZLGPLNAtspiz2.0)r   )debug)AXComponent)AXObject)AXSelection)AXTable)AXText)AXUtilitiesApplication)AXUtilitiesCollection)AXUtilitiesEvent)AXUtilitiesRelation)AXUtilitiesRole)AXUtilitiesStatec                   sJ  a  ] tR t^;t o RtRt/ t/ t]P                  ! 4       t
]V 3R lR l4       t]V 3R lR l4       t]RLV 3R lR ll4       t]RMV 3R
 lR ll4       t]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       t]RNV 3R lR ll4       t]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       t]V 3R  lR! l4       t]V 3R" lR# l4       t]V 3R$ lR% l4       t]V 3R& lR' l4       t]V 3R( lR) l4       t]V 3R* lR+ l4       t]V 3R, lR- l4       t ]V 3R. lR/ l4       t!]V 3R0 lR1 l4       t"]V 3R2 lR3 l4       t#]V 3R4 lR5 l4       t$]V 3R6 lR7 l4       t%]V 3R8 lR9 l4       t&]V 3R: lR; l4       t']V 3R< lR= l4       t(]V 3R> lR? l4       t)]V 3R@ lRA l4       t*]ROV 3RB lRC ll4       t+]V 3RD lRE l4       t,]ROV 3RF lRG ll4       t-]RPV 3RH lRI ll4       t.V 3RJ lt/RKt0V t1R	# )QAXUtilitiesr    Fc                   < V ^8  d   QhRR/#    returnN format__classdict__   "6/usr/lib/python3.14/site-packages/orca/ax_utilities.py__annotate__AXUtilities.__annotate__G   s           c                 s~    \         P                  ! \        P                  R7      p RV n        V P                  4        R# )z3Starts thread to periodically clear cached details.targetTN)	threadingThreadr   _clear_stored_dataZdaemonstart)Zthreads    r   start_cache_clearing_threadZ'AXUtilities.start_cache_clearing_threadF   s*     !!)G)GHr   c                r   r   r   r   r   r   r   r   O   s     2 2 2r   c                 s\     \         P                  ! ^<4       \        P                  4        K-  )z*Clears any data we have cached for objects)timeZsleepr   _clear_all_dictionariesr   r   r   r    ZAXUtilities._clear_stored_dataN   s     JJrN//1r   c                s$   < V ^8  d   QhRS[ RR/# )r   reasonr   N)strr   r   r   r   r   W   s     / / /T /r   c                s`   R pV '       d   VRV  2,          p\         P                  ! \         P                  VR4       \        P                  ;_uu_ 4        \        P
                  P                  4        \        P                  P                  4        RRR4       R#   + '       g   i     R# ; i)zAXUtilities: Clearing cache.z	 Reason: TN)r   print_message
LEVEL_INFOr   _lockSET_MEMBERSZclearIS_LAYOUT_ONLY)r%   msg   & r   r$   Z#AXUtilities._clear_all_dictionariesV   sr    ,Yvh''CE,,c48##))+&&,,. s   =BB-	Nc                sL   < V ^8  d   QhRS[ P                  R,          RS[RR/# )r   objNr%   r   r   
Accessibler&   r   r   r   r   r   b   s.     , ,!1!1D!8 , ,VZ ,r   c                s   \         P                  V4       \        P                  ! V4       \        P                  ! V4       \
        P                  ! V4       \        P                  ! V 4      '       d   \        P                  ! V4       R# R# )z*Clears all cached information immediately.N)	r   r$   r   Zclear_cache_nowr   r
   r   Zis_table_relatedr   )r.   r%      &&r   clear_all_cache_nowZAXUtilities.clear_all_cache_nowa   s`     	++F3  (++F3((0++C00##F+ 1r   c                :   < V ^8  d   QhRS[ P                  RS[/# )r   windowr   r   r0   boolr   r   r   r   r   m   s!     ) )U%5%5 )$ )r   c                s   V f   R# \         P                  ! V RR4       \        P                  ! V 4      pRV RV.p\        P
                  ! V 4      '       g:   VP                  R4       \        P                  ! \        P                  VR4       R# \        P                  ! V 4      '       g:   VP                  R4       \        P                  ! \        P                  VR4       R# \        P                  ! V 4      '       d:   VP                  R4       \        P                  ! \        P                  VR4       R# \         P                  ! V4      R	8X  d:   VP                  R
4       \        P                  ! \        P                  VR4       R# V'       dr   \        P                  ! V4      '       gV   VP                  R4       \        P                  ! V 4      '       g)   \        P                  ! \        P                  VR4       R# VP                  R4       \        P                  ! \        P                  VR4       R# )zCReturns True if window can be the active window based on its state.Fz+Checking if window can be the active windowAXUtilities:Zfromzlacks active stateTzlacks showing statezis iconifiedzmutter-x11-framesz3is from app that cannot have the real active windowzis from app unknown to AT-SPI2zcan be active window)r   clear_cacher   get_applicationr   Z	is_activeappendr   print_tokensr(   
is_showingZis_iconifiedget_nameZis_application_in_desktopr   is_dialog_or_alert)r4   apptokens   &  r   can_be_active_windowZ AXUtilities.can_be_active_windowl   s    >VU,YZ$44V< &&#6))&11MM./u//>**622MM/0u//>((00MM.)u//>S!%88MMOPu//>-GGLLMM:; #55f==""5#3#3VTB,-5++VT:r   c                sB   < V ^8  d   QhRS[ P                  R,          /# r   r   r0   r   r   r   r   r      s     3 3 0 04 7 3r   c            	     s   . p \         P                  ! RR7      pV F@  pV P                  \        \        P
                  ! V\        P                  4      4      4       KB  	  V '       g-   RV.p\        P                  ! \        P                  VR4       R# \        V 4      ^8X  d;   RV ^ ,          .p\        P                  ! \        P                  VR4       V ^ ,          # RV .p\        P                  ! \        P                  VR4       . ROp. pV  Fp  p\        P                  ! \         P                  ! V4      4      V9   d.   RVR.p\        P                  ! \        P                  VR4       K_  VP                  V4       Kr  	  \        V4      ^8X  d;   R	V^ ,          .p\        P                  ! \        P                  VR4       V^ ,          # RpV'       d4   R
V.p\        P                  ! \        P                  VR4       V^ ,          pVe   RVR.pMR.p\        P                  ! \        P                  VR4       V# )z:Tries to locate the active window; may or may not succeed.T)Zmust_have_windowz.AXUtilities: Unable to find active window fromNzAXUtilities: Active window isz2AXUtilities: These windows all claim to be active:zAXUtilities: Suspectingzis a non-active Electron appz,AXUtilities: Active window is believed to bez0AXUtilities: Still have multiple active windows:zAXUtilities: Returningzas active windowz#AXUtilities: No active window found)ZslackZdiscordzoutline-clientzwhatsapp-desktop-linux)r   Zget_all_applicationsextendlistr   iter_childrenr   rB   r   r;   r(   lenr=   r9   r:   )Z
candidatesZappsr?   r@   Zsuspect_appsfilteredframeZguesss           r   find_active_windowZAXUtilities.find_active_window   s    
%::DQCd8#9#9#{?_?_#`ab  FMFu//>z?a5z!}EFu//>a= F
S5++VT:2 E  !7!G!G!NOS__3U<Z[""5#3#3VTB&   x=ADhqkRFu//>A;)-H(SFu//>QKE.7IJF;<F5++VT:r   c                r3   r   r.   r   r5   r   r   r   r   r      s!     	9 	9%*:*: 	9t 	9r   c                s    \         P                  ! V 4      '       g   R# \        P                  ! V 4      '       g   R# \        P
                  ! V 4      '       g   R# \        P                  V 4      '       * # )zKReturns True if obj is an unfocused alert or dialog with presentable items.F)r   r>   r   get_child_countr   r<   r   rB   r.      &r   is_unfocused_alert_or_dialogZ(AXUtilities.is_unfocused_alert_or_dialog   sT     11#66'',,**3//33C888r   c                ^   < V ^8  d   QhRS[ P                  RS[S[ P                  ,          /# rK   r   r0   rE   r   r   r   r   r      s,      e.>.> 4HXHXCY r   c                s   \         P                  ! V 4      p\        \        P                  ! V\
        P                  4      4      p\        P                  ! V R 4      pVP                  \        \        P                  ! V\
        P                  4      4      4       RV RV.p\        P                  ! \        P                  VR4       V# )zTReturns a list of all the unfocused alerts and dialogs in the app and window of obj.c                 sV    \         P                  ! \        P                  ! V 4      4      # N)r   Zis_applicationr   
get_parent)xrN   r   <lambda>Z>AXUtilities.get_unfocused_alerts_and_dialogs.<locals>.<lambda>   s    ?99(:M:Ma:PQr   z-AXUtilities: Unfocused alerts and dialogs for:T)r   r9   rE   r   rF   r   rO   find_ancestorrD   r   r;   r(   )r.   r?   resultrI   r@      &    r    get_unfocused_alerts_and_dialogsZ,AXUtilities.get_unfocused_alerts_and_dialogs   s     %44S9h,,S+2Z2Z[\&&QSd811%9a9abcdA3VT5++VT:r   c          	      sj   < V ^8  d   QhRS[ P                  RS[RS[RS[S[ P                  ,          /# )r   r.   must_be_showing_and_visibleexclude_push_buttonr   )r   r0   r6   rE   r   r   r   r   r      sB     < <<%)< "< 
e		<r   c                sN  aa \         P                  ! 4       oV'       dI   \        P                  P                  S9   d*   SP                  \        P                  P                  4       Rp\        P                  ! V 4      '       d   S'       g   \        P                  ! V S4      pML\        P                  P                  \        P                  P                  .p\        P                  ! V SV4      p\        P                  '       g   V# VV3R lp\        P                   ! W4      # )z5Returns all the descendants of obj with a widget roleNc                 s   < \         P                  ! V 4      S9  d   R # S'       d5   \        P                  ! V 4      ;'       d    \        P                  ! V 4      # R# )FT)r   get_roler   r<   
is_visible)Zaccr[   roless   &r   is_matchZ-AXUtilities.get_all_widgets.<locals>.is_match  sE      %U2*'2237\\<L<W<WX[<\\r   )r   Zget_widget_rolesr   ZRoleZPUSH_BUTTONremover   supports_collectionr	   Zfind_all_with_roleZ	StateTypeZSHOWINGZVISIBLEZ!find_all_with_role_and_all_statesr   COMPARE_COLLECTION_PERFORMANCEZfind_all_descendants)r.   r[   r\   rX   Zstatesr`   r_   s   &f&   @r   get_all_widgetsZAXUtilities.get_all_widgets   s      0025::#9#9U#BLL//0'',,..AA#uM//115??3J3JK.PP( ===	 ,,S;;r   c                \   < V ^8  d   QhRS[ P                  RS[ P                  R,          /# r   r.   r   NrC   r   r   r   r   r     s0     	P 	P 0 0 	PU5E5E5L 	Pr   c                    Rp\         P                  ! V 4      '       d/   \        P                  ! V 4      p\        P
                  '       g   V# \         P                  ! V \        P                  4      # )z,Returns the default button descendant of objN)	r   rb   r	   Zfind_default_buttonr   rc   find_descendantr   Zis_default_buttonr.   rX   r-   r   get_default_buttonZAXUtilities.get_default_button
  sT     '',,*>>sCF===''_-N-NOOr   c                re   rf   rC   r   r   r   r   r     s0     	J 	J 0 0 	JU5E5E5L 	Jr   c                rg   )z%Returns the focused descendant of objN)	r   rb   r	   Zfind_focused_objectr   rc   rh   r   Z
is_focusedri   r-   r   get_focused_objectZAXUtilities.get_focused_object  sU     '',,*>>sCF===''-=-H-HIIr   c                re   rf   rC   r   r   r   r   r   #  s0     	J 	J%** 	Ju/?/?$/F 	Jr   c                rg   )z&Returns the info bar descendant of objN)	r   rb   r	   Zfind_info_barr   rc   rh   r   Zis_info_barri   r-   r   get_info_barZAXUtilities.get_info_bar"  sT     '',,*88=F===''_-H-HIIr   c                re   rf   rC   r   r   r   r   r   /  s0     	L 	LE,, 	L1A1AD1H 	Lr   c                rg   )z(Returns the status bar descendant of objN)	r   rb   r	   Zfind_status_barr   rc   rh   r   Zis_status_barri   r-   r   get_status_barZAXUtilities.get_status_bar.  sT     '',,*::3?F===''_-J-JKKr   c                sP   < V ^8  d   QhRS[ P                  RS[S[S[3,          /# rK   )r   r0   tupler6   r&   r   r   r   r   r   ;  s.     W WU-- W%c	2B Wr   c                sX
  a Rp\         P                  ! V 4      pV\        P                  ! 4       9   d   R# \        P                  ! W4      '       d5   \         P
                  ! V \        P                  4      RJpV'       d   RpW13# \        P                  ! W4      '       g   \        P                  ! W4      '       d5   \         P
                  ! V \        P                  4      RJpV'       d   RpW13# \        P                  ! W4      '       d(   \        P                  V 4      '       * pV'       d   RpW13# \        P                  ! W4      '       g   \        P                  ! W4      '       Edx   \         P                  ! V 4      p\         P                   ! V 4      p\"        P$                  ! V 4      p\"        P&                  ! V 4      pV'       g   V'       g   V'       g   V'       g   R# V\         P                  ! \(        P*                  ! V 4      4      8X  d   R# \         P,                  ! V 4      ^8X  dY   \         P.                  ! V ^ 4      pV\         P                  ! V4      8X  d   R# \        P0                  ! V4      '       g	   W9   d   R# \        P2                  ! 4       o\         P
                  ! V V3R l4      p	V	'       d   \         P                  ! V	4      V8X  d   R# RV3# \        P4                  ! W4      '       g   \        P6                  ! W4      '       d@   \8        P:                  ! V 4      '       d   R# \         P<                  ! V R4      '       d   R# R# \        P>                  ! V 4      '       d9   \        P@                  ! \         P.                  ! V ^ 4      4      pV'       d   R	pW13# \        PB                  ! W4      '       d$   \D        PF                  ! V 4      pV'       d   R
pW13# \        PH                  ! V 4      '       dz   \8        P:                  ! V 4      '       d   R# \8        PJ                  ! V 4      '       d   R# \8        PL                  ! V 4      '       d   R# \        P                  V 4      '       d   R# R# \        PN                  ! W4      '       d   \        PN                  ! \         P.                  ! V ^ 4      4      '       d   R# \D        PP                  ! V 4      p
\        PB                  ! V
4      '       d$   \D        PF                  ! V
4      pV'       d   RpW13# RV3# )zMReturns True and a string reason if obj is believed to serve only for layout. Nzis inside desktop framezis inside combo boxzlacks explicit namec                 s6   < \         P                  ! V 4      S9   # rR   r   r]   )rT   	set_roles   &r   rU   Z-AXUtilities._is_layout_only.<locals>.<lambda>e  s    X=N=Nq=QU^=^r   Fclickzis parent of page tab listzis layout tablezis in layout table)Tzhas layout-only role)Tz&lacks name, description, and relations)Tzhas same name as app)Tzhas same name as its only child)Tz#is labelled by non-label only child)Tz"is in set container with same name)Fzis focusable)Fzhas click action)Tzis not interactive)Fzis selectable)Fzis expandable)Fzhas explicit name)TzCis not focusable, selectable, or expandable and lacks explicit name)Tz child of this cell is table cell))r   r]   r   Zget_layout_only_rolesZis_layered_panerW   Zis_desktop_frameis_menuis_listis_combo_boxZis_groupr   has_explicit_nameZis_panelZis_groupingr=   get_descriptionr   get_is_labelled_byget_is_described_byr   r9   rL   	get_childis_labelZget_set_container_rolesZ
is_sectionZis_documentr   is_focusable
has_actionZis_tool_barZis_page_tab_listis_tabler   Zis_layout_tableis_table_rowZis_selectableZis_expandableZis_table_cell	get_table)r.   r%   rolerX   ZnameZdescriptionZlabelled_byZdescribed_bychildancestorZtablerq   s   &          @r   _is_layout_onlyZAXUtilities._is_layout_only:  s      %?88:://**355++C1Q1QRZ^^F2>!""3--1H1H1S1S++C1M1MNVZZF.>!##C..$66s;;F.>!##C../2M2Mc2X2X$$S)D"2237K-@@EK.BB3GLK;,EEx(()?)O)OPS)TUU33'',1 **328,,U33BB&//665;OFF'??AI--c3^_HH--h74?AA&= %%c00O4O4OPS4Z4Z,,S11,,""30000--&&s++$55h6H6Ha6PQF5>!##C..,,S1F*>!'',,,,S11,,--c22----c22--,,S1111^^((33,,X-?-?Q-GHH??%%c*E''.. 0071F~%f}r   c                r3   rK   r5   r   r   r   r   r     s!      E,,  r   c                st   \        V 4      \        P                  9   d-   \        P                  P                  \        V 4      R4      w  rM4\        P	                  V 4      w  rW3\        P                  \        V 4      &   V'       d2   RV RV RV 2.p\
        P                  ! \
        P                  VR4       V# )z9Returns True if obj is believed to serve only for layout.r7   zbelieved to be layout only: z, T)Fro   )hashr   r+   getr   r   r;   r(   )r.   rX   r%   r@   s   &   r   is_layout_onlyZAXUtilities.is_layout_only  s     9222(77;;DI{SNFF(88=NF4:NK&&tCy1$c-I&QSTZS[+\]Fu//>r   c                r3   rK   r5   r   r   r   r   r     s!     % %u// %D %r   c                s   \         P                  ! V 4      '       g   R# \        P                  ! V 4      '       g   \        P                  V RR7      pV'       * # \        P                  ! V 4      '       d.   RV R.p\        P                  ! \        P                  VR4       R# \        P                  ! V 4      '       d.   RV R.p\        P                  ! \        P                  VR4       R# \        P                  ! V 4      '       d.   RV R.p\        P                  ! \        P                  VR4       R# \        P                  ! V 4      '       d.   RV R.p\        P                  ! \        P                  VR4       R# \        P                  ! V 4      '       d.   RV R	.p\        P                  ! \        P                  VR4       R# RV R
.p\        P                  ! \        P                  VR4       R# )zJReturns True if obj is a dialog that should be treated as a message dialogFT)r\   r7   z(is not a message dialog: has scroll panez'is not a message dialog: has split panez/is not a message dialog: has tree or tree tablez2is not a message dialog: has combo box or list boxz,is not a message dialog: has editable objectz"is believed to be a message dialog)r   r>   r   rb   r   rd   r	   Zhas_scroll_paner   r;   r(   Zhas_split_paneZhas_tree_or_tree_tableZhas_combo_box_or_list_boxZhas_editable_object)r.   Zwidgetsr@   rA   r   is_message_dialogZAXUtilities.is_message_dialog  s    11#66++C00!11#41PG; 0055$c+UVFu//> //44$c+TUFu//> 77<<$c+\]Fu//> ::3??$c+_`Fu//> 44S99$c+YZFu//> #'KL5++VT:r   c                sT   < V ^8  d   QhRS[ P                  RS[ P                  RS[/# )r   obj1obj2r   r5   r   r   r   r   r     s.      %"2"2 %:J:J t r   c                s.   W8X  d   R# \         P                  ! V 4      \         P                  ! V4      8w  g0   \         P                  ! V 4      \         P                  ! V4      8w  d   R# RVRV .p\        P                  ! \        P
                  VR4       R# )z*Returns True if obj2 is redundant to obj1.Fr7   zis redundant toT)r   r=   r]   r   r;   r(   )r   r   r@      && r   is_redundant_objectZAXUtilities.is_redundant_object  su     <T"h&7&7&==%):):4)@@ $(94@5++VT:r   c                sn   < V ^8  d   QhRS[ S[P                  ,          RS[ S[P                  ,          /# )r   object_listr   )rE   r   r0   r   r   r   r   r     s1      $u/?/?*@ T%JZJZE[ r   c                s   R pV '       d   \        V 4      ^8X  d   V # \        V \        P                  ! V4      R7      pVR,          w  r4\        P
                  ! V4      '       dK   \        P                  ! V4      R8X  d0   \        P                  ! W4.4      w  rVWS8w  d   VP                  4        W8w  dU   RV .p\        P                  ! \        P                  VR4       RV.p\        P                  ! \        P                  VR4       V# )z<Returns the list of objects sorted according to child index.c                 sd    \         P                  ! V 4      \         P                  ! V4      ,
          # rR   )r   get_index_in_parent)rT   Zyr1   r   cmpZ-AXUtilities._sort_by_child_index.<locals>.cmp  s$    //2X5Q5QRS5TTTr   )Zkey:i    r   NZgtkzAXUtilities: Original listTzAXUtilities: Sorted list)rG   Zsorted	functoolsZ
cmp_to_keyr   Zis_radio_buttonr   Zget_toolkit_namer   Zsort_objects_by_positionZreverser   r;   r(   )r   r   rX   ZfirstZsecondZsorted_firstZ_sorted_secondr@   s   &       r   _sort_by_child_indexZ AXUtilities._sort_by_child_index  s    	U c+.!3)=)=c)BCs**511h6O6OPU6VZ_6_ ,7+O+OQVP_+`(L$  2K@Fu//>0&9Fu//>r   c                sx   < V ^8  d   QhRS[ P                  RS[ P                  RS[S[ P                  ,          /# )r   r.   	containerr   rQ   r   r   r   r   r     s<     . ..*/*:*:.	e	.r   c                s  a Vf.   RV R.p\         P                  ! \         P                  VR4       . # \        P                  ! V 4      pV'       dD   RV RVRV.p\         P                  ! \         P                  VR4       \
        P                  V4      # \        P                  ! V 4      pV'       dD   RV RVRV.p\         P                  ! \         P                  VR4       \
        P                  V4      # \        P                  ! V 4      '       Ed   \        P                  ! V 4      pV'       dF   \        P                  ! V4      '       d*   VP                  V4       \        P                  ! V4      pKM  VP                  V 4       \        P                  ! V 4      pV'       dF   \        P                  ! V4      '       d*   VP                  V4       \        P                  ! V4      pKM  RV RVRV.p\         P                  ! \         P                  VR4       V# \        P                  ! V 4      '       d_   \        \        P                   ! V\        P                  4      4      pRV RVRV.p\         P                  ! \         P                  VR4       V# \        P"                  ! V 4      o\        \        P                   ! VV3R	 l4      4      pRV RVR
V.p\         P                  ! \         P                  VR4       V# )z+Returns the members of the container of objzAXUtilities: Members ofz!not obtainable: container is NoneTZinzvia member-ofzvia node-parent-ofzbased on siblingszbased on menu rolec                 s6   < \         P                  ! V 4      S8H  # rR   rp   )rT   r   rr   r   rU   Z.AXUtilities._get_set_members.<locals>.<lambda>#  s    (BSBSTUBVZ^B^r   zbased on role)r   r;   r(   r   Zget_is_member_ofr   r   Zget_is_node_parent_ofr   Zis_description_valuer   Zget_previous_siblingr:   Zget_next_siblingZis_menu_relatedrE   rF   r]   )r.   r   r@   rX   Zprevious_siblingZnext_siblingr   s   &&    @r   _get_set_membersZAXUtilities._get_set_members  s\    /6YZFu//>I$55c:/dIX^_Fu//>33F;;$::3?/dIG[]cdFu//>33F;;//44'<<SA"'K'KL\']']./#+#@#@AQ#R MM##44S9L?#G#G#U#Ul+'88F/dIGZ\bcFu//>M**3//(00O<[<[\]F/dIG[]cdFu//>M  %h,,Y8^_`+S$	?TZ[5++VT:r   c                rP   rK   rQ   r   r   r   r   r   )  s,      U-- $u7G7G2H r   c                s   . p\         P                  ! V 4      p\        V4      \        P                  9   d*   \        P                  P                  \        V4      . 4      pW9  dh   V'       d/   RV RVRV.p\        P                  ! \        P                  VR4       \        P                  W4      pV\        P                  \        V4      &   \         P                  ! V \        P                  4      '       * pV'       g   V# \        \        \        P                   V4      4      pW8w  dL   R\#        V4      P%                  \#        V4      4      .p\        P                  ! \        P                  VR4       V# )z,Returns the members of the container of obj.r7   znot in cached members ofrV   Tz"AXUtilities: Filtered non-showing:)r   Zget_parent_checkedr   r   r*   r   r   r;   r(   r   rW   r   rv   rE   Zfilterr   r<   setZ
difference)r.   rX   r   r@   Zmust_be_showingrH      &     r   get_set_membersZAXUtilities.get_set_members(  s!    *,//4		?k555 ,,00i"EF(#/I9VY[ab""5#3#3VTB 11#AF7=K##DO4 '44S/:V:VWWM/::FCD:CK<R<RSVW_S`<abFu//>r   c                r3   rK   r   r0   intr   r   r   r   r   F  s!      %** s r   c                s"   \         P                  ! V RR4      p\        V\        4      '       d"   VP	                  4       '       d   \        V4      # \        P                  ! V 4      '       d+   \        P                  ! \        P                  ! V 4      4      # \        P                  ! V 4      '       d[   \        P                  ! \         P                  ! V 4      4      '       g+   \        P                  ! \        P                  ! V 4      4      # \        P                  ! V 4      '       d:   \        P                  ! V 4      pV'       g   R# \!        V4      ^8X  d
   V^ ,          p \        P"                  ! V 4      '       g   \        P$                  ! V 4      '       d&   \         P&                  ! V \        P(                  4      p \         P*                  ! \         P                  ! V 4      4      pVR8  d   V# \,        P/                  V 4      p\!        V4      # )z6Returns the total number of objects in this container.setsizeF  )r   get_attribute
isinstancer&   	isnumericr   r   r   r   Zget_row_countr   is_table_cell_or_headerrS   rv   r   get_selected_childrenrG   ru   Zis_list_boxrh   is_list_itemrL   r   r   )r.   rX   selected_childrenchild_countmembersrY   r   get_set_sizeZAXUtilities.get_set_sizeE  sq    ''Y>fc""v'7'7'9'9v;'',,(():):3)?@@22377"//0C0CC0HII(():):3)?@@'',, + A A# F$	$%*'*""3''?+F+Fs+K+K**30L0LMC..x/B/B3/GH--c27|r   c                r3   rK   r5   r   r   r   r   r   f  s!      U%5%5 $ r   c                s8   \         P                  ! V 4      '       d   R# \        P                  ! V R4      pVP	                  R4      R8X  d   R# \
        P                  ! V 4      '       d1   VP	                  R4      R8H  ;'       g    VP	                  R4      R8H  # R# )zIReturns True if the total number of objects in this container is unknown.TFr   z-1ZrowcountZcolcount)r   Zis_indeterminater   get_attributes_dictr   r   r   )r.   attrsr-   r   get_set_size_is_unknownZ#AXUtilities.get_set_size_is_unknowne  s|     ,,S11,,S%899Y4'##C((99Z(D0QQEIIj4IT4QQr   c                r3   rK   r   r   r   r   r   r   v  s!     )" )"!1!1 )"c )"r   c                s&   \         P                  ! V RR4      p\        V\        4      '       d)   VP	                  4       '       d   \        V4      ^,
          # \        P                  ! V 4      '       d   \         P                  ! V RR4      p\        V\        4      '       d)   VP	                  4       '       d   \        V4      ^,
          # \         P                  ! V 4      '       d>   \         P                  ! V \        P                  4      p\         P                  ! VRR4      p\        V\        4      '       d)   VP	                  4       '       d   \        V4      ^,
          # \        P                  ! V 4      '       dN   \        P                  ! \         P                  ! V 4      4      '       g   \        P                  ! V 4      ^ ,          # \        P                  ! V 4      '       d:   \        P                   ! V 4      pV'       g   R# \#        V4      ^8X  d
   V^ ,          p \         P                  ! \         P                  ! V 4      4      pVR8  d   \         P$                  ! V 4      # \&        P)                  V 4      pW9  d   R# VP+                  V 4      # )zQReturns the position of obj with respect to the number of items in its container.ZposinsetFZrowindexr   r   )r   r   r   r&   r   r   r   r   rL   rh   r   rS   r   Zget_cell_coordinatesrv   r   r   rG   r   r   r   index)r.   rX   Zcellr   r   r   r   r   get_position_in_setZAXUtilities.get_position_in_setu  s    ''Z?fc""v'7'7'9'9v;?"'',,++CUCF&#&&6+;+;+=+=6{Q&'',,//_5\5\]!//j%H&#&&6+;+;+=+=6{Q&22377"//0C0CC0HII//4Q77'',, + A A# F$	$%*'*..x/B/B3/GH//44--c2I}}S!!r   c                r3   rK   r5   r   r   r   r   r     s%     F Fu// FD Fr   c                s6    \         P                  ! V R4      R8H  # )zTReturns True if obj has an author/app-provided name as opposed to a calculated name.zexplicit-nameZtrue)r   r   rM   rN   r   rw   ZAXUtilities.has_explicit_name  s     %%c?;vEEr   c                r3   rK   r5   r   r   r   r   r     s!      !1!1 d r   c                sn   \         P                  ! V 4      '       g   \        P                  ! V 4      '       g   R# \        P
                  ! V 4      pV F^  p\         P                  ! V4      '       g   K!  \        P                  ! V4      '       g   K?  \        P                  ! V4      '       g   K]   R# 	  R# )z*Returns True if obj has a visible caption.FT)
r   Z	is_figurer   supports_tabler   ry   Z
is_captionr   r<   r^   )r.   labelslabelrA   r   has_visible_captionZAXUtilities.has_visible_caption  s~      ))#..(2I2I#2N2N$77<E))%00#..u55:J:U:UV[:\:\ 
 r   c                r3   rK   r/   r   r   r   r   r     s!      !1!1 c r   c                    \         P                  ! V 4      pV Uu. uF7  p\        P                  ! V4      ;'       g    \        P
                  ! V4      NK9  	  ppRP                  V4      pV# u upi )z#Returns the displayed label of obj. )r   ry   r   r=   r   get_all_textjoin)r.   r   r   stringsrX   rY   r   get_displayed_labelZAXUtilities.get_displayed_label  sd     %77<W]^W]e8$$U+IIv/B/B5/IIW]^'" _
   !A-A-c                r3   rK   r/   r   r   r   r   r     s!      u'7'7 C r   c                r   )z)Returns the displayed description of obj.r   )r   rz   r   r=   r   r   r   )r.   ZdescriptionsZdescr   rX   rY   r   get_displayed_descriptionZ%AXUtilities.get_displayed_description  sd     +>>sCT`aT`D8$$T*GGf.A.A$.GGT`a'" br   c                r3   rK   r   r   r   r   r   r     s!      u// C r   c                sZ   \         P                  ! V 4      '       g   ^ # \        P                  ! V 4      '       * p\        P
                  ! W4      p \        VP                  RR4      4      pV#   \         d2    RT RTR.p\        P                  ! \        P                  TR4        ^ # i ; i)z!Returns the heading level of obj.ZlevelZ0z(AXUtilities: Exception getting value for()T)r   Z
is_headingr   Zis_editabler   r   r   r   Z
ValueErrorr   r;   r(   )r.   Z	use_cacher   Zvaluer@   rY   r   get_heading_levelZAXUtilities.get_heading_level  s     ))#..(44S99	,,S<			'3/0E   	@#sESVWFu//>	s   A. .8B*)B*c                r3   rK   r   r   r   r   r   r     s!      u// C r   c                s   a  R V 3R llp. p\         P                  ! S V4      pV'       d*   VP                  V4       \         P                  ! W14      pK1  \        V4      # )z!Returns the nesting level of obj.c                sD    V ^8  d   QhR\         P                  R\        /# )r   rT   r   r5   )r   s   "r   r   Z3AXUtilities.get_nesting_level.<locals>.__annotate__  s      	: 	:E$$ 	: 	:r   c                 s   < \         P                  ! S4      '       d+   \         P                  ! \        P                  ! V 4      4      # \         P
                  ! SV 4      # rR   )r   r   ru   r   rS   Zhave_same_role)rT   r.   rr   r   predZ+AXUtilities.get_nesting_level.<locals>.pred  sC    ++C00&..x/B/B1/EFF"11#q99r   )r   rW   r:   rG   )r.   r   Z	ancestorsr   s   f   r   get_nesting_levelZAXUtilities.get_nesting_level  sQ    	: 	:
 	))#t4X&--h=H9~r   c                re   rf   rC   r   r   r   r   r     s,      U-- %2B2BT2I r   c                s   \         P                  ! V 4      '       g   R# \        P                  ! V 4      pV F#  p\         P                  ! V4      '       d   K!  Vu # 	  \         P
                  ! V 4      ^,           p\         P                  ! V 4      pV'       d]   ^ Tu;8  d   \         P                  ! V4      8  g:   M Tp \         P
                  ! V 4      ^,           p\         P                  ! V 4      pKd  Vf   R# \         P                  ! WC4      pWP8X  d.   RV R.p\        P                  ! \        P                  VR4       R# V# )zIReturns the next object (depth first, unless there's a flows-to relation)Nr7   z claims to be its own next objectT)r   is_validr   Zget_flows_tois_deadr   rS   rL   r{   r   r;   r(   )r.   targetsr   r   parentZnext_objectr@      &      r   get_next_objectZAXUtilities.get_next_object  s       %%%2237F##F++  ,,S1A5$$S)QI)A)A&)IIC0059E((-F>((7$c+MNFu//>r   c                re   rf   rC   r   r   r   r   r     s,      !1!1 e6F6F6M r   c                s   \         P                  ! V 4      '       g   R# \        P                  ! V 4      pV F#  p\         P                  ! V4      '       d   K!  Vu # 	  \         P
                  ! V 4      ^,
          p\         P                  ! V 4      pV'       dd   ^ Tu;8:  d#   \         P                  ! V4      ^,
          8  g:   M Tp \         P
                  ! V 4      ^,
          p\         P                  ! V 4      pKk  Vf   R# \         P                  ! WC4      pWP8X  d.   RV R.p\        P                  ! \        P                  VR4       R# V# )zOReturns the previous object (depth first, unless there's a flows-from relation)Nr7   z$claims to be its own previous objectT)r   r   r   Zget_flows_fromr   r   rS   rL   r{   r   r;   r(   )r.   r   r   r   r   Zprevious_objectr@   r   r   get_previous_objectZAXUtilities.get_previous_object
  s      %%%44S9F##F++  ,,S1A5$$S)Q%N(*B*B6*JQ*NNC0059E((-F>",,V;!$c+QRFu//>r   c                sb   < V ^8  d   QhRS[ P                  RS[ P                  R,          RS[/# )r   r.   bounding_boxNr   )r   r0   Rectr6   r   r   r   r   r   )  s6     3 33jj4'3 
3r   c                s\   \         P                  ! V RR4       RV R.p\        P                  ! \        P                  VR4       \
        P                  ! V 4      '       d   \
        P                  ! V 4      '       g.   RV R.p\        P                  ! \        P                  VR4       R# RV R.p\        P                  ! \        P                  VR4       \
        P                  ! V 4      '       d.   RV R	.p\        P                  ! \        P                  VR4       R# RV R
.p\        P                  ! \        P                  VR4       \        P                  ! V 4      '       d.   RV R.p\        P                  ! \        P                  VR4       R# RV R.p\        P                  ! \        P                  VR4       \        P                  ! V 4      '       d.   RV R.p\        P                  ! \        P                  VR4       R# RV RVR.p\        P                  ! \        P                  VR4       VeL   \        P                  ! W4      '       g0   RV RVR.p\        P                  ! \        P                  VR4       R# RV R.p\        P                  ! \        P                  VR4       R# )z9Returns true if obj should be treated as being on screen.Fz)Updating to check if object is on screen.zAXUtilities: Checking ifzis showing and visible....Tr7   z3is not showing and visible. Treating as off screen.z*is showing and visible. Checking hidden...z0is reports being hidden. Treating as off screen.z(is not hidden. Checking size and rect...zAXUtilities: Rect ofz$is unhelpful. Treating as on screen.z4has size and a valid rect. Checking if off screen...zis believed to be off screen.zis not off screen. Checkingzintersection...r   znot inz. Treating as off screen.zis believed to be on screen.)r   r8   r   r;   r(   r   r<   r^   Z	is_hiddenr   Zhas_no_size_or_invalid_rectZobject_is_off_screenZobject_intersects_rect)r.   r   r@   r   r   is_on_screenZAXUtilities.is_on_screen(  s8    	S%)TU,c3OP5++VT: ++C005E5P5PQT5U5U$c+`aFu//> #'ST5++VT:%%c**$c+]^Fu//> #'QR5++VT:22377,c3YZFu//> #']^5++VT:++C00$c+JKFu//> #'D 135++VT:#K,N,Ns,a,a#S(LB]^Fu//> #'EF5++VT:r   c                r3   rK   r5   r   r   r   r   r   _  s!       0 0 T r   c                s^   \         P                  ! V 4      '       d!   \         P                  ! V 4      '       d   R# R# \        P                  ! V 4      p\         P
                  ! W4      '       d   \        P                  ! V 4      '       * # \         P                  ! W4      '       d8   \         P                  ! V 4      '       g   \        P                  ! V 4      '       * # \        P                  ! V 4      '       d5   \         P                  ! W4      ;'       g    \         P                  ! W4      # R# )z5Returns True if obj should be treated as a leaf node.FT)r   Zchildren_are_presentationalZis_page_tabr   r]   rv   r   Zis_expandedrt   Zhas_role_from_ariar=   Zis_linkr|   )r.   r   r-   r   treat_as_leaf_nodeZAXUtilities.treat_as_leaf_node^  s     66s;;**3//  %''22'33C888""3--o6X6XY\6]6]'33C888S!!"**35\\9Q9QRU9\\r   c                s|   < V ^8  d   QhRS[ P                  RS[P                  RS[ P                  R,          RS[/# )r   rootcancellation_eventr   Nr   )r   r0   r   Eventr   rE   r   r   r   r   r   u  sD     2 22%OO2 jj4'2 
	2r   c           	     s   R V R\        \        V 4      4       R2.p\        P                  ! \        P                  VR4       VP                  4       '       d+   Rp\        P                  ! \        P                  VR4       . # \        P                  W4      '       g   . # \        P                  V 4      '       d   V .# \        P                  ! V 4      '       d<   \        P                  ! V 4      '       d    \        \        P                  ! V 4      4      # . p\        P                   ! V 4      pV'       g9   \        P"                  ! V 4      '       g   \$        P&                  ! V 4      '       d   VP)                  V 4       Vf   \*        P,                  ! V 4      p\/        \        P0                  ! V 4      4       F  w  rxRV R2VR\        \        V4      4       R2.p\        P                  ! \        P                  VR4       VP                  4       '       d+   Rp\        P                  ! \        P                  VR4        Mu\        P3                  WV4      p	VP5                  V	4       V'       g   K  V	'       g   K  W9   g   K  V\        P                   ! V4      8X  g   K  VP7                  V 4       K  	  V'       d   V# \8        P:                  ! V 4      '       g   \        P<                  ! V R4      '       d   V .# . # )z)AXUtilities: Getting on-screen objects inr   r   Tz5AXUtilities: Cancellation event set. Stopping search.zAXUtilities: Child z isrs   )ZhexZidr   r;   r(   is_setr'   r   r   r   r   r   Zsupports_selectionrE   r   Ziter_visible_cellsr=   rx   r   Zhas_presentable_textr:   r   Zget_rectZ	enumeraterF   _get_on_screen_objectsrD   ra   r   r}   r~   )
r   r   r   r@   r,   ZobjectsZ	root_nameZir   Zchildrens
   &&&       r   r   Z"AXUtilities._get_on_screen_objectst  s;    >tqRPTXWXEYZ5++VT:$$&&IC 0 0#t<I'';;I))$//6M""4((X-H-H-N-N224899%%d+	0066&:U:UVZ:[:[NN4 &//5L!("8"8">?HA+A3c2EQs2e9~>Na;PQFu//>!((**M##E$4$4c4@"99%UabHNN8$yXX$/i8K\K\]bKc>ct$ @ N((..(2E2EdG2T2T6M	r   c                sh   < V ^8  d   QhRS[ P                  RS[ P                  R,          RS[RS[/# )r   r   r   Ntimeoutr   )r   r0   r   ZfloatrE   r   r   r   r   r     s@     # ##jj4'# # 
	#r   c                s  a aa	a
 \         P                  ! 4       o
\        P                  ! 4       o	VV	V
V 3R lp\        P                  ! VR7      pVP                  4         S
P                  VR7      pVP!                  4        R\#        V4       R	2S .p\        P                  ! \        P                  VR4       V#   \         P                   d    RS .p\        P                  ! \        P                  TR4       S	P                  4        . pRp\        P                  ! \        P                  TR4       \        P                  ! 4       pRT.p\        P                  ! \        P                  TR4        ELi ; i)
z5Returns a list of onscreen objects in the given root.c                  s   < \         P                  SSS4      p SP                  4       '       g   SP                  V 4       R # R # rR   )r   r   r   Zput)rX   r   r   result_queuer   s    r   _workerZ2AXUtilities.get_on_screen_objects.<locals>._worker  s;     77>PR^_F%,,..  ( /r   r   )r   z-AXUtilities: get_on_screen_objects timed out.Tz/AXUtilities: Checking AT-SPI responsiveness....zAXUtilities: Desktop iszAXUtilities: z onscreen objects found in)queueZQueuer   r   r   r!   r   ZEmptyr   r;   ZLEVEL_WARNINGr   r'   r(   r   Zget_desktopr   rG   )r   r   r   r   Zworker_threadrX   r@   r,   Zdesktopr   r   s   ff&      @@r   get_on_screen_objectsZ!AXUtilities.get_on_screen_objects  s5    +0++-&__.	) 	)
 "((8	?!%%g%6F 	!#f+.HI4P5++VT: {{ 
	?EtLFu22FDA""$FCC 0 0#t<,88:G/9Fu//>
	?s    B; ;B8E76E7c                s   < V ^8  d   Qh/ S[ S[S[S[P                  ,          3,          ;R&   S[ S[S[S[S[3,          3,          ;R&   # )r   r*   r+   )Zdictr   rE   r   r0   rn   r6   r&   r   r   r   r   r   ;   sG      c4 0 01127  eD#I../4 r   r   )ro   )Nro   )TFrR   )Ng      @)2Z__name__Z
__module__Z__qualname__Z__firstlineno____doc__rc   r*   r+   r   ZLockr)   Zstaticmethodr"   r    r$   r2   rB   rJ   rO   rZ   rd   rj   rk   rl   rm   r   r   r   r   r   r   r   r   r   r   rw   r   r   r   r   r   r   r   r   r   r   r   Z__annotate_func__Z__static_attributes__Z__classdictcell__)r   s   @r   r   r   ;   s    M%*" 68K24NNNE  2 2 / / / , , , ) )V 3 3j 	9 	9   < < <@ 	P 	P 	J 	J 	J 	J 	L 	L W Wr   % %N    6 . .`  8  >   )" )"V F F
        $     :  : 3 3 3j  * 2 2 2h # # #_  r   r   )Z	predicateZfind)/r   Z__id__Z__version__Z__date__Z__copyright__Z__license__r   Zinspectr   r   r#   ZgiZrequire_versionZgi.repositoryr   ro   r   Zax_componentr   Z	ax_objectr   Zax_selectionr   Zax_tabler   Zax_textr   Zax_utilities_applicationr   Zax_utilities_collectionr	   Zax_utilities_eventr
   Zax_utilities_relationr   Zax_utilities_roler   Zax_utilities_stater   r   Z
getmembersZ
isfunctionZmethod_nameZmethodZsetattrZ
startswithr"   r   r   r   <module>r      s  6 J6      	   7E "   %  %   < : 0 6 . 0R Rh #--.DPWPbPbcKKf- d #--.>'J\J\]KKf- ^ #--.AWM_M_`KKf- a #--oI[I[\KKf- ] #--.>'J\J\]KKf- ^ #--.CwOaOabKf%%[&1 c  ' ' )r   