ó
±xYc           @  sP  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$ d e% f d „  ƒ  YZ& d e% f d „  ƒ  YZ' d S(   iÿÿÿÿ(   t   unicode_literalsi   (   t   Buffert   AcceptAction(   t   BufferMapping(   t	   Clipboardt   InMemoryClipboard(   t   DEFAULT_BUFFERt   EditingMode(   t	   CLIFiltert   to_cli_filter(   t   load_basic_bindings(   t   load_emacs_bindings(   t   load_vi_bindings(   t   BaseRegistry(   t   load_key_bindings(   t   Window(   t	   Container(   t   BufferControl(   t   DEFAULT_STYLEt   StyleNu   AbortActionu   Applicationt   AbortActionc           B  s/   e  Z d  Z d Z d Z d Z e e e f Z RS(   u8   
    Actions to take on an Exit or Abort exception.
    u   retryu   raise-exceptionu   return-none(   t   __name__t
   __module__t   __doc__t   RETRYt   RAISE_EXCEPTIONt   RETURN_NONEt   _all(    (    (    s9   lib/python2.7/site-packages/prompt_toolkit/application.pyR      s
   t   Applicationc           B  sk   e  Z d  Z d d d e d d d e j e j e e d e e e j	 e e d d d d d d d d d „ Z
 RS(   uY
  
    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.
    c         C  sl  t  | ƒ } t  | ƒ } t  | ƒ } t  | ƒ } | d  k sQ t | t ƒ sQ t ‚ | d  k sr t | t ƒ sr t ‚ | d  k s™ t | t t f ƒ s™ t ‚ | d  k sº t | t ƒ sº t ‚ | d  k sÛ t | t	 ƒ sÛ t ‚ | t
 j k sð t ‚ |	 t
 j k st ‚ t |
 t ƒ st ‚ | d  k s8t | ƒ s8t ‚ t | t ƒ sMt ‚ t | t ƒ sbt ‚ t | t j ƒ szt ‚ | d  k s˜t | ƒ s˜t ‚ | d  k s¹t | t ƒ s¹t ‚ t | t ƒ sÎt ‚ | d  k sìt | ƒ sìt ‚ | d  k s
t | ƒ s
t ‚ | d  k s(t | ƒ s(t ‚ | d  k sFt | ƒ sFt ‚ | d  k sdt | ƒ sdt ‚ | d  k s‚t | ƒ s‚t ‚ | d  k s t | ƒ s t ‚ | p²t t ƒ  ƒ |  _ | pÍt d t j ƒ |  _ | sêt | t ƒ rt | d | ƒ|  _ n	 | |  _ | r!| |  j t <n  | |  _ | p3t |  _ | d  k rQt ƒ  } n  | d  k rid „  } n  | |  _ | p~t ƒ  |  _  | |  _! |	 |  _" |
 |  _# | |  _$ | |  _% | |  _& | |  _' | |  _( | |  _) | |  _* d „  } | pð| |  _+ | pÿ| |  _, | p| |  _- | p| |  _. | p,| |  _/ | p;| |  _0 | pJ| |  _1 | pY| |  _2 g  |  _3 d  S(   Nt   accept_actiont   initialc           S  s   d  S(   N(   t   None(    (    (    s9   lib/python2.7/site-packages/prompt_toolkit/application.pyt   <lambda>   s    c         S  s   d S(   u    Dummy event handler. N(    (   t   cli(    (    s9   lib/python2.7/site-packages/prompt_toolkit/application.pyt   dummy_handler­   s    (4   R	   R   t
   isinstanceR   t   AssertionErrorR   t   dictR   R   R   R   R   t   boolt   callableR   t   sixt   string_typesR   R   R   t   layoutR   t   IGNOREt   buffert   buffersR   t   initial_focussed_bufferR   t   styleR   t   key_bindings_registryR   t	   clipboardt   on_abortt   on_exitt   use_alternate_screent   mouse_supportt	   get_titlet
   paste_modet   ignore_caset   editing_modet   erase_when_donet   reverse_vi_search_directiont   on_input_timeoutt   on_startt   on_stopt   on_resett   on_initializet   on_buffer_changedt	   on_rendert   on_invalidatet   pre_run_callables(   t   selfR*   R,   R-   R.   R/   R0   R1   R2   R3   R4   R5   R6   R7   R8   R9   R:   R;   R<   R=   R>   R?   R@   RA   RB   RC   R"   (    (    s9   lib/python2.7/site-packages/prompt_toolkit/application.pyt   __init__W   sz    !!'!!!															N(   R   R   R   R   R   R   R   t   FalseR   t   EMACSRF   (    (    (    s9   lib/python2.7/site-packages/prompt_toolkit/application.pyR   $   s   2			(   u   AbortActionu   Application((   t
   __future__R    R,   R   R   t   buffer_mappingR   R1   R   R   t   enumsR   R   t   filtersR   R	   t   key_binding.bindings.basicR
   t   key_binding.bindings.emacsR   t   key_binding.bindings.viR   t   key_binding.registryR   t   key_binding.defaultsR   R*   R   t   layout.containersR   t   layout.controlsR   t   stylesR   R   R(   t   __all__t   objectR   R   (    (    (    s9   lib/python2.7/site-packages/prompt_toolkit/application.pyt   <module>   s&    