Ë
    g
fî  ã                   óŠ   — d Z dZdZdZdZd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  G d„ d«      Zy)aÇ  
Utilities for obtaining objects via the collection interface.
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            
       óL  — e Zd ZdZeg ej                  j                  g ej                  j                  g ej                  j                  g ej                  j                  df	d„«       Z	eej                  j                  fd„«       Zeej                  j                  fd„«       Zy)ÚAXCollectionz=Utilities for obtaining objects via the collection interface.Fc	                 óÄ  — t        j                  «       }	| r| D ]  }
|	j                  |
«       Œ i }|rF|D ]A  }|j                  dd«      \  }}|j	                  dd«      }||v r||   dz   |z   ||<   Œ=|||<   ŒC 	 t         j
                  j                  |	||||||||«	      }|S # t        $ r3}d|g}t        j                  t        j                  |d«       Y d}~yd}~ww xY w)z4Creates a match rule based on the supplied criteria.ú:r   z\:z-AXCollection: Exception in create_match_rule:TN)r   ÚStateSetÚaddÚsplitÚreplaceÚ	MatchRuleÚnewÚ	Exceptionr   ÚprintTokensÚ
LEVEL_INFO)ÚstatesÚstate_match_typeÚ
attributesÚattribute_match_typeÚrolesÚrole_match_typeÚ
interfacesÚinterface_match_typeÚinvertÚ	state_setÚstateÚattributes_dictÚattrÚkeyÚvalueÚruleÚerrorÚtokenss                     ú4/usr/lib/python3/dist-packages/orca/ax_collection.pyÚcreate_match_rulezAXCollection.create_match_rule5   s  € ô —N‘NÓ$ˆ	ÙØò %�Ø—‘˜eÕ$ð%ð ˆÙØ"ò 1�Ø!ŸZ™Z¨¨QÓ/‘
��UØŸ™ c¨5Ó1�Ø˜/Ñ)Ø+:¸3Ñ+?À#Ñ+EÈÑ+M�O CÒ(à+0�O CÒ(ð1ð	Ü—?‘?×&Ñ& yØ'7Ø'6Ø';Ø',Ø'6Ø'1Ø';Ø'-ó/ˆDð ˆøô ò 	ØEÀuÐMˆFÜ×Ñœe×.Ñ.°¸Ô=Üûð	ús   Á:'B# Â#	CÂ,)CÃCc                 óÈ  — t        j                  | «      sg S |€g S t        j                  «       }	 t        j                  j                  | ||dd«      }dt        |«      › dt        j                  «       |z
  d›d�}t        j                  t        j                  |d«       |S # t        $ r5}d|g}t        j                  t        j                  |d«       g cY d}~S d}~ww xY w)	z6Returns a list of objects matching the specified rule.Nr   Tz+AXCollection: Exception in get_all_matches:zAXCollection: z match(es) found in ú.4fÚs)r   Úsupports_collectionÚtimer   Ú
CollectionÚget_matchesr   r   r   r   ÚlenÚprintMessage)Úobjr$   ÚorderÚstartÚmatchesr%   r&   Úmsgs           r'   Úget_all_matcheszAXCollection.get_all_matchesb   sÒ   € ô ×+Ñ+¨CÔ0ØˆIàˆ<ØˆIä—	‘	“ˆð	ô ×&Ñ&×2Ñ2°3¸¸eÀQÈÓMˆGð œs 7›|˜nÐ,@ÄÇÁÃÈuÑATÐUXÐ@YÐYZÐ[ˆÜ×Ñœ5×+Ñ+¨S°$Ô7Øˆøô ò 	ØCÀUÐKˆFÜ×Ñœe×.Ñ.°¸Ô=Ø�Iûð	ús   ±#B# Â#	C!Â,*CÃC!ÃC!c                 óÀ  — t        j                  | «      sy|€yt        j                  «       }	 t        j                  j                  | ||dd«      }d}|r|d   }d|dt        j                  «       |z
  d›d	�g}t        j                  t        j                  |d«       |S # t        $ r3}d|g}t        j                  t        j                  |d«       Y d}~yd}~ww xY w)
z5Returns the first object matching the specified rule.Nr   Tz+AXCollection: Exception in get_first_match:r   zAXCollection: foundzin r*   r+   )
r   r,   r-   r   r.   r/   r   r   r   r   )r2   r$   r3   r4   r5   r%   r&   Úmatchs           r'   Úget_first_matchzAXCollection.get_first_matchz   s×   € ô ×+Ñ+¨CÔ0Øàˆ<Øä—	‘	“ˆð	ô ×&Ñ&×2Ñ2°3¸¸eÀQÈÓMˆGð ˆÙØ˜A‘JˆEà'¨°#´d·i±i³kÀEÑ6IÈ#Ð5NÈaÐ0PÐQˆÜ×Ñœ%×*Ñ*¨F°DÔ9Øˆøô ò 	ØCÀUÐKˆFÜ×Ñœe×.Ñ.°¸Ô=Üûð	ús   ¯#B! Â!	CÂ*)CÃCN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ústaticmethodr   ÚCollectionMatchTypeÚALLÚANYr(   ÚCollectionSortOrderÚ	CANONICALr7   r:   © ó    r'   r	   r	   /   s«   „ ÙGð
 Ø!#Ø+0×+DÑ+D×+HÑ+HØ%'Ø/4×/HÑ/H×/LÑ/LØ "Ø*/×*CÑ*C×*GÑ*GØ%'Ø/4×/HÑ/H×/LÑ/LØ!&ò)ó ð)ðX Ø).×)BÑ)B×)LÑ)Lò ó ðð. Ø).×)BÑ)B×)LÑ)Lò ó ñrF   r	   )r>   Ú__id__Ú__version__Ú__date__Ú__copyright__Ú__license__r-   ÚgiÚrequire_versionÚgi.repositoryr   Ú r   Ú	ax_objectr   r	   rE   rF   r'   ú<module>rQ      sR   ðñ*ð €Ø€Ø€Ø1€Ø€ã ã 	Ø €× Ñ �7˜EÔ "Ý å Ý ÷eò erF   