Team Ai
Datasetpublic

codekingpro/portable-devtools

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

2��j�S�3��SSKJr SSKrSSKrSSKJr SSKJrJr SSK	J4r5 SSKJr SSK
JrJr SS	KJr SS6KJr SSKJrJr \R.(aSSKJr SS
KJr \R6"S5r\R6"S5r\R6"S5r"SS\5rSSjr "SS\\\RB\\\45r"g)�)�annotationsN)�MutableMapping)�
CanvasCombine�CompositeCanvas)�remove_defaults)�is_mouse_press�)�Sizing�VAlign)�WidgetContainerMixin)�Filler)�Widget�WidgetError)�Iterator)�Literal�7BodyWidget�HeaderWidget�FooterWidgetc��\rSrSrSrg)�8FrameError��N)�__name__�9__module__�__qualname__�__firstlineno__�__static_attributes__r��XD:\code\apps\devtools\python\user_packages\Python313\site-packages\urwid/widget/frame.pyrrs��rrc���Ucg[U[5(dMURRSURR3n[10R"US3[SS9 gg)N�.z is not subclass of Widget���11stacklevel)�12isinstancer�	__class__rr�warnings�warn�DeprecationWarning)�widget�obj_class_paths  r�_check_widget_subclassr,sd��
�~���f�f�%�%�"�,�,�7�7�8��&�:J�:J�:S�:S�9T�U���
�
���8�9���	13�&rc�^�\rSrSrSrSr\"\R/5r	S,S-U4Sjjjr14S.U4SjjrS/Sjr\
S0Sj5r\RS1Sj5rS0S	jrS1S15jr\
S2Sj5r\RS3Sj5rS2S
jrS3Sjr\
S4Sj5r\RS5Sj5rS4SjrS5Sjr\
S6Sj5r\RS7Sj5rS6SjrS7Sjr\
S8Sj5r\
S9Sj5rS:Sjr\R>S;Sj5r \R>S<Sj5r \R>S=Sj5r S>Sjr \R>S?Sj5r!\R>S@Sj5r!\R>SAS j5r!SBS!jr!SCS"jr"SDS#jr#SES$jr$SFSGS%jjr%SHS&jr&SIS'jr'SJS(jr(SKS)jr)SLS*jr*S+r+U=r,$)M�Frame�,a`16Frame widget is a box widget with optional header and footer17flow widgets placed above and below the box widget.18 19.. note:: The main difference between a Frame and a :class:`Pile` widget20    defined as: `Pile([('pack', header), body, ('pack', footer)])` is that21    the Frame will not automatically change focus up and down in response to keystrokes.22Tc�>�[TU]5 X lXlX0lUS;aX@lO6XB:XaSUlO)XC:XaSUlOXA:XaSUlO[
SU<35e[U5 [U5 [U5 g)a623:param body: a box widget for the body of the frame24:type body: Widget25:param header: a flow widget for above the body (or None)26:type header: Widget27:param footer: a flow widget for below the body (or None)28:type footer: Widget29:param focus_part:  'header', 'footer' or 'body'30:type focus_part: str | Widget31>�body�footer�headerr3r2r1zInvalid focus part N)�super�__init__�_header�_body�_footer�32focus_part�33ValueErrorr,)�selfr1r3r2r9r&s     �rr5�Frame.__init__9s���"	�������34����5�5�(�O�
�
!�&�D�O�
�
!�&�D�O�
�
�$�D�O��2�:�.�A�B�B��v�&��t�$��v�&rc�>�0[TU]5EURURURUR35S.En[
U[R5$)N)r1r3r2r9)	r4�_repr_attrsr7r6r8r9rr.r5)r;�attrsr&s  �rr>�Frame._repr_attrs^sN���36��g�!�#�37��J�J��l�l��l�l��/�/�38���u�e�n�n�5�5rc#�# �SUR4v� SUR4v� SUR4v� SUR4v� g7f)Nr1r3r2r9)r7r6r8r9�r;s r�
__rich_repr__�Frame.__rich_repr__hsA����d�j�j� � �����$�$�����$�$��D�O�O�+�+�s�AAc��UR$�N)r6rBs rr3�Frame.headern����|�|�rc�z�[U5 XlUcURS:XaSUlUR5 g)Nr3r1)r,r6r9�_invalidate�r;r3s  rr3rGr�2���v�&����>�d�o�o��9�$�D�O����rc��[R"SURRSURRS3[SS9 UR39$)N�method `z/.get_header` is deprecated, standard property `�C.header` should be used instead.API will be removed in version 5.0.�r#�r'r(r&rr)r3rBs r�40get_header�Frame.get_headerz�S���
�
��t�~�~�.�.�/�0"�"&�.�.�"9�"9�!:�;2�
2�
��	41��{�{�rc��[R"SURRSURRS3[SS9 Xlg)NrNz/.set_header` is deprecated, standard property `rOrPr#rQrKs  r�42set_header�Frame.set_header��N���
�
��t�~�~�.�.�/�0"�"&�.�.�"9�"9�!:�;2�
2�
��	43��rc��UR$rF)r7rBs rr1�44Frame.body�s���z�z�rc�F�[U5 XlUR5 grF)r,r7rJ�r;r1s  rr1rZ�s���t�$��45����rc��[R"SURRSURRS3[SS9 UR46$)NrNz,.get_body` is deprecated, standard property z@.body should be used instead.API will be removed in version 5.0.rPr#�r'r(r&rr)r1rBs r�get_body�Frame.get_body�sS���
�
��t�~�~�.�.�/�0!�!%���!8�!8� 9�:2�
2�
��	47��y�y�rc��[R"SURRSURRS3[SS9 Xlg)NrNz-.set_body` is deprecated, standard property `zA.body` should be used instead.API will be removed in version 5.0.rPr#r^r\s  r�set_body�Frame.set_body�sN���
�
��t�~�~�.�.�/�0"�"&�.�.�"9�"9�!:�;2�
2�
��	48��	rc��UR$rF)r8rBs rr2�Frame.footer�rHrc�z�[U5 XlUcURS:XaSUlUR5 g)Nr2r1)r,r8r9rJ�r;r2s  rr2re�rLrc��[R"SURRSURRS3[SS9 UR49$)NrNz/.get_footer` is deprecated, standard property `�C.footer` should be used instead.API will be removed in version 5.0.rPr#�r'r(r&rr)r2rBs r�50get_footer�Frame.get_footer�rTrc��[R"SURRSURRS3[SS9 Xlg)NrNz/.set_footer` is deprecated, standard property `rirPr#rjrgs  r�51set_footer�Frame.set_footer�rXrc��UR$)z�52writeable property containing an indicator which part of the frame53that is in focus: `'body', 'header'` or `'footer'`.54 55:returns: one of 'header', 'footer' or 'body'.56:rtype: str57)r9rBs r�focus_position�Frame.focus_position�s�����rc���US;a[SU35eUS:Xa
URbUS:XaURc[SU35eXlUR	5 g)zk58Determine which part of the frame is in focus.59 60:param part: 'header', 'footer' or 'body'61:type part: str62>r1r2r3zInvalid position for Frame: r3Nr2zThis Frame has no )�63IndexErrorr6r8r9rJ�r;�parts  rrqrr�sh���3�3��;�D�6�B�C�C��H�����!5�4�8�;K�PT�P\�P\�Pd��1�$��8�9�9������rc�N�[R"S[SS9 UR$)aA64writeable property containing an indicator which part of the frame65that is in focus: `'body', 'header'` or `'footer'`.66 67.. note:: included for backwards compatibility. You should rather use68    the container property :attr:`.focus_position` to get this value.69 70:returns: one of 'header', 'footer' or 'body'.71:rtype: str72z�included for backwards compatibility.You should rather use the container property `.focus_position` to get this value.API will be removed in version 5.0.rPr#�r'r(r)rqrBs r�	get_focus�Frame.get_focus�s+��	�
�
�
2�
��	73��"�"�"rc�D�[R"S[SS9 Xlg)Nz�included for backwards compatibility.You should rather use the container property `.focus_position` to set this value.API will be removed in version 5.0.rPr#rxrus  r�	set_focus�Frame.set_focus�s#���
�
�
2�
��	74�#�rc�d�URURURS.UR$)za75child :class:`Widget` in focus: the body, header or footer widget.76This is a read-only property.)r3r2r1)r6r8r7r9rBs r�focus�Frame.focuss)��77�,�,�$�,�,��78�79�S�TX�Tc�Tc�d�drc�^�"U4SjS[[[[R[80[[4S445nU"5$)a�81a dict-like object similar to::82 83    {84        "body": (body_widget, None),85        "header": (header_widget, None),  # if frame has a header86        "footer": (footer_widget, None),  # if frame has a footer87    }88 89This object may be used to read or update the contents of the Frame.90 91The values are similar to the list-like .contents objects used92in other containers with (:class:`Widget`, options) tuples, but are93constrained to keys for each of the three usual parts of a Frame.94When other keys are used a :exc:`KeyError` will be raised.95 96Currently, all options are `None`, but using the :meth:`options` method97to create the options value is recommended for forwards98compatibility.99c�>�\rSrSrSrSSjrYRrYRr	YRrS	SjrS100U4Sjjr
SSjrSrg)�%Frame.contents.<locals>.FrameContentsi(rc�4�[UR55$rF)�len�keys��101inner_selfs r�__len__�-Frame.contents.<locals>.FrameContents.__len__2s���:�?�?�,�-�-rc3�@# �UR5Shv�N gN7frF)r�r�s r�__iter__�.Frame.contents.<locals>.FrameContents.__iter__9s���%�?�?�,�,�,�����c�V>�SURRS[U5STS3$)N�<�(z) for �>)r&r�dict)r�r;s �r�__repr__�.Frame.contents.<locals>.FrameContents.__repr__<s4����:�/�/�8�8�9��4�102�;K�:L�F�SW�RX�XY�Z�Zrc3�@# �UR5Shv�N gN7frF)�itemsr�s rrC�3Frame.contents.<locals>.FrameContents.__rich_repr__?s���%�+�+�-�-�-�r�N)�return�int)r�z
Iterator[str])r��str�r�z4Iterator[tuple[str | None, typing.Any] | typing.Any])rrrr�	__slots__r��_contents__getitem__�__getitem__�_contents__setitem__�__setitem__�_contents__delitem__�__delitem__r�r�rCrrBs�r�
FrameContentsr�(sB����I�
.��3�3�K��3�3�K��3�3�K�
-�
[�
.rr�N)rr��tuple�typing�Unionrrr)r;r�s` r�contents�Frame.contentssE���:	.����f�l�l�:�|�\�#I�J�D�P�Q�S�
�	.�4��rc��S/nUR(aURS5 UR(aURS5 U$)Nr1r3r2)r6�appendr8)r;r�s  r�_contents_keys�Frame._contents_keysDs4���x���<�<��K�K��!��<�<��K�K��!��rc��grFr�r;�keys  rr��Frame._contents__getitem__Ls��UXrc��grFrr�s  rr�r�O���Y\rc��grFrr�s  rr�r�Rr�rc���US:XaURS4$US:XaUR(aURS4$US:XaUR(aURS4$[SU<35e)Nr1r3r2�Frame.contents has no key: )r7r6r8�KeyErrorr�s  rr�r�Use���&�=��J�J��%�%��(�?�t�|�|��L�L�$�'�'��(�?�t�|�|��L�L�$�'�'��4�S�G�<�=�=rc��grFr�r;r��values   rr��Frame._contents__setitem__`s��berc��grFrr�s   rr�r�c���firc��grFrr�s   rr�r�fr�rc� �US;a[SU<35eUup4Ub[SU<35eUS:XaX0lgUS:XaX0lgX0lg![[4a.n[SU<35R	UR1035UeSnAff=f)N>r1r2r3r�zadded content invalid: r1r2)	r�rr:�	TypeError�with_traceback�
__traceback__r1r2r3)r;r�r��value_w�
value_options�excs      rr�r�is���104�2�2��8���@�A�A�	m�%*�"�G��(� �#:�5�)�!D�E�E�)��&�=��I�
�H�_�!�K�!�K���I�&�	m��6�u�i�@�A�P�P�QT�Qb�Qb�c�il�l��	m�s�A�B
�)B�B
c���US;a[SU<35eUS:Xa
URbUS:XaURc[SU<35eUS:XaSUlgSUlg)N>r2r3z!Frame.contents can't remove key: r3r2r�)r�r6r8r3r2r�s  rr��Frame._contents__delitem__}se���*�*��>�s�g�F�G�G��8�O���� 4�#��/�d�l�l�Nb��8���@�A�A��(�?��D�K��D�Krc��g)zf105There are currently no options for Frame contents.106 107Return None as a placeholder for future options.108NrrBs r�options�
Frame.options�s�rc�^�Uup4S=pVUR(a3URRU4URS:H=(a U5nUR(a3URRU4URS:H=(a U5nUnURS:XaXW:�aSU4Xe44$Xu-nXg:�aXu4Xe44$OkURS:XaXd:�aUS4Xe44$Xv-nXW:�aXg4Xe44$O?Xe-U:�a7[	SUS-1095nXWS-110:�aSU4Xe44$Xu-n[	SUS-1115nX�4Xe44$Xe4Xe44$)aR112Calculate the number of rows for the header and footer.113 114:param size: See :meth:`Widget.render` for details115:type size: widget size116:param focus: ``True`` if this widget is in focus117:type focus: bool118:returns: `(head rows, foot rows),(orig head, orig foot)`119          orig head/foot are from rows() calls.120:rtype: (int, int), (int, int)121rr3r2r	)r3�rowsr9r2�max)	r;�sizer�maxcol�maxrow�frows�hrows�	remaining�rless1s	         r�frame_top_bottom�Frame.frame_top_bottom�so�� �������;�;��K�K�$�$�f�Y����8�0K�0U�PU�V�E��;�;��K�K�$�$�f�Y����8�0K�0U�PU�V�E��	��?�?�h�&��!��9�~��~�5�5���I��!�!�)�E�>�9�9�"��_�_��
(���!�1�~��~�5�5���I��!��)�E�>�9�9�"��]�i�
'���I��M�*�F��A�
�%��6�{�U�N�2�2���I���I��M�*�F��?�U�N�2�2��~��~�-�-rc�.�Uup4URX44U5uupVupx/n	/n122SnU(aQXW:aL[UR[R5RX54U=(a URS:H5nOYU(aRURRU4U=(a URS:H5nUR5U:wa[S5eU(a<U	RUSURS:H45 U123RUR5 Xe-U:auURRX4U-124U-1254U=(a URS:H5nU	RUSURS:H45 U126RUR5 Sn
U(aQXh:aL[UR[R5RX64U=(a URS:H5n
OYU(aRURRU4U=(a URS:H5n
U
R5U:wa[S5eU
(a<U	RU
SURS:H45 U127RUR5 [U	5$)Nr3zrows, render mismatchr1r2)r�r
r3r�TOP�renderr9r��RuntimeErrorr�r1r2�BOTTOMr)r;r�rr�r��htrim�ftrimr�r��combinelist�128depends_on�headr1�foots              rr��Frame.render�s��129 ���)-�)>�)>��?O�QV�)W�&��������130����U�]��$�+�+�v�z�z�2�9�9�6�/�5�Kp�UY�Ud�Ud�hp�Up�q�D�
��;�;�%�%�v�i��1V�4�?�?�h�;V�W�D��y�y�{�e�#�"�#:�;�;������h����8�0K�L�M����d�k�k�*��=�6�!��9�9�#�#�V�e�^�e�-C�$D�e�Fi�PT�P_�P_�ci�Pi�j�D�����f�d�o�o��.G�H�I����d�i�i�(����U�]��$�+�+�v�}�}�5�<�<�f�_�e�Ns�X\�Xg�Xg�ks�Xs�t�D�
��;�;�%�%�v�i��1V�4�?�?�h�;V�W�D��y�y�{�e�#�"�#:�;�;������h����8�0K�L�M����d�k�k�*��[�)�)rc���Uup4URS:XaKURb>URR5(dU$URRU4U5$URS:XaKURb>URR5(dU$URRU4U5$URS:waU$UnURbXPRRU45-nURbXPRRU45-nUS::aU$URR5(dU$URRX54U5$)z!Pass keypress to widget in focus.r3r2r1r)r9r3�131selectable�keypressr2r�r1)r;r�r�r�r�r�s      rr��Frame.keypress�s2�� ����?�?�h�&�4�;�;�+B��;�;�)�)�+�+��132��;�;�'�'��	�3�7�7��?�?�h�&�4�;�;�+B��;�;�)�)�+�+��133��;�;�'�'��	�3�7�7��?�?�f�$��J��	��;�;�"����)�)�6�)�4�4�I��;�;�"����)�)�6�)�4�4�I���>��J��y�y�#�#�%�%��J��y�y�!�!�6�"5�s�;�;rc���UupxURXx4U5uup�up�XY:a�U=(a URS:Hn[U5(a,US:Xa&URR	5(aSUl[
URS5(dgURRU4X#XEU5$XXU134-135:�a�U=(a URS:Hn[U5(a,US:Xa&URR	5(aSUl[
URS5(dgURRU4X#XEU-136U137-U5$U=(a URS:Hn[U5(a,US:Xa&URR	5(aSUl[
URS5(dgURRXxU	-138U139-1404X#XEU	-141U5$)zX142Pass mouse event to appropriate part of frame.143Focus may be changed on button 1 press.144r3r	�mouse_eventFr2r1)145r�r9rr3r�rq�hasattrr�r2r1)
r;r��event�button�col�rowrr�r�r�r��_hrows�_frowss
             rr��Frame.mouse_events��� ���+/�+@�+@�&�AQ�SX�+Y�(���(���;��9�d�o�o��9�E��e�$�$��1�����9O�9O�9Q�9Q�&.��#��4�;�;�
�6�6���;�;�*�*�F�9�e�S�u�U�U��5�.� ��9�d�o�o��9�E��e�$�$��1�����9O�9O�9Q�9Q�&.��#��4�;�;�
�6�6���;�;�*�*�F�9�e�S�PV�,�Y^�J^�`e�f�f��3�$�/�/�V�3���%� � �V�q�[�T�Y�Y�5I�5I�5K�5K�"(�D���t�y�y�-�0�0���y�y�$�$�f�u�n�u�.D�%E�u�VY�af�[f�hm�n�nrc���URR5(dg[URS5(dgURnUup4UR	US5uupVnUS:XaSnUR146R
U45n	OKUS:Xa%UnURR
X4U-147U-14845n	O XF-149nURR
U45n	U	cgU	up�X�U-4$)z2Return the cursor coordinates of the focus widget.N�get_cursor_coordsTr3rr1)	rr�r�rqr�r3r�r1r2)r;r��fpr�r�r�r��_�150row_adjust�coords�x�ys            rr��Frame.get_cursor_coords0s����z�z�$�$�&�&���t�z�z�#6�7�7��
�
 �
 ����� �1�1�$��=�����
��>��J��[�[�2�2�F�9�=�F�
�6�\��J��Y�Y�0�0�&�5�.�5�:P�1Q�R�F���J��[�[�2�2�F�9�=�F��>������j�.� � rc#�j# �UR(aSv� Sv� UR(aSv� gg7f)zD151Return an iterator over the positions in this Frame top to bottom.152r3r1r2N)r6r8rBs rr��Frame.__iter__K�)����<�<��N����<�<��N����13c#�j# �UR(aSv� Sv� UR(aSv� gg7f)zD153Return an iterator over the positions in this Frame bottom to top.154r2r1r3N)r8r6rBs r�__reversed__�Frame.__reversed__Ur�r�)r7r8r6r1r9rqr2r3)NNr1)r1rr3rr2rr9z,Literal['header', 'footer', 'body'] | Widget)r�zdict[str, typing.Any]r�)r�r)r3rr��None)r�r)r1rr�r)r�r)r2rr�r)r��#Literal['header', 'footer', 'body'])rvrr�r)r�z(BodyWidget | HeaderWidget | FooterWidget)r�zjMutableMapping[Literal['header', 'footer', 'body'], tuple[BodyWidget | HeaderWidget | FooterWidget, None]])r�z)list[Literal['header', 'footer', 'body']])r��Literal['body']r��tuple[BodyWidget, None])r��Literal['header']r��tuple[HeaderWidget, None])r��Literal['footer']r��tuple[FooterWidget, None])r��#Literal['body', 'header', 'footer']r��5tuple[BodyWidget | HeaderWidget | FooterWidget, None])r�rr�rr�r)r�rr�rr�r)r�rr�rr�r)r�r	r�r155r�r)r�zLiteral['header', 'footer']r�r)r�r)r��tuple[int, int]r�boolr�z'tuple[tuple[int, int], tuple[int, int]])F)r�rrrr�r)r�rr�r�r�z156str | None)r�rr�r�r�r�r�r�r�r�rrr�zbool | None)r�rr�ztuple[int, int] | None)r�z-Iterator[Literal['header', 'body', 'footer']])r�z-Iterator[Literal['footer', 'body', 'header']])-rrrr�__doc__�_selectable�	frozensetr157�BOX�_sizingr5r>rC�propertyr3�setterrRrVr1r_rbr2rkrnrqryr|rr�r�r��overloadr�r�r�r�r�r�r�r�r�r�r�r�
__classcell__)r&s@rr.r.,s������K������%�G�158 $�#�CI�#'��#'��#'��	#'�159A�#'�#'�J6�,������]�]����������160�[�[����161�������]�]����������������#�(#��e��e��6�162�6��6�p��_�_�X��X��_�_�\��\��_�_�\��\�	>�6�	>�	>�	>��_�_�e��e��_�_�i��i��_�_�i��i�"�
0�"�E�"�163�	"�(��1.�l�&*��&*��&*�164�	&*�P<��<��<�165�	<�<'o��'o��'o��	'o�166�'o��
'o��'o�167�'o�R!�6��rr.)r*z
Widget | Noner�r)#�168__future__rr�r'�collections.abcr�urwid.canvasrr�urwid.split_reprr�169urwid.utilr�	constantsr170r�	containerr�fillerr
r*rr�
TYPE_CHECKINGr�typing_extensionsr�TypeVarrrrrr,�Genericr.rrr�<module>r"s���"�
��*�7�,�%�%�+��'�	���(�)��^�^�L�
)�171��~�~�n�-���~�~�n�-��	��	�172173�q�F�(�&�.�.��\�S_�9_�*`�qr
codekingpro/portable-devtools · Team Ai