
    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 ej                  dd	       dd
l
mZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ  G d d      Zy)a  
Utilities for finding all objects that meet a certain criteria.
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      )debug)AXCollection)AXObject)AXUtilitiesRole)AXUtilitiesStatec                       e Zd ZdZed        Zedd       Zedd       Zedd       Zedd       Z	edd       Z
edd	       Zedd
       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Z edd       Z!edd        Z"edd!       Z#edd"       Z$edd#       Z%edd$       Z&edd%       Z'edd&       Z(edd'       Z)edd(       Z*edd)       Z+edd*       Z,edd+       Z-edd,       Z.edd-       Z/edd.       Z0edd/       Z1edd0       Z2edd1       Z3edd2       Z4edd3       Z5edd4       Z6edd5       Z7edd6       Z8edd7       Z9edd8       Z:edd9       Z;edd:       Z<edd;       Z=edd<       Z>edd=       Z?edd>       Z@edd?       ZAedd@       ZBeddA       ZCeddB       ZDeddC       ZEeddD       ZFeddE       ZGeddF       ZHeddG       ZIeddH       ZJeddI       ZKeddJ       ZLeddK       ZMeddL       ZNeddM       ZOeddN       ZPeddO       ZQeddP       ZReddQ       ZSeddR       ZTeddS       ZUeddT       ZVeddU       ZWeddV       ZXeddW       ZYeddX       ZZeddY       Z[eddZ       Z\edd[       Z]edd\       Z^edd]       Z_edd^       Z`edd_       Zaedd`       Zbedda       Zceddb       Zdeddc       Zeeddd       Zfedde       Zgeddf       Zheddg       Zieddh       Zjeddi       Zkeddj       Zleddk       Zmeddl       Zneddm       Zoeddn       Zpeddo       Zqeddp       Zreddq       Zseddr       Ztedds       Zueddt       Zveddu       Zweddv       Zxeddw       Zyeddx       Zzeddy       Z{eddz       Z|edd{       Z}edd|       Z~edd}       Zedd~       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       ZeddÄ       ZedĄ        Zedń        ZedƄ        ZedǄ        ZedȄ        ZedɄ        Zedʄ        Zed˄        Zy)AXUtilitiesCollectionz?Utilities for finding all objects that meet a certain criteria.c                 L   | sg S t        j                          }d|g}t        j                  t        j                  |d       t	        t        ||             } dt        |        dt        j                          |z
  dd}t        j                  t        j                  |d       | S )Nz*AXUtilitiesCollection: Applying predicate TzAXUtilitiesCollection: z matches found in z.4fs)timer   printTokens
LEVEL_INFOlistfilterlenprintMessage)matchespredstarttokensmsgs        >/usr/lib/python3/dist-packages/orca/ax_utilities_collection.py_apply_predicatez&AXUtilitiesCollection._apply_predicate6   s    I		>E%**FD9vdG,-'G~5G		V[H[\_G``ab5++S$7    Nc                 2   | r|sg S t        |      }dt        j                         d| |d|g}t        j                  t        j
                  |d       t        j                  ||      }t        j                  | |      }|t        j                  ||      }|S )NAXUtilitiesCollection:Root:of:T)statesstate_match_typer   inspectcurrentframer   r   r   r   create_match_ruleget_all_matchesr   r   )root
state_listr#   r   r   ruler   s          r   _find_all_with_statesz+AXUtilitiesCollection._find_all_with_statesD   s    I*%
*G,@,@,B4!15*F%**FD9--ZRbc..tT:+<<WdKGr   c                 2   | r|sg S t        |      }dt        j                         d| |d|g}t        j                  t        j
                  |d       t        j                  ||      }t        j                  | |      }|t        j                  ||      }|S )Nr   r    r!   T)rolesrole_match_typer$   )r)   	role_listr/   r   r   r+   r   s          r   _find_all_with_rolez)AXUtilitiesCollection._find_all_with_roleU   s    IO	*G,@,@,B4%D%**FD9--I_..tT:+<<WdKGr   c                 .   | r|sg S t        |      }dt        j                         d| d|g}t        j                  t        j
                  |d       t        j                  |      }t        j                  | |      }|t        j                  ||      }|S )zLReturns all descendants of root which implement all the specified interfacesr   r    zall of:T)
interfacesr$   )r)   interface_listr   r   r+   r   s         r   find_all_with_interfacesz.AXUtilitiesCollection.find_all_with_interfacesf   s     In-*G,@,@,B4N<%**FD9--H..tT:+<<WdKGr   c                 b    t         j                  | |t        j                  j                  |      S )z?Returns all descendants of root with any of the specified roles)r   r1   r   CollectionMatchTypeANYr)   r0   r   s      r   find_all_with_rolez(AXUtilitiesCollection.find_all_with_roley   s.     %88)U66::DB 	Br   c                 b    t         j                  | |t        j                  j                  |      S )zFReturns all descendants of root which have none of the specified roles)r   r1   r   r7   NONEr9   s      r   find_all_without_rolesz,AXUtilitiesCollection.find_all_without_roles   s.     %88)U66;;TC 	Cr   c                    | r|r|sg S t        |      }t        |      }dt        j                         d| d|d|g}t        j                  t        j
                  |d       t        j                  ||t        j                  j                        }t        j                  | |      }|t        j                  ||      }|S )zIReturns all descendants of root with any of the roles, and all the statesr   r    Roles:States:Tr.   r"   r#   )r   r%   r&   r   r   r   r   r'   r   r7   ALLr(   r   r   r)   r0   r*   r   r   r+   r   s          r   !find_all_with_role_and_all_statesz7AXUtilitiesCollection.find_all_with_role_and_all_states        zIO	*%
*G,@,@,B49iM%**FD9--JAZAZA^A^`..tT:+<<WdKGr   c                    | r|r|sg S t        |      }t        |      }dt        j                         d| d|d|g}t        j                  t        j
                  |d       t        j                  ||t        j                  j                        }t        j                  | |      }|t        j                  ||      }|S )zLReturns all descendants of root with any of the roles, and any of the statesr   r    r?   r@   TrA   )r   r%   r&   r   r   r   r   r'   r   r7   r8   r(   r   r   rC   s          r    find_all_with_role_and_any_statez6AXUtilitiesCollection.find_all_with_role_and_any_state   rE   r   c                    | r|r|sg S t        |      }t        |      }dt        j                         d| d|d|g}t        j                  t        j
                  |d       t        j                  ||t        j                  j                        }t        j                  | |      }|t        j                  ||      }|S )zMReturns all descendants of root with any of the roles, and none of the statesr   r    r?   r@   TrA   )r   r%   r&   r   r   r   r   r'   r   r7   r<   r(   r   r   rC   s          r   !find_all_with_role_without_statesz7AXUtilitiesCollection.find_all_with_role_without_states   s     zIO	*%
*G,@,@,B49iM%**FD9--JAZAZA_A_a..tT:+<<WdKGr   c                 b    t         j                  | |t        j                  j                  |      S )zFReturns all descendants of root which have all of the specified states)r   r,   r   r7   rB   r)   r*   r   s      r   find_all_with_statesz*AXUtilitiesCollection.find_all_with_states   .     %::*e77;;TC 	Cr   c                 b    t         j                  | |t        j                  j                  |      S )zFReturns all descendants of root which have any of the specified states)r   r,   r   r7   r8   rK   s      r   find_all_with_any_statez-AXUtilitiesCollection.find_all_with_any_state   rM   r   c                 b    t         j                  | |t        j                  j                  |      S )zGReturns all descendants of root which have none of the specified states)r   r,   r   r7   r<   rK   s      r   find_all_without_statesz-AXUtilitiesCollection.find_all_without_states   s.     %::*e77<<dD 	Dr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z?Returns all descendants of root with the accelerator label role)r   RoleACCELERATOR_LABELr   r:   r)   r   r.   s      r   find_all_accelerator_labelsz1AXUtilitiesCollection.find_all_accelerator_labels   +     --.$77eTJJr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z3Returns all descendants of root with the alert role)r   rS   ALERTr   r:   rU   s      r   find_all_alertsz%AXUtilitiesCollection.find_all_alerts   +     !!"$77eTJJr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z7Returns all descendants of root with the animation role)r   rS   	ANIMATIONr   r:   rU   s      r   find_all_animationsz)AXUtilitiesCollection.find_all_animations   +     %%&$77eTJJr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z3Returns all descendants of root with the arrow role)r   rS   ARROWr   r:   rU   s      r   find_all_arrowsz%AXUtilitiesCollection.find_all_arrows   r[   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z5Returns all descendants of root with the article role)r   rS   ARTICLEr   r:   rU   s      r   find_all_articlesz'AXUtilitiesCollection.find_all_articles   +     ##$$77eTJJr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z3Returns all descendants of root with the audio role)r   rS   AUDIOr   r:   rU   s      r   find_all_audiosz%AXUtilitiesCollection.find_all_audios   r[   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z:Returns all descendants of root with the autocomplete role)r   rS   AUTOCOMPLETEr   r:   rU   s      r   find_all_autocompletesz,AXUtilitiesCollection.find_all_autocompletes  +     (()$77eTJJr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z9Returns all descendants of root with the block quote role)r   rS   BLOCK_QUOTEr   r:   rU   s      r   find_all_block_quotesz+AXUtilitiesCollection.find_all_block_quotes  +     ''($77eTJJr   c                     t         j                  j                  t         j                  j                  g}t        j                  | ||      S )zDReturns all descendants of root with the push- or toggle-button role)r   rS   PUSH_BUTTONTOGGLE_BUTTONr   r:   rU   s      r   find_all_buttonsz&AXUtilitiesCollection.find_all_buttons  s7     '')A)AB$77eTJJr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z6Returns all descendants of root with the calendar role)r   rS   CALENDARr   r:   rU   s      r   find_all_calendarsz(AXUtilitiesCollection.find_all_calendars  +     $$%$77eTJJr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z4Returns all descendants of root with the canvas role)r   rS   CANVASr   r:   rU   s      r   find_all_canvasesz'AXUtilitiesCollection.find_all_canvases!  +     ""#$77eTJJr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z5Returns all descendants of root with the caption role)r   rS   CAPTIONr   r:   rU   s      r   find_all_captionsz'AXUtilitiesCollection.find_all_captions(  rf   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z3Returns all descendants of root with the chart role)r   rS   CHARTr   r:   rU   s      r   find_all_chartsz%AXUtilitiesCollection.find_all_charts/  r[   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z6Returns all descendants of root with the checkbox role)r   rS   	CHECK_BOXr   r:   rU   s      r   find_all_check_boxesz*AXUtilitiesCollection.find_all_check_boxes6  r_   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z<Returns all descendants of root with the check menuitem role)r   rS   CHECK_MENU_ITEMr   r:   rU   s      r   find_all_check_menu_itemsz/AXUtilitiesCollection.find_all_check_menu_items=  +     ++,$77eTJJr   c           	      4   | g S dg}t         j                  j                  g}t         j                  j                  }t        j                         }t         j                  j                  }dg}t         j                  j                  }dt        j                         d| |d|dg	}	t        j                  t        j                  |	d       fd}
t        j                  |||||||	      }t        j                  | |      }t        j!                  ||
      }|S )
zLReturns all non-focusable descendants of root which support the click actionActionzxml-roles:gridcellr   r    r!   . pred:Tc                     t        j                  | d      }d| t        j                  |       d|g}t        j                  t        j
                  |d       |syd u xs  |       S )Nclickr   zhas click Action:TFr   
has_actionactions_as_stringr   r   r   objresultr   r   s      r   is_matchz;AXUtilitiesCollection.find_all_clickables.<locals>.is_matchW  se    ((g6F.X5O5OPS5T)63Fe..=4<,49,r   )r3   
attributesattribute_match_typer.   r/   r"   r#   )r   	StateType	FOCUSABLEr7   r<   r	   )get_roles_to_exclude_from_clickables_listr%   r&   r   r   r   r   r'   r(   r   r   )r)   r   r3   r"   r#   r.   roles_match_typer   r   r   r   r+   r   s    `           r   find_all_clickablesz)AXUtilitiesCollection.find_all_clickablesD  s	    <IZ
//++, 4499IIK 4499*+
$88==*G,@,@,B4!15%DR%**FD9	- --!!!5,-/ ..tT:'88(Kr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z;Returns all descendants of root with the color_chooser role)r   rS   COLOR_CHOOSERr   r:   rU   s      r   find_all_color_choosersz-AXUtilitiesCollection.find_all_color_choosersl  +     ))*$77eTJJr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z;Returns all descendants of root with the column header role)r   rS   COLUMN_HEADERr   r:   rU   s      r   find_all_column_headersz-AXUtilitiesCollection.find_all_column_headerss  r   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z6Returns all descendants of root with the combobox role)r   rS   	COMBO_BOXr   r:   rU   s      r   find_all_combo_boxesz*AXUtilitiesCollection.find_all_combo_boxesz  r_   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z5Returns all descendants of root with the comment role)r   rS   COMMENTr   r:   rU   s      r   find_all_commentsz'AXUtilitiesCollection.find_all_comments  rf   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z>Returns all descendants of root with the content deletion role)r   rS   CONTENT_DELETIONr   r:   rU   s      r   find_all_content_deletionsz0AXUtilitiesCollection.find_all_content_deletions  +     ,,-$77eTJJr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z?Returns all descendants of root with the content insertion role)r   rS   CONTENT_INSERTIONr   r:   rU   s      r   find_all_content_insertionsz1AXUtilitiesCollection.find_all_content_insertions  rW   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z9Returns all descendants of root with the date editor role)r   rS   DATE_EDITORr   r:   rU   s      r   find_all_date_editorsz+AXUtilitiesCollection.find_all_date_editors  rq   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z8Returns all descendants of root with the definition role)r   rS   
DEFINITIONr   r:   rU   s      r   find_all_definitionsz*AXUtilitiesCollection.find_all_definitions  +     &&'$77eTJJr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z>Returns all descendants of root with the description list role)r   rS   DESCRIPTION_LISTr   r:   rU   s      r   find_all_description_listsz0AXUtilitiesCollection.find_all_description_lists  r   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z>Returns all descendants of root with the description term role)r   rS   DESCRIPTION_TERMr   r:   rU   s      r   find_all_description_termsz0AXUtilitiesCollection.find_all_description_terms  r   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z?Returns all descendants of root with the description value role)r   rS   DESCRIPTION_VALUEr   r:   rU   s      r   find_all_description_valuesz1AXUtilitiesCollection.find_all_description_values  rW   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z;Returns all descendants of root with the desktop frame role)r   rS   DESKTOP_FRAMEr   r:   rU   s      r   find_all_desktop_framesz-AXUtilitiesCollection.find_all_desktop_frames  r   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z:Returns all descendants of root with the desktop icon role)r   rS   DESKTOP_ICONr   r:   rU   s      r   find_all_desktop_iconsz,AXUtilitiesCollection.find_all_desktop_icons  rm   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z2Returns all descendants of root with the dial role)r   rS   DIALr   r:   rU   s      r   find_all_dialsz$AXUtilitiesCollection.find_all_dials  )     !$77eTJJr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z4Returns all descendants of root with the dialog role)r   rS   DIALOGr   r:   rU   s      r   find_all_dialogsz&AXUtilitiesCollection.find_all_dialogs  r}   r   c                 Z    t        j                  d      }t        j                  | ||      S )zAReturns all descendants of root that has any dialog or alert roleT)r	   get_dialog_rolesr   r:   rU   s      r   find_all_dialogs_and_alertsz1AXUtilitiesCollection.find_all_dialogs_and_alerts  s)      006$77eTJJr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z<Returns all descendants of root with the directory pane role)r   rS   DIRECTORY_PANEr   r:   rU   s      r   find_all_directory_panesz.AXUtilitiesCollection.find_all_directory_panes  +     **+$77eTJJr   c                 X    t        j                         }t        j                  | ||      S )zBReturns all descendants of root that has any document-related role)r	   get_document_rolesr   r:   rU   s      r   find_all_documentsz(AXUtilitiesCollection.find_all_documents  s'      224$77eTJJr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z<Returns all descendants of root with the document email role)r   rS   DOCUMENT_EMAILr   r:   rU   s      r   find_all_document_emailsz.AXUtilitiesCollection.find_all_document_emails  r   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z<Returns all descendants of root with the document frame role)r   rS   DOCUMENT_FRAMEr   r:   rU   s      r   find_all_document_framesz.AXUtilitiesCollection.find_all_document_frames  r   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )zCReturns all descendants of root with the document presentation role)r   rS   DOCUMENT_PRESENTATIONr   r:   rU   s      r   find_all_document_presentationsz5AXUtilitiesCollection.find_all_document_presentations  s+     112$77eTJJr   c                 f    t         j                  j                  g}t        j	                  | ||      S )zBReturns all descendants of root with the document spreadsheet role)r   rS   DOCUMENT_SPREADSHEETr   r:   rU   s      r   find_all_document_spreadsheetsz4AXUtilitiesCollection.find_all_document_spreadsheets  s+     001$77eTJJr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z;Returns all descendants of root with the document text role)r   rS   DOCUMENT_TEXTr   r:   rU   s      r   find_all_document_textsz-AXUtilitiesCollection.find_all_document_texts  r   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z:Returns all descendants of root with the document web role)r   rS   DOCUMENT_WEBr   r:   rU   s      r   find_all_document_websz,AXUtilitiesCollection.find_all_document_webs  rm   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z:Returns all descendants of root with the drawing area role)r   rS   DRAWING_AREAr   r:   rU   s      r   find_all_drawing_areasz,AXUtilitiesCollection.find_all_drawing_areas  rm   r   c                     t         j                  j                  g}|r)|j                  t         j                  j                         t
        j                  | ||      S )z2Returns all descendants of root which are editable)r   r   EDITABLEappendr   r   rL   )r)   must_be_focusabler   r"   s       r   find_all_editable_objectsz/AXUtilitiesCollection.find_all_editable_objects  sD     //**+MM%//334$99$MMr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z5Returns all descendants of root with the editbar role)r   rS   EDITBARr   r:   rU   s      r   find_all_editbarsz'AXUtilitiesCollection.find_all_editbars$  rf   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z6Returns all descendants of root with the embedded role)r   rS   EMBEDDEDr   r:   rU   s      r   find_all_embeddedsz(AXUtilitiesCollection.find_all_embeddeds+  ry   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z3Returns all descendants of root with the entry role)r   rS   ENTRYr   r:   rU   s      r   find_all_entriesz&AXUtilitiesCollection.find_all_entries2  r[   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z6Returns all descendants of root with the extended role)r   rS   EXTENDEDr   r:   rU   s      r   find_all_extendedsz(AXUtilitiesCollection.find_all_extendeds9  ry   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z:Returns all descendants of root with the file chooser role)r   rS   FILE_CHOOSERr   r:   rU   s      r   find_all_file_choosersz,AXUtilitiesCollection.find_all_file_choosers@  rm   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z4Returns all descendants of root with the filler role)r   rS   FILLERr   r:   rU   s      r   find_all_fillersz&AXUtilitiesCollection.find_all_fillersG  r}   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z3Returns all descendants of root which are focusable)r   r   r   r   rL   r)   r   r"   s      r   find_all_focusable_objectsz0AXUtilitiesCollection.find_all_focusable_objectsN  s+     //++,$99$MMr   c           	         | g S dg}t         j                  j                  g}t         j                  j                  }t        j                         }t         j                  j                  }dt        j                         d| |d|dg	}t        j                  t        j                  |d       fd}t        j                  |||||      }	t        j                  | |	      }
t         j#                  |
|      }
|
S )	zQReturns all focusable descendants of root which support the click-ancestor actionr   r   r    r!   r   Tc                     t        j                  | d      }d| t        j                  |       d|g}t        j                  t        j
                  |d       |syd u xs  |       S )Nzclick-ancestorr   zhas click-ancestor Action:TFr   r   s      r   r   zVAXUtilitiesCollection.find_all_focusable_objects_with_click_ancestor.<locals>.is_matchf  sf    ((.>?F.X5O5OPS5T2F<Fe..=4<,49,r   )r3   r.   r/   r"   r#   )r   r   r   r7   r8   r	   r   r<   r%   r&   r   r   r   r   r'   r(   r   r   )r)   r   r3   r"   r#   r.   r   r   r   r+   r   s    `         r   .find_all_focusable_objects_with_click_ancestorzDAXUtilitiesCollection.find_all_focusable_objects_with_click_ancestorU  s     <IZ
//++, 4488IIK 4499*G,@,@,B4!15%DR%**FD9	- --!,-/ ..tT:'88(Kr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z1Returns all descendants of root which are focused)r   r   FOCUSEDr   rL   r  s      r   find_all_focused_objectsz.AXUtilitiesCollection.find_all_focused_objectsy  +     //))*$99$MMr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z?Returns all descendants of root with the focus traversable role)r   rS   FOCUS_TRAVERSABLEr   r:   rU   s      r   find_all_focus_traversablesz1AXUtilitiesCollection.find_all_focus_traversables  rW   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z:Returns all descendants of root with the font chooser role)r   rS   FONT_CHOOSERr   r:   rU   s      r   find_all_font_choosersz,AXUtilitiesCollection.find_all_font_choosers  rm   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z4Returns all descendants of root with the footer role)r   rS   FOOTERr   r:   rU   s      r   find_all_footersz&AXUtilitiesCollection.find_all_footers  r}   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z6Returns all descendants of root with the footnote role)r   rS   FOOTNOTEr   r:   rU   s      r   find_all_footnotesz(AXUtilitiesCollection.find_all_footnotes  ry   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z2Returns all descendants of root with the form role)r   rS   FORMr   r:   rU   s      r   find_all_formsz$AXUtilitiesCollection.find_all_forms  r   r   c                     t        j                         }|st        j                  | ||      S t        j
                  j                  g}t        j                  | |||      S )z>Returns all descendants of root with a form-field-related role)r	   get_form_field_rolesr   r:   r   r   r   rD   r)   r   r   r.   r"   s        r   find_all_form_fieldsz*AXUtilitiesCollection.find_all_form_fields  sU      446 (;;D%NN//++,$FFtUTZ\`aar   c                 f    t         j                  j                  g}t        j	                  | ||      S )z3Returns all descendants of root with the frame role)r   rS   FRAMEr   r:   rU   s      r   find_all_framesz%AXUtilitiesCollection.find_all_frames  r[   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z8Returns all descendants of root with the glass pane role)r   rS   
GLASS_PANEr   r:   rU   s      r   find_all_glass_panesz*AXUtilitiesCollection.find_all_glass_panes  r   r   c                 R   | g S dt        j                         d| d|g}t        j                  t        j                  |d       t
        j                  j                  g}dg}t        j                  ||      }t        j                  | |      }|t        j                  ||       |S )z.Returns all descendants of root that are gridsr   r    pred:Tzxml-roles:gridr.   r   )r%   r&   r   r   r   r   rS   TABLEr   r'   r(   r   r   )r)   r   r   r.   r   r+   gridss          r   find_all_gridsz$AXUtilitiesCollection.find_all_grids  s     <I*G,@,@,B4$0%**FD9!!"&'
--EjQ,,T48!225$?r   c                 J   | g S t         j                  | |      }|sg S dt        j                         d| d|g}t	        j
                  t        j                  |d       g }|D ]&  }|j                  t         j                  |             ( |t         j                  ||       |S )z3Returns all descendants of root that are grid cellsr   r    r)  T)
r   r-  r%   r&   r   r   r   extendfind_all_table_cellsr   )r)   r   r,  r   cellsgrids         r   find_all_grid_cellsz)AXUtilitiesCollection.find_all_grid_cells  s     <I%44T4@I*G,@,@,B4$0%**FD9 	KDLL.CCDIJ	K !225$?r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z6Returns all descendants of root with the grouping role)r   rS   GROUPINGr   r:   rU   s      r   find_all_groupingsz(AXUtilitiesCollection.find_all_groupings  ry   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z4Returns all descendants of root with the header role)r   rS   HEADERr   r:   rU   s      r   find_all_headersz&AXUtilitiesCollection.find_all_headers  r}   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )5Returns all descendants of root with the heading role)r   rS   HEADINGr   r:   rU   s      r   find_all_headingsz'AXUtilitiesCollection.find_all_headings  rf   r   c                 \   | g S dt        j                         d| d|d|g}t        j                  t        j                  |d       t
        j                  j                  g}d| g}t        j                  ||      }t        j                  | |      }|t        j                  ||      }|S )r;  r   r    zLevel:r)  Tzlevel:r*  )r%   r&   r   r   r   r   rS   r<  r   r'   r(   r   r   )r)   levelr   r   r.   r   r+   r   s           r   find_all_headings_at_levelz0AXUtilitiesCollection.find_all_headings_at_level  s     <I*G,@,@,B45'4A%**FD9##$ug&'
--EjQ..tT:+<<WdKGr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z<Returns all descendants of root with the html container role)r   rS   HTML_CONTAINERr   r:   rU   s      r   find_all_html_containersz.AXUtilitiesCollection.find_all_html_containers  r   r   c                     t         j                  j                  g}t         j                  j                  g}t
        j                  | |||      S )z>Returns all descendants of root that is a horizontal scrollbar)r   rS   
SCROLL_BARr   
HORIZONTALr   rD   r)   r   r.   r"   s       r   find_all_horizontal_scrollbarsz4AXUtilitiesCollection.find_all_horizontal_scrollbars  sA     &&'//,,-$FFtUTZ\`aar   c                     t         j                  j                  g}t         j                  j                  g}t
        j                  | |||      S )z>Returns all descendants of root that is a horizontal separator)r   rS   	SEPARATORr   rF  r   rD   rG  s       r   find_all_horizontal_separatorsz4AXUtilitiesCollection.find_all_horizontal_separators  sA     %%&//,,-$FFtUTZ\`aar   c                     t         j                  j                  g}t         j                  j                  g}t
        j                  | |||      S )z;Returns all descendants of root that is a horizontal slider)r   rS   SLIDERr   rF  r   rD   rG  s       r   find_all_horizontal_slidersz1AXUtilitiesCollection.find_all_horizontal_sliders'  sA     ""#//,,-$FFtUTZ\`aar   c                 f    t         j                  j                  g}t        j	                  | ||      S )z2Returns all descendants of root with the icon role)r   rS   ICONr   r:   rU   s      r   find_all_iconsz$AXUtilitiesCollection.find_all_icons/  r   r   c                     t         j                  j                  t         j                  j                  g}t        j                  | ||      S )z<Returns all descendants of root with the icon or canvas role)r   rS   rP  r{   r   r:   rU   s      r   find_all_icons_and_canvasesz1AXUtilitiesCollection.find_all_icons_and_canvases6  s5     %**"3"34$77eTJJr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z3Returns all descendants of root with the image role)r   rS   IMAGEr   r:   rU   s      r   find_all_imagesz%AXUtilitiesCollection.find_all_images=  r[   r   c                     t         j                  j                  t         j                  j                  g}t        j                  | ||      S )z=Returns all descendants of root with the image or canvas role)r   rS   rU  r{   r   r:   rU   s      r   find_all_images_and_canvasesz2AXUtilitiesCollection.find_all_images_and_canvasesD  s7     !!5::#4#45$77eTJJr   c                     t         j                  j                  t         j                  j                  g}t        j                  | ||      S )z@Returns all descendants of root with the image or image map role)r   rS   rU  	IMAGE_MAPr   r:   rU   s      r   find_all_images_and_image_mapsz4AXUtilitiesCollection.find_all_images_and_image_mapsK  s7     !!5::#7#78$77eTJJr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z7Returns all descendants of root with the image map role)r   rS   rZ  r   r:   rU   s      r   find_all_image_mapsz)AXUtilitiesCollection.find_all_image_mapsR  r_   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z6Returns all descendants of root with the info bar role)r   rS   INFO_BARr   r:   rU   s      r   find_all_info_barsz(AXUtilitiesCollection.find_all_info_barsY  ry   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )zAReturns all descendants of root with the input method window role)r   rS   INPUT_METHOD_WINDOWr   r:   rU   s      r   find_all_input_method_windowsz3AXUtilitiesCollection.find_all_input_method_windows`  +     //0$77eTJJr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z<Returns all descendants of root with the internal frame role)r   rS   INTERNAL_FRAMEr   r:   rU   s      r   find_all_internal_framesz.AXUtilitiesCollection.find_all_internal_framesg  r   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z3Returns all descendants of root with the label role)r   rS   LABELr   r:   rU   s      r   find_all_labelsz%AXUtilitiesCollection.find_all_labelsn  r[   r   c                     t         j                  j                  t         j                  j                  g}t        j                  | ||      S )z>Returns all descendants of root with the label or caption role)r   rS   ri  r   r   r:   rU   s      r   find_all_labels_and_captionsz2AXUtilitiesCollection.find_all_labels_and_captionsu  s7     !!5::#5#56$77eTJJr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z6Returns all descendants of root with the landmark role)r   rS   LANDMARKr   r:   rU   s      r   find_all_landmarksz(AXUtilitiesCollection.find_all_landmarks|  ry   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z:Returns all descendants of root with the layered pane role)r   rS   LAYERED_PANEr   r:   rU   s      r   find_all_layered_panesz,AXUtilitiesCollection.find_all_layered_panes  rm   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z7Returns all descendants of root with the level bar role)r   rS   	LEVEL_BARr   r:   rU   s      r   find_all_level_barsz)AXUtilitiesCollection.find_all_level_bars  r_   r   c                     t         j                  j                  g}|st        j	                  | ||      S t         j
                  j                  g}t        j                  | |||      S )z2Returns all descendants of root with the link role)r   rS   LINKr   r:   r   r   rD   r   s        r   find_all_linksz$AXUtilitiesCollection.find_all_links  sW     ! (;;D%NN//++,$FFtUTZ\`aar   c                 V   | g S dt        j                         d| d|g}t        j                  t        j                  |d       g }g d}|D ]  }|j                  d|z           t        j                  |      }t        j                  | |      }|t        j                  ||      }|S )z5Returns all descendants of root that are live regionsr   r    r)  T)offpolite	assertivezcontainer-live:)r   )r%   r&   r   r   r   r   r   r'   r(   r   r   )r)   r   r   r   levelsr?  r+   r   s           r   find_all_live_regionsz+AXUtilitiesCollection.find_all_live_regions  s     <I*G,@,@,B4$0%**FD9
/ 	9E/%78	9 --D..tT:+<<WdKGr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z2Returns all descendants of root with the list role)r   rS   LISTr   r:   rU   s      r   find_all_listsz$AXUtilitiesCollection.find_all_lists  r   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z6Returns all descendants of root with the list box role)r   rS   LIST_BOXr   r:   rU   s      r   find_all_list_boxesz)AXUtilitiesCollection.find_all_list_boxes  ry   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z7Returns all descendants of root with the list item role)r   rS   	LIST_ITEMr   r:   rU   s      r   find_all_list_itemsz)AXUtilitiesCollection.find_all_list_items  r_   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z1Returns all descendants of root with the log role)r   rS   LOGr   r:   rU   s      r   find_all_logsz#AXUtilitiesCollection.find_all_logs  s)      $77eTJJr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z2Returns all descendants of root with the mark role)r   rS   MARKr   r:   rU   s      r   find_all_marksz$AXUtilitiesCollection.find_all_marks  r   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z5Returns all descendants of root with the marquee role)r   rS   MARQUEEr   r:   rU   s      r   find_all_marqueesz'AXUtilitiesCollection.find_all_marquees  rf   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z2Returns all descendants of root with the math role)r   rS   MATHr   r:   rU   s      r   find_all_mathsz$AXUtilitiesCollection.find_all_maths  r   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z;Returns all descendants of root with the math fraction role)r   rS   MATH_FRACTIONr   r:   rU   s      r   find_all_math_fractionsz-AXUtilitiesCollection.find_all_math_fractions  r   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z7Returns all descendants of root with the math root role)r   rS   	MATH_ROOTr   r:   rU   s      r   find_all_math_rootsz)AXUtilitiesCollection.find_all_math_roots  r_   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z2Returns all descendants of root with the menu role)r   rS   MENUr   r:   rU   s      r   find_all_menusz$AXUtilitiesCollection.find_all_menus  r   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z5Returns all descendants of root with the menubar role)r   rS   MENU_BARr   r:   rU   s      r   find_all_menu_barsz(AXUtilitiesCollection.find_all_menu_bars  ry   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z7Returns all descendants of root with the menu item role)r   rS   	MENU_ITEMr   r:   rU   s      r   find_all_menu_itemsz)AXUtilitiesCollection.find_all_menu_items   r_   r   c                 X    t        j                         }t        j                  | ||      S )z;Returns all descendants of root that has any menu item role)r	   get_menu_item_rolesr   r:   rU   s      r   find_all_menu_items_of_any_kindz5AXUtilitiesCollection.find_all_menu_items_of_any_kind  s'      335$77eTJJr   c                 X    t        j                         }t        j                  | ||      S )z>Returns all descendants of root that has any menu-related role)r	   get_menu_related_rolesr   r:   rU   s      r   find_all_menu_related_objectsz3AXUtilitiesCollection.find_all_menu_related_objects  '      668$77eTJJr   c                     t        j                  d      }t        j                  j                  g}t
        j                  | |||      S )zMReturns all descendants of root with the alert or dialog role and modal stateT)r	   r   r   r   MODALr   rD   rG  s       r   find_all_modal_dialogsz,AXUtilitiesCollection.find_all_modal_dialogs  s?      006//''($FFtUTZ\`aar   c                     t         j                  j                  g}t         j                  j                  g}t
        j                  | |||      S zGReturns all descendants of root with the entry role and multiline state)r   rS   r   r   
MULTI_LINEr   rD   rG  s       r   find_all_multi_line_entriesz1AXUtilitiesCollection.find_all_multi_line_entries  sA     !!"//,,-$FFtUTZ\`aar   c                 f    t         j                  j                  g}t        j	                  | ||      S )z:Returns all descendants of root with the notification role)r   rS   NOTIFICATIONr   r:   rU   s      r   find_all_notificationsz,AXUtilitiesCollection.find_all_notifications%  rm   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z9Returns all descendants of root with the option pane role)r   rS   OPTION_PANEr   r:   rU   s      r   find_all_option_panesz+AXUtilitiesCollection.find_all_option_panes,  rq   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z2Returns all descendants of root with the page role)r   rS   PAGEr   r:   rU   s      r   find_all_pagesz$AXUtilitiesCollection.find_all_pages3  r   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z6Returns all descendants of root with the page tab role)r   rS   PAGE_TABr   r:   rU   s      r   find_all_page_tabsz(AXUtilitiesCollection.find_all_page_tabs:  ry   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z;Returns all descendants of root with the page tab list role)r   rS   PAGE_TAB_LISTr   r:   rU   s      r   find_all_page_tab_listsz-AXUtilitiesCollection.find_all_page_tab_listsA  r   r   c                     t         j                  j                  t         j                  j                  g}t        j                  | ||      S )zGReturns all descendants of root with the page tab or page tab list role)r   rS   r  r  r   r:   rU   s      r   &find_all_page_tab_list_related_objectsz<AXUtilitiesCollection.find_all_page_tab_list_related_objectsH  s7     ))5::+>+>?$77eTJJr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z3Returns all descendants of root with the panel role)r   rS   PANELr   r:   rU   s      r   find_all_panelsz%AXUtilitiesCollection.find_all_panelsO  r[   r   c                     t         j                  j                  g}|r)|j                  t         j                  j                         t
        j                  | ||      S )z7Returns all descendants of root with the paragraph role)r   rS   	PARAGRAPHr   r<  r   r:   )r)   treat_headings_as_paragraphsr   r.   s       r   find_all_paragraphsz)AXUtilitiesCollection.find_all_paragraphsV  sD     %%&'LL++,$77eTJJr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z;Returns all descendants of root with the password text role)r   rS   PASSWORD_TEXTr   r:   rU   s      r   find_all_password_textsz-AXUtilitiesCollection.find_all_password_texts_  r   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z8Returns all descendants of root with the popup menu role)r   rS   
POPUP_MENUr   r:   rU   s      r   find_all_popup_menusz*AXUtilitiesCollection.find_all_popup_menusf  r   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z:Returns all descendants of root with the progress bar role)r   rS   PROGRESS_BARr   r:   rU   s      r   find_all_progress_barsz,AXUtilitiesCollection.find_all_progress_barsm  rm   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z9Returns all descendants of root with the push button role)r   rS   rs   r   r:   rU   s      r   find_all_push_buttonsz+AXUtilitiesCollection.find_all_push_buttonst  rq   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z>Returns all descendants of root with the push button menu role)r   rS   PUSH_BUTTON_MENUr   r:   rU   s      r   find_all_push_button_menusz0AXUtilitiesCollection.find_all_push_button_menus{  r   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z:Returns all descendants of root with the radio button role)r   rS   RADIO_BUTTONr   r:   rU   s      r   find_all_radio_buttonsz,AXUtilitiesCollection.find_all_radio_buttons  rm   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z=Returns all descendants of root with the radio menu item role)r   rS   RADIO_MENU_ITEMr   r:   rU   s      r   find_all_radio_menu_itemsz/AXUtilitiesCollection.find_all_radio_menu_items  r   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z4Returns all descendants of root with the rating role)r   rS   RATINGr   r:   rU   s      r   find_all_ratingsz&AXUtilitiesCollection.find_all_ratings  r}   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z7Returns all descendants of root with the root pane role)r   rS   	ROOT_PANEr   r:   rU   s      r   find_all_root_panesz)AXUtilitiesCollection.find_all_root_panes  r_   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z8Returns all descendants of root with the row header role)r   rS   
ROW_HEADERr   r:   rU   s      r   find_all_row_headersz*AXUtilitiesCollection.find_all_row_headers  r   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z3Returns all descendants of root with the ruler role)r   rS   RULERr   r:   rU   s      r   find_all_rulersz%AXUtilitiesCollection.find_all_rulers  r[   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z7Returns all descendants of root with the scrollbar role)r   rS   rE  r   r:   rU   s      r   find_all_scroll_barsz*AXUtilitiesCollection.find_all_scroll_bars  r   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z9Returns all descendants of root with the scroll pane role)r   rS   SCROLL_PANEr   r:   rU   s      r   find_all_scroll_panesz+AXUtilitiesCollection.find_all_scroll_panes  rq   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z5Returns all descendants of root with the section role)r   rS   SECTIONr   r:   rU   s      r   find_all_sectionsz'AXUtilitiesCollection.find_all_sections  rf   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z4Returns all descendants of root which are selectable)r   r   
SELECTABLEr   rL   r  s      r   find_all_selectable_objectsz1AXUtilitiesCollection.find_all_selectable_objects  s+     //,,-$99$MMr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z2Returns all descendants of root which are selected)r   r   SELECTEDr   rL   r  s      r   find_all_selected_objectsz/AXUtilitiesCollection.find_all_selected_objects  s+     //**+$99$MMr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z7Returns all descendants of root with the separator role)r   rS   rJ  r   r:   rU   s      r   find_all_separatorsz)AXUtilitiesCollection.find_all_separators  r_   r   c                 X    t        j                         }t        j                  | ||      S )z9Returns all descendants of root with a set container role)r	   get_set_container_rolesr   r:   rU   s      r   find_all_set_containersz-AXUtilitiesCollection.find_all_set_containers  s'      779$77eTJJr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z1Returns all descendants of root which are showing)r   r   SHOWINGr   rL   r  s      r   find_all_showing_objectsz.AXUtilitiesCollection.find_all_showing_objects  r  r   c                     t         j                  j                  t         j                  j                  g}t        j                  | ||      S )z=Returns all descendants of root which are showing and visible)r   r   r  VISIBLEr   rL   r  s      r   $find_all_showing_and_visible_objectsz:AXUtilitiesCollection.find_all_showing_and_visible_objects  s7     //))5??+B+BC$99$MMr   c                     t         j                  j                  t         j                  j                  g}t        j                  | ||      S )z<Returns all descendants of root which are showing or visible)r   r   r  r   r   rO   r  s      r   #find_all_showing_or_visible_objectsz9AXUtilitiesCollection.find_all_showing_or_visible_objects  s7     //))5??+B+BC$<<T64PPr   c                     t         j                  j                  g}t         j                  j                  g}t
        j                  | |||      S r  )r   rS   r   r   SINGLE_LINEr   rD   rG  s       r   find_all_single_line_entriesz2AXUtilitiesCollection.find_all_single_line_entries  sA     !!"//--.$FFtUTZ\`aar   c                 f    t         j                  j                  g}t        j	                  | ||      S )z4Returns all descendants of root with the slider role)r   rS   rM  r   r:   rU   s      r   find_all_slidersz&AXUtilitiesCollection.find_all_sliders  r}   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z9Returns all descendants of root with the spin button role)r   rS   SPIN_BUTTONr   r:   rU   s      r   find_all_spin_buttonsz+AXUtilitiesCollection.find_all_spin_buttons  rq   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z8Returns all descendants of root with the split pane role)r   rS   
SPLIT_PANEr   r:   rU   s      r   find_all_split_panesz*AXUtilitiesCollection.find_all_split_panes  r   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z4Returns all descendants of root with the static role)r   rS   STATICr   r:   rU   s      r   find_all_staticsz&AXUtilitiesCollection.find_all_statics  r}   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z7Returns all descendants of root with the statusbar role)r   rS   
STATUS_BARr   r:   rU   s      r   find_all_status_barsz*AXUtilitiesCollection.find_all_status_bars  r   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z7Returns all descendants of root with the subscript role)r   rS   	SUBSCRIPTr   r:   rU   s      r   find_all_subscriptsz)AXUtilitiesCollection.find_all_subscripts  r_   r   c                     t         j                  j                  t         j                  j                  g}t        j                  | ||      S )zFReturns all descendants of root with the subscript or superscript role)r   rS   r  SUPERSCRIPTr   r:   rU   s      r   $find_all_subscripts_and_superscriptsz:AXUtilitiesCollection.find_all_subscripts_and_superscripts$  s7     %%uzz'='=>$77eTJJr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z8Returns all descendants of root with the suggestion role)r   rS   
SUGGESTIONr   r:   rU   s      r   find_all_suggestionsz*AXUtilitiesCollection.find_all_suggestions+  r   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z9Returns all descendants of root with the superscript role)r   rS   r  r   r:   rU   s      r   find_all_superscriptsz+AXUtilitiesCollection.find_all_superscripts2  rq   r   c                 6    dg}t         j                  | ||      S )zBReturns all descendants of root which support the action interfacer   r   r5   r)   r   r3   s      r   find_all_supports_actionz.AXUtilitiesCollection.find_all_supports_action9  s!     Z
$==dJPTUUr   c                 6    dg}t         j                  | ||      S )zDReturns all descendants of root which support the document interfaceDocumentr!  r"  s      r   find_all_supports_documentz0AXUtilitiesCollection.find_all_supports_document@  s!     !\
$==dJPTUUr   c                 6    dg}t         j                  | ||      S )zIReturns all descendants of root which support the editable text interfaceEditableTextr!  r"  s      r   find_all_supports_editable_textz5AXUtilitiesCollection.find_all_supports_editable_textG  s"     %%
$==dJPTUUr   c                 6    dg}t         j                  | ||      S )zEReturns all descendants of root which support the hypertext interface	Hypertextr!  r"  s      r   find_all_supports_hypertextz1AXUtilitiesCollection.find_all_supports_hypertextN  !     "]
$==dJPTUUr   c                 6    dg}t         j                  | ||      S )zEReturns all descendants of root which support the hyperlink interface	Hyperlinkr!  r"  s      r   find_all_supports_hyperlinkz1AXUtilitiesCollection.find_all_supports_hyperlinkU  r-  r   c                 6    dg}t         j                  | ||      S )zEReturns all descendants of root which support the selection interface	Selectionr!  r"  s      r   find_all_supports_selectionz1AXUtilitiesCollection.find_all_supports_selection\  r-  r   c                 6    dg}t         j                  | ||      S )zAReturns all descendants of root which support the table interfaceTabler!  r"  s      r   find_all_supports_tablez-AXUtilitiesCollection.find_all_supports_tablec  !     Y
$==dJPTUUr   c                 6    dg}t         j                  | ||      S )zFReturns all descendants of root which support the table cell interface	TableCellr!  r"  s      r   find_all_supports_table_cellz2AXUtilitiesCollection.find_all_supports_table_cellj  r-  r   c                 6    dg}t         j                  | ||      S )z@Returns all descendants of root which support the text interfaceTextr!  r"  s      r   find_all_supports_textz,AXUtilitiesCollection.find_all_supports_textq  s!     X
$==dJPTUUr   c                 6    dg}t         j                  | ||      S )zAReturns all descendants of root which support the value interfaceValuer!  r"  s      r   find_all_supports_valuez-AXUtilitiesCollection.find_all_supports_valuex  r7  r   c                    | g S dt        j                         d| d|g}t        j                  t        j                  |d       t
        j                  j                  g}dg}t
        j                  j                  }t        j                  |||      }t        j                  | |      }|t        j                  ||       |S )z3Returns all descendants of root with the table roler   r    r)  Tzlayout-guess:true)r.   r   r   )r%   r&   r   r   r   r   rS   r+  r7   r<   r   r'   r(   r   r   )r)   r   r   r.   r   r   r+   tabless           r   find_all_tablesz%AXUtilitiesCollection.find_all_tables  s     <I*G,@,@,BGTSZ\`a%**FD9!!")*
$88==--!!57
 --dD9!2264@r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z8Returns all descendants of root with the table cell role)r   rS   
TABLE_CELLr   r:   rU   s      r   r0  z*AXUtilitiesCollection.find_all_table_cells  r   r   c                 X    t        j                         }t        j                  | ||      S )zLReturns all descendants of root with the table cell or a header-related role)r	   get_table_cell_rolesr   r:   rU   s      r    find_all_table_cells_and_headersz6AXUtilitiesCollection.find_all_table_cells_and_headers  s'      446$77eTJJr   c                 f    t         j                  j                  g}t        j	                  | ||      S )zAReturns all descendants of root with the table column header role)r   rS   TABLE_COLUMN_HEADERr   r:   rU   s      r   find_all_table_column_headersz3AXUtilitiesCollection.find_all_table_column_headers  rd  r   c                 X    t        j                         }t        j                  | ||      S )zDReturns all descendants of root that has a table header related role)r	   get_table_header_rolesr   r:   rU   s      r   find_all_table_headersz,AXUtilitiesCollection.find_all_table_headers  r  r   c                 Z    t        j                  |      }t        j                  | ||      S )z=Returns all descendants of root that has a table related role)r	   get_table_related_rolesr   r:   )r)   r   include_captionr.   s       r   find_all_table_related_objectsz4AXUtilitiesCollection.find_all_table_related_objects  s)      77H$77eTJJr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z7Returns all descendants of root with the table row role)r   rS   	TABLE_ROWr   r:   rU   s      r   find_all_table_rowsz)AXUtilitiesCollection.find_all_table_rows  r_   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z>Returns all descendants of root with the table row header role)r   rS   TABLE_ROW_HEADERr   r:   rU   s      r   find_all_table_row_headersz0AXUtilitiesCollection.find_all_table_row_headers  r   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z?Returns all descendants of root with the tearoff menu item role)r   rS   TEAROFF_MENU_ITEMr   r:   rU   s      r   find_all_tearoff_menu_itemsz1AXUtilitiesCollection.find_all_tearoff_menu_items  rW   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z6Returns all descendants of root with the terminal role)r   rS   TERMINALr   r:   rU   s      r   find_all_terminalsz(AXUtilitiesCollection.find_all_terminals  ry   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z2Returns all descendants of root with the text role)r   rS   TEXTr   r:   rU   s      r   find_all_textsz$AXUtilitiesCollection.find_all_texts  r   r   c                     t         j                  j                  t         j                  j                  t         j                  j                  g}t
        j                  | ||      S )zOReturns all descendants of root that has any role associated with textual input)r   rS   r   r  r
  r   r:   rU   s      r   find_all_text_inputsz*AXUtilitiesCollection.find_all_text_inputs  sC     !!5::#;#;UZZ=S=ST$77eTJJr   c                 f    t         j                  j                  g}t        j	                  | ||      S )z3Returns all descendants of root with the timer role)r   rS   TIMERr   r:   rU   s      r   find_all_timersz%AXUtilitiesCollection.find_all_timers  r[   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z6Returns all descendants of root with the titlebar role)r   rS   	TITLE_BARr   r:   rU   s      r   find_all_title_barsz)AXUtilitiesCollection.find_all_title_bars  r_   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z;Returns all descendants of root with the toggle button role)r   rS   rt   r   r:   rU   s      r   find_all_toggle_buttonsz-AXUtilitiesCollection.find_all_toggle_buttons  r   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z5Returns all descendants of root with the toolbar role)r   rS   TOOL_BARr   r:   rU   s      r   find_all_tool_barsz(AXUtilitiesCollection.find_all_tool_bars  ry   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z5Returns all descendants of root with the tooltip role)r   rS   TOOL_TIPr   r:   rU   s      r   find_all_tool_tipsz(AXUtilitiesCollection.find_all_tool_tips   ry   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z2Returns all descendants of root with the tree role)r   rS   TREEr   r:   rU   s      r   find_all_treesz$AXUtilitiesCollection.find_all_trees  r   r   c                     t         j                  j                  t         j                  j                  g}t        j                  | ||      S )z@Returns all descendants of root with the tree or tree table role)r   rS   rs  
TREE_TABLEr   r:   rU   s      r   find_all_trees_and_tree_tablesz4AXUtilitiesCollection.find_all_trees_and_tree_tables  s5     %**"7"78$77eTJJr   c                 X    t        j                         }t        j                  | ||      S )z<Returns all descendants of root that has a tree related role)r	   get_tree_related_rolesr   r:   rU   s      r   find_all_tree_related_objectsz3AXUtilitiesCollection.find_all_tree_related_objects  r  r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z7Returns all descendants of root with the tree item role)r   rS   	TREE_ITEMr   r:   rU   s      r   find_all_tree_itemsz)AXUtilitiesCollection.find_all_tree_items  r_   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z8Returns all descendants of root with the tree table role)r   rS   rv  r   r:   rU   s      r   find_all_tree_tablesz*AXUtilitiesCollection.find_all_tree_tables#  r   r   c                    fd}t         j                  j                  t         j                  j                  g}|st        j                  | ||      }|S t         j                  j                  g}t        j                  | |||      }|S )zLReturns all the descendants of root that have a label role, but no relationsc                 F    t        j                  |       ry |       S y)NFT)r   get_relations)r   r   s    r   _predz>AXUtilitiesCollection.find_all_unrelated_labels.<locals>._pred.  s'    %%c*Cy r   )	r   rS   ri  r  r   r:   r   r  rD   )r)   must_be_showingr   r  r.   r   r"   s     `    r   find_all_unrelated_labelsz/AXUtilitiesCollection.find_all_unrelated_labels*  sz    	 !!5::#4#45+>>tUERG 	 oo--.F+MMeVU,G r   c                     t         j                  j                  g}t         j                  j                  g}t
        j                  | |||      }|r#t        t        t        j                  |            }|S )zPReturns all descendants of root with the link role and without the visited state)r   rS   rw  r   VISITEDr   rI   r   r   r
   is_focusable)r)   r   r   r.   r"   r   s         r   find_all_unvisited_linksz.AXUtilitiesCollection.find_all_unvisited_links?  s^     !//))*&HHuV\^bc&!1!>!>GHFr   c                     t         j                  j                  g}t         j                  j                  g}t
        j                  | |||      S )z<Returns all descendants of root that is a vertical scrollbar)r   rS   rE  r   VERTICALr   rD   rG  s       r   find_all_vertical_scrollbarsz2AXUtilitiesCollection.find_all_vertical_scrollbarsJ  sA     &&'//**+$FFtUTZ\`aar   c                     t         j                  j                  g}t         j                  j                  g}t
        j                  | |||      S )z<Returns all descendants of root that is a vertical separator)r   rS   rJ  r   r  r   rD   rG  s       r   find_all_vertical_separatorsz2AXUtilitiesCollection.find_all_vertical_separatorsR  sA     %%&//**+$FFtUTZ\`aar   c                     t         j                  j                  g}t         j                  j                  g}t
        j                  | |||      S )z9Returns all descendants of root that is a vertical slider)r   rS   rM  r   r  r   rD   rG  s       r   find_all_vertical_slidersz/AXUtilitiesCollection.find_all_vertical_slidersZ  sA     ""#//**+$FFtUTZ\`aar   c                 f    t         j                  j                  g}t        j	                  | ||      S )z1Returns all descendants of root which are visible)r   r   r   r   rL   r  s      r   find_all_visible_objectsz.AXUtilitiesCollection.find_all_visible_objectsb  r  r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z3Returns all descendants of root with the video role)r   rS   VIDEOr   r:   rU   s      r   find_all_videosz%AXUtilitiesCollection.find_all_videosi  r[   r   c                 f    t         j                  j                  g}t        j	                  | ||      S )z6Returns all descendants of root with the viewport role)r   rS   VIEWPORTr   r:   rU   s      r   find_all_viewportsz(AXUtilitiesCollection.find_all_viewportsp  ry   r   c                     t         j                  j                  g}t         j                  j                  g}|r)|j                  t         j                  j                         t        j                  | |||      S )zQReturns all descendants of root with the link role and focused and visited states)	r   rS   rw  r   r  r   r   r   rD   r   s        r   find_all_visited_linksz,AXUtilitiesCollection.find_all_visited_linksw  sX     !//))*MM%//334$FFtUTZ\`aar   c                     t         j                  j                  g}t         j                  j                  g}t        j                  ||      }t        j                  | |      S )z&Returns the default button inside rootr.   r"   )r   rS   rs   r   
IS_DEFAULTr   r'   get_first_matchr)   r.   r"   r+   s       r   find_default_buttonz)AXUtilitiesCollection.find_default_button  sM     ''(//,,---E&I++D$77r   c                     t         j                  j                  g}t        j                  |      }t        j
                  | |      S )z&Returns the focused object inside rootr"   )r   r   r  r   r'   r  r)   r"   r+   s      r   find_focused_objectz)AXUtilitiesCollection.find_focused_object  s9     //))*--V<++D$77r   c                     t         j                  j                  g}t         j                  j                  t         j                  j
                  g}t        j                  ||      }t        j                  | |      S )z"Returns the status bar inside rootr  )	r   rS   r  r   r  r   r   r'   r  r  s       r   find_status_barz%AXUtilitiesCollection.find_status_bar  sY     &&'//))5??+B+BC--E&I++D$77r   c                 >   t         j                  j                  t         j                  j                  g}t         j                  j
                  t         j                  j                  g}t        j                  ||      }t        t        j                  | |            S )zJReturns True if there's a showing, visible combobox or listbox inside rootr  )r   rS   r   r  r   r  r   r   r'   boolr  r  s       r   has_combo_box_or_list_boxz/AXUtilitiesCollection.has_combo_box_or_list_box  sj     %%uzz':':;//))5??+B+BC--E&IL00t<==r   c                    t         j                  j                  t         j                  j                  t         j                  j                  g}t        j                  |      }t        t        j                  | |            S )zGReturns True if there's a showing, visible, editable object inside rootr  )	r   r   r  r   r   r   r'   r  r  r  s      r   has_editable_objectz)AXUtilitiesCollection.has_editable_object  sV     //))5??+B+BEOOD\D\]--V<L00t<==r   c                    t         j                  j                  g}t         j                  j                  t         j                  j
                  g}t        j                  ||      }t        t        j                  | |            S )zBReturns True if there's a showing, visible scroll pane inside rootr  )
r   rS   r  r   r  r   r   r'   r  r  r  s       r   has_scroll_panez%AXUtilitiesCollection.has_scroll_pane  s^     ''(//))5??+B+BC--E&IL00t<==r   c                    t         j                  j                  g}t         j                  j                  t         j                  j
                  g}t        j                  ||      }t        t        j                  | |            S )zAReturns True if there's a showing, visible split pane inside rootr  )
r   rS   r  r   r  r   r   r'   r  r  r  s       r   has_split_panez$AXUtilitiesCollection.has_split_pane  s^     &&'//))5??+B+BC--E&IL00t<==r   c                 >   t         j                  j                  t         j                  j                  g}t         j                  j
                  t         j                  j                  g}t        j                  ||      }t        t        j                  | |            S )zIReturns True if there's a showing, visible tree or tree table inside rootr  )r   rS   rs  rv  r   r  r   r   r'   r  r  r  s       r   has_tree_or_tree_tablez,AXUtilitiesCollection.has_tree_or_tree_table  sh     %**"7"78//))5??+B+BC--E&IL00t<==r   )N)TN)FN)NF)__name__
__module____qualname____doc__staticmethodr   r,   r1   r5   r:   r=   rD   rG   rI   rL   rO   rQ   rV   rZ   r^   rb   re   ri   rl   rp   ru   rx   r|   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r
  r  r  r  r  r  r  r!  r$  r'  r-  r3  r6  r9  r=  r@  rC  rH  rK  rN  rQ  rS  rV  rX  r[  r]  r`  rc  rg  rj  rl  ro  rr  ru  rx  r~  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r#  r&  r)  r,  r0  r3  r6  r:  r=  r@  rC  r0  rH  rK  rN  rR  rU  rX  r[  r^  ra  rc  rf  ri  rk  rn  rq  rt  rw  rz  r}  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r   r   r   r   3   s   I         $ B B C C  (  (  ( C C C C D D K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K % %N K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K N N K K K K K K K K K K K K N N ! !F N N K K K K K K K K K K b b K K K K  &  . K K K K K K  $ K K b b b b b b K K K K K K K K K K K K K K K K K K K K K K K K K K K K b b  , K K K K K K K K K K K K K K K K K K K K K K K K K K K K b b b b K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K N N N N K K K K N N N N Q Q b b K K K K K K K K K K K K K K K K K K V V V V V V V V V V V V V V V V V V V V  . K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K  (   b b b b b b N N K K K K b b 8 8 8 8 8 8 > > > > > > > > > >r   r   )r  __id____version____date____copyright____license__r%   r   girequire_versiongi.repositoryr    r   ax_collectionr   	ax_objectr   ax_utilities_roler	   ax_utilities_stater
   r   r  r   r   <module>r     s^   * 1   	   7E "   '  . 0R> R>r   