__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
o

K��^E�	@s�dZddlmZddlZddlmZmZmZmZddl	m
Z
ddlZddlZe�
d�ZejGdd�d��Zd	d
�ZGdd�de�Zd
d�ZGdd�de�ZGdd�de�ZGdd�de�Zedkr�ddlmZed�eee�d�dejddd�fe�d�g�ee�d�ejddd�e�d �e�d!�g�ged"d#d$�ed"d%d&�d'�d(d)�Zed*efe�d+�g�Zd,d-�Zejeed.�Ze� �dSdS)/aI
A table widget.

One of the principles of urwid is that widgets get their size from
their container rather than deciding it for themselves. At times (as
in stretchy.py) this does not make for the best UI. This module
defines TablePile and TableListBox widgets that by default only take
up as much horizontal space as needed for their cells. If the table
wants more horizontal space than is present, there is a degree of
customization available as to what to do: you can tell which column to
allow to shrink, and to omit another column to try to keep the
shrinking column above a given threshold.

You can also let columns take all available space, as is the urwid
default.

Other features include cells that span multiple columns and binding
tables together so that they use the same widths for their columns.

There is not a lot of care about how the various features interact, so
be careful, or rather do not be surprised when things break. Gotchas
that have occurred to me during implementation:

1. This code needs to know the "natural width" of anything you put
   into a table. Don't be surprised if widget_width needs extending.
2. Having a cell that spans multiple columns span a column that can
   shrink or be omitted will be confusing.
3. Binding tables together that have different column options will
   similarly not do anything sensible.
4. You can wrap table rows in decorators that do not affect their size
   (AttrMap, etc) but do not use ones that do affect size (Padding,
   etc) or things will get confusing.
5. I haven't tested this code with more than one column that can
   shrink or more than one column that can be omitted.

Example:

```
    v = TablePile([
        TableRow([
            urwid.Text("aa"),
            (2, urwid.Text("0123456789"*5, wrap='clip')),
            urwid.Text('eeee')]),
        TableRow([
            urwid.Text("ccc"),
            urwid.Text("0123456789"*4, wrap='clip'),
            urwid.Text('fff'*10), urwid.Text('g')]),
        ], {
            0: ColSpec(omittable=True),
            1: ColSpec(can_shrink=True, min_width=10),
            }, spacing=4)
```
�)�defaultdictN)�Columns�ListBox�Pile�
WidgetWrap)�widget_widthzsubiquitycore.ui.tablec@sLeZdZdZejdd�Zejdd�Zejdd�Zejdd�Z	ejdd�Z
dS)�ColSpeczDetails about a column.T)�defaultFrN)�__name__�
__module__�__qualname__�__doc__�attr�ib�pack�
can_shrink�	min_width�	omittable�rpad�rr�./usr/share/subiquity/subiquitycore/ui/table.pyrYsrcs>t|�}t�fdd�|dd�D��}|�d|d7}|S)Nc3s0�|]}�d|��d|dd�VqdS)��rN)�get)�.0�i��widthsrr�	<genexpr>xs�.z_width.<locals>.<genexpr>���r)�sorted�sum)r�user_indices�rrrr�_widthrsr$csHeZdZdZ�fdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	�Z
S)�TableRowz]A row in a table.

    A wrapper around a Columns. The widths will be set when rendered.
    cs�g|_g}|D](}d}t|t�r|\}}|dksJ�|j�||f�|�|�|�t�d��q|d=t|�|_t��	|j�dS)zlcells is a list of [widget] or [(colspan, widget)].

        colspan is assumed to be 1 if omitted.
        rr�rN)
�cells�
isinstance�tuple�append�urwid�Textr�columns�super�__init__)�selfr'�cols�cell�colspan��	__class__rrr/�s


zTableRow.__init__cCs$|jjD]\}}|��rdSqdS)NTF)�_w�contents�
selectable)r0�w�_rrrr8�s
�zTableRow.selectableccs6�d}|jD]\}}t|||�|fV||7}qdS)z=Yield the user indices each cell spans and the cell.
        rN)r'�range)r0�user_ir3r2rrr�_user_indices_cells�s�
�zTableRow._user_indices_cellscCsFi}|��D]\}}t|�dkr |d|vr t|�|d|d<q|S)z�Return a mapping {underlying-index:natural-width}.

        Cells spanning multiple columns are ignored (handled in
        adjust_for_spanning_cells).
        rrr)r=�lenr)r0�
unpacked_colsrr"r2rrr�get_natural_widths�s�zTableRow.get_natural_widthsc
	Cs�|��D]M\}}t|�|@rqt|�dkrqt||�}t|�}||krQt|�|@}|r-|}t||t|��\}	}
t|�D]\}}|d||	t||
k�7<q<qdS)z�Make sure columns are wide enough for cells with colspan > 1.

        This very roughly follows the approach in
        https://www.w3.org/TR/CSS2/tables.html#width-layout.
        rrN)r=�setr>r$r�divmod�	enumerate�int)
r0�unpacked_user_indices�no_inherent_sizerr"r2�	cur_width�
cell_width�unsized�div�modr�user_jrrr�adjust_for_spanning_cells�s 
"��z"TableRow.adjust_for_spanning_cellsc	Cs�g}|��D]L\}}zt||�}Wnty!|j�dd�}Yn
w|dkr'q|j�d|�}|�||f�|�dt|�dd�}|rR|�t�	d�|j�d|�f�q||jj
dd�<dS)z�Configure row to given widths.

        `widths` is a mapping {underlying-index:width}. An index being
        missing means let the column shrink, a width being 0 means omit
        the column entirely.
        �weightrr�givenrr&N)r=r$�KeyErrorr-�optionsr*r�maxr+r,r7)r0rr1r"r2�width�opt�nrrr�
set_widths�s ��zTableRow.set_widths)r
rrr
r/r8r=r@rMrV�
__classcell__rrr4rr%}sr%csFdd�|��D�}dd�|��D�}|D]}|j�|�}|��D]\}}	t|	|�|d��||<q qt|���dd}
|rFt|
t|�d�}
t�}t|
�D]}||vrh|�d|d�dkrh|�|�d|d|<qM|�	�fdd�t|
d�D��|�	d	d�|��D��|�
�}
|D]
}|j�|||�q�t|�
��}||ks�|�rt|
�D]}||js�d||vr�|
d||d|<q�t|
�D]V}||js�||j�sd||vr�|d|=||j�r	|t|�
��}|||jkr�n't|
�D] }||js�q�|�d|��rd|d|<d|d|d<nq�nq�q�|}||t|�fS)
z6Return {cell-index:width} and total width for a table.cSsh|]	\}}|js|�qSr�r�rr<�csrrr�	<setcomp>�s

��z+_compute_widths_for_size.<locals>.<setcomp>cSs"i|]
\}}|jrd||j�qS)r)rr)rrrZrrr�
<dictcomp>�s"z,_compute_widths_for_size.<locals>.<dictcomp>rrrcsi|]	}d|d��qS)rrr)rr<��default_spacingrrr\	�cSs*i|]\}}|jdurd|d|j�qS)Nrr)rrYrrrr\s
�)�items�base_widgetr@rRr�keysrAr;�add�update�copyrMr!�valuesrrrr�bool)�maxcol�
table_rows�colspecsr^rEr�row�
row_widths�underlying_ir9�colcountrFr<�
widths_before�total_width�	remainingrLrr]r�_compute_widths_for_size�st��
�����

���
rrcspeZdZd�fdd�	Zdd�Zdd	�Zd
d�Zdd
�Z�fdd�Z�fdd�Z	e
dd��Zejdd��Z�Z
S)�
AbstractTableNr�leftcs\�fdd�|D�|_|duri}tt|�|_||_t��|�|j��d|_t	|g�|_
dS)z�Create a Table.

        `rows` - a list of possibly-decorated TableRows
        `colspecs` - a mapping {column-index:ColSpec}
        'spacing` - how much space to put between cells.
        csg|]	}tj|�d��qS)��align�r+�Padding�rrkrurr�
<listcomp>Fr_z*AbstractTable.__init__.<locals>.<listcomp>N)rirrrj�spacingr.r/�_make�
_last_sizerA�group)r0�rowsrjr{rvr4rurr/?szAbstractTable.__init__cCs |j|jB}|D]}||_qdS)z�Bind two tables such that they will use the same column widths.

        Don't expect anything good to happen if the two tables do not
        use the same colspecs.
        N)r~)r0�other_table�	new_group�tablerrr�bindPs�zAbstractTable.bindcCs
d|_dS�N)r}�r0rrr�
invalidateZs
zAbstractTable.invalidatecCs~|j|krdSg}|jD]}|�|j�qt|d||j|j�\}}}|jD]}||_|jD]
}|s5||_|j�	|�q.q&dS)Nr)
r}r~�extendrirrrjr{rSrarV)r0�sizerr�rrp�has_unpackedrkrrrrr]s 


�

��z&AbstractTable._compute_widths_for_sizecCs8g}|jD]}|�|j�qtd||j|j�\}}}|S)Ni��)r~r�rirrrjr{)r0rr�rrpr�rrr�get_natural_widthms

�zAbstractTable.get_natural_widthc�|�|�t��||�Sr�)rrr.r�r0r��focusr4rrru�
zAbstractTable.rowscr�r�)rrr.�renderr�r4rrr�yr�zAbstractTable.rendercCs
|jjjSr��r6ra�focus_positionr�rrrr�}s
zAbstractTable.focus_positioncCs||jj_dSr�r�)r0�valrrrr��s)Nrrt)r
rrr/r�r�rrr�rr��propertyr��setterrWrrr4rrs<s

rsc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�	TablePilecCstdd�|D��S)NcSsg|]}d|f�qSrXr)rr#rrrrz�sz#TablePile._make.<locals>.<listcomp>)r�r0rrrrr|�szTablePile._makecs8���|�j||�<�fdd�|D��jj||�<dS)Ncs"g|]
}t�|��j�d�f�qSrX)r+rxr6rQ)rr9r�rrrz�s�z)TablePile.insert_rows.<locals>.<listcomp>)r�rir6r7)r0�index�new_rowsrr�r�insert_rows�s

�zTablePile.insert_rowscCs�|��t|jj�||}|jj|k}|j||�=|jj||�=|r)|��dS|jj��s?|jjd7_|jj��r/dSdS)Nr)	r�r>r6r7r�ri�_select_last_selectabler�r8)r0�start�end�
new_length�refocusrrr�remove_rows�s�zTablePile.remove_rowscsv���dd�|D�}|�_t�jj�dk}�fdd�|D��jjdd�<t�jj�dk}|r7|s9���dSdSdS)�Update the list of rows. cS�g|]}t�|��qSrrwryrrrrz��z*TablePile.set_contents.<locals>.<listcomp>rcsg|]
}|�j�d�f�qSrX)r6rQryr�rrrz�sN)r�rir>r6r7�_select_first_selectable)r0r�empty_before�empty_afterrr�r�set_contents�s�zTablePile.set_contentsN)r
rrr|r�r�r�rrrrr��s
r�c@seZdZdd�Zdd�ZdS)�TableListBoxcCst|�Sr�)rr�rrrr|�szTableListBox._makecCsf|��dd�|D�}||_|jjj}t|�dk}||dd�<t|�dk}|r/|s1|��dSdSdS)r�cSr�rrwryrrrrz�r�z-TableListBox.set_contents.<locals>.<listcomp>rN)r�rir6ra�bodyr>r�)r0rr�r�r�rrrr��s
�zTableListBox.set_contentsN)r
rrr|r�rrrrr��sr��__main__)�setup_loggerz
.subiquity�aar�201234567890123456789012345678901234567890123456789�clip)�wrap�eeee�ccc�(0123456789012345678901234567890123456789�ffffffffffffffffffffffffffffff�gT�
)rrr)rr)rr�)r{r�xcGstj�r�)r+�ExitMainLoop)�argsrrr�unhandled_input�sr�)r�)!r
�collectionsr�logging�subiquitycore.ui.containerrrrr�subiquitycore.ui.widthrrr+�	getLogger�log�srr$r%rrrsr�r�r
�subiquitycore.logr�r,�v�	SolidFillr��MainLoop�loop�runrrrr�<module>sX6
pOJ+���


��
��

Filemanager

Name Type Size Permission Actions
__init__.cpython-310.pyc File 179 B 0644
actionmenu.cpython-310.pyc File 4.53 KB 0644
anchors.cpython-310.pyc File 1.55 KB 0644
buttons.cpython-310.pyc File 1.6 KB 0644
container.cpython-310.pyc File 12.33 KB 0644
form.cpython-310.pyc File 15.73 KB 0644
frame.cpython-310.pyc File 1.67 KB 0644
interactive.cpython-310.pyc File 3.53 KB 0644
selector.cpython-310.pyc File 7.73 KB 0644
spinner.cpython-310.pyc File 1.63 KB 0644
stretchy.cpython-310.pyc File 5.49 KB 0644
table.cpython-310.pyc File 13.62 KB 0644
utils.cpython-310.pyc File 10.29 KB 0644
width.cpython-310.pyc File 1.1 KB 0644
Filemanager