%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/orca/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/orca/__pycache__/speech.cpython-312.pyc

�

g
fe)���dZdZdZdZdZdZddlZddlZdd	lm	Z	dd
lm
Z
ddlmZddlmZdd
l
mZddlmZe
j"�Zej'd�Zdadad�Zd�Zd�Zdd�Zd�Zd�Zdd�Zdd�Zdd�Zd�Z d�Z!d�Z"d d�Z#d�Z$y)!z�Manages the default speech server for orca.  A script can use this
as its speech server, or it can feel free to create one of its own.z$Id$z
$Revision$z$Date$z-Copyright (c) 2005-2009 Sun Microsystems Inc.�LGPL�N�)�debug)�logger)�settings)�speech_generator)�VoiceFamily)�ACSS�speechc��|syd}	tjd|���}tj}|r|jj|�a
tsE|jj�a
|r)d|g}tjtj|d�tstd|����y#t$rL	tj|�}n2#t$r&tjtj
�YnwxYwY��wxYw)Nzorca.z!SPEECH: Invalid speechServerInfo:Tz%ERROR: No speech server for factory: )
�	importlib�
import_module�	Exceptionr�printException�LEVEL_SEVEREr�speechServerInfo�SpeechServer�getSpeechServer�
_speechserver�printTokens�
LEVEL_INFO)�
moduleNamer�factory�tokenss    �-/usr/lib/python3/dist-packages/orca/speech.py�_initSpeechServerr2s������G�5��)�)�E�*��*>�?�� �0�0����,�,�<�<�=M�N�
���,�,�<�<�>�
��9�;K�L�F����e�.�.���=���?�
�|�L�M�M���%�5�	5��-�-�j�9�G���	5�� � ��!3�!3�4�	5��5�s5�B,�,	D�6C�D�,C;�8D�:C;�;D�Dc�z�tjtjdd�tr&tjtjdd�ytj
r2t
tdtj
�t
tdddg�	tj}t|tj�tr*dg}tjtj|d�n'd	}tjtj|d�tjtjd
d�y#t$rutj}|D]]}|tjk7s�	t|d�trn4�-#t$r&tjtj�Y�[wxYwY��wxYw)NzSPEECH: InitializingTzSPEECH: Already initialized�speechServerFactoryrzDefault Synthesizer�defaultz$SPEECH: Using speech server factory:zSPEECH: Not availablezSPEECH: Initialized)r�printMessagerrr�speechSystemOverride�setattrrrrr�speechFactoryModulesrrr)r�moduleNamesr�msgs    r�initr&Qs_��	���u�'�'�)?��F��
���5�+�+�-J�D�Q��
�$�$���/��1N�1N�O���,�/D�i�.P�Q�=��1�1�
��*�h�&?�&?�@��8�*�E��
���%�*�*�F�D�9�%��
���5�+�+�S�$�7�	���u�'�'�)>��E��%�	=��3�3��%�	=�J��X�9�9�9�=�%�j�$�7�$��%�� �=��(�(��);�);�<�=��
	=��	=�s6�*D<�<1F:�/F�F:�,F3�0F:�2F3�3F:�9F:c��d}tjtj|d�tjst�yt
�y)Nz SPEECH: Checking speech setting.T)rr rr�enableSpeech�shutdownr&)r%s r�checkSpeechSettingr*us2��
,�C�	���u�'�'��d�3�� � ��
���c��t|t�r8|j|j�}	t	|�}|||j<|St|t�rt|�dk(rt|d�St|t�rt|�Stj}t|tj�S#t
$rt	i�}Y��wxYw)Nrr)�
isinstancer
�get�FAMILYr	r�list�len�dictr�voices�
DEFAULT_VOICE)�acss�familyr3s   r�
__resolveACSSr7~s����$������$�+�+�&��	%� ��(�F�#��T�[�[����	�D�$�	�C��I��N��D��G�}��	�D�$�	��D�z�������F�8�1�1�2�3�3���	%� ��_�F�	%�s�B<�<C�Cc��tjrytrtj||�y|D]O\}}d|j�d�}tjt
j|d�tj|��Qy)N�SPEECH OUTPUT: '�'T)
r�
silenceSpeechr�sayAll�	utterancerr r�log�info)�utteranceIterator�progressCallback�contextr5�logLines     rr<r<�so����������.�0@�A�0�	�O�W�d�(��):�):�(;�1�=�G����u�/�/��$�?��H�H�W��	r+c�\�tsCd|�d|��}tjtj|d�tj|�yt
tjjtj��}	|jt|��t|�}d|�d|��}tjtj|d�tj|||�y#t$r7}d|�d|��}tjtj|d�Yd}~��d}~wwxYw)z2Speaks the individual string using the given ACSS.r9�' TNz%SPEECH: Exception updated voice with z: )rrr rr>r?r
rr3r.r4�updater7r�speak)�textr5�	interruptrC�voice�errorr%�
resolvedVoices        r�_speakrM�s����$�T�F�"�T�F�3��
���5�+�+�W�d�;�����������$�$�X�%;�%;�<�=�E�8�
���]�4�(�)�
"�%�(�M��T�F�"�]�O�
4�C�	���u�'�'��d�3�����m�Y�7���8�5�d�V�2�e�W�E��
���5�+�+�S�$�7�7��8�s�C+�+	D+�4-D&�&D+c�X�tjrytttj
tjtf}d}t||�s3tjtj|t|�zdd�ytrEdtj�tz
d�d�}tjtj|d�tj�at|t�r.d|�d|��}tjtj|d�n+d	|d
|g}tjtj|d�t|t�r
t|||�t|t�syg}|}|�t|�}|D�]{}	t|	|�s3tjtj|t|	�zdd��Ct|	t�rt!|	||��at|	t�rt#|	�s�}|j%|	���|s��t|�}
g}t|	tj
�r)|dr�|ddj'�r�|dxxdz
cc<nvt|	t�rf|
j)|	�|�|
}|
|k(r��d
|
d|g}tjtj|d�|j%|j+��|rdj-|�}t|||�|
}|}��~|rdj-|�}t|||�yy)z�Speaks the given content.  The content can be either a simple
    string or an array of arrays of objects returned by a speech
    generator.Nz$SPEECH: Bad content sent to speak():T�SPEECH: Last spoke �.4f� seconds agozSPEECH: Speak 'z' acss: z
SPEECH: Speakz, acss:����.zSPEECH: New voicez != active voice� )rr;�strr0r�Pause�	LineBreakr
r-rr r�
_timestamp�timerrMrGr1�append�isalnumrF�pop�join)
�contentr5rI�
validTypesrKr%r�toSpeak�activeVoice�element�newVoice�newItemsToSpeak�strings
             rrGrG�s���
�����t�-�3�3�"�,�,�d�4�J�2�E��g�z�*�
���5�+�+�U�S��\�-A�4��N���#�D�I�I�K�*�$<�S�#A��N��
���5�+�+�S�$�7�����J��'�3����y����7��
���5�+�+�S�$�7�!�7�I�t�<��
���%�*�*�F�D�9��'�3���w��i�(��g�t�$���G��K����4�j���&���'�:�.����u�/�/���W��1E�t�T�R�
���
&��'�4��+�
���
%��7�|����w�'�
��D�z�H� �O��'�#3�#9�#9�:��2�;�7�2�;�r�?�#:�#:�#<��B�K�3�&�K��G�T�*�����(��&�"*�K��{�*��-�x�9K�[�Y���!�!�%�"2�"2�F�D�A��&�&�w�{�{�}�5�����'�*���v�{�I�6�"�K�%�G�9&�<����'�"���v�{�I�.�r+c�"�tjrytrEdtj�tz
d�d�}t	j
tj|d�tj�a|j�}|j�}t|�}|�d|��}d|j��d|��}t	j
tj|d�tj|�trtj||�yy)	zeSpeaks a key event immediately.

    Arguments:
    - event: input_event.KeyboardEvent to speak.
    NrOrPrQTrTr9rE)rr;rXrYrr r�
getKeyName�getLockingStateStringr7�stripr>r?r�
speakKeyEvent)�eventr5r%�keyname�lockingStateStringrCs      rrjrj�s��������#�D�I�I�K�*�$<�S�#A��N��
���5�+�+�S�$�7�����J���� �G��4�4�6�����D�
�I�Q�)�*�
+�C� �����
�R��v�6�G�	���u�'�'��$�7��H�H�W����#�#�E�4�0�r+c���tjrytrEdtj�tz
d�d�}t	j
tj|d�tj�at|�}d|�d�|g}t	jtj|d�tjd|�d��trtj||��yy)	aSSpeaks a single character immediately.

    Arguments:
    - character: text to be spoken
    - acss:      acss.ACSS instance; if None,
                 the default voice settings will be used.
                 Otherwise, the acss settings will be
                 used to augment/override the default
                 voice settings.
    NrOrPrQTr9r:)r5)
rr;rXrYrr rr7rr>r?r�speakCharacter)�	characterr5r%rs    rroros��������#�D�I�I�K�*�$<�S�#A��N��
���5�+�+�S�$�7�����J����D� ���1�-�t�
4�F�	���e�&�&���5��H�H��	�{�!�
,�-���$�$�Y�T�$�:�r+c�>�d}trtj�}|S�N)r�getInfo)r?s rrsrs.s���D���$�$�&���Kr+c�:�trtj�yyrr)r�stop�r+rruru5s�������r+c��tjtjdd�trtj	�dayy)NzSPEECH: Shutting downT)rr rr�shutdownActiveServersrvr+rr)r)9s4��	���u�'�'�)@�$�G���+�+�-��
�r+c�>�trtj||�yyrr)r�reset)rHr5s  rrzrz@s������D�$�'�r+c��tSrr)rrvr+rrrDs���r+rr)NT)NN)%�__doc__�__id__�__version__�__date__�
__copyright__�__license__r
rY�rrrr�speechserverr	r5r
�	getLogger�_logger�newLogr>rrXrr&r*r7r<rMrGrjrorsrur)rzrrvr+r�<module>r�s���(G�������?�
���������%��
�&�
�
�
��
�n�n�X����
��
�N�>"F�H�4�"	�8�*F/�P1�6;�8���(�r+

Zerion Mini Shell 1.0