
    +"                        d dl mZ ddlmZmZ ddlmZ ddlmZm	Z	 ddl
mZmZ ddlmZmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl m!Z!m"Z" d dl#Z#dZ$ G d de%      Z& G d de%      Z'y)    )unicode_literals   )BufferAcceptAction)BufferMapping)	ClipboardInMemoryClipboard)DEFAULT_BUFFEREditingMode)	CLIFilterto_cli_filter)load_basic_bindings)load_emacs_bindings)load_vi_bindings)BaseRegistry)load_key_bindings)Window)	Container)BufferControl)DEFAULT_STYLEStyleN)AbortActionApplicationc                   &    e Zd ZdZdZdZdZeeefZy)r   z8
    Actions to take on an Exit or Abort exception.
    retryzraise-exceptionzreturn-noneN)__name__
__module____qualname____doc__RETRYRAISE_EXCEPTIONRETURN_NONE_all     -lib/third_party/prompt_toolkit/application.pyr   r      s$     E'OK?K0Dr%   r   c                       e Zd ZdZdddedddej                  ej                  dddddej                  ddddddddddfdZ	y)r   aY
  
    Application class to be passed to a
    :class:`~prompt_toolkit.interface.CommandLineInterface`.

    This contains all customizable logic that is not I/O dependent.
    (So, what is independent of event loops, input and output.)

    This way, such an :class:`.Application` can run easily on several
    :class:`~prompt_toolkit.interface.CommandLineInterface` instances, each
    with a different I/O backends. that runs for instance over telnet, SSH or
    any other I/O backend.

    :param layout: A :class:`~prompt_toolkit.layout.containers.Container` instance.
    :param buffer: A :class:`~prompt_toolkit.buffer.Buffer` instance for the default buffer.
    :param initial_focussed_buffer: Name of the buffer that is focussed during start-up.
    :param key_bindings_registry:
        :class:`~prompt_toolkit.key_binding.registry.BaseRegistry` instance for
        the key bindings.
    :param clipboard: :class:`~prompt_toolkit.clipboard.base.Clipboard` to use.
    :param on_abort: What to do when Control-C is pressed.
    :param on_exit: What to do when Control-D is pressed.
    :param use_alternate_screen: When True, run the application on the alternate screen buffer.
    :param get_title: Callable that returns the current title to be displayed in the terminal.
    :param erase_when_done: (bool) Clear the application output when it finishes.
    :param reverse_vi_search_direction: Normally, in Vi mode, a '/' searches
        forward and a '?' searches backward. In readline mode, this is usually
        reversed.

    Filters:

    :param mouse_support: (:class:`~prompt_toolkit.filters.CLIFilter` or
        boolean). When True, enable mouse support.
    :param paste_mode: :class:`~prompt_toolkit.filters.CLIFilter` or boolean.
    :param ignore_case: :class:`~prompt_toolkit.filters.CLIFilter` or boolean.
    :param editing_mode: :class:`~prompt_toolkit.enums.EditingMode`.

    Callbacks (all of these should accept a
    :class:`~prompt_toolkit.interface.CommandLineInterface` object as input.)

    :param on_input_timeout: Called when there is no input for x seconds.
                    (Fired when any eventloop.onInputTimeout is fired.)
    :param on_start: Called when reading input starts.
    :param on_stop: Called when reading input ends.
    :param on_reset: Called during reset.
    :param on_buffer_changed: Called when the content of a buffer has been changed.
    :param on_initialize: Called after the
        :class:`~prompt_toolkit.interface.CommandLineInterface` initializes.
    :param on_render: Called right after rendering.
    :param on_invalidate: Called when the UI has been invalidated.
    NFc                 P   t        |      }t        |      }t        |      }t        |      }|t        |t              sJ |t        |t              sJ |t        |t        t
        f      sJ |t        |t              sJ |t        |t              sJ |t        j                  v sJ |	t        j                  v sJ t        |
t              sJ |t        |      sJ t        |t              sJ t        |t              sJ t        |t        j                        sJ |t        |      sJ |t        |t              sJ t        |t              sJ |t        |      sJ |t        |      sJ |t        |      sJ |t        |      sJ |t        |      sJ |t        |      sJ |t        |      sJ |xs t!        t#                     | _        |xs t        t&        j(                        | _        |rt        |t
              st        ||      | _        n|| _        |r|| j,                  t.        <   || _        |xs t2        | _        |
t7               }|d }|| _        |xs
 t;               | _        || _        |	| _         |
| _!        || _"        || _#        || _$        || _%        || _&        || _'        || _(        d }|xs || _)        |xs || _*        |xs || _+        |xs || _,        |xs || _-        |xs || _.        |xs || _/        |xs || _0        g | _1        y )N)accept_action)initialc                       y )Nr$   r$   r%   r&   <lambda>z&Application.__init__.<locals>.<lambda>   s    r%   c                      y)z Dummy event handler. Nr$   )clis    r&   dummy_handlerz+Application.__init__.<locals>.dummy_handler   s    r%   )2r   
isinstancer   r   dictr   r   r   r   r#   boolcallabler   sixstring_typesr   r   r   layoutr   IGNOREbufferbuffersr
   initial_focussed_bufferr   styler   key_bindings_registryr	   	clipboardon_aborton_exituse_alternate_screenmouse_support	get_title
paste_modeignore_caseediting_modeerase_when_donereverse_vi_search_directionon_input_timeouton_starton_stopon_reseton_initializeon_buffer_changed	on_renderon_invalidatepre_run_callables)selfr6   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   r/   s                              r&   __init__zApplication.__init__W   s@     #:.
#K0%m4&34O&P#~FI!>>>~FF!;;;*Wt]6K"LLL$,
;PR^0___ Jy)$DDD;++++++*****.555 HY$777*i000+y111,(8(8999'84D+EEE}
5% 888/40008H#555(7"3338H#555 (H5F,GGG$(??? HY$777$(???7} 7 I\5H5H Ij-@(:QRDL"DL+1DLL('>$+m
 ($5$7!$I%:""9&7&9 $8!*"$&(.+F(	% !1 AM 1M/- 1M*;m!2!Cm"3m*;m "$r%   )
r   r   r   r   r
   r   r!   r   EMACSrR   r$   r%   r&   r   r   $   sa    1d #4)7'+t%55{?Z?Z&+5!u;CTCT!&-2"&tddti$r%   r   )(
__future__r   r8   r   r   buffer_mappingr   r=   r   r	   enumsr
   r   filtersr   r   key_binding.bindings.basicr   key_binding.bindings.emacsr   key_binding.bindings.vir   key_binding.registryr   key_binding.defaultsr   r6   r   layout.containersr   layout.controlsr   stylesr   r   r4   __all__objectr   r   r$   r%   r&   <module>rb      sV    ' ( ) 3 . - ; ; 5 . 3  ( * ( 
1& 1\$& \$r%   