%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /snap/core20/current/usr/share/subiquity/subiquitycore/__pycache__/
Upload File :
Create Path :
Current File : //snap/core20/current/usr/share/subiquity/subiquitycore/__pycache__/controller.cpython-38.pyc

U

K��^�@sVddlmZmZddlZe�d�ZGdd�de�ZGdd�de�ZGdd	�d	e�Z	dS)
�)�ABC�abstractmethodNzsubiquitycore.controllerc@seZdZdZdS)�Skipz@Raise this from a controller's start_ui method to skip a screen.N)�__name__�
__module__�__qualname__�__doc__�r	r	�0/usr/share/subiquity/subiquitycore/controller.pyrsrc@s�eZdZdZgZdZdd�Zdd�Zdd�Ze	d	d
��Z
edd��Ze	d
d��Z
dd�Zdd�Zdd�Zddd�Zdd�Zddd�ZdS)�BaseControllerzBase class for controllers.NcCs�t|�jdtd��|_|j|_|j|_|j|_||_|jjj	|jdd�|_|j
�|ji�|_
|jdk	r|t
|jj|j�|_dS)NZ
Controller�DEBUG)Z
childlevel)�typer�len�nameZui�signalZopts�app�contextZchildZanswers�get�
model_name�getattrZ
base_modelZmodel)�selfrr	r	r
�__init__s
zBaseController.__init__cCs8g}|jD]\}}|�|t||�f�q
|j�|�dS)z6Defines signals associated with controller from model.N)�signals�appendrrZconnect_signals)rrZsig�cbr	r	r
�register_signals*szBaseController.register_signalscCsdS)aGCalled just before the main loop is started.

        At the time this is called, all controllers and models and so on
        have been created. This is when the controller should start
        interacting with the outside world, e.g. probing for network
        devices or start making connections to the snap store.
        Nr	�rr	r	r
�start1szBaseController.startcCsdS�Nr	rr	r	r
�cancel;szBaseController.cancelcCs$|jjj}t|t�r|j}q
||kSr)rZcontrollersZcur�
isinstance�RepeatedController�orig)r�instr	r	r
�showing?s

zBaseController.showingcCsdS)z_Start running this controller's UI.

        This method should call self.ui.set_body.
        Nr	rr	r	r
�start_uiFszBaseController.start_uicCsdS)aStop running this controller's UI.

        This method doesn't actually need to remove this controller's UI
        as the next one is about to replace it, it's more of a hook to
        stop any background tasks that can be stopped when the UI is not
        running.
        Nr	rr	r	r
�end_uiMszBaseController.end_uicCsdSrr	rr	r	r
�	serializeVszBaseController.serializecCs|dk	rtd�|���dS)Nz missing deserialize method on {})�	Exception�format)r�datar	r	r
�deserializeYszBaseController.deserialize�ccs�|��D]~\}}t|d�||�d�}|dkrBt|d�|�dd��}t||�}ddlm}	||�}t|j|	�rz|j�d|�||_dVqdV|j	D]}
|
�
�q�|��|r�|jj
s�td��|�d�dS)	Nz_action_clean_{}_{}z_action_clean_{}cSs|Srr	)�xr	r	r
�<lambda>e�z1BaseController._enter_form_data.<locals>.<lambda>r)�SelectorZselectzanswers left form invalid!)�itemsrr)Zsubiquitycore.ui.selectorr0r ZwidgetZ_emit�value�_fieldsZvalidateZ	validatedZdone_btnZenabledr(Z_click_done)rZformr*ZsubmitZclean_suffix�k�v�cZfieldr0Zbfr	r	r
�_enter_form_data`s.
�


zBaseController._enter_form_dataccs|D]}|�|�EdHqdSr)Z_answers_action)rZactions�actionr	r	r
�_run_actionsvszBaseController._run_actionscCsV|dkrd|jj}zt|�Wntk
r6YdSX|jj�||j||d�dS)Ng�������?g�������?)rZscale_factor�next�
StopIterationZaio_loopZ
call_later�
_run_iterator)r�itZdelayr	r	r
r<zszBaseController._run_iterator)r,)N)rrrrrrrrrrr�propertyr$r%r&r'r+r7r9r<r	r	r	r
rs$



	
rc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
r!cCs(d�|j|�|_||_||_|j|_dS)Nz{}-{})r)rr"�indexr)rr"r?r	r	r
r�szRepeatedController.__init__cCsdSrr	rr	r	r
r�sz#RepeatedController.register_signalscCs|j�|j�dSr)r"r%r?rr	r	r
r%�szRepeatedController.start_uicCs|j��dSr)r"rrr	r	r
r�szRepeatedController.cancelN)rrrrrr%rr	r	r	r
r!�sr!)
�abcrrZloggingZ	getLogger�logr(rrr!r	r	r	r
�<module>s

k

Zerion Mini Shell 1.0