
    g
f+                         d Z dZdZdZdZdZddlZ ej                  dd	       dd
lm	Z	 ddl
mZ ddlmZ  G d d      Zy)a  
Utilities for obtaining state-related information.
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)AXObjectc                      e Zd ZdZed        Zed        Zed        Zed        Zed        Z	ed        Z
ed        Zed	        Zed
        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Z ed        Z!ed        Z"ed         Z#ed!        Z$ed"        Z%ed#        Z&ed$        Z'ed%        Z(ed&        Z)ed'        Z*ed(        Z+ed)        Z,ed*        Z-ed+        Z.ed,        Z/ed-        Z0ed.        Z1y/)0AXUtilitiesStatez2Utilities for obtaining state-related information.c                 H    t        j                  |       j                         S )z*Returns true if obj has an empty state set)r   get_state_setis_emptyobjs    9/usr/lib/python3/dist-packages/orca/ax_utilities_state.pyhas_no_statezAXUtilitiesState.has_no_state0   s     %%c*3355    c                 ^    t        j                  | t        j                  j                        S )z+Returns true if obj has the has-popup state)r   	has_stater   	StateType	HAS_POPUPr   s    r   	has_popupzAXUtilitiesState.has_popup6   !     !!#u'@'@AAr   c                 ^    t        j                  | t        j                  j                        S )z-Returns true if obj has the has-tooltip state)r   r   r   r   HAS_TOOLTIPr   s    r   has_tooltipzAXUtilitiesState.has_tooltip<   !     !!#u'B'BCCr   c                 ^    t        j                  | t        j                  j                        S )z(Returns true if obj has the active state)r   r   r   r   ACTIVEr   s    r   	is_activezAXUtilitiesState.is_activeB   !     !!#u'='=>>r   c                 ^    t        j                  | t        j                  j                        S )z*Returns true if obj has the animated state)r   r   r   r   ANIMATEDr   s    r   is_animatedzAXUtilitiesState.is_animatedH   !     !!#u'?'?@@r   c                 ^    t        j                  | t        j                  j                        S )z'Returns true if obj has the armed state)r   r   r   r   ARMEDr   s    r   is_armedzAXUtilitiesState.is_armedN   !     !!#u'<'<==r   c                 ^    t        j                  | t        j                  j                        S )z&Returns true if obj has the busy state)r   r   r   r   BUSYr   s    r   is_busyzAXUtilitiesState.is_busyT   s!     !!#u';';<<r   c                    t        j                  | t        j                  j                        ryt        j                  | t        j                  j
                        r+d| dg}t        j                  t        j                  |d       yy)z+Returns true if obj has the checkable stateTAXUtilitiesState:$is checked but lacks state checkableF)	r   r   r   r   	CHECKABLECHECKEDr   printTokens
LEVEL_INFOr   tokenss     r   is_checkablezAXUtilitiesState.is_checkableZ   f     c5??#<#<=c5??#:#:;)30VWFe..=r   c                    t        j                  | t        j                  j                        syt        j                  | t        j                  j
                        s*d| dg}t        j                  t        j                  |d       y)z)Returns true if obj has the checked stateFr,   r-   T)	r   r   r   r   r/   r.   r   r0   r1   r2   s     r   
is_checkedzAXUtilitiesState.is_checkedh   c     !!#u'>'>?!!#u'@'@A)30VWFe..=r   c                 ^    t        j                  | t        j                  j                        S )z+Returns true if obj has the collapsed state)r   r   r   r   	COLLAPSEDr   s    r   is_collapsedzAXUtilitiesState.is_collapsedu   r   r   c                 ^    t        j                  | t        j                  j                        S )z,Returns true if obj has the is-default state)r   r   r   r   
IS_DEFAULTr   s    r   
is_defaultzAXUtilitiesState.is_default{   !     !!#u'A'ABBr   c                 ^    t        j                  | t        j                  j                        S )z)Returns true if obj has the defunct state)r   r   r   r   DEFUNCTr   s    r   
is_defunctzAXUtilitiesState.is_defunct   !     !!#u'>'>??r   c                 ^    t        j                  | t        j                  j                        S )z*Returns true if obj has the editable state)r   r   r   r   EDITABLEr   s    r   is_editablezAXUtilitiesState.is_editable   r#   r   c                 ^    t        j                  | t        j                  j                        S )z)Returns true if obj has the enabled state)r   r   r   r   ENABLEDr   s    r   
is_enabledzAXUtilitiesState.is_enabled   rC   r   c                    t        j                  | t        j                  j                        ryt        j                  | t        j                  j
                        r+d| dg}t        j                  t        j                  |d       yy)z,Returns true if obj has the expandable stateTr,   &is expanded but lacks state expandableF)	r   r   r   r   
EXPANDABLEEXPANDEDr   r0   r1   r2   s     r   is_expandablezAXUtilitiesState.is_expandable   sf     c5??#=#=>c5??#;#;<)30XYFe..=r   c                    t        j                  | t        j                  j                        syt        j                  | t        j                  j
                        s*d| dg}t        j                  t        j                  |d       y)z*Returns true if obj has the expanded stateFr,   rK   T)	r   r   r   r   rM   rL   r   r0   r1   r2   s     r   is_expandedzAXUtilitiesState.is_expanded   sc     !!#u'?'?@!!#u'A'AB)30XYFe..=r   c                    t        j                  | t        j                  j                        ryt        j                  | t        j                  j
                        r+d| dg}t        j                  t        j                  |d       yy)z+Returns true if obj has the focusable stateTr,   $is focused but lacks state focusableF)	r   r   r   r   	FOCUSABLEFOCUSEDr   r0   r1   r2   s     r   is_focusablezAXUtilitiesState.is_focusable   r5   r   c                    t        j                  | t        j                  j                        syt        j                  | t        j                  j
                        s*d| dg}t        j                  t        j                  |d       y)z)Returns true if obj has the focused stateFr,   rR   T)	r   r   r   r   rT   rS   r   r0   r1   r2   s     r   
is_focusedzAXUtilitiesState.is_focused   r8   r   c                 ^    t        j                  | t        j                  j                        S )z,Returns true if obj has the horizontal state)r   r   r   r   
HORIZONTALr   s    r   is_horizontalzAXUtilitiesState.is_horizontal   r?   r   c                 ^    t        j                  | t        j                  j                        S )z+Returns true if obj has the iconified state)r   r   r   r   	ICONIFIEDr   s    r   is_iconifiedzAXUtilitiesState.is_iconified   r   r   c                 ^    t        j                  | t        j                  j                        S )z/Returns true if obj has the indeterminate state)r   r   r   r   INDETERMINATEr   s    r   is_indeterminatez!AXUtilitiesState.is_indeterminate   !     !!#u'D'DEEr   c                 ^    t        j                  | t        j                  j                        S )z/Returns true if obj has the invalid_state state)r   r   r   r   INVALIDr   s    r   is_invalid_statez!AXUtilitiesState.is_invalid_state   rC   r   c                 ^    t        j                  | t        j                  j                        S )z/Returns true if obj has the invalid_entry state)r   r   r   r   INVALID_ENTRYr   s    r   is_invalid_entryz!AXUtilitiesState.is_invalid_entry   ra   r   c                 ^    t        j                  | t        j                  j                        S )z'Returns true if obj has the modal state)r   r   r   r   MODALr   s    r   is_modalzAXUtilitiesState.is_modal   r'   r   c                 ^    t        j                  | t        j                  j                        S )z,Returns true if obj has the multi_line state)r   r   r   r   
MULTI_LINEr   s    r   is_multi_linezAXUtilitiesState.is_multi_line   r?   r   c                 ^    t        j                  | t        j                  j                        S )z1Returns true if obj has the multiselectable state)r   r   r   r   MULTISELECTABLEr   s    r   is_multiselectablez#AXUtilitiesState.is_multiselectable   !     !!#u'F'FGGr   c                 ^    t        j                  | t        j                  j                        S )z(Returns true if obj has the opaque state)r   r   r   r   OPAQUEr   s    r   	is_opaquezAXUtilitiesState.is_opaque   r   r   c                 ^    t        j                  | t        j                  j                        S )z)Returns true if obj has the pressed state)r   r   r   r   PRESSEDr   s    r   
is_pressedzAXUtilitiesState.is_pressed   rC   r   c                 ^    t        j                  | t        j                  j                        S )z+Returns true if obj has the read-only state)r   r   r   r   	READ_ONLYr   s    r   is_read_onlyzAXUtilitiesState.is_read_only  r   r   c                 ^    t        j                  | t        j                  j                        S )z*Returns true if obj has the required state)r   r   r   r   REQUIREDr   s    r   is_requiredzAXUtilitiesState.is_required  r#   r   c                 ^    t        j                  | t        j                  j                        S )z+Returns true if obj has the resizable state)r   r   r   r   	RESIZABLEr   s    r   is_resizablezAXUtilitiesState.is_resizable  r   r   c                 ^    t        j                  | t        j                  j                        S )z,Returns true if obj has the selectable state)r   r   r   r   
SELECTABLEr   s    r   is_selectablezAXUtilitiesState.is_selectable  r?   r   c                 ^    t        j                  | t        j                  j                        S )z1Returns true if obj has the selectable-text state)r   r   r   r   SELECTABLE_TEXTr   s    r   is_selectable_textz#AXUtilitiesState.is_selectable_text  rq   r   c                 ^    t        j                  | t        j                  j                        S )z*Returns true if obj has the selected state)r   r   r   r   SELECTEDr   s    r   is_selectedzAXUtilitiesState.is_selected#  r#   r   c                 ^    t        j                  | t        j                  j                        S )z+Returns true if obj has the sensitive state)r   r   r   r   	SENSITIVEr   s    r   is_sensitivezAXUtilitiesState.is_sensitive)  r   r   c                 ^    t        j                  | t        j                  j                        S )z)Returns true if obj has the showing state)r   r   r   r   SHOWINGr   s    r   
is_showingzAXUtilitiesState.is_showing/  rC   r   c                 ^    t        j                  | t        j                  j                        S )z-Returns true if obj has the single-line state)r   r   r   r   SINGLE_LINEr   s    r   is_single_linezAXUtilitiesState.is_single_line5  r   r   c                 ^    t        j                  | t        j                  j                        S )z'Returns true if obj has the stale state)r   r   r   r   STALEr   s    r   is_stalezAXUtilitiesState.is_stale;  r'   r   c                 ^    t        j                  | t        j                  j                        S )z+Returns true if obj has the transient state)r   r   r   r   	TRANSIENTr   s    r   is_transientzAXUtilitiesState.is_transientA  r   r   c                 ^    t        j                  | t        j                  j                        S )z+Returns true if obj has the truncated state)r   r   r   r   	TRUNCATEDr   s    r   is_truncatedzAXUtilitiesState.is_truncatedG  r   r   c                 ^    t        j                  | t        j                  j                        S )z*Returns true if obj has the vertical state)r   r   r   r   VERTICALr   s    r   is_verticalzAXUtilitiesState.is_verticalM  r#   r   c                 ^    t        j                  | t        j                  j                        S )z)Returns true if obj has the visible state)r   r   r   r   VISIBLEr   s    r   
is_visiblezAXUtilitiesState.is_visibleS  rC   r   c                 ^    t        j                  | t        j                  j                        S )z)Returns true if obj has the visited state)r   r   r   r   VISITEDr   s    r   
is_visitedzAXUtilitiesState.is_visitedY  rC   r   c                 ^    t        j                  | t        j                  j                        S )z5Returns true if obj has the manages-descendants state)r   r   r   r   MANAGES_DESCENDANTSr   s    r   manages_descendantsz$AXUtilitiesState.manages_descendants_  s!     !!#u'J'JKKr   c                 ^    t        j                  | t        j                  j                        S )z9Returns true if obj has the supports-autocompletion state)r   r   r   r   SUPPORTS_AUTOCOMPLETIONr   s    r   supports_autocompletionz(AXUtilitiesState.supports_autocompletione  s!     !!#u'N'NOOr   N)2__name__
__module____qualname____doc__staticmethodr   r   r   r   r"   r&   r*   r4   r7   r;   r>   rB   rF   rI   rN   rP   rU   rW   rZ   r]   r`   rd   rg   rj   rm   rp   rt   rw   rz   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r   r   r	   r	   -   s   <6 6
 B B
 D D
 ? ?
 A A
 > >
 = =
   
 
 B B
 C C
 @ @
 A A
 @ @
   
 
   
 
 C C
 B B
 F F
 @ @
 F F
 > >
 C C
 H H
 ? ?
 @ @
 B B
 A A
 B B
 C C
 H H
 A A
 B B
 @ @
 D D
 > >
 B B
 B B
 A A
 @ @
 @ @
 L L
 P Pr   r	   )r   __id____version____date____copyright____license__girequire_versiongi.repositoryr    r   	ax_objectr   r	   r   r   r   <module>r      sQ   * 1 	   7E "   |P |Pr   