+
    Qi8  c                   s    R t RtRtRtRtRt^ RIt]P                  ! RR4       ]P                  ! R	R
4       ^ RIH	t	 ^ RIH
t
 ^RIHt ^RIHt ^RIHt ^RIHt ^RIHt ^RIHt  ! R R4      t]! 4       tR R ltR# ):Provides support for synthesizing accessible input events.z$Id$z
$Revision$z$Date$zQCopyright (c) 2005-2008 Sun Microsystems Inc.Copyright (c) 2018-2023 Igalia, S.L.ZLGPLNAtspiz2.0ZGtkz3.0)r   )GLib)debug)AXComponent)AXObject)AXText)AXUtilitiesDebugging)AXUtilitiesRolec                   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
]R-V 3R lR ll4       t]V 3R lR l4       t]R.V 3R lR ll4       t]R/V 3R lR ll4       t]R,V 3R lR ll4       t]R,V 3R lR ll4       t]R,V 3R lR ll4       t]R,V 3R lR ll4       t]R,V 3R lR ll4       t]R,V 3R lR  ll4       t]R,V 3R! lR" ll4       t]R,V 3R# lR$ ll4       t]R,V 3R% lR& ll4       t]R,V 3R' lR( ll4       t]V 3R) lR* l4       tR+tV tR# )0AXEventSynthesizerr    c                :   < V ^8  d   QhRS[ P                  RS[/#    objreturnr   
Accessibleboolformat__classdict__   ">/usr/lib/python3.14/site-packages/orca/ax_event_synthesizer.py__annotate__AXEventSynthesizer.__annotate__2   s%     H Hu// HD H    c                sr    \         P                  ! V 4      pVRJ ;'       g    \        P                  ! V4      # )z=Returns True if the parent of obj is the application or None.N)r   Z
get_parentr   Zis_application)r   Zparent   & r   _highest_ancestorZ$AXEventSynthesizer._highest_ancestor1   s1     $$S)~GG!?!?!GGr   Nc                sv   < V ^8  d   QhRS[ P                  RS[R,          RS[ P                  R,          RS[/# )r   r   offsetNancestorr   r   r   intr   r   r   r   r   r   9   sF     ) ))d
) ""T)) 
	)r   c                s   RV R.p\         P                  ! \         P                  VR4       \        P                  ! V 4      pT;'       g&    \
        P                  ! V \        P                  4      pVf-   RV .p\         P                  ! \         P                  VR4       R# \        P                  ! V4      p\        P                  ! WT4      p\        P                  ! V4      '       d/   RV RW%.p\         P                  ! \         P                  VR4       R# Vf.   RV R.p\         P                  ! \         P                  VR4       R# \        P                  ! W4      p\        P                  ! V4      '       d-   R	V .p\         P                  ! \         P                  VR4       R# \        P                  ! Wt4      p\        P                  ! V4      '       d1   RV R
VRV.p\         P                  ! \         P                  VR4       R# R# )zIReturns true if obj, or the caret offset therein, is scrolled off-screen.zAXEventSynthesizer: Checking ifzis scrolled offscreenT-AXEventSynthesizer: Could not get ancestor ofFAXEventSynthesizer:zis outside ofzis not scrolled offscreenz3AXEventSynthesizer: Could not get character rect of's caret
not in obj)r   print_tokens
LEVEL_INFOr   get_rectr   find_ancestorr	   r   get_rect_intersectionis_empty_rectr   get_character_rect)r   r   r   tokensrectancestor_rectintersectionextents   &&&     r   _is_scrolled_off_screenZ*AXEventSynthesizer._is_scrolled_off_screen8   s    4S:QR5++VT:##C(``x55c;M;_;_`EsKFu//>#,,X6"88M$$\22+S/8[Fu//>>+S2MNFu//>++C8$$W--KSQFu//>"88G$$\22+S*g|UYZFu//>r   c          
      sL   < V ^8  d   QhRS[ P                  RS[RS[RS[RS[/# )r   r   
relative_x
relative_yeventr   r   r   r   strr   r   r   r   r   r   e   s;      +.<?HK	r   c                s   R V RV RV 2.p\         P                  ! \         P                  VR4        \        P                  P                  4       p\        P                  P                  WPWV4       R#   \        P                   d7   pRT 2p\         P                  ! \         P                  TR4        Rp?R# Rp?ii ; i)z9AXEventSynthesizer: Attempting to generate mouse event onzat relative coordinates Z,Tz<AXEventSynthesizer: Exception in _generate_mouse_event_new: NF)
r   r$   r%   r   ZDeviceZnewZgenerate_mouse_eventr   ZGErrorZprint_message)r   r2   r3   r4   r+   ZdeviceZerrorZmessages   &&&&    r   _generate_mouse_eventZ(AXEventSynthesizer._generate_mouse_eventd   s     Ns,ZL*FH5++VT:	\\%%'FLL--f:SXY
 	 {{ 	TUZT[\G 0 0'4@	s   ?A4 4B?	+B::B?c                sT   < V ^8  d   QhRS[ P                  RS[R,          RS[RS[/# )r   r   r   Nr4   r   r5   r   r   r   r   r   v   s;     \ \u'7'7 \t \TW \\` \r   c                s   Vf!   \        \        P                  ! V 4      ^ 4      p\        P	                  W4      '       dr   \        P                  W4       \        P	                  W4      '       dB   RV R.p\        P                  ! \        P                  VR4       \        P                  ! W4       \        P                  ! W4      p\        P                  ! V4      '       d   R# \        P                  ! V 4      p\        P                  ! WE4      p\        P                  ! V4      '       d1   RV RVRV.p\        P                  ! \        P                  VR4       R# VP                  VP                  ,
          VP                   ^,          ,           pVP"                  VP"                  ,
          VP$                  ^,          ,           p\        P'                  WW4      # )zCPerforms the specified mouse event on the current character in obj.r!   z"is still offscreen. Setting caret.TFr"   r#   )Zmaxr   Zget_caret_offsetr	   r1   scroll_into_viewr   r$   r%   Zset_caret_offsetr*   r   r)   r&   r(   xwidthyheightr7   )	r   r   r4   r+   r/   r,   r.   r2   r3   s	   &&&      r   _mouse_event_on_characterZ,AXEventSynthesizer._mouse_event_on_characteru   sY    >005q9F55cBB//<!99#FF/6Z[""5#3#3VTB''4++C8$$W--##C("88G$$\22+S*g|UYZFu//>ii$&&(GMMA,==
ii$&&(GNNQ,>>
!77[[r   c                @   < V ^8  d   QhRS[ P                  RS[RS[/# )r   r   r4   r   )r   r   r6   r   r   r   r   r   r      s-     \ \E$4$4 \S \T \r   c                s   \         P                  V 4      '       dr   \         P                  V 4       \         P                  V 4      '       dB   RV R.p\        P                  ! \        P
                  VR4       \        P                  ! V 4       \        P                  ! V 4      pVP                  ^,          pVP                  ^,          p\         P                  WWQ4      # )z*Performs the specified mouse event on obj.r!   z#is still offscreen. Grabbing focus.T)r	   r1   r8   r   r$   r%   r   Z
grab_focusr   r&   r:   r<   r7   )r   r4   r+   r,   r2   r3   s   &&    r   _mouse_event_on_objectZ)AXEventSynthesizer._mouse_event_on_object   s     55c:://4!99#>>/6[\""5#3#3VTB##C(##C(ZZ!^
[[1_
!77[[r   c                sN   < V ^8  d   QhRS[ P                  RS[R,          RS[/# )r   r   r   Nr   r   r   r   r   r   r      s2     P P 0 0 P#* PPT Pr   c                s    RV R2V .p\         P                  ! \         P                  VR4       \        P	                  WR4      # )z3Routes the pointer to the current character in obj.z2AXEventSynthesizer: Attempting to route to offset  inTabsr   r$   r%   r	   r=   )r   r   r+   s   && r   route_to_characterZ%AXEventSynthesizer.route_to_character   sD     GvhcRTWX5++VT:!;;COOr   c                r
   r   r   r   r   r   r   r      s%     E EU-- E$ Er   c                s    RV .p\         P                  ! \         P                  VR4       \        P	                  V R4      # )z-Moves the mouse pointer to the center of obj.z*AXEventSynthesizer: Attempting to route toTrA   )r   r$   r%   r	   r?   )r   r+   r   r   route_to_objectZ"AXEventSynthesizer.route_to_object   s9     ?D5++VT:!88eDDr   c                sT   < V ^8  d   QhRS[ P                  RS[R,          RS[RS[/# )r   r   r   Nbuttonr   r   r   r   r   r   r      s=     X XX'*TzXBEX	Xr   c                s    RV R2V .p\         P                  ! \         P                  VR4       \        P	                  WRV R24      # )zHSingle click on the current character in obj using the specified button.z2AXEventSynthesizer: Attempting to click at offset r@   TbcrB   )r   r   rE   r+   s   &&& r   click_characterZ"AXEventSynthesizer.click_character   sM     GvhcRTWX5++VT:!;;C1VHTUWWr   c                r>   )r   r   rE   r   r   r   r   r   r   r      s-     M M%** MC M Mr   c                s6    \         P                  V RV R24      # )z/Single click on obj using the specified button.rF   rG   )r	   r?   )r   rE   s   &&r   click_objectZAXEventSynthesizer.click_object   s     "88&mLLr   c          
      sz   < V ^8  d   QhRS[ P                  RS[ P                  RS[R,          RS[R,          RR/# )r   r   locationstart_offsetN
end_offsetr   )r   r   
ScrollTyper   r   r   r   r   r      sK     ; ;;).)9)9;Dj;584Z; 
;r   c                s   \         P                  ! V 4      p\        P                  ! WW#4       \        P
                  ! V RR4       \         P                  ! V 4      pRVRV.p\        P                  ! \        P                  VR4       WE8w  d   R# \         P                  ! W4       \        P
                  ! V RR4       \         P                  ! V 4      pRVRV.p\        P                  ! \        P                  VR4       R# )z-Attempts to scroll to the specified location.F(To obtain updated location after scroll.(AXEventSynthesizer: Text scroll, before:after:TN*AXEventSynthesizer: Object scroll, before:)
r   get_positionr   Zscroll_substring_to_locationr   clear_cacher   r$   r%   Zscroll_object_to_location)r   rJ   rK   rL   beforeafterr+   s   &&&&   r   _scroll_to_locationZ&AXEventSynthesizer._scroll_to_location   s     ))#.++C<TS%)ST((-<fhPUV5++VT:?--c<S%)ST((->RWX5++VT:r   c                sl   < V ^8  d   QhRS[ P                  RS[RS[RS[R,          RS[R,          RR/# )r   r   x_coordy_coordrK   NrL   r   r   r   r   r   r   r   r   r      sM     ; ;;(+;69;Dj;584Z; 
;r   c                s   \         P                  ! V 4      p\        P                  ! WW#V4       \        P
                  ! V RR4       \         P                  ! V 4      pRVRV.p\        P                  ! \        P                  VR4       WV8w  d   R# \         P                  ! WV4       \        P
                  ! V RR4       \         P                  ! V 4      pRVRV.p\        P                  ! \        P                  VR4       R# )z.Attempts to scroll obj to the specified point.FrN   rO   rP   TNrQ   )
r   rR   r   Zscroll_substring_to_pointr   rS   r   r$   r%   Zscroll_object_to_point)r   rW   rX   rK   rL   rT   rU   r+   s   &&&&&   r   _scroll_to_pointZ#AXEventSynthesizer._scroll_to_point   s     ))#.((wjYS%)ST((-<fhPUV5++VT:?**3AS%)ST((->RWX5++VT:r   c                `   < V ^8  d   QhRS[ P                  RS[R,          RS[R,          RR/# r   r   rK   NrL   r   rY   r   r   r   r   r      E     F FFDjF $JF 
	Fr   c                d    \         P                  V \        P                  P                  W4       R# )z!Attempts to scroll obj into view.N)r	   rV   r   rM   ZANYWHEREr   rK   rL      &&&r   r8   Z#AXEventSynthesizer.scroll_into_view   &     	..!!**L	Fr   c                r[   r\   rY   r   r   r   r   r      sE     ] ]]Dj] $J] 
	]r   c                s   \         P                  ! V \        P                  4      pVf-   RV .p\        P
                  ! \        P                  VR4       R# \        P                  ! V4      pVP                  VP                  ^,          ,           pVP                  VP                  ^,          ,           p\        P                  WWqV4       R# )z3Attempts to scroll obj to the center of its window.Nr    T)r   r'   r	   r   r   r$   r%   r   r&   r9   r:   r;   r<   rZ   )r   rK   rL   r   r+   r-   rW   rX   r0   r   scroll_to_centerZ#AXEventSynthesizer.scroll_to_center   s     ))#/A/S/STEsKFu//>#,,X6//M$7$7!$;;//M$8$81$<<++C'Q[\r   c                r[   r\   rY   r   r   r   r   r     r]   r   c                r^   )z'Attempts to scroll obj to the top edge.N)r	   rV   r   rM   ZTOP_EDGEr_   r`   r   scroll_to_top_edgeZ%AXEventSynthesizer.scroll_to_top_edge  ra   r   c                r[   r\   rY   r   r   r   r   r     r]   r   c                r^   )z'Attempts to scroll obj to the top left.N)r	   rV   r   rM   ZTOP_LEFTr_   r`   r   scroll_to_top_leftZ%AXEventSynthesizer.scroll_to_top_left  ra   r   c                r[   r\   rY   r   r   r   r   r   #  sE     G GGDjG $JG 
	Gr   c                r^   )z(Attempts to scroll obj to the left edge.N)r	   rV   r   rM   Z	LEFT_EDGEr_   r`   r   scroll_to_left_edgeZ&AXEventSynthesizer.scroll_to_left_edge"  s&     	..!!++\	Gr   c                r[   r\   rY   r   r   r   r   r   .  sE     I IIDjI $JI 
	Ir   c                r^   )z*Attempts to scroll obj to the bottom edge.N)r	   rV   r   rM   ZBOTTOM_EDGEr_   r`   r   scroll_to_bottom_edgeZ(AXEventSynthesizer.scroll_to_bottom_edge-  s&     	..!!--|	Ir   c                r[   r\   rY   r   r   r   r   r   9  sE     J JJDjJ $JJ 
	Jr   c                r^   )z+Attempts to scroll obj to the bottom right.N)r	   rV   r   rM   ZBOTTOM_RIGHTr_   r`   r   scroll_to_bottom_rightZ)AXEventSynthesizer.scroll_to_bottom_right8  s&     	..!!..	Jr   c                r[   r\   rY   r   r   r   r   r   D  sE     H HHDjH $JH 
	Hr   c                r^   )z)Attempts to scroll obj to the right edge.N)r	   rV   r   rM   Z
RIGHT_EDGEr_   r`   r   scroll_to_right_edgeZ'AXEventSynthesizer.scroll_to_right_edgeC  s&     	..!!,,l	Hr   c                r
   r   r   r   r   r   r   r   O  s!      u'7'7 D r   c                s   . ROpV FO  p\         P                  ! W4      '       g   K!  RVRV R.p\        P                  ! \        P                  VR4        R# 	  \        P                  \        P
                  8  d   R# RV R\        P                  ! V 4      .p\        P                  ! \        P                  VR4       R# )	z<Attempts to perform a click-like action if one is available.zAXEventSynthesizer: 'z' onzperformed successfullyTFzAXEventSynthesizer: Actions onZ:)ZclickZpressZjumpZopenZactivate)r   Zdo_named_actionr   r$   r%   Z
debugLevelr   Zactions_as_string)r   ZactionsZactionr+   s   &   r   try_all_clickable_actionsZ,AXEventSynthesizer.try_all_clickable_actionsN  s     AF''441663H`a""5#3#3VTB	  e...2C&88=?5++VT:r    )NN)N)N   )rk   )Z__name__Z
__module__Z__qualname__Z__firstlineno____doc__Zstaticmethodr   r1   r7   r=   r?   rC   rD   rH   rI   rV   rZ   r8   rb   rc   rd   re   rf   rg   rh   ri   Z__static_attributes__Z__classdictcell__)r   s   @r   r	   r	   .   s    DH H ) ) )V    \ \8 \ \ P P P E E X X X M M M
 ; ; ;* ; ; ;* F F F ] ] ]$ F F F F F F G G G I I I J J J H H H  r   r	   c                s$    V ^8  d   QhR\         /# )r   r   )r	   )r   s   "r   r   r   b  s      + r   c                 s    \         # )zReturns the Event Synthesizer.)_synthesizerrj   r   r   get_synthesizerrn   b  s
     r   )rl   Z__id__Z__version__Z__date__Z__copyright__Z__license__ZgiZrequire_versionZgi.repositoryr   r   Z r   Zax_componentr   Z	ax_objectr   Zax_textr   Zax_utilities_debuggingr   Zax_utilities_roler   r	   rm   rn   rj   r   r   <module>ro      s}   0 A7 	   7E "   5%      %   8 .q qf	 "#r   