/snap/core20/2866/usr/share/subiquity/subiquitycore/__pycache__
Edit: /snap/core20/2866/usr/share/subiquity/subiquitycore/__pycache__/controller.cpython-38.pyc (5321B)
U
K^ @ sV d dl mZmZ d dlZedZG dd deZG dd deZG dd d eZ dS )
)ABCabstractmethodNzsubiquitycore.controllerc @ s e Zd ZdZdS )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.pyr s r c @ s e Zd ZdZg ZdZdd Zdd Zdd Ze d d
Z
edd Ze d
d Z
dd Zdd Zdd ZdddZdd ZdddZdS )BaseControllerzBase class for controllers.Nc C s t | jd td | _|j| _|j| _|j| _|| _| jjj | jdd| _|j
| ji | _
| jd k r|t
| jj| j| _d S )NZ
ControllerDEBUG)Z
childlevel)typer lennameZuisignalZoptsappcontextZchildZanswersget
model_namegetattrZ
base_modelZmodel)selfr r r r
__init__ s
zBaseController.__init__c C s8 g }| j D ]\}}||t| |f q
| j| dS )z6Defines signals associated with controller from model.N)signalsappendr r Zconnect_signals)r r Zsigcbr r r
register_signals* s zBaseController.register_signalsc C s dS )aG Called 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 r r r r
start1 s zBaseController.startc C s d S Nr r r r r
cancel; s zBaseController.cancelc C s$ | j jj}t|tr|j}q
|| kS r )r ZcontrollersZcur
isinstanceRepeatedControllerorig)r instr r r
showing? s
zBaseController.showingc C s dS )z_Start running this controller's UI.
This method should call self.ui.set_body.
Nr r r r r
start_uiF s zBaseController.start_uic C s dS )a Stop 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 r r r r
end_uiM s zBaseController.end_uic C s d S r r r r r r
serializeV s zBaseController.serializec C s |d k rt d| d S )Nz missing deserialize method on {}) Exceptionformat)r datar r r
deserializeY s zBaseController.deserialize c c s | D ]~\}}t| d||d }|d krBt| d|dd }t||}ddlm} ||}t|j| rz|jd| ||_d V qd V |j D ]}
|
q| |r|jj
std|d d S ) Nz_action_clean_{}_{}z_action_clean_{}c S s | S r r )xr r r
e z1BaseController._enter_form_data..r )SelectorZselectzanswers left form invalid!)itemsr r) Zsubiquitycore.ui.selectorr0 r ZwidgetZ_emitvalue_fieldsZvalidateZ validatedZdone_btnZenabledr( Z_click_done)r Zformr* ZsubmitZclean_suffixkvcZfieldr0 Zbfr r r
_enter_form_data` s.
zBaseController._enter_form_datac c s |D ]}| |E d H qd S r )Z_answers_action)r Zactionsactionr r r
_run_actionsv s zBaseController._run_actionsc C sV |d krd| j j }zt| W n tk
r6 Y d S X | j j|| j||d d S )Ng?g?)r Zscale_factornext
StopIterationZaio_loopZ
call_later
_run_iterator)r itZdelayr r r
r<