%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/speechd_config/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/speechd_config/__pycache__/config.cpython-312.pyc

�

�Ifl�����ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
mZejej d�ej"ej$ej&�ej(ej$�ejZdadad�Zd�Zd	�Zd
�Zd�Zd�ZGd
�d�ZGd�d�Zd�Z e!dk(re	jDe ��yy)�N)�
BaseDirectory�)�buildconfig�Fc�~�t|�tr,tjdt	j
|�z�yy)zZOutput information messages for the user on stdout
    and if desired, by espeak synthesisz	espeak %sN)�print�use_espeak_synthesis�os�system�shlex�quote)�msgs �7/usr/lib/python3/dist-packages/speechd_config/config.py�reportr0s-��
�#�J��
�	�	�+����C� 0�0�1��c�<�trtjd�yy)zBProduce a sound for the event 'input requested' used in question()zespeak "Type in"N)r	r
r�rr�input_audio_iconr7s���
�	�	�&�'�rc��	t|t�r|rd}nd}nt|�}t|dz|zdz�t	�t
st
d�}t
st�dk(r|St|t�r|dvry|d	vry
td���t|t�rt|�St|t�r|Std��)
z3Ask a simple question and suggest the default value�yes�noz [z] :�>r)r�y�Y�true�t�1T)r�n�N�false�f�0Fz#Unknown answer (type 'yes' or 'no')z"Invalid type for the default value)
�
isinstance�bool�strrr�dont_ask�input�len�int�	TypeError)�text�default�default_str�str_inps    r�questionr/<s�����g�t�$��#��"���g�,�K��t�d�{�;�&�u�,�-�����C�j�G���G���)��N�
���
&��;�;���?�?���=�>��
���
%��w�<��
���
%��N��@�A�Arc���t||�}||vrbttd|z��ttdt|�z��ttd�d�}|r
t||�}n|S||vr�b|S)z�Ask a question with suggested answers. If the answer typed is not
    in 'suggest', the user is notified and given an opportunity to correct
    his choicezRThe value you have chosen is not among the suggested values.
You have chosen '%s'.zThe suggested values are z#Do you want to correct your answer?T�r/r�_r%)r+r,�suggest�reply�corrects     r�question_with_suggested_answersr6`s���

�T�7�#�E�
�w�
��q�� �!�"�	#��q�,�s�7�|�;�<�=��1�B�C�T�J����T�7�+�E��L��w�
��Lrc
��t||�}||vr4ttd|�dt|�����t||�}||vr�4|S)zGAsk a question and repeat it until the answer typed in is in 'required'zYou have chosen 'z'. Please choose one of r1)r+r,�requiredr4s    r�question_with_required_answersr9qsK��
�T�7�#�E�
�x�
��q�E�3�x�=�Y�Z�[���w�'���x�
��Lrc
��tjtd���}|jdddddtd��	�|jd
ddddtd
��	�|jdddddtd��	�|jdddddtd��	�|jdddddtd��	�|jddddtd��	�|jddddtd��	�|jd d!ddtd"��	�|jd#d$ddtd%��	�|jd&d'd(dttd)��	�|jd*d+d,ddtd-��	�|jd.d/d0ddtd1��	�|jd2d3dtd4��5�|S)6z;Set up an argparser instance with all the options accepted.zRA simple tool for basic configuration of Speech Dispatcher and problem diagnostics)�descriptionz-uz--create-user-conf�create_user_configuration�
store_trueFz9Create Speech Dispatcher configuration for the given user)�dest�actionr,�helpz-cz--config-basic-settings-user�config_basic_settings_userz.Configure basic settings in user configurationz-Cz--config-basic-settings-system�config_basic_settings_systemz5Configure basic settings in system-wide configurationz-dz
--diagnostics�diagnosticsz(Diagnose problems with the current setupz-sz--test-spd-say�test_spd_sayz2Test connection to Speech Dispatcher using spd-sayz--test-festival�
test_festival�'Test whether Festival works as a serverz
--test-espeak�test_espeakz0Test whether Espeak works as a standalone binaryz--test-alsa�	test_alsazTest ALSA audio outputz--test-pulse�
test_pulsezTest Pulse Audio outputz-ez--espeakr	z!Use espeak to synthesize messagesz-nz
--dont-askr&z3Do not ask any questions, always use default valuesz-Dz--debug�debugz%Debug a problem and generate a reportz	--version�version� Print version and copyright info)r>r?r@)�argparse�ArgumentParserr2�add_argumentr	)�parsers r�setup_argparserQzs.��
�
$�
$��j�k�m�F�
����2�
(��u�
�J�
K��M�����<�
)�,��
�?�
@��B�����>�
+�L�%�
�F�
G��I�����o�M��U�
�9�
:��<�����.�^��U�
�C�
D��F����)���U�
�8�
9��;�����m�L��A�P�Q��S�
���
�K���A�6�7��9�
����\�,���";� <��>�
����j�/E��)=��6�7��9�����l�����H�I��K�����i�g����:�;��=�����)���5�6��8��Mrc��eZdZdZd�Zd�Zd�Zd�Zd�Zdd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Z		dd�Zd�Zd�Zdd�Zy)�TestszrTests of functionality of Speech Dispatcher and its dependencies
    and methods for determination of proper pathsc��d|_y�N)�festival_socket��selfs r�__init__zTests.__init__�s
��#��rc�l�tdtj�d��ttd�dz�y)rLz	spd-conf �
a$Copyright (C) %d-%d Brailcom, o.p.s.
This is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version. Please see COPYING for more details.

)i�i�N)rr�VERSIONr2rWs rrKz
Tests.version�s9����;�.�.�/�r�2�3��q�?�@�
��	rc�^�tjjtjd�S)z#Return user configuration directory�speech-dispatcher)r
�path�joinr�xdg_config_homerWs r�
user_conf_dirzTests.user_conf_dir�s���w�w�|�|�M�9�9�;N�O�Orc�"�tjS)z(Determine system configuration directory)r�
SPD_CONF_PATHrWs r�system_conf_dirzTests.system_conf_dir�s���(�(�(rc�\�tjj|j��S)z5Determine whether user configuration directory exists)r
r_�existsrbrWs r�user_conf_dir_existszTests.user_conf_dir_exists�s���w�w�~�~�d�0�0�2�3�3rc��tjtjtj�|_	|jj	tj
|�|f�y#tj$rI}|j\}}ttd||fz��ttd|z��Yd}~yd}~wwxYw)z�
        Try to connect to festival and determine whether it is possible.
        On success self.festival_socket is initialized with the opened socket.
        ztERROR: It was not possible to connect to Festival on the
given host and port. Connection failed with error %d : %s .z�Hint: Most likely, your Festival server is not running now
or not at the default port %d.

Try /etc/init.d/festival start or run 'festival --server' from the command line.NFT)
�socket�AF_INET�SOCK_STREAMrV�connect�
gethostbyname�error�argsrr2)rX�host�port�e�num�reasons      r�festival_connectzTests.festival_connect�s���
 &�}�}�V�^�^�V�=O�=O�P���
	�� � �(�(�&�*>�*>�t�*D�d�)K�L����|�|�	��F�F�M�S�&��1�?�BE�v��O�P�
Q��1�T�W[�[�\�
]���	�s�0A*�*C�=?C�Cc�*�|js|j�sy|jjtdd��t	|jjd��}d|vrt
td��yt
td��y)	zSTest whether festival works and contains working festival-freebsoft-utils.
        Fz(require 'speech-dispatcher)
�asciii�LPz"Festival contains freebsoft-utils.Tz�ERROR: Your Festival server is working but it doesn't seem
to load festival-freebsoft-utils. You need to install festival-freebsoft-utils
to be able to use Festival with Speech Dispatcher.)rVrv�send�bytesr%�recvrr2)rXr4s  r�festival_with_freebsoft_utilsz#Tests.festival_with_freebsoft_utils�s����#�#��(�(�*�����!�!�%�(H�'�"R�S��D�(�(�-�-�d�3�4���5�=��1�9�:�;���1�6�7�
8�rc�v�ddl}	|jd�y#t$rtt	d��YywxYw)z0Try whether python speechd library is installed.rN�speechdz�Python can't find the Speech Dispatcher library.
Is it installed? This won't prevent Speech Dispatcher to work, but no
Python applications like Orca will be able to use it.
Search for package like python-speechd, download and install it.FT)�	importlib�
import_module�ImportErrorrr2)rXr�s  r�python_speechd_in_pathzTests.python_speechd_in_path�sJ���	��#�#�I�.���
�	��1�D�E�
F��	�s��8�8c�B�tjjtjd�}d}|dk(rd}n|dk(rd}ntd��t
j|�s4tt|�d|�d	���ttd
|z�d�}|S|�d|��}tj|�r,ttd
|z��ttd��yttd�d�}|sttd��yttd|z��y)z]Try to play a sound through the standard playback utility for the
        given audio method.ztest.wavN�alsa�aplay�pulse�paplayz-Test for this audio system is not implementedz selected, but zT not installed. This might be a false
warning, but most likely sound is not working.z&Are you sure that %s audio is working?F� zCan't play audio via
     %szUYour audio doesn't seem to work, please fix audio first or choose
a different method.zDid you hear the sound?Tz�Please examine the above output from the sound playback
utility. If everything seems right, are you sure your audio is loud enough and
not muted in the mixer? Please fix your audio system first or choose a different
audio output method in configuration.zAudio output '%s' works)r
r_r`r�SPD_SOUND_DATA_PATH�NotImplementedError�shutil�whichrr2r/r)rX�type�wavfile�binaryr4�cmds      r�audio_try_playzTests.audio_try_play�s���'�'�,�,�{�>�>�z�J�����6�>��F�
�W�_��F�%�&U�V�V��|�|�F�#��1�59�6�C�D�
E��Q�G�$�N�O�QV�W�E��L���)��
�9�9�S�>��1�4�s�:�;�<��1���
����4�5�t�<����1�)�*�
+���1�.��5�6�7�rc��ttd��	tjd�rttd��yt	td�d�}|rttd��yttd��y)	z$Test Speech Dispatcher using spd_sayz'Testing Speech Dispatcher using spd_sayTz.spd-say -P important "Speech Dispatcher works"z\Can't execute the spd-say binary,
it is very likely that Speech Dispatcher is not installed.Fz9Did you hear the message about Speech Dispatcher working?z+Speech Dispatcher is installed and working!z8Speech Dispatcher is installed but there is some problem�rr2r
rr/)rX�hearing_tests  rrDzTests.test_spd_saysr��	�q�:�;�<���y�y�K�L��q�>�?�@��#�A�&a�$b�dh�i�L���q�F�G�H���q�S�T�U�rc��ttd��|j�}|sttd��yttd��y)rFz*Testing whether Festival works as a serverzFestival server is not working.Fz'Festival server seems to work correctlyT)rr2r})rX�rets  rrEzTests.test_festival,sC���q�=�>�?��0�0�2����1�6�7�8���1�>�?�@�rc��ttd��tjd�rttd��yttd��y)zTest the espeak utilityzTesting whether Espeak works�espeakzEspeak is installedTzKCan't execute the espeak binary, it is likely that espeak
is not installed.F)rr2r�r�rWs rrGzTests.test_espeak8sF��	�q�/�0�1��<�<��!��1�*�+�,���1���
�rc�N�ttd��|jd��S)zTest ALSA sound outputzTesting ALSA sound outputr��r��rr2r�rWs rrHzTests.test_alsaDs$���q�,�-�.��"�"��"�/�/rc�N�ttd��|jd��S)zTest Pulse Audio sound outputzTesting PULSE sound outputr�r�r�rWs rrIzTests.test_pulseIs$���q�-�.�/��"�"��"�0�0rNc��g}g}|r0|j�rd}ttd�d�}|r	ddiSd}nd}|sttd�d�sddiSd�}|dd|�r|j�r|dgz
}|d	d
|�r|j	�r|d	gz
}|dd|�r|j�r|dgz
}|d
d|�r|j
�r|d
gz
}ttd��|j�}	||||	d�S)zPerform a complete diagnosticsTz9Speech Dispatcher works. Do you want to skip other tests?�spd_say_workingFz�
Speech Dispatcher isn't running or we can't connect to it (see above),
do you want to proceed with other tests? (They can help to determine
what is wrong)c�D�|sy||vrttd|z�d�ryy)z3Ask the user whether to test a specific capability.FzDo you want to test the %s now?T)r/r2)�
identifier�name�listings   r�decide_to_testz)Tests.diagnostics.<locals>.decide_to_tesths+�����w�&��Q�@�4�G�H�$�O��r�festivalzFestival synthesizerr�zEspeak synthesizerr�zALSA sound systemr�zPulse Audio sound systemzJTesting whether Python Speech Dispatcher library is in path and importable)r��audio�synthesizers�python_speechd)	rDr/r2rErGrHrIrr�)
rX�speechd_running�output_modules�audio_output�working_modules�
working_audior��skipr��python_speechd_workings
          rrCzTests.diagnosticsNsB�����
��� � �"�"&����"]� ^� $�&���-�t�4�4�"'��#�O���A�����*�5�1�1�	��*�&<�n�M��!�!�#��J�<�/���(�$8�.�I����!��H�:�-���&�"5�|�D��~�~���&��)�
��'�#=�|�L���� ��'��*�
��q�]�^�_�!%�!<�!<�!>��$3�'�!0�$:�<�	<rc��ttd��d|vr.|drttd��nttd��d|vr#ttd�t|d�z�d|vr#ttd�t|d�z�d	|vr.|d	rttd
��nttd��ttd��y
)z,Write out diagnostics results using report()z

Diagnostics results:r�zSpeech Dispatcher is workingz-Speech Dispatcher not working through spd-sayr�z2Synthesizers that were tested and seem to work: %sr�z3Audio systems that were tested and seem to work: %sr�z-Python Speech Dispatcher module is importablezTPython Speech Dispatcher module not importable.
Either not installed or not in path.zEnd of diagnostics resultsN)rr2r%)rX�resultss  r�write_diagnostics_resultszTests.write_diagnostics_results�s���	�q���	���'��(�)��q�7�8�9��q�H�I�J��W�$��1�I�J��w�~�.�/�0�
1��g���1�J�K��w�w�'�(�)�
*��w�&��'�(��q�H�I�J��q�(�)�*��q�-�.�/rc�,�tjjtjj|j	�d��syttj|j	���dkDsytjjtjj|j	�d��sytjjtjj|j	�d��syy)z:Decide if the user configuration seems reasonably complete�speechd.confF��modules�clientsT)r
r_rgr`rbr(�listdirrWs r�!user_configuration_seems_completez'Tests.user_configuration_seems_complete�s����w�w�~�~�b�g�g�l�l�4�+=�+=�+?��P�Q���2�:�:�d�0�0�2�3�4�q�8���w�w�~�~�b�g�g�l�l�4�+=�+=�+?��K�L���w�w�~�~�b�g�g�l�l�4�+=�+=�+?��K�L��rc���ttd��|sttd�dddg�}ttd�d�}|r+t	j
d�t	j
d�n?ttd	��ttd
�d�}|sttd��t
jd�d
tjvrtjd
}nd}tjj|d�}tjj�}tjj|d|j|j|j fz�}|dk(r;ttd��t	j
d�}|j#�}nfttd��ttd��ttd�d�}|rd}nttd��|j%�}t
jd�sttd�d�}ttd��t	j
d�}	|	s+t	j
d�t	j
d�nttd��ttd��t
jd�ttd ��t	j
d!�t	j
d"|�d#|�d$|���t	j
d�t	j
d�t	j
d%|z�ttd&|z��y')(zvStart Speech Dispatcher in debugging mode, collect the debugging output
        and offer to send it to the developersz@Starting collecting debugging output, configuration and logfilesz<
Do you want to debug 'system' or  'user' Speech Dispatcher?�userrzdIt is necessary to kill the currently running Speech Dispatcher
processes. Do you want to do it now?T�killall speech-dispatcher�killall speech-dispatchzy
You decided not to kill running Speech Dispatcher processes.
Please make sure your Speech Dispatcher is not running now.z*Is your Speech Dispatcher not running now?z@Can't continue, please stop your Speech Dispatcher and try againr��TMPDIRz/tmp/z
speechd-debugzspeechd-debug-%d-%d-%d.tar.gzz7Speech Dispatcher will be started now in debugging modezspeech-dispatcher -D�3Warning: You must be root or under sudo to do this.zC
Please start your system Speech Dispatcher now with parameter '-D'z&Is your Speech Dispatcher running now?�Can't continuez5Speech Dispatcher failed to start, continuing anyway?FzTrying to speak some messagesz'spd-say "Speech Dispatcher debugging 1"z'spd-say "Speech Dispatcher debugging 2"z'spd-say "Speech Dispatcher debugging 3"z6Can't test Speech Dispatcher connection, can't connectzPlease wait (about 5 seconds)�z>Collecting debugging output and your configuration informationz	umask 077ztar -cz r�z > z	rm -rf %sz�
Please send %s to speechd-discuss@nongnu.org with
a short description of what you did. We will get in touch with you soon
and suggest a solution.N)rr2r9r/r
r�time�sleep�environr_r`�datetime�date�today�day�month�yearrbre)
rXr�r4�tmpdir�
debugdir_pathr��debugarchive_path�speechd_started�configure_directoryr�s
          r�debug_and_reportzTests.debug_and_report�s���	�q�S�T�U��1�!�5?�3@�28�6�8�:L�N�D�
��(�)�*.�0����I�I�1�2��I�I�/�0��1�?�@�
A��Q�K�L�d�S�E���q�[�\�]��
�
�1�
��r�z�z�!��Z�Z��)�F��F������V�_�=�
��}�}�"�"�$���G�G�L�L��1P�*.�(�(�D�J�J��	�	�)J�2K�L���6�>��1�N�O�P�"$�)�)�,B�"C�C�O�"&�"4�"4�"6���1�J�K�T��1�F�G�
H��Q�G�H�$�O�E��"&���q�)�*�+�"&�"6�"6�"8���
�
�1�
���Q�V�W���E�	�q�0�1�2��i�i�C�D����I�I�A�B��I�I�A�B��1�M�N�O��q�0�1�2��
�
�1�
��q�Q�R�T�
�	�	�+��
�	�	� �"5�7H�J�	K�
�	�	�-�.�
�	�	�+�,�
�	�	�+�
�-�.��q��/�/�0�	1r)�	localhosti")TNNrU)�__name__�
__module__�__qualname__�__doc__rYrKrbrerhrvr}r�r�rDrErGrHrIrCr�r�r�rrrrSrS�so��5�$��P�)�4��&�"�&�P�$
�
�0�
1�
BF��:<�x0�2� S1rrSc�N�eZdZdZdZdZdZd�Zd�Zd�Z	d�Z
dd�Zd�Zd	�Z
d
�Zy)�	ConfigurezNSetup user configuration and/or set basic options in user/system configurationNc��||_yrU)�test)rXr�s  rrYzConfigure.__init__s	����	rc�^�tj|jj��y)zRemove user configuration treeN)r��rmtreer�rbrWs r�remove_user_configurationz#Configure.remove_user_configurations���
�
�d�i�i�-�-�/�0rc��tj|dd��D]�}|j�D]�\}}||vs�d}|j�D]!}|dk(s|dk(r�||k(r
|dk7s�d}n|dz
}�#|dk(s�Gt	|t
�r
|rd	}n,|s*d
}n't	|t�rt|�}nt|�}t|dzz���t|d�
���y)z�Substitute the given options with given values.

        Arguments:
        configfile -- the file path of the configuration file as a string
        options -- a list of tuples (option_name, value)Tz.bak)�inplace�backupr�#�	r�rr�2z   r�)�endN)	�	fileinputr'�items�splitr#r$r)r%r)	rX�
configfile�options�line�opt�value�unknown�word�spd_vals	         r�options_substitutezConfigure.options_substitutes����O�O�J��V�L�&	%�D�%�m�m�o�$
%�
��U��$�;� �G� $�
�
��
)���#�:����$�!�S�[� '�!�|�*+�� %�#�q�L�G�
)��!�|�%�e�T�2�$�*-��%*�*-��'��s�3�&)�%�j�G�&)�%�j�G��c�E�k�G�3�4��C$
%�H�d��$�M&	%rc�Z�|jj�r�|jj�r=tt	d�d�}|stt	d��y|j
�n=tt	d�d�}|s|j
�ntt	d��y|jj�}tjtj|�tjd�}tj|�tj|jj�d|z�tj|jj��D]�\}}}|D]:}tjtj j#||�d|z��<|D]:}tjtj j#||�d	|z��<��tt	d
|jj�z��y)z2Create user configuration in the standard locationzLUser configuration already exists.
Do you want to rewrite it with a new one?Fz:Keeping configuration intact and continuing with settings.NzYUser configuration already exists, but it seems to be incomplete.
Do you want to keep it?z*Keeping configuration intact and aborting.ri�i�z User configuration created in %s)r�rhr�r/r2rr�rbr��copytreer�SPD_CONF_ORIG_PATHr
�umask�chmod�walkr_r`)	rXr4�config_rootr��root�dirs�files�dr!s	         rr<z#Configure.create_user_configurationFs����9�9�)�)�+��y�y�:�:�<� ��$-�".�/4�6����1�Y�Z�[���2�2�4� ��$�"�"�$����2�2�4��1�I�J�K���i�i�-�-�/������6�6��D�������
�����
������(�(�*�U�e�V�^�<�!#������)@�)@�)B�!C�	@��D�$���
@����������d�A�.�����?�
@��
@����������d�A�.�����?�
@�	@�	�q�3�d�i�i�6M�6M�6O�O�P�Qrc
�D�|dk(rttd��n9|dk(r)ttd��ttd��ntd��tddgd	��|_td
d�|_tdd
gd��|_ttd�d�}ttd�d�}ttd�d�}|dk(r9tjj|jj�d�}n=|dk(r8tjj|jj�d�}|j|j|j|j|||d��|dk(r�ttd�d�}|r�tj tjjt"j$d�tjjt&j(d��ttd|z��yyy)zAAsk for basic settings and rewrite them in the configuration filer�z/Configuring user settings for Speech Dispatcherrr�z1Configuring system settings for Speech Dispatcher�Invalid configuration typezDefault output module�	espeak-ng)r�r�r��flite�ivona�picozespeak-ng-mbrola-genericzespeak-mbrola-genericz
swift-genericzepos-genericzdtk-generic�ibmtts�cicero�kalizmary-generic�	baratinooznDefault language (two/three-letter iso language code like "en" or "cs", possibly with a region qualification.)zen-USzDefault audio output methodr�)r��libaor��ossz
pulse,alsazZDefault speech rate (on the scale of -100..100, 0 is default, 50 is faster, -50 is slower)r"zZDefault speech pitch (on the scale of -100..100, 0 is default, 50 is higher, -50 is lower)z`Default speech pitch range (on the scale of -100..100, 0 is default, 50 is higher, -50 is lower)r�)�
DefaultModule�DefaultLanguage�AudioOutputMethod�DefaultRate�DefaultPitch�DefaultPitchRangez�Do you want to have Speech Dispatcher automatically started from ~/.config/autostart ?
This is usually not necessary, most applications will start Speech Dispatcher automatically.Fzspeechd.desktopz
autostart/z�
Configuration written to %s
Basic configuration now complete. You might still need to fine tune it by
manually editing the configuration file above. Especially if you need to
use special audio settings, non-standard synthesizer ports etc.N)rr2�
ValueErrorr6�default_output_moduler/�default_language�default_audio_methodr
r_r`r�rbrer�r��copyr�SPD_DESKTOP_CONF_PATHrra)rXr��default_speech_rate�default_speech_pitch�default_speech_pitch_ranger��setup_autostarts       r�configure_basic_settingsz"Configure.configure_basic_settingsks���6�>��1�F�G�H�
�X�
��1�J�K�L��1�H�I�J��9�:�:�&E�#��
*�&+��"�!)�
A��!���%D�)��;�%=��!�
'�
�j�k���� (�
�j�k�� ��&.�
�p�q��&�"�
�6�>������d�i�i�&=�&=�&?��P�J�
�X�
������d�i�i�&?�&?�&A�>�R�J����
�26�2L�2L�48�4I�4I�6:�6O�6O�0C�1E�6P�!#�	$��6�>�&��`�a���O������G�G�L�L��!B�!B�DU�V��G�G�L�L��!>�!>��M��
�q�C�FP�	P�Q�R�
�rc�f�ttd��tjd�}|r�ttd|z��t	td�d�}|rWtjd�tjd�tjd�}|rttd��y	yy	y)
z$Start Speech Dispatcher in user-modez'Starting Speech Dispatcher in user-moder^�4Can't start Speech Dispatcher. Exited with status %dz�Perhaps this is because your Speech Dispatcher is already running.
Do you want to kill all running Speech Dispatchers and try again?Tr�r�zCan't start Speech DispatcherFr�)rX�errr4s   r�speechd_start_userzConfigure.speechd_start_user�s���	�q�:�;�<��i�i�+�,����1�K�c�Q�R�S��Q� E�F�GK�M�E���	�	�5�6��	�	�3�4��i�i� 3�4����1�<�=�>� ���rc���ttd��ttd��ttd�d�}|rmttd��tjd�ttd��tjd�}|rttd	|z��y
yttd��ttd�d�}|sttd
��y
y)z&Start Speech Dispatcher in system-moder�z)Starting Speech Dispatcher in system-modez=Is your system using an /etc/init.d/speech-dispatcher script?Tz9Stopping Speech Dispatcher in case any is running alreadyz"/etc/init.d/speech-dispatcher stopz<Starting Speech Dispatcher via /etc/init.d/speech-dispatcherz#/etc/init.d/speech-dispatcher startrFz]Do not know how to start system Speech Dispatcher,
you have to start it manually to continue.z'Have you started Speech Dispatcher now?r�)rr2r/r
r)rXr4r�s   r�speechd_start_systemzConfigure.speechd_start_system�s���	�q�F�G�P��q�<�=�>���Z�[������1�P�Q�R��I�I�:�;��1�S�T�U��)�)�A�B�C���q�O�RU�U�V�W���

�1�.�/�
0��Q�H�I�4�P�E���q�)�*�+��rc��ttd�dddg�}|dk(r#|j�|jd��n#|dk(r|jd��nt	d��ttd�d�}|st
td��y	|dk(r|j�}n|dk(r|j�}st
td
��|jj||jg|jg��}|jj|�|s5ttd�d
�}|r|jj|��y	y	y	)zJCreate a complete configuration, run diagnosis and if necessary, debuggingz?Do you want to create/setup a 'user' or 'system' configuration?r�rr�r�zFDo you want to start/restart Speech Dispatcher now and run some tests?Tz-Your configuration is now done but not testedNz%Your Speech Dispatcher is not running)r�r�r�zODo you want to run debugging now and send a request for help to the developers?F)r9r2r<rr
r/rrrr�rCrrr�r�)rX�speechd_typer4�started�results     r�complete_configzConfigure.complete_config�sS��6�
�O�P��V�X�&�(���6�!��*�*�,��)�)�v�)�6�
�X�
%��)�)�x�)�8��9�:�:���c�d�fj�k����1�D�E�F���v�%��1�1�3����)��3�3�5����1�<�=�>����&�&��04�0I�0I�/J�26�2L�2L�1M�'�O��	
�	�	�+�+�F�3���Q�p�q�"�$�E���	�	�*�*��*�=��r)r�)r�r�r�r�rrrrYr�r�r<rrrr"rrrr�r�sE��X� �������1�.%�`#R�JFR�P�,�2%>rr�c��t�}|j�}|ja|jat	�}t|�}|jsttd��|jr;|j�ttd�d�}|r|jd��yy|jr|jd��y|jr|jd��y|jr|j�y|jr|j�y|j r|j!�y|j"r|j%d��y|j&r|j%d��y|j(r"|j)�}|j+|�y|j,r|j/�y|jr|j
�yttd	�d�}|r|j1�yttd
�d�}|r"|j)�}|j+|�yttd��y)Nz&
Speech Dispatcher configuration tool
z,Do you want to continue with basic settings?Tr�r�rr�r�z4Do you want to setup a completely new configuration?z)Do you want to run diagnosis of problems?zwPlease run this command again and select what you want to do
or read the quick help available through '-h' or '--help'.)rQ�
parse_argsr&r	rSr�rKrr2r<r/rrArBrErDrGrHr�rIrCr�rJr�r")r�r��	configurer4r�s     r�mainr&s�����G�� � �"�G����H�"�7�7���7�D��$��I��?�?��q�;�<�=��(�(��+�+�-���I�J�D�Q����.�.�F�.�;��	�	+�	+��*�*��*�7�	�	-�	-��*�*��*�9�	�	�	�����	�	�	�����	�	�	�����	�	�	������(�	�	�	������)�	�	�	���� ���&�&�s�+�	�������	���������Q�R�TX�Y����%�%�'��Q�J�K�T�R�E���$�$�&���.�.�s�3��q�>�?�@r�__main__)#rMr�r��gettext�localer
r�rrj�sysr��xdgrrr�	setlocale�LC_ALL�bindtextdomain�GETTEXT_PACKAGE�	LOCALEDIR�
textdomainr2r	r&rrr/r6r9rQrSr�r&r��exitrrr�<module>r3s���(����
�	�
��
�
������������#������3�3�[�5J�5J�K�����;�.�.�/��O�O������2�(�
"B�H�"�(�Tb1�b1�H>�>�H>@�@�z���C�H�H�T�V��r

Zerion Mini Shell 1.0