HOME


Mini Shell 1.0
DIR: /snap/core20/2571/usr/share/subiquity/subiquitycore/ui/__pycache__/
Upload File :
Current File : //snap/core20/2571/usr/share/subiquity/subiquitycore/ui/__pycache__/interactive.cpython-38.pyc
U

K��^�
�@s�dZddlmZddlZddlZddlmZmZddlm	Z	ddl
mZe�d�Z
Gdd	�d	e�ZGd
d�de�ZGdd
�d
e�Zeed�Zeed�ZGdd�de�ZGdd�de	�ZGdd�de�ZdS)z Re-usable input widgets
�)�partialN)�Edit�IntEdit)�
WidgetWrap)�Selectorzsubiquitycore.ui.inputc@s*eZdZdZedd��Zejdd��ZdS)�StringEditorzH Edit input class

    Attaches its result to the `value` accessor.
    cCs|��S�N)Z
get_edit_text��self�r�4/usr/share/subiquity/subiquitycore/ui/interactive.py�value)szStringEditor.valuecCs|�|�dSr)�
set_edit_text)r
r
rrrr
-sN)�__name__�
__module__�__qualname__�__doc__�propertyr
�setterrrrrr#s

rcs"eZdZdZd�fdd�	Z�ZS)�PasswordEditorz( Password input prompt with masking
    �*cst�j|d�dS)N)�mask)�super�__init__)r
r��	__class__rrr5szPasswordEditor.__init__)r�rrrrr�
__classcell__rrrrr2srcs*eZdZdZd�fdd�	Zdd�Z�ZS)�RestrictedEditorz+Editor that only allows certain characters.Ncst���t�|�|_dSr)rr�re�compile�matcher)r
Zallowedrrrr<s
zRestrictedEditor.__init__cCst|�dko|j�|�dk	S)N�)�lenr!�match)r
Zchrrr�
valid_char@szRestrictedEditor.valid_char)N)rrrrrr%rrrrrr9srz[^:,=]z[-a-zA-Z0-9_.@+=]cs eZdZdZ�fdd�Z�ZS)�UsernameEditorz, Username input prompt with input rules
    csX|j|dk	rt��||�S|�|�d}d}|dkrJt�||�dkrJdSt��||�S)z+ restrict what chars we allow for username Nrz[a-z_][a-z0-9_-]*�F)Z_command_mapr�keypressZinsert_text_resultrr$)r
�size�keyZnew_textZusernamerrrr(LszUsernameEditor.keypress)rrrrr(rrrrrr&Hsr&cs<eZdZdZd�fdd�	Zedd��Zejdd��Z�ZS)	�
IntegerEditorz IntEdit input class
    rcst|d�|_t��|j�dS)N)�default)r�_editrr)r
r,rrrr[szIntegerEditor.__init__cCs
|j��Sr)r-r
r	rrrr
_szIntegerEditor.valuecCs|j�t|��Sr)r-r�str)r
�valrrrr
cs)r)	rrrrrrr
rrrrrrr+Xs
r+cs eZdZdZ�fdd�Z�ZS)�YesNoz Yes/No selector
    cs td�td�g}t��|�dS)NZYesZNo)�_rr)r
ZoptsrrrrkszYesNo.__init__rrrrrr0hsr0)r�	functoolsrZloggingrZurwidrrZsubiquitycore.ui.containerrZsubiquitycore.ui.selectorrZ	getLogger�logrrrZRealnameEditorZEmailEditorr&r+r0rrrr�<module>s