Mini Shell

Direktori : /usr/lib/python3.6/site-packages/simpleline/render/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/simpleline/render/__pycache__/prompt.cpython-36.pyc

3

<�Zc+�@s:ddlmZmZmZddlZejd�ZGdd�de�ZdS)�)�C_�N_�_NZ
simplelinec@s�eZdZdZed�Zed�Zedd�Zed�Z	edd�Z
ed�Zedd	�Zed
�Z
edd�Zed�Zefd
d�Zdd�Zdd�Zdd�Ze
fdd�Zefdd�Ze	fdd�Zefdd�Zdd�Zdd �Zd!S)"�Promptz.Class to create a prompt message with options.z&Please make a selection from the above�ENTERzTUI|Spoke Navigation�qzto quit�czto continue�rz
to refresh�hzto helpcCs||_t�|_dS)z[
        :param message: the message of the prompt
        :type message: str|None
        N)�message�dict�options)�selfr�r�/usr/lib/python3.6/prompt.py�__init__4szPrompt.__init__cCs
||_dS)zsSet the prompt message.

        :param message: the message of the prompt
        :type message: str|None
        N)r)rrrrr�set_message<szPrompt.set_messagecCs&||jkrtjd||�||j|<dS)aAdd an option to the prompt.
        Causes a warning if the option already exists.

        :param key: the key for choosing the option
        :type key: str

        :param description: the description of the option
        :type description: str
        z+The option '%s' does already exist in '%s'.N)r
�log�warning)r�key�descriptionrrr�
add_optionDs

zPrompt.add_optioncCs&||jkrtjd||�||j|<dS)aUpdate an option in the prompt.
        Causes a warning if the option does not exist.

        :param key: the key for choosing the option
        :type key: str

        :param description: the description of the option
        :type description: str
        z'The option '%s' does not exist in '%s'.N)r
rr)rrrrrr�
update_optionSs

zPrompt.update_optioncCs.tj|jkr|jtj|�n|jtj|�dS)zAdd the option to refresh.N)r�REFRESHr
rr)rrrrr�add_refresh_optionbszPrompt.add_refresh_optioncCs.tj|jkr|jtj|�n|jtj|�dS)zAdd the option to continue.N)r�CONTINUEr
rr)rrrrr�add_continue_optioniszPrompt.add_continue_optioncCs.tj|jkr|jtj|�n|jtj|�dS)zAdd the option to quit.N)r�QUITr
rr)rrrrr�add_quit_optionpszPrompt.add_quit_optioncCs.tj|jkr|jtj|�n|jtj|�dS)zAdd the option to help.N)r�HELPr
rr)rrrrr�add_help_optionwszPrompt.add_help_optioncCs|jj|d�S)z�Remove an option with the given key.

        :param key: the key of the option
        :type key: str

        :return: the removed option
        :rtype: str|None
        N)r
�pop)rrrrr�
remove_option~s	zPrompt.remove_optioncsv�jr�jrdSg}�jr.|jt�j���jrh�fdd�t�jj��D�}ddj|�}|j|�dj|�dS)z/Return the string representation of the prompt.�cs"g|]}d|t�j|�f�qS)z'%s' %s)rr
)�.0r)rrr�
<listcomp>�sz"Prompt.__str__.<locals>.<listcomp>z[%s]z, � z: )rr
�appendr�sorted�keys�join)r�partsZopt_listZopt_strr)rr�__str__�s

zPrompt.__str__N)�__name__�
__module__�__qualname__�__doc__rZDEFAULT_MESSAGErrrZQUIT_DESCRIPTIONrZCONTINUE_DESCRIPTIONrZREFRESH_DESCRIPTIONrZHELP_DESCRIPTIONrrrrrrrr r"r,rrrrrs*



r)	Zsimpleline.utils.i18nrrrZloggingZ	getLoggerr�objectrrrrr�<module>s