Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/prompt_toolkit/layout/__pycache__/controls.cpython-39.pyc
Ðазад
a d�h�� � @ s� d Z ddlmZ ddlZddlmZmZ ddlmZm Z m Z mZmZ ddl mZ ddlmZ ddlmZ dd lmZ dd lmZ ddlmZmZ ddlmZmZmZ dd lmZm Z m!Z! ddl"m#Z#m$Z$ ddl%m&Z&m'Z'm(Z( ddl)m*Z* ddl+m,Z, ddl-m.Z. ddl/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6 e�rFddl7m8Z8m9Z9 ddl-m:Z: g d�Z;e e<e<gef Z=G dd� ded�Z>G dd� d�Z?G dd� de>�Z@G dd � d e>�ZAG d!d"� d"e�ZBG d#d$� d$e>�ZCG d%d&� d&eC�ZDdS )'z) User interface Controls for the layout. � )�annotationsN)�ABCMeta�abstractmethod)� TYPE_CHECKING�Callable�Hashable�Iterable� NamedTuple)�get_app)�Buffer)�SimpleCache)�Point)�Document)�FilterOrBool� to_filter)�AnyFormattedText�StyleAndTextTuples�to_formatted_text)�fragment_list_to_text�fragment_list_width�split_lines)�Lexer�SimpleLexer)�MouseButton� MouseEvent�MouseEventType)�SearchState)� SelectionType�� get_cwidth� )�DisplayMultipleCursors�#HighlightIncrementalSearchProcessor�HighlightSearchProcessor�HighlightSelectionProcessor� Processor�TransformationInput�merge_processors)�KeyBindingsBase�NotImplementedOrNone)�Event)� BufferControl�SearchBufferControl�DummyControl�FormattedTextControl� UIControl� UIContentc @ s� e Zd ZdZdd�dd�Zddd�d d �Zdddddd �dd�Zdd�dd�Zedddd�dd��Z ddd�dd�Z dd�dd�Zdd�dd�Zdd�d d!�Z d"d�d#d$�Zd%S )&r/ z5 Base class for all user interface controls. �None��returnc C s d S �N� ��selfr5 r5 ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/prompt_toolkit/layout/controls.py�resetD s zUIControl.reset�int� int | None��max_available_widthr3 c C s d S r4 r5 �r7 r= r5 r5 r8 �preferred_widthH s zUIControl.preferred_width�bool�GetLinePrefixCallable | None��width�max_available_height� wrap_lines�get_line_prefixr3 c C s d S r4 r5 )r7 rC rD rE rF r5 r5 r8 �preferred_heightK s zUIControl.preferred_heightc C s dS )z> Tell whether this user control is focusable. Fr5 r6 r5 r5 r8 �is_focusableT s zUIControl.is_focusabler0 �rC �heightr3 c C s dS )zn Generate the content for this user control. Returns a :class:`.UIContent` instance. Nr5 )r7 rC rJ r5 r5 r8 �create_contentZ s zUIControl.create_contentr r) ��mouse_eventr3 c C s t S )a; Handle mouse events. When `NotImplemented` is returned, it means that the given event is not handled by the `UIControl` itself. The `Window` or key bindings can decide to handle this event as scrolling or changing focus. :param mouse_event: `MouseEvent` instance. )�NotImplemented)r7 rM r5 r5 r8 � mouse_handlerb s zUIControl.mouse_handlerc C s dS )z� Request to move the cursor down. This happens when scrolling down and the cursor is completely at the top. Nr5 r6 r5 r5 r8 �move_cursor_downn s zUIControl.move_cursor_downc C s dS )z0 Request to move the cursor up. Nr5 r6 r5 r5 r8 �move_cursor_upu s zUIControl.move_cursor_up�KeyBindingsBase | Nonec C s dS )z� The key bindings that are specific for this user control. Return a :class:`.KeyBindings` object if some key bindings are specified, or `None` otherwise. Nr5 r6 r5 r5 r8 �get_key_bindingsz s zUIControl.get_key_bindings�Iterable[Event[object]]c C s g S )z� Return a list of `Event` objects. This can be a generator. (The application collects all these events, in order to bind redraw handlers to these events.) r5 r6 r5 r5 r8 �get_invalidate_events� s zUIControl.get_invalidate_eventsN)�__name__� __module__�__qualname__�__doc__r9 r? rG rH r rK rO rP rQ rS rU r5 r5 r5 r8 r/ ? s r/ )� metaclassc @ s^ e Zd ZdZdd� ddddfddd d d d�dd �Zddd�dd�Zddddddd�dd�ZdS )r0 a� Content generated by a user control. This content consists of a list of lines. :param get_line: Callable that takes a line number and returns the current line. This is a list of (style_str, text) tuples. :param line_count: The number of lines. :param cursor_position: a :class:`.Point` for the cursor position. :param menu_position: a :class:`.Point` for the menu position. :param show_cursor: Make the cursor visible. c C s g S r4 r5 ��ir5 r5 r8 �<lambda>� � zUIContent.<lambda>r NT�#Callable[[int], StyleAndTextTuples]r: �Point | Noner@ )�get_line� line_count�cursor_position� menu_position�show_cursorc C s4 || _ || _|ptddd�| _|| _|| _i | _d S �Nr ��x�y)ra rb r rc rd re �_line_heights_cache)r7 ra rb rc rd re r5 r5 r8 �__init__� s zUIContent.__init__r )�linenor3 c C s || j k r| �|�S t�dS )z(Make it iterable (iterate line by line).N)rb ra � IndexError)r7 rl r5 r5 r8 �__getitem__� s zUIContent.__getitem__rA r; )rl rC rF � slice_stopr3 c C s t � j|||f}z| j| W S t�y |dkr:d}n�t| �|��d|� }t|�}|r�|tt||d���7 }d}||kr�|d7 }||8 }t|||d ��} tt| ��} | |kr�d}q�|| 7 }qvnBzt ||�\}}W n t y� d}Y n0 |� r�|d7 }td|�}|| j|<