
    yh\                     6    S SK Jr  SSKrSSKr " S S\5      rg)   )driver    Nc                   |    \ rS rSrSrSS jrS rS rS rSS jr	S	 r
SS
 jrS rS rS rS rSS jrS rS rSrg)Engine   aN  
@ivar proxy: Proxy to a driver implementation
@type proxy: L{DriverProxy}
@ivar _connects: Array of subscriptions
@type _connects: list
@ivar _inLoop: Running an event loop or not
@type _inLoop: bool
@ivar _driverLoop: Using a driver event loop or not
@type _driverLoop: bool
@ivar _debug: Print exceptions or not
@type _debug: bool
Nc                     [         R                  " [        R                  " U 5      X5      U l        0 U l        SU l        SU l        X l        g)z
Constructs a new TTS engine instance.

@param driverName: Name of the platform specific driver to use. If
    None, selects the default driver for the operating system.
@type: str
@param debug: Debugging output enabled or not
@type debug: bool
FTN)r   DriverProxyweakrefproxy	_connects_inLoop_driverLoop_debug)self
driverNamedebugs      F/var/www/auris/envauris/lib/python3.13/site-packages/pyttsx3/engine.py__init__Engine.__init__   s<     ''d(;ZO
    c                     U R                   R                  U/ 5       H  n U" S0 UD6  M     g! [         a-    U R                  (       a  [        R
                  " 5          MD   MG  f = f)z
Invokes callbacks for an event topic.

@param topic: String event name
@type topic: str
@param kwargs: Values associated with the event
@type kwargs: dict
N )r   get	Exceptionr   	traceback	print_exc)r   topickwargscbs       r   _notifyEngine._notify%   sV     ..$$UB/B*V 0  *;;'') *s   .0A%$A%c                 d    U R                   R                  U/ 5      nUR                  U5        XS.$ )a  
Registers a callback for an event topic. Valid topics and their
associated values:

started-utterance: name=<str>
started-word: name=<str>, location=<int>, length=<int>
finished-utterance: name=<str>, completed=<bool>
error: name=<str>, exception=<exception>

@param topic: Event topic name
@type topic: str
@param cb: Callback function
@type cb: callable
@return: Token to use to unregister
@rtype: dict
)r   r   )r   
setdefaultappend)r   r   r   arrs       r   connectEngine.connect5   s.    " nn''r2

2))r   c                     US   n U R                   U   nUR                  US   5        [        U5      S:X  a  U R                   U	 gg! [         a     gf = f)zq
Unregisters a callback for an event topic.

@param token: Token of the callback to unregister
@type token: dict
r   Nr   r   )r   KeyErrorremovelen)r   tokenr   r%   s       r   
disconnectEngine.disconnectJ   sb     g	..'C 	

5;s8q=u%   		s   A 
AAc                 H    US:X  a  gU R                   R                  X5        g)z
Adds an utterance to speak to the event queue.

@param text: Text to speak
@type text: unicode
@param name: Name to associate with this utterance. Included in
    notifications about this utterance.
@type name: str
Nz%Argument value can't be none or empty)r   say)r   textnames      r   r0   
Engine.sayZ   s     4<:JJNN4&r   c                 8    U R                   R                  5         g)z9
Stops the current utterance and clears the event queue.
N)r   stopr   s    r   r5   Engine.stopi   s     	

r   c                 <    U R                   R                  XU5        g)a  
Adds an utterance to speak to the event queue.

@param text: Text to speak
@type text: unicode
@param filename: the name of file to save.
@param name: Name to associate with this utterance. Included in
    notifications about this utterance.
@type name: str
N)r   save_to_file)r   r1   filenamer2   s       r   r9   Engine.save_to_fileo   s     	

5r   c                 6    U R                   R                  5       $ )zT
@return: True if an utterance is currently being spoken, false if not
@rtype: bool
)r   isBusyr6   s    r   r=   Engine.isBusy|   s    
 zz  ""r   c                 8    U R                   R                  U5      $ )a  
Gets the current value of a property. Valid names and values include:

voices: List of L{voice.Voice} objects supported by the driver
voice: String ID of the current voice
rate: Integer speech rate in words per minute
volume: Floating point volume of speech in the range [0.0, 1.0]

Numeric values outside the valid range supported by the driver are
clipped.

@param name: Name of the property to fetch
@type name: str
@return: Value associated with the property
@rtype: object
@raise KeyError: When the property name is unknown
)r   getProperty)r   r2   s     r   r@   Engine.getProperty   s    $ zz%%d++r   c                 :    U R                   R                  X5        g)a  
Adds a property value to set to the event queue. Valid names and values
include:

voice: String ID of the voice
rate: Integer speech rate in words per minute
volume: Floating point volume of speech in the range [0.0, 1.0]

Numeric values outside the valid range supported by the driver are
clipped.

@param name: Name of the property to fetch
@type name: str
@param: Value to set for the property
@rtype: object
@raise KeyError: When the property name is unknown
N)r   setProperty)r   r2   values      r   rC   Engine.setProperty   s    $ 	

t+r   c                     U R                   (       a  [        S5      eSU l         SU l        U R                  R	                  5         g)z
Runs an event loop until all commands queued up until this method call
complete. Blocks during the event loop and returns when the queue is
cleared.

@raise RuntimeError: When the loop is already running
run loop already startedTN)r   RuntimeErrorr   r   
runAndWaitr6   s    r   rI   Engine.runAndWait   s6     <<9::

r   c                     U R                   (       a  [        S5      eSU l         Xl        U R                  R	                  U R                  5        g)aa  
Starts an event loop to process queued commands and callbacks.

@param useDriverLoop: If True, uses the run loop provided by the driver
    (the default). If False, assumes the caller will enter its own
    run loop which will pump any events for the TTS engine properly.
@type useDriverLoop: bool
@raise RuntimeError: When the loop is already running
rG   TN)r   rH   r   r   	startLoop)r   useDriverLoops     r   rL   Engine.startLoop   s<     <<9::(

T--.r   c                     U R                   (       d  [        S5      eU R                  R                  U R                  5        SU l         g)zP
Stops a running event loop.

@raise RuntimeError: When the loop is not running
run loop not startedFN)r   rH   r   endLoopr   r6   s    r   rQ   Engine.endLoop   s6     ||566

4++,r   c                     U R                   (       d  [        S5      eU R                  (       a  [        S5      eU R                  R	                  5         g)z=
Must be called regularly when using an external event loop.
rP   z$iterate not valid in driver run loopN)r   rH   r   r   iterater6   s    r   rT   Engine.iterate   s<     ||566EFF

r   )r   r   r   r   r   )NF)N)T)__name__
__module____qualname____firstlineno____doc__r   r    r&   r-   r0   r5   r9   r=   r@   rC   rI   rL   rQ   rT   __static_attributes__r   r   r   r   r      sM    "* **& '6#,(,( / 	r   r   ) r   r   r
   objectr   r   r   r   <module>r^      s      VV Vr   