U
K��^w% � @ sv d Z ddlmZ ddlZddlmZmZmZmZm Z
mZmZm
Z
mZ ddlmZ ddlmZmZ ddlmZ ddlmZ dd lmZ e�d
�Zdd� ZeG d
d� d��Z edddddddddddddddddd d!d"d#d$g�Zd%d&� ZeG d'd(� d(��Z d)d*� eedg�B D �Z!d+d,� Z"d-d.� Z#d/d0� Z$d@d3d4�Z%G d5d6� d6e
�Z&G d7d8� d8e�Z'dAd:d;�Z(d<d=� Z)G d>d?� d?e�Z*dS )Bz UI utilities � )�
partialmethodN) �ACTIVATE�AttrMap�CompositeCanvas�connect_signal�Padding�SelectableIcon�Text�WidgetDecoration�
WidgetDisable)� other_btn)�ListBox�Pile)�Stretchy)�TableRow)�widget_widthzsubiquitycore.ui.utilsc
C s� d}t d|�D ]�}t| d�|�tt|d�� t| d�|�tt|d�� t| d�|�ttd||d �� t| d
�|�ttdd|fd�� t| d
�|�ttdd|fd�� t| d�|�ttdd|fd�� q| S )aT Decorator for generating useful padding methods
Loops through and generates methods like:
Padding.push_1(Widget)
Sets the left padding attribute by 1
Padding.pull_24(Widget)
Sets right padding attribute by 24.
Padding.center_50(Widget)
Provides center padding with a relative width of 50
�d � zpush_{})�leftzpull_{})�rightzfixed_{}�center)�align�width� min_widthz center_{}�relative)r r zleft_{}r zright_{}r )�range�setattr�formatr �_Padding)�clsZ
padding_count�i� r! �./usr/share/subiquity/subiquitycore/ui/utils.py�
apply_padders* s4 ��������r# c @ s e Zd ZdZee�ZdS )r au Padding methods
.. py:meth:: push_X(:class:`urwid.Widget`)
This method supports padding the left side of the widget
from 1-99, for example:
.. code::
Padding.push_20(Text("This will be indented 20 columns")
.. py:meth:: pull_X(:class:`urwid.Widget`)
This method supports padding the right side of the widget
from 1-99, for example:
.. code::
Padding.pull_20(Text("This will be right indented 20 columns")
.. py:meth:: fixed_X(:class:`urwid.Widget`)
This method supports padding the widget to a fixed size and
centering it.
from 1-99, for example:
.. code::
Padding.fixed_20(Text("This will be centered and fixed sized
of 20 columns"))
.. py:meth:: center_X(:class:`urwid.Widget`)
This method centers a widget with X being the relative width of
the widget.
.. code::
Padding.center_10(Text("This will be centered with a "
"width of 10 columns"))
.. py:meth:: left_X(:class:`urwid.Widget`)
This method aligns a widget left with X being the relative width of
the widget.
.. code::
Padding.left_10(Text("This will be left aligned with a "
"width of 10 columns"))
.. py:meth:: right_X(:class:`urwid.Widget`)
This method right aligns a widget with X being the relative width of
the widget.
.. code::
Padding.right_10(Text("This will be right aligned with a "
"width of 10 columns"))
N)�__name__�
__module__�__qualname__�__doc__r r Z
line_breakr! r! r! r" |