+
    Qi  c                   s    R t RtRtRtRtRt^ RIt^ RIt]P                  ! RR4       ^ R	I	H
t
 ^ R
I	Ht ^RIHt ^RIHt  ! R R4      tR# )BUtilities for obtaining information about accessible applications.z$Id$z
$Revision$z$Date$zLCopyright (c) 2023-2024 Igalia, S.L.Copyright (c) 2024 GNOME Foundation Inc.ZLGPLNAtspiz2.0)r   )GLib)debug)AXObjectc                   s@  a  ] tR t^+t o Rt]V 3R lR l4       t]RV 3R lR ll4       t]V 3R lR l4       t]V 3R lR	 l4       t	]V 3R
 lR l4       t
]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       tRtV tR# )AXUtilitiesApplicationr    c                :   < V ^8  d   QhRS[ P                  RS[/#    objreturnr   
AccessibleZstrformat__classdict__   "B/usr/lib/python3.14/site-packages/orca/ax_utilities_application.py__annotate__#AXUtilitiesApplication.__annotate__/   s!      5#3#3      c                s    \         P                  V 4      pVf   R# \        P                  ! V4       R\         P	                  V 4       R\         P                  V 4       R2pV# )z3Returns the application details of obj as a string. z (Z Z))r   get_applicationr   get_nameget_application_toolkit_nameget_application_toolkit_version)r	   appZstrings   &  r   application_as_stringZ,AXUtilitiesApplication.application_as_string.   sl     %44S9;   %& '&CCCHI%EEcJK1N 	
 r   c          	      sV   < V ^8  d   QhRS[ RS[ RS[ RS[S[P                  ,          /# )r   must_have_windowexclude_unresponsiveis_debugr
   )boollistr   r   r   r   r   r   r   >   s<     ; ;;"; ; 
e		;r   c                s   a aa \         P                  4       pVf   . # R VVV 3R llp\        \        P                  ! W44      4      # )z6Returns a list of running applications known to Atspi.c                sD    V ^8  d   QhR\         P                  R\        /# r   r   r   r   )r   s   "r   r   ZAAXUtilitiesApplication.get_all_applications.<locals>.__annotate__I   s      	 	e&& 	4 	r   c                 s   < S'       d   \         P                  V 4      '       d   R # \        P                  ! V 4      R8X  d   S# S'       d   \        P                  ! V 4      ^ 8  # R# )Fzmutter-x11-framesT)r   is_application_unresponsiver   r   Zget_child_count)r	   r   r   r   s   &r   predZ9AXUtilitiesApplication.get_all_applications.<locals>.predI   sP    #(>(Z(Z[^(_(_  %)<<//4q88r   )r   get_desktopr    r   Ziter_children)r   r   r   desktopr#   s   fff  r   get_all_applicationsZ+AXUtilitiesApplication.get_all_applications=   s?     )446?I	 	 H**79::r   c                s\   < V ^8  d   QhRS[ P                  RS[ P                  R,          /# )r   r	   r
   Nr   r   r   r   r   r   r   U   s,      U-- %2B2BT2I r   c                s    V f   R#  \         P                  P                  V 4      pV#   \        P                   d7   pRT 2p\
        P                  ! \
        P                  TR4        Rp?R# Rp?ii ; i)z6Returns the accessible application associated with objNz6AXUtilitiesApplication: Exception in get_application: T)r   r   r   r   GErrorr   print_message
LEVEL_INFO)r	   r   errormsg   &   r   r   Z&AXUtilitiesApplication.get_applicationT   sk     ;	""2237C
 
	 {{ 	J5'RC 0 0#t<	s   ) A4+A//A4c                r   r   r   r   r   r   r   r   d   s!      %*:*: s r   c                   \         P                  V 4      pVf   R#  \        P                  P	                  V4      pV#   \
        P                   d7   pRT 2p\        P                  ! \        P                  TR4        Rp?R# Rp?ii ; i)z8Returns the toolkit name reported for obj's application.Nr   zCAXUtilitiesApplication: Exception in get_application_toolkit_name: T)
r   r   r   r   Zget_toolkit_namer   r(   r   r)   r*   )r	   r   Znamer+   r,      &    r   r   Z3AXUtilitiesApplication.get_application_toolkit_namec   s}     %44S9;	##44S9D  {{ 	WX]W^_C 0 0#t<	   > B	+BB	c                r   r   r   r   r   r   r   r   u   s!      U-=-= # r   c                r.   )z;Returns the toolkit version reported for obj's application.Nr   zFAXUtilitiesApplication: Exception in get_application_toolkit_version: T)
r   r   r   r   Zget_toolkit_versionr   r(   r   r)   r*   )r	   r   Zversionr+   r,   r/   r   r   Z6AXUtilitiesApplication.get_application_toolkit_versiont   s}     %44S9;	&&::3?G  {{ 	Z[`ZabC 0 0#t<	r0   c                sH   < V ^8  d   QhRS[ RS[P                  R,          /# )r   pidr
   N)intr   r   r   r   r   r   r      s&     
 
c 
e.>.>.E 
r   c                s    \         P                  4       pV F!  p\         P                  V4      V 8X  g   K  Vu # 	  RV R.p\        P                  ! \        P
                  VR4       R# )z9Returns the accessible application with the specified pidzWARNING: app with pid is not in the accessible desktopTN)r   r&   get_process_idr   print_tokensr*   )r1   applicationschildtokensr-   r   get_application_with_pidZ/AXUtilitiesApplication.get_application_with_pid   s^     .BBD!E%44U;sB " *30RS5++VT:r   c                sB   < V ^8  d   QhRS[ P                  R,          /# )r   r
   Nr'   r   r   r   r   r      s     
 
))D0 
r   c                 s     \         P                  ! ^ 4      p V #   \        P                   d6   pRT.p\        P
                  ! \        P                  TR4        Rp?R# Rp?ii ; i)zReturns the accessible desktopz,ERROR: Exception getting desktop from Atspi:TN)r   r$   r   r(   r   r5   r*   )r%   r+   r8   s      r   r$   Z"AXUtilitiesApplication.get_desktop   sY    	''*G  {{ 	DeLFu//>	s    A$*AA$c                r   r   )r   r   r2   r   r   r   r   r      s!     
 
E,, 
 
r   c                s     \         P                  P                  V 4      pV#   \        P                   d8   pRT 2p\
        P                  ! \
        P                  TR4       Ru Rp?# Rp?ii ; i)z*Returns the process id associated with objz5AXUtilitiesApplication: Exception in get_process_id: TNi)r   r   r4   r   r(   r   r)   r*   )r	   r1   r+   r,   r-   r   r4   Z%AXUtilitiesApplication.get_process_id   sc    	""11#6C 
 {{ 	I%QC 0 0#t<I	s   # A/,A*$A/*A/c                r   r   r   r
   r!   r   r   r   r   r      s!     
 
u'7'7 
D 
r   c                s    \         P                  4       pV F  pW 8X  g   K   R# 	  RV R.p\        P                  ! \        P                  VR4       R# )z%Returns true if app is known to AtspiTzWARNING:r3   F)r   r&   r   r5   r*   )r   r6   r7   r8   r-   r   is_application_in_desktopZ0AXUtilitiesApplication.is_application_in_desktop   sN     .BBD!E| " c#EF5++VT:r   c                r   r:   r!   r   r   r   r   r      s!      )9)9 d r   c                s   \         P                  V 4      p \        P                  ! RV R24      pVP	                  4       ^,          pTR8X  d0   R	T R
2.p\        P                  ! \        P                  TR4       R# TR8X  d0   R	T R2.p\        P                  ! \        P                  TR4       R# R#   \
        P                  \        3 d;   pRT RT 2.p\        P                  ! \        P                  TR4        Rp?R# Rp?ii ; i)z:Returns true if app's process is known to be unresponsive.z
cat /proc/z/status | grep Statez8AXUtilitiesApplication: Exception checking state of pid z: TNFZZzAXUtilitiesApplication: pid z is zombie processZTz is suspended/stopped process)r   r4   
subprocessZ	getoutputZsplitr   r(   Z
IndexErrorr   r5   r*   )r   r1   Zstater+   r8   r/   r   r"   Z2AXUtilitiesApplication.is_application_unresponsive   s     %33C8	((:cU:N)OPEKKM!$E C<4SE9KLMFu//>C<4SE9VWXFu//> Z( 	PQTPUUWX]W^_`Fu//>	s   1B6 6D/DD N)FFF)Z__name__Z
__module__Z__qualname__Z__firstlineno____doc__Zstaticmethodr   r&   r   r   r   r9   r$   r4   r;   r"   Z__static_attributes__Z__classdictcell__)r   s   @r   r   r   +   s     L  ; ; ;,         
 
 
 
 
 
 
 
  r   r   )r>   Z__id__Z__version__Z__date__Z__copyright__Z__license__r<   ZgiZrequire_versionZgi.repositoryr   r   r   r   Z	ax_objectr   r   r=   r   r   <module>r?      sT   0 I;  	   7E "    e er   