ó
‹²,]c           @   s­   d  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 m Z m Z m Z d e e e e e f d „  ƒ  YZ d	 e e f d
 „  ƒ  YZ d S(   s#   Control widgets used by ShellWidgetiÿÿÿÿ(   t   Qtt   Signal(   t	   QTextEdit(   t   restore_keyevent(   t   CallTipWidget(   t   BaseEditMixint   GetHelpMixint   TracebackLinksMixint   BrowseHistoryMixint   ControlWidgetc           B   sn   e  Z d  Z e Z e e ƒ Z e e ƒ Z	 e ƒ  Z
 d d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   sw   
    Subclass of QTextEdit with features from Spyder's mixins to use as the
    control widget for IPython widgets
    c         C   so   t  j |  | ƒ t j |  ƒ t j |  ƒ t j |  ƒ t j |  ƒ t |  d t ƒ|  _ g  |  _	 t |  _
 d  S(   Nt   hide_timer_on(   R   t   __init__R   R   R   R   R   t   Falset   calltip_widgett   found_resultst   calltips(   t   selft   parent(    (    sD   lib/python2.7/site-packages/spyder/widgets/ipythonconsole/control.pyR      s    	c         C   s   |  j  j t ƒ d S(   s   Reimplement Qt MethodN(   t   visibility_changedt   emitt   True(   R   t   event(    (    sD   lib/python2.7/site-packages/spyder/widgets/ipythonconsole/control.pyt	   showEvent+   s    c         C   sa   |  j  ƒ  j |  _ |  j ƒ  rP |  j ƒ  } | rP | j ƒ  rP |  j | ƒ qP n  |  j | ƒ d S(   s    Action for '(' N(   t   parentWidgett   _prompt_post   current_prompt_post   get_current_line_to_cursort   get_last_objt   isdigitt   show_object_infot   insert_text(   R   t   textt   last_obj(    (    sD   lib/python2.7/site-packages/spyder/widgets/ipythonconsole/control.pyt   _key_paren_left/   s    c         C   st   t  | ƒ \ } } } } } | t j k r` |  j ƒ  r` |  j r` |  j ƒ  j r` |  j | ƒ n t j	 |  | ƒ d S(   s4   Reimplement Qt Method - Basic keypress event handlerN(
   R   R    t   Key_ParenLeftt   has_selected_textt   help_enabledR   t   _readingR!   R   t   keyPressEvent(   R   R   R   t   keyt   ctrlt   shift(    (    sD   lib/python2.7/site-packages/spyder/widgets/ipythonconsole/control.pyR&   8   s
    c         C   s#   |  j  j ƒ  t t |  ƒ j | ƒ S(   s7   Reimplement Qt method to send focus change notification(   t   focus_changedR   t   superR	   t   focusInEvent(   R   R   (    (    sD   lib/python2.7/site-packages/spyder/widgets/ipythonconsole/control.pyR,   B   s    c         C   s#   |  j  j ƒ  t t |  ƒ j | ƒ S(   s7   Reimplement Qt method to send focus change notification(   R*   R   R+   R	   t   focusOutEvent(   R   R   (    (    sD   lib/python2.7/site-packages/spyder/widgets/ipythonconsole/control.pyR-   G   s    N(   t   __name__t
   __module__t   __doc__R   t   QT_CLASSR   t   boolR   t   strt   go_to_errorR*   t   NoneR   R   R!   R&   R,   R-   (    (    (    sD   lib/python2.7/site-packages/spyder/widgets/ipythonconsole/control.pyR	      s   					
	t   PageControlWidgetc           B   sb   e  Z d  Z e Z e e ƒ Z e ƒ  Z e ƒ  Z	 d d „ Z d „  Z d „  Z d „  Z d „  Z RS(   s„   
    Subclass of QTextEdit with features from Spyder's mixins.BaseEditMixin to
    use as the paging widget for IPython widgets
    c         C   s*   t  j |  | ƒ t j |  ƒ g  |  _ d  S(   N(   R   R   R   R   (   R   R   (    (    sD   lib/python2.7/site-packages/spyder/widgets/ipythonconsole/control.pyR   W   s    c         C   s   |  j  j t ƒ d S(   s   Reimplement Qt MethodN(   R   R   R   (   R   R   (    (    sD   lib/python2.7/site-packages/spyder/widgets/ipythonconsole/control.pyR   \   s    c         C   sJ   t  | ƒ \ } } } } } | t j k rF |  j ƒ  rF |  j j ƒ  n  d S(   s4   Reimplement Qt Method - Basic keypress event handlerN(   R   R    t	   Key_Slasht	   isVisiblet   show_find_widgetR   (   R   R   R   R'   R(   R)   (    (    sD   lib/python2.7/site-packages/spyder/widgets/ipythonconsole/control.pyR&   `   s    c         C   s#   |  j  j ƒ  t t |  ƒ j | ƒ S(   s7   Reimplement Qt method to send focus change notification(   R*   R   R+   R6   R,   (   R   R   (    (    sD   lib/python2.7/site-packages/spyder/widgets/ipythonconsole/control.pyR,   g   s    c         C   s#   |  j  j ƒ  t t |  ƒ j | ƒ S(   s7   Reimplement Qt method to send focus change notification(   R*   R   R+   R6   R-   (   R   R   (    (    sD   lib/python2.7/site-packages/spyder/widgets/ipythonconsole/control.pyR-   l   s    N(   R.   R/   R0   R   R1   R   R2   R   R9   R*   R5   R   R   R&   R,   R-   (    (    (    sD   lib/python2.7/site-packages/spyder/widgets/ipythonconsole/control.pyR6   M   s   					N(   R0   t   qtpy.QtCoreR    R   t   qtpy.QtWidgetsR   t   spyder.utils.qthelpersR   t   spyder.widgets.calltipR   t   spyder.widgets.mixinsR   R   R   R   R	   R6   (    (    (    sD   lib/python2.7/site-packages/spyder/widgets/ipythonconsole/control.pyt   <module>   s   "9