← Back
Editing: containers.cpython-311.pyc
� �Ïc� � � � d Z ddlmZmZ ddlmZ ddlmZ ddlm Z m Z mZmZm Z mZmZmZmZ ddlmZ ddlmZ ddlmZ dd lmZmZmZmZ dd lmZmZm Z ddl!m"Z"m#Z# ddl$m%Z% dd l&m'Z'm(Z( ddl)m*Z*m+Z+m,Z,m-Z- ddl.m/Z/m0Z0m1Z1m2Z2m3Z3 ddl4m5Z5m6Z6m7Z7m8Z8m9Z9 ddl:m;Z; ddl<m=Z= ddl>m?Z?m@Z@mAZA ddlBmCZC e rddlDmEZEmFZF ddlGmHZH g d�ZI G d� de�� � ZJe r G d� deE� � ZKeeJdf ZLdCd �ZM G d!� d"e� � ZN G d#� d$e� � ZO G d%� d&eJ� � ZP G d'� d(eP� � ZQ G d)� d*eP� � ZR G d+� d,eJ� � ZS G d-� d.� � ZT G d/� d0� � ZU G d1� d2� � ZV G d3� d4� � ZWeez ZX G d5� d6e� � ZY G d7� deJ� � ZZ G d8� d9eJ� � Z[ G d:� d;eJ� � Z\d<eLdeJfd=�Z]d<eLdeZfd>�Z^d?e_dd@fdA�Z`dBS )Dza Container for the layout. (Containers can contain other containers or user interface controls.) � )�ABCMeta�abstractmethod)�Enum)�partial) � TYPE_CHECKING�Callable�Dict�List�Optional�Sequence�Tuple�Union�cast)�get_app)�SimpleCache)�Point)�FilterOrBool�emacs_insert_mode� to_filter�vi_insert_mode)�AnyFormattedText�StyleAndTextTuples�to_formatted_text)�fragment_list_to_text�fragment_list_width)�KeyBindingsBase)� MouseEvent�MouseEventType)� get_cwidth�take_using_weights�to_int�to_str� )�DummyControl�FormattedTextControl�GetLinePrefixCallable� UIContent� UIControl)�AnyDimension� Dimension�max_layout_dimensions�sum_layout_dimensions�to_dimension)�Margin)� MouseHandlers)�_CHAR_CACHE�Screen� WritePosition)�explode_text_fragments)�Protocol� TypeGuard)�NotImplementedOrNone)�AnyContainer� Container�HorizontalAlign� VerticalAlign�HSplit�VSplit�FloatContainer�Float�WindowAlign�Window�WindowRenderInfo�ConditionalContainer� ScrollOffsets�ColorColumn�to_container� to_window�is_container�DynamicContainerc � � e Zd ZdZedd�� � Zededefd�� � Zedededefd �� � Z ed e deded e dedee ddfd�� � Zdefd�Zdee fd�Zeded fd�� � ZdS )r8 z/ Base class for user interface layout. �returnNc � � dS )zu Reset the state of this container and all the children. (E.g. reset scroll offsets, etc...) N� ��selfs �B/usr/lib/python3/dist-packages/prompt_toolkit/layout/containers.py�resetzContainer.reset^ � � � � � �max_available_widthc � � dS )z� Return a :class:`~prompt_toolkit.layout.Dimension` that represents the desired width for this container. NrL �rN rS s rO �preferred_widthzContainer.preferred_widthe rQ rR �width�max_available_heightc � � dS )z� Return a :class:`~prompt_toolkit.layout.Dimension` that represents the desired height for this container. NrL �rN rW rX s rO �preferred_heightzContainer.preferred_heightl rQ rR �screen�mouse_handlers�write_position�parent_style�erase_bg�z_indexc � � dS )a= Write the actual content to the screen. :param screen: :class:`~prompt_toolkit.layout.screen.Screen` :param mouse_handlers: :class:`~prompt_toolkit.layout.mouse_handlers.MouseHandlers`. :param parent_style: Style string to pass to the :class:`.Window` object. This will be applied to all content of the windows. :class:`.VSplit` and :class:`.HSplit` can use it to pass their style down to the windows that they contain. :param z_index: Used for propagating z_index from parent to child. NrL �rN r\ r] r^ r_ r` ra s rO �write_to_screenzContainer.write_to_screens rQ rR c � � dS )z� When this container is modal, key bindings from parent containers are not taken into account if a user control in this container is focused. FrL rM s rO �is_modalzContainer.is_modal� s � � �urR c � � dS )z� Returns a :class:`.KeyBindings` object. These bindings become active when any user control in this container has the focus, except if any containers between this container and the focused user control is modal. NrL rM s rO �get_key_bindingszContainer.get_key_bindings� s � � �trR c � � g S )zG Return the list of child :class:`.Container` objects. rL rM s rO �get_childrenzContainer.get_children� s � � � rR �rJ N)�__name__� __module__�__qualname__�__doc__r rP �intr* rV r[ r1 r/ r2 �str�boolr rd rf r rh r rj rL rR rO r8 r8 Y sp � � � � � �� � �� � � �^�� ��3� �9� � � � �^�� ��c� �� �� � � � �^�� ���� &�� &� � �� � � �#��� �� � � �^��*�$� � � � ��(�?�";� � � � � ��d�;�/� � � � �^�� � rR r8 )� metaclassc � � e Zd ZdZdd�ZdS )�MagicContainerzY Any object that implements ``__pt_container__`` represents a container. rJ r7 c � � d S �NrL rM s rO �__pt_container__zMagicContainer.__pt_container__� s � ��CrR N)rJ r7 )rl rm rn ro rx rL rR rO ru ru � s2 � � � � � � � � � � � � � rR ru rJ r@ c �>