
    yhs                     :    S SK r S SKrS SKrS SKr " S S\5      rg)    Nc                   |    \ rS rSrSrS rS rSS jrS rS r	S	 r
S
 rS rS rS rS rS rS rS rS rS rSrg)DriverProxy   ap  
Proxy to a driver implementation.

@ivar _module: Module containing the driver implementation
@type _module: module
@ivar _engine: Reference to the engine that owns the driver
@type _engine: L{engine.Engine}
@ivar _queue: Queue of commands outstanding for the driver
@type _queue: list
@ivar _busy: True when the driver is busy processing a command, False when
    not
@type _busy: bool
@ivar _name: Name associated with the current utterance
@type _name: str
@ivar _debug: Debugging output enabled or not
@type _debug: bool
@ivar _iterator: Driver iterator to invoke when in an external run loop
@type _iterator: iterator
c                 p   Uc0  [         R                  S:X  a  SnO[         R                  S:X  a  SnOSnSU-  n[        R                  " U5      U l        U R                  R                  [        R                  " U 5      5      U l        Xl	        / U l
        SU l        SU l        SU l        X0l        S	U l        g)
a6  
Constructor.

@param engine: Reference to the engine that owns the driver
@type engine: L{engine.Engine}
@param driverName: Name of the driver module to use under drivers/ or
    None to select the default for the platform
@type driverName: str
@param debug: Debugging output enabled or not
@type debug: bool
Ndarwinnssswin32sapi5espeakzpyttsx3.drivers.%sT )sysplatform	importlibimport_module_modulebuildDriverweakrefproxy_driver_engine_queue_busy_name	_iterator_debug_current_text)selfengine
driverNamedebugnames        F/var/www/auris/envauris/lib/python3.13/site-packages/pyttsx3/driver.py__init__DriverProxy.__init__   s     ||x'#
($
%
#j0 ..t4||//d0CD

    c                 f     U R                   R                  5         g ! [        [        4 a     g f = fN)r   destroyAttributeError	TypeErrorr   s    r"   __del__DriverProxy.__del__>   s.    	LL  "	* 		s    00Nc                 ^    U R                   R                  XU45        U R                  5         g)z
Adds a command to the queue.

@param mtd: Method to invoke to process the command
@type mtd: method
@param args: Arguments to apply when invoking the method
@type args: tuple
@param name: Name associated with the command
@type name: str
N)r   append_pumpr   mtdargsr!   s       r"   _pushDriverProxy._pushD   s$     	Ct,-

r%   c                    U R                   (       d{  [        U R                  5      (       a`  U R                  R                  S5      nUS   U l         US   " US   6   U R                   (       d  [        U R                  5      (       a  M^  gggg! [
         a@  nU R                  SUS9  U R                  (       a  [        R                  " 5          SnANvSnAff = f)zg
Attempts to process the next command in the queue if one exists and the
driver is not currently busy.
r         error)	exceptionN)
r   lenr   popr   	Exceptionnotifyr   	traceback	print_exc)r   cmdes      r"   r0   DriverProxy._pumpR   s    
 ::3t{{#3#3++//!$CQDJ*AA	 ::3t{{#3#3:#3:
  *Gq1;;'')*s   B 
C6CCc                 t    SU;  d  US   c  U R                   US'   U R                  R                  " U40 UD6  g)z
Sends a notification to the engine from the driver.

@param topic: Notification topic
@type topic: str
@param kwargs: Arbitrary keyword arguments
@type kwargs: dict
r!   N)r   r   _notify)r   topickwargss      r"   r>   DriverProxy.notifya   s9     6&>#9!ZZF6NU-f-r%   c                 T    Xl         U R                   (       d  U R                  5         gg)zm
Called by the driver to indicate it is busy.

@param busy: True when busy, false when idle
@type busy: bool
N)r   r0   )r   busys     r"   setBusyDriverProxy.setBusyn   s     
zzJJL r%   c                     U R                   $ )z@
@return: True if the driver is busy, false if not
@rtype: bool
)r   r+   s    r"   isBusyDriverProxy.isBusyy   s    
 zzr%   c                 `    Xl         U R                  U R                  R                  U4U5        gz
Called by the engine to push a say command onto the queue.

@param text: Text to speak
@type text: unicode
@param name: Name to associate with the utterance
@type name: str
N)r   r4   r   say)r   textr!   s      r"   rR   DriverProxy.say   s&     "

4<<##dWd3r%   c                       U R                   S   u  pnXR                  R                  :X  a  OU R                   R	                  S5        MJ  U R
                  R                  5         g! [         a     M(  f = f)zU
Called by the engine to stop the current utterance and clear the queue
of commands.
r   N)r   
IndexErrorr   endLoopr<   r   stopr1   s       r"   rX   DriverProxy.stop   sm     "&++a.4 ll***KKOOA  	  s   A' '
A54A5c                 T    U R                  U R                  R                  X4U5        grQ   )r4   r   save_to_file)r   rS   filenamer!   s       r"   r[   DriverProxy.save_to_file   s!     	

4<<,,t.>Er%   c                 8    U R                   R                  U5      $ )z
Called by the engine to get a driver property value.

@param name: Name of the property
@type name: str
@return: Property value
@rtype: object
)r   getProperty)r   r!   s     r"   r_   DriverProxy.getProperty   s     ||''--r%   c                 R    U R                  U R                  R                  X45        g)z
Called by the engine to set a driver property value.

@param name: Name of the property
@type name: str
@param value: Property value
@type value: object
N)r4   r   setProperty)r   r!   values      r"   rb   DriverProxy.setProperty   s     	

4<<++d];r%   c                     U R                  U R                  R                  [        5       5        U R                  R                  5         g)z
Called by the engine to start an event loop, process all commands in
the queue at the start of the loop, and then exit the loop.
N)r4   r   rW   tupler   	startLoopr+   s    r"   
runAndWaitDriverProxy.runAndWait   s.    
 	

4<<''1 r%   c                     U(       a  U R                   R                  5         gU R                   R                  5       U l        g)z.
Called by the engine to start an event loop.
N)r   rg   iterater   r   useDriverLoops     r"   rg   DriverProxy.startLoop   s+     LL""$!\\113DNr%   c                     / U l         U R                  R                  5         U(       a  U R                  R                  5         OSU l        U R                  S5        g)z-
Called by the engine to stop an event loop.
NT)r   r   rX   rW   r   rK   rl   s     r"   rW   DriverProxy.endLoop   sA     LL  "!DNTr%   c                 P     [        U R                  5        g! [         a     gf = f)zg
Called by the engine to iterate driver commands and notifications from
within an external event loop.
N)nextr   StopIterationr+   s    r"   rk   DriverProxy.iterate   s%    
	  		s    
%%)	r   r   r   r   r   r   r   r   r   r'   )__name__
__module____qualname____firstlineno____doc__r#   r,   r4   r0   r>   rK   rN   rR   rX   r[   r_   rb   rh   rg   rW   rk   __static_attributes__ r%   r"   r   r      sY    (  D*.	
4 	F	.	<!4
r%   r   )r   r?   r   r   objectr   r{   r%   r"   <module>r}      s    
   [& [r%   