Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
filler.cpython-313.pyc179 linesDownload Raw Back to __pycache__
1�

2��j�9��.�SSKJr SSKrSSKrSSKJr SSKJr SSKJ	r	 SSK3JrJrJ
r
JrJrJrJrJr SSKJrJr \R,(aSS	KJr \R2"S45r"SS\5r"S
S\\5rSSjrg)�)�annotationsN)�CompositeCanvas)�remove_defaults)�	int_scale�)�RELATIVE_100�Sizing�VAlign�5WHSettings�normalize_height�normalize_valign�simplify_height�simplify_valign)�WidgetDecoration�WidgetError)�Literal�
WrappedWidgetc��\rSrSrSrg)�FillerError��N)�__name__�6__module__�__qualname__�__firstlineno__�__static_attributes__r��YD:\code\apps\devtools\python\user_packages\Python313\site-packages\urwid/widget/filler.pyrrs��rrc�x^�\rSrSr\R7\RSSS4SU4SjjjrSSjr	SSSjjr8SU4Sjjr\SSj5r
\
RSS	j5r
SS9jrSSjrSSjrSS
jrSSSjjrSSjrS SjrS!SjrS"SjrS#SjrSrU=r$)$�Filler� Nrc�>�[TU]U5 [U[5(a{USS:Xa5[U[5(a	USS:wa[	S5eUSn[10nO=USS:Xa4[U[5(a	USS:wa[	S5eUSn[11n[U[5(aAUSS:XaUSn[RnOWUSS:XaUSn[RnO8UnO5[U[[45(d[	SU<35e[
U5nUbU[R:Xa[RnXPlX`l[!U[5uUlUl['U[5uUlUlUR([R,[R1;aX@lgSUlg)	a�12:param body: a flow widget or box widget to be filled around (stored as self.original_widget)13:type body: Widget14 15:param valign: one of:16    ``'top'``, ``'middle'``, ``'bottom'``,17    (``'relative'``, *percentage* 0=top 100=bottom)18 19:param height: one of:20 21    ``'pack'``22      if body is a flow widget23 24    *given height*25      integer number of rows for self.original_widget26 27    (``'relative'``, *percentage of total height*)28      make height depend on container's height29 30:param min_height: one of:31 32    ``None``33      if no minimum or if body is a flow widget34 35    *minimum height*36      integer number of rows for the widget when height not fixed37 38:param top: a fixed number of rows to fill at the top39:type top: int40:param bottom: a fixed number of rows to fill at the bottom41:type bottom: int42 43If body is a flow widget, then height must be ``'pack'`` and *min_height* will be ignored.44Sizing of the filler will be BOX/FLOW in this case.45 46If height is integer, *min_height* will be ignored and sizing of filler will be BOX/FLOW.47 48Filler widgets will try to satisfy height argument first by reducing the valign amount when necessary.49If height still cannot be satisfied it will also be reduced.50rz	fixed topzfixed bottomz:fixed top height may only be used with fixed bottom valignrz:fixed bottom height may only be used with fixed top valignzinvalid valign: N)�super�__init__�51isinstance�tuplerrr52�TOP�BOTTOM�strr	�FLOWr�PACK�top�bottomr
�valign_type�
valign_amountr�height_type�
height_amount�GIVEN�53min_height)	�self�body�valign�heightr3r,r-�normalized_valign�	__class__s	        �rr$�Filler.__init__!s����j	������f�e�$�$��a�y�K�'�!�&�%�0�0�F�1�I��4O�%�&b�c�c��Q�i��%�����n�,�!�&�%�0�0�F�1�I��4L�%�&b�c�c�����%���f�e�$�$��a�y�K�'��Q�i��$*�J�J�!����n�,�����$*�M�M�!�$*�!��F�V�S�M�2�2�� 0��54�;�<�<�!'�v����>�V�v�{�{�2��_�_�F�����/?�@Q�S^�/_�,���$�,�/?���/T�,���$�,����J�$4�$4�j�o�o�#F�F�(�O�"�D�Orc���[R1nUR[R[R551;aUR
[R5 [U5$)z�Widget sizing.56 57Sizing BOX is always supported.58Sizing FLOW is supported if: FLOW widget (a height type is PACK) or BOX widget with height GIVEN59)	r	�BOXr0rr+r2�addr*�	frozenset)r4�sizings  rr?�
Filler.sizing�sG�� &�z�z�l�����60����1A�1A�B�B��J�J�v�{�{�#��� � rc�F�UR[R:Xa5URR	X5UR61-UR-$UR[R:Xa&URUR62-UR-$[S5e)z+Flow pack support if FLOW sizing supported.z+Method 'rows' not supported for BOX widgets)63r0rr+�original_widget�rowsr,r-r2r1r)r4�size�focuss   rrC�Filler.rows�s{�����z���.��'�'�,�,�T�9�D�H�H�D�t�{�{�R�R����z�/�/�/��%�%����0�4�;�;�>�>��G�H�Hrc�>�0[TU]5E[URUR5[URUR5URURURS.En[U[R5$)N)r6r7r,r-r3)r#�_repr_attrsrr.r/rr0r1r,r-r3rr r$)r4�attrsr9s  �rrH�Filler._repr_attrs�ss���64��g�!�#�65�%�d�&6�&6��8J�8J�K�%�d�&6�&6��8J�8J�K��8�8��k�k��/�/�
66���u�f�o�o�6�6rc�N�[R"S[SS9 UR$)�9backwards compatibility, widget used to be stored as body�^backwards compatibility, widget used to be stored as body. API will be removed in version 5.0.���67stacklevel��warnings�warn�DeprecationWarningrB�r4s rr5�Filler.body�s'��	�
�
�l���	68�69�#�#�#rc�D�[R"S[SS9 Xlg)NrMrNrOrQ�r4�new_bodys  rr5rV�s���
�
�l���	70�71 (�rc�N�[R"S[SS9 UR$)rL�^backwards compatibility, widget used to be stored as body. API will be removed in version 4.0.rNrOrQrUs r�get_body�Filler.get_body�s%���
�
�l���	72�73�#�#�#rc�D�[R"S[SS9 Xlg)Nr[rNrOrQrXs  r�set_body�Filler.set_body�s���
�
�l���	74�75 (�rc�6�URR5$)zReturn selectable from body.)�_original_widget�76selectablerUs rrc�Filler.selectable�s���$�$�/�/�1�1rc77���URX5up4UR[R:XacURRU4US9n[
UURUR[RUSURUR5$[
UURURURURURURUR5$)zs78Return the number of rows to pad on the top and bottom.79 80Override this method to define custom padding behaviour.81)rEN)�packr0rr+rbrC�calculate_top_bottom_fillerr.r/r2r,r-r1r3)r4rDrE�maxcol�maxrowr7s      r�
filler_values�Filler.filler_values�s������4�/������z���.��*�*�/�/��	��/�G�F�.��� � ��"�"�� � ���������	�	
�+���������������O�O��H�H��K�K�	82�		83rc�F�URX5up4URX5upVUR[R:XaUR84R
U4U5nO#UR85R
X4U-86U-874U5n[U5nU(aPUR5U:�a<URb/URup�X�:�aURX�-88S-XE-89U-905 UR5U:�aURSU5 U$URXV5 U$)z:Render self.original_widget with space above and/or below.rr)rfrjr0rr+rb�renderrrC�cursor�trim�pad_trim_top_bottom)91r4rDrErhrir,r-�canv�_cx�cys92          rrm�
Filler.render�s������4�/����(�(��5������z���.��(�(�/�/��	�5�A�D��(�(�/�/��#���9N�0O�QV�W�D��t�$���d�i�i�k�F�*�t�{�{�/F��k�k�G�C��|��	�	�"�+��/�6�<�&�+@�A��9�9�;����I�I�a�� ��K�� � ��-��rc��URUS5up4UR[R:XaURRU4U5$UR
X44S5upVURRX4U-93U-944U5$)z&Pass keypress to self.original_widget.T)rfr0rr+rb�keypressrj)r4rD�keyrhrir,r-s       rrv�Filler.keypresss�����4��.������z���.��(�(�1�1�6�)�S�A�A��(�(�&�)9�4�@����$�$�-�-�v��|�f�7L�.M�s�S�Src�|�URUS5up#[URS5(dgURUS5upEUR[95R:XaURRU45nO"URRX#U-96U-9745nU(dgUupxX�:�aUS-98nXxU-4$)z6Return cursor coords from self.original_widget if any.T�get_cursor_coordsNr)rf�hasattrrbrjr0rr+rz)	r4rDrhrir,r-�coords�x�ys	         rrz�Filler.get_cursor_coordss������4��.����t�,�,�.A�B�B���(�(��t�4������z���.��*�*�<�<�f�Y�G�F��*�*�<�<�f�s�l�U[�F[�=\�]�F�������;���99�A��c�'�z�rc�J�URUS5up#[URS5(dgUR[R100:XaURR
U45nU$URUS5upVURR
X#U-101U-10245nU$)z1Return pref_col from self.original_widget if any.T�get_pref_colN)rfr{rbr0rr+r�rj)r4rDrhrir}r,r-s       rr��Filler.get_pref_col!s������4��.����t�,�,�n�=�=�����z���.��%�%�2�2�F�9�=�A�103���,�,�T�4�8�K�C��%�%�2�2�F�S�L�6�<Q�3R�S�A��rc�n�URUS5upE[URS5(dgURUS5upgX6:dX4U-104:�agUR[105R:Xa URRU4X#U-1065$URRXEU-107U-1084X#U-1095$)�Pass to self.original_widget.T�move_cursor_to_coordsF)rfr{rbrjr0rr+r�)r4rD�col�rowrhrir,r-s        rr��Filler.move_cursor_to_coords/s������4��.����t�,�,�.E�F�F���(�(��t�4����9����.�����z���.��(�(�>�>��y�#�UX�y�Y�Y��$�$�:�:�F�S�L�SY�DY�;Z�\_�gj�aj�k�krc�t�URX5upx[URS5(dgURUS5up�XY:dXXU110-111:�agUR[112R:Xa"URRU4X#XEU	-113U5$URRXxU	-114U115-1164X#XEU	-117U5$)r��mouse_eventFT)rfr{rbrjr0rr+r�)r4rD�event�buttonr�r�rErhrir,r-s           rr��Filler.mouse_event=s������4�/����t�,�,�m�<�<���(�(��t�4����9����.�����z���.��(�(�4�4�f�Y��s�Z]�T]�_d�e�e��$�$�0�0�&�3�,��:O�1P�RW�ad�lo�fo�qv�w�wr)r-r1r0r3rBr,r/r.)r5rr6zbLiteral['top', 'middle', 'bottom'] | VAlign | tuple[Literal['relative', WHSettings.RELATIVE], int]r7zdint | Literal['pack', WHSettings.PACK] | tuple[Literal['relative', WHSettings.RELATIVE], int] | Noner3�118int | Noner,�intr-r��return�None)r�zfrozenset[Sizing])F)rDz119tuple[int]rE�boolr�r�)r�zdict[str, typing.Any])r�r)rYrr�r�)r�r�)rD�tuple[int, int] | tuple[int]rEr�r��tuple[int, int])rDr�rEr�r�r)rDztuple[int, int] | tuple[()]rwr)r�z120str | None)rDr�r�ztuple[int, int] | None)rDr�r�r�)rDr�r�r�r�r�r�r�)rDr�r�r�r�r�r�r�rEr�r�zbool | None)rrrrr121�MIDDLErr+r$r?rCrH�propertyr5�setterr\r_rcrjrmrvrzr�r�r�r�
__classcell__)r9s@rr r  sp���
�M�M�
�O�O�!%���`#��`#�
o�	`#�
q�`#��`#��`#��`#�122�`#�`#�D	!�I�	7��$��$�123�[�[�(��(�$�(�2�124�F��*����125�	�2T�)�T��T�126�	T��$�l�x�*�x��	x�127�x��
x��x�128�x�xrr c�&�U[R:Xa0[X-129U-130S5n[USUS-5n	Ub[X�5n	OUn	[R131S[RS[RS0RX5n132X	-133U-134U-135nU[SU136-137SUS-5-
nX	-138U-139nUSs=:aU:aO O[Xg*5nXl-nX|-
nO$USs=:aU:aO O[Xv*5nX|-nXl-
n[US5n[US5nXg4$)a140Return the amount of filler (or clipping) on the top and141bottom part of maxrow rows to satisfy the following:142 143valign_type -- 'top', 'middle', 'bottom', 'relative'144valign_amount -- a percentage when align_type=='relative'145height_type -- 'given', 'relative', 'clip'146height_amount -- a percentage when width_type=='relative'147    otherwise equal to the height of the widget148min_height -- a desired minimum width for the widget or None149top -- a fixed number of rows to fill on the top150bottom -- a fixed number of rows to fill on the bottom151 152>>> ctbf = calculate_top_bottom_filler153>>> ctbf(15, "top", 0, "given", 10, None, 2, 0)154(2, 3)155>>> ctbf(15, "relative", 0, "given", 10, None, 2, 0)156(2, 3)157>>> ctbf(15, "relative", 100, "given", 10, None, 2, 0)158(5, 0)159>>> ctbf(15, "middle", 0, "given", 4, None, 2, 0)160(6, 5)161>>> ctbf(15, "middle", 0, "given", 18, None, 2, 0)162(0, 0)163>>> ctbf(20, "top", 0, "relative", 60, None, 0, 0)164(0, 8)165>>> ctbf(20, "relative", 30, "relative", 60, None, 0, 0)166(2, 6)167>>> ctbf(20, "relative", 30, "relative", 60, 14, 0, 0)168(2, 4)169r�er�2�d)170r�RELATIVE�maxrr171r'r�r(�get�min)
rir.r/r0r1r3r,r-�	maxheightr7r6�filler�shifts
             rrgrgTs!��R�j�)�)�)����v�-�q�1�	��=�#�y�1�}�=���!���,�F�����j�j�!�V�]�]�B��
�
�s�
C�
G�
G��
c�F��_�s�
"�V�
+�F�172�i��f��c�6�A�:�6�6�F�173�/�F�174"�C����C���C��!��������	�q�	�6�	��F�D�!���������c�1�+�C�
���^�F��;�r)rir�r.zLLiteral['top', 'middle', 'bottom', 'relative', WHSettings.RELATIVE] | VAlignr/r�r0z\Literal['given', 'relative', 'clip', WHSettings.GIVEN, WHSettings.RELATIVE, WHSettings.CLIP]r1r�r3r�r,r�r-r�r�r�)�175__future__r�typingrR�urwid.canvasr�urwid.split_reprr�176urwid.utilr�	constantsrr	r177rrr
rr�widget_decorationrr�
TYPE_CHECKING�typing_extensionsr�TypeVarrrr rgrrr�<module>r�s���"�
��(�,� �	�	�	�=�	���)�����/�
�	�+�	�qx�
�m�
,�qx�h	F��F�]�F��F�n�	F�178�F��
F�179
�F�
�F��Fr
codekingpro/portable-devtools · Team Ai