+
    <inS  c                   sb    . R	Ot ^ RIt^ RIHt ^ RIHt ^ RItRtRtRt	 ! R R ]
4      tR
R ltR# )RegistryN)Atspi)GLibr   ZQtZNonec                   s   a  ] tR t^+t o Rt/ tR tR tRR ltR t	R t
R tRR ltR tR tR tR tR tR tR t^ t^tR tR t. ^ ]]3R
R
R	3R lt. ^ ]]33R ltR tR tR tR tRtV tR# )r    aJ  
Wraps the Accessibility.Registry to provide more Pythonic registration for
events.

This object should be treated as a singleton, but such treatment is not
enforced. You can construct another instance of this object and give it a
reference to the Accessibility.Registry singleton. Doing so is harmless and
has no point.

@@ivar asynchronous: Should event dispatch to local listeners be decoupled
        from event receiving from the registry?
@@type asynchronous: boolean
@@ivar reg: Reference to the real, wrapped registry object
@@type reg: Accessibility.Registry
@@ivar dev: Reference to the device controller
@@type dev: Accessibility.DeviceEventController
@@ivar clients: Map of event names to client listeners
@@type clients: dictionary
@@ivar observers: Map of event names to AT-SPI L{_Observer} objects
@@type observers: dictionary
c                s    V P                   V n         V P                  '       d   R #  RV n        R V n        R V n        \        P                  ! 4       V n        R #   \         d     L>i ; i)NF)	_Registry__shared_state__dict__has_implementationsZAttributeErrorapp_event_registerdesktopr   ZMainLoop	main_loopself   &5/usr/lib/python3.14/site-packages/pyatspi/registry.py__init__ZRegistry.__init__C   sb     $ 3 3 444 & 5
 ,1(*.'#!% ' s   A A'&A'c                s    V # )z>
@@return: This instance of the registry
@@rtype: L{Registry}
 r	   r   r   __call__ZRegistry.__call__S   s	    
     Nc                sN    RV n         RV n        RV n        \        4       V n        R# )a  
Creates a new 'Registry' object and sets this object
as the default returned by pyatspi.Registry.

The default registry (without calling this function) uses the
GLib main loop with caching. It connects to a registry daemon.

This function should be called before pyatspi is used if you
wish to change these defaults.

@@param main_loop_type: 'GLib', 'None' or 'Qt'. If 'None' is selected then caching
                       is disabled.

@@param use_registry: Whether to connect to a registry daemon for device events.
                     Without this the application to connect to must be declared in the
                     app_name parameter.

@@param app_name: D-Bus name of the application to connect to when not using the registry daemon.
TFN)r   asynchronousstartedZdictevent_listeners)r
   Zmain_loop_typeapp_name   &&&r   _set_registryZRegistry._set_registryZ   s%    * ,0($)!$'+v$r   c                sR    VR8X  d   V P                   # \        P                  W4      # )*
For backwards compatibility with old API
async)r   object__getattr__)r
   name   &&r   r   ZRegistry.__getattr__u   s(     w(((%%d11r   c                sL    VR8X  d   W n         \        P                  WV4       R# )r   r   N)r   r   __setattr__)r
   r   Zvaluer   r   r   ZRegistry.__setattr__}   s!     w$)!t51r   c                s0    V P                  \        4       R # N)r   MAIN_LOOP_GLIBr	   r   r   _set_default_registryZRegistry._set_default_registry   s    ""N3r   FTc                s  a a RV9   d
   VR,          pS P                   '       g   S P                  4        RS n        V'       dk   VV 3R loRSn        \        P
                  ! S4      p\        P                  ! 4        \        P                  ! V4       SP                  e   SP                  hM\        P                  ! 4        RS n        R# )a  
Enter the main loop to start receiving and dispatching events.

@@param asynchronous: Should event dispatch be asynchronous
        (decoupled) from event receiving from the AT-SPI registry?
@@type asynchronous: boolean
@@param gil: Add an idle callback which releases the Python GIL for a few
        milliseconds to allow other threads to run? Necessary if other threads
        will be used in this process.
@@type gil: boolean
r   Tc                  s   <  \         P                  ! R 4       R#   \         d#   p T Sn        SP	                  4         Rp ? R# Rp ? ii ; i)g{Gz?NT)timeZsleepZKeyboardInterruptkeyboard_exceptionstop)Ze
releaseGILr
   s    r   r$   Z"Registry.start.<locals>.releaseGIL   sA    !4(,

4(8
 (,	 (9 !4HI
(E(,		'+	!4s    AAANF)	r   r    r   r"   r   Zidle_addr   Z
event_mainZsource_remove)r
   r   ZgilZkwargsir$   s   f&&, @r   startZRegistry.start   s     f$#)'?L///225#, 9=
5 MM*5((***1-%88D&0&C&C C E ((*$r   c                st    V P                   '       g   V P                  4        \        P                  ! 4        R# )z
Quits the main loop.
N)r   r    r   Z
event_quit)r
   Zargss   &*r   r#   ZRegistry.stop   s(     ///225  "r   c                s    ^# )zW
Gets the number of available desktops.

@@return: Number of desktops
@@rtype: integer
r   r	   r   r   getDesktopCountZRegistry.getDesktopCount   s     r   c                sr    V P                   '       g   V P                  4        \        P                  ! V4      # )z
Gets a reference to the i-th desktop.

@@param i: Which desktop to get
@@type i: integer
@@return: Desktop reference
@@rtype: Accessibility.Desktop
)r   r    r   Zget_desktop)r
   r%   r   r   
getDesktopZRegistry.getDesktop   s-     ///225((++r   c                s    V! V4      # r   r   )r
   ZeventZcallbackr   r   eventWrapperZRegistry.eventWrapper   s    &r   c                s@   V P                   '       g   V P                  4         V P                  V,          pT F"  p\        P                  P                  Y44       K$  	  R#    \        P                  P                  T P                  T4      ;q0P                  T&    Lf; i)a  
Registers a new client callback for the given event names. Supports 
registration for all subevents if only partial event name is specified.
Do not include a trailing colon.

For example, 'object' will register for all object events, 
'object:property-change' will register for all property change events,
and 'object:property-change:accessible-parent' will register only for the
parent property change event.

Registered clients will not be automatically removed when the client dies.
To ensure the client is properly garbage collected, call 
L{deregisterEventListener}.

@@param client: Callable to be invoked when the event occurs
@@type client: callable
@@param names: List of full or partial event names
@@type names: list of string
N)r   r    r   r   EventListenernewr)   Zregisterr
   clientnameslistenerr      &&*  r   registerEventListenerZRegistry.registerEventListener   s    ( ///225u#'#7#7#? "D++44hE "uBGBUBUBYBYZ^ZkZkmsBtt#7#7#?s   A! !:Bc                sD   V P                   '       g   V P                  4         V P                  V,          pT F$  p\        P                  P                  YERT4       K&  	  R#    \        P                  P                  T P                  T4      ;q@P                  T&    Lh; i)a  
Registers a new client callback for the given event names. Supports
registration for all subevents if only partial event name is specified.
Do not include a trailing colon.

For example, 'object' will register for all object events,
'object:property-change' will register for all property change events,
and 'object:property-change:accessible-parent' will register only for the
parent property change event.

Registered clients will not be automatically removed when the client dies.
To ensure the client is properly garbage collected, call
L{deregisterEventListener}.

@@param client: Callable to be invoked when the event occurs
@@type client: callable
@@param names: List of full or partial event names
@@type names: list of string
N)r   r    r   r   r*   r+   r)   Zregister_with_app)r
   r-   Zappr.   r/   r   s   &&&*  r   registerEventListenerWithAppZ%Registry.registerEventListenerWithApp   s    ( ///225u#'#7#7#? "D++==xtUXY "uBGBUBUBYBYZ^ZkZkmsBtt#7#7#?s   A# #:Bc                s    V P                   '       g   V P                  4         V P                  V,          pT F"  p\        P                  P                  Y44       K$  	  R#     R# ; i)a.  
Unregisters an existing client callback for the given event names. Supports 
unregistration for all subevents if only partial event name is specified.
Do not include a trailing colon.

This method must be called to ensure a client registered by
L{registerEventListener} is properly garbage collected.

@@param client: Client callback to remove
@@type client: callable
@@param names: List of full or partial event names
@@type names: list of string
@@return: Were event names specified for which the given client was not
        registered?
@@rtype: boolean
N)r   r    r   r   r*   Z
deregisterr,   r0   r   deregisterEventListenerZ Registry.deregisterEventListener  s[    " ///225#'#7#7#? "D++66xF "s   A! !A&c                s0   \         P                  P                  pV'       d"   V\         P                  P                  ,          pV'       d"   V\         P                  P                  ,          pV'       d"   V\         P                  P
                  ,          pV# r   )r   ZKeyListenerSyncTypeZNOSYNCZSYNCHRONOUSZ
CANCONSUMEZALL_WINDOWS)r
   synchronous
preemptiveglobal_results   &&&& r   makeSyncTypeZRegistry.makeSyncType,  sc    2299%";";"G"GG%";";"F"FF%";";"G"GGr   c                s<    ^ pV F  pV^V,          ,          pK  	  V# )i    r   )r
   kindr7   r%   s   &&  r   makeKindZRegistry.makeKind6  s$    A16* r   c           	     s   V P                   '       g   V P                  4         V P                  V,          pT P                  YVT4      p	\        TR4      '       d   Tp
MT.p
T
 F,  p\        P                  ! TTTT P                  T4      T	4       K.  	  R#    \        P                  P                  T P                  T4      ;qP                  T&    L; i)a  
Registers a listener for key stroke events.

@@param client: Callable to be invoked when the event occurs
@@type client: callable
@@param key_set: Set of hardware key codes to stop monitoring. Leave empty
        to indicate all keys.
@@type key_set: list of integer
@@param mask: When the mask is None, the codes in the key_set will be 
        monitored only when no modifier is held. When the mask is an 
        integer, keys in the key_set will be monitored only when the modifiers in
        the mask are held. When the mask is an iterable over more than one 
        integer, keys in the key_set will be monitored when any of the modifier
        combinations in the set are held.
@@type mask: integer, iterable, None
@@param kind: Kind of events to watch, KEY_PRESSED_EVENT or 
        KEY_RELEASED_EVENT.
@@type kind: list
@@param synchronous: Should the callback notification be synchronous, giving
        the client the chance to consume the event?
@@type synchronous: boolean
@@param preemptive: Should the callback be allowed to preempt / consume the
        event?
@@type preemptive: boolean
@@param global_: Should callback occur even if an application not supporting
        AT-SPI is in the foreground? (requires xevie)
@@type global_: boolean
__iter__N)r   r    r   r   ZDeviceListenerr+   r)   r8   hasattrZregister_keystroke_listenerr:   )r
   r-   key_setmaskr9   r4   r5   r6   r/   ZsyncFlagmasksms   &&&&&&&&    r   registerKeystrokeListenerZ"Registry.registerKeystrokeListener<  s    H ///225v#'#7#7#?  ,,[gN4,, $!%A99(:A:;:>--:N:B	D vBGBVBVBZBZ[_[l[lntBuu#7#7#?s   B :Cc           	     s   V P                   '       g   V P                  4         V P                  V,          p\        TR4      '       d   TpMT.pT F)  p\        P
                  ! YRYpP                  T4      4       K+  	  R#     R# ; i)a  
Deregisters a listener for key stroke events.

@@param client: Callable to be invoked when the event occurs
@@type client: callable
@@param key_set: Set of hardware key codes to stop monitoring. Leave empty
        to indicate all keys.
@@type key_set: list of integer
@@param mask: When the mask is None, the codes in the key_set will be 
        monitored only when no modifier is held. When the mask is an 
        integer, keys in the key_set will be monitored only when the modifiers in
        the mask are held. When the mask is an iterable over more than one 
        integer, keys in the key_set will be monitored when any of the modifier
        combinations in the set are held.
@@type mask: integer, iterable, None
@@param kind: Kind of events to stop watching, KEY_PRESSED_EVENT or 
        KEY_RELEASED_EVENT.
@@type kind: list
@@raise KeyError: When the client isn't already registered for events
Nr;   )r   r    r   r<   r   Zderegister_keystroke_listenerr:   )r
   r-   r=   r>   r9   r/   r?   r@   s   &&&&&   r   deregisterKeystrokeListenerZ$Registry.deregisterKeystrokeListenerr  s|    2 ///225#'#7#7#? 4,, $!%A;;X !==#68 s   B   Bc                s    V P                   '       g   V P                  4        Vf   Rp\        P                  ! WV4       R# )a  
Generates a keyboard event. One of the keycode or the keysym parameters
should be specified and the other should be None. The kind parameter is 
required and should be one of the KEY_PRESS, KEY_RELEASE, KEY_PRESSRELEASE,
KEY_SYM, KEY_STRING, KEY_LOCKMODIFIERS, or KEY_UNLOCKMODIFIERS.

@@param keycode: Hardware keycode or None
@@type keycode: integer
@@param keysym: Symbolic key string or None
@@type keysym: string
@@param kind: Kind of event to synthesize
@@type kind: integer
NZ )r   r    r   Zgenerate_keyboard_event)r
   ZkeycodeZkeysymr9      &&&&r   generateKeyboardEventZRegistry.generateKeyboardEvent  s6     ///225>!#--wEr   c                sx    V P                   '       g   V P                  4        \        P                  ! WV4       R# )a  
Generates a mouse event at the given absolute x and y coordinate. The kind
of event generated is specified by the name. For example, MOUSE_B1P 
(button 1 press), MOUSE_REL (relative motion), MOUSE_B3D (butten 3 
double-click).

@@param x: Horizontal coordinate, usually left-hand oriented
@@type x: integer
@@param y: Vertical coordinate, usually left-hand oriented
@@type y: integer
@@param name: Name of the event to generate
@@type name: string
N)r   r    r   Zgenerate_mouse_event)r
   ZxZyr   rC   r   generateMouseEventZRegistry.generateMouseEvent  s,     ///225**A$7r   c                s    \         P                  '       g   \         P                  4        \        P                  ! V 4       R# )a  
Sets the reference window that will be used when
generateMouseEvent is called. Coordinates will be assumed to
be relative to this window. This * is needed because, due to
Wayland's security model, it is not currently possible to
possible to retrieve global coordinates.
If NULL is passed, then AT-SPI will use the window that has
focus at the time that atspi_generate_mouse_event is called.

@@param accessible: the accessible corresponding to the window
to select. should be a top-level window with a role of
pyatspi.ROLE_APPLICATION.
N)r
   r   r    r   ZsetReferenceWindow)Z
accessibler   r   setReferenceWIndowZRegistry.setReferenceWIndow  s*     ///225((4r   c                s    R# )z(
Dispatch events that have been queued.
Nr   r	   r   r   pumpQueuedEventsZRegistry.pumpQueuedEvents  s     r   )r   r   r   r   r   r   r   r   r   )FT) Z__name__Z
__module__Z__qualname__Z__firstlineno__Z__doc__r   r   r   r   r   r   r    r&   r#   r'   r(   r)   r1   r2   r3   Z_KEY_PRESSED_EVENTZ_KEY_RELEASED_EVENTr8   r:   rA   rB   rD   rE   rF   rG   Z__static_attributes__Z__classdictcell__)Z__classdict__s   @r   r    r    +   s     	* 	1 		.6	2	2	4'	%R	#		,	'	F:	Z:	G: 		 /1+,,>@S+T2615.34	Dp 13-..@BU-V	&	8T	F(	8$	5$	 	r   c                 s<    \        4       pVP                  W4       R # r   )r    r   )r   r   Zregistrys   && r   set_default_registryrH     s    ;	4r   )r    r   MAIN_LOOP_NONErH   r   )Z__all__ZosZ_osZgi.repositoryr   r   r!   r   ZMAIN_LOOP_QTrI   r   r    rH   r   r   r   <module>rJ      s?   2#
     mv m^5r   