
,]c           @   s  d  Z  d d l Z d d l Z d d l Z d d l m Z d d l m Z d d l m	 Z	 m
 Z
 m Z m Z m Z m Z d d l m Z m Z m Z m Z m Z m Z m Z m Z m Z d d l m Z m Z m Z m Z m Z m Z m  Z  m! Z! d d l" m# Z# d d	 l$ m% Z% d d
 l& m' Z' m( Z( m) Z) d d l* m+ Z, d d l- m. Z. d d l/ m0 Z0 d d l1 m2 Z2 d   Z3 d e f d     YZ4 d e e0 f d     YZ5 d e2 f d     YZ6 d   Z7 d e8 f d     YZ9 d e5 f d     YZ: d S(   s   QPlainTextEdit base classiN(   t   OrderedDict(   t   to_qvariant(   t   QEventt
   QEventLoopt   QPointt   Qtt   Signalt   Slot(	   t
   QClipboardt   QColort   QFontt   QMouseEventt   QPalettet   QTextCharFormatt   QTextFormatt   QTextOptiont   QTextCursor(   t   QAbstractItemViewt   QApplicationt   QListWidgett   QListWidgetItemt   QMainWindowt   QPlainTextEditt	   QTextEditt   QToolTip(   t   get_font(   t   CONF(   t   PY3t	   str_lowert   to_text_string(   t   icon_manager(   t   CallTipWidget(   t   BaseEditMixin(   t   ANSIEscapeCodeHandlerc         C   s   xp t  rr | j t d   } | d k r. Pn  |  j | |  |  |  j   d k ra |  j   n  | | d } q W|  j | |  d S(   s4   Helper to print text, taking into account backspacesi   ii    i   N(   t   Truet   findt   chrt
   insertTextt   positionInBlockt   deletePreviousChar(   t   cursort   textt   fmtt   index(    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   insert_text_to'   s    	t   CompletionWidgetc           B   sh   e  Z d  Z e e  Z d   Z d   Z e d  Z	 d   Z
 d   Z d   Z d   Z d	 d  Z RS(
   s   Completion list widgetc         C   sl   t  j |  |  |  j t j t j B | |  _ d  |  _ t	 |  _
 d  |  _ |  j   |  j j |  j  d  S(   N(   R   t   __init__t   setWindowFlagsR   t	   SubWindowt   FramelessWindowHintt   texteditt   Nonet   completion_listt   Falset   case_sensitivet   enter_selectt   hidet   itemActivatedt   connectt   item_selected(   t   selft   parentt   ancestor(    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR.   9   s    				
c         C   s   |  j  |   |  j |  d  S(   N(   t   resizet   setFont(   R<   t   sizet   font(    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   setup_appearanceC   s    c         C   s  g  | D] } | d ^ q } g  | D] } | d ^ q$ } t  |  d k rk | rk |  j j | d  d  S| |  _ |  j   i d d 6d d 6d d 6d d 6d d 6d	 d	 6} | |  _ t |  rx^ t | |  D]= \ } } | j | d
  } |  j	 t
 t j |  |   q Wn |  j |  |  j d  t j t j  |  j   |  j   |  j   t j   } | j | j |    }	 |	 j   }
 |	 j   } |  j j   j   } | j | j   |  j j    |  j j  |  } | j   |  j!   } |  j"   } | d  k r|
 } n" t$ | j   | j!   |
 g  } | | k rg| j | j   |  j!    n  | j%   |  j&   } |  j"   } | d  k r| } n" t$ | j%   | j&   | g  } | j   } | | k r,|  j j   j'   } |  j j  |  } | j |  | j( | j%   |  j&    n  | d  k	 rJ| j) |  } n  |  j* |  t+ |  j j,  rv|  j-   n  |  j. j/ |  d  S(   Ni   i    t	   attributet   instancet	   statementt   methodt   functiont   classt   modulet   no_match(0   t   lenR2   t   insert_completionR4   t   cleart	   type_listt   anyt   zipt   gett   addItemR   t   imat   icont   addItemst   setCurrentRowR   t   processEventsR   t   ExcludeUserInputEventst   showt   setFocust   raise_t   desktopt   availableGeometryt   screenNumbert   rightt   bottomt
   cursorRectt   bottomRightt   setXt   xt   get_linenumberarea_widtht   mapToGlobalt   widthR=   R3   t   mint   yt   heightt   topRightt   setYt   mapFromGlobalt   moveR   t   completion_textt   update_currentt   sig_show_completionst   emit(   R<   R4   t	   automatict   ct   typest	   icons_mapt   tRU   R]   t   srectt   screen_rightt   screen_bottomt   pointt
   comp_rightR>   t	   anc_rightt   comp_bottomt
   anc_bottomt
   x_position(    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt	   show_listG   sn    	


	&


 	" 	" c         C   s   t  j |   |  j j   d  S(   N(   R   R8   R2   R[   (   R<   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR8      s    c         C   s  | j    | j   } } | j   t j @} | j   t j @} | j   t j @} | pa | pa | } | t j t j f k r |  j	 s | t j
 k r |  j   n| t j t j t j t j f k s | d k r |  j   |  j j |  n | t j t j t j t j t j t j t j f k r>| r>t j |  |  nk t |  sY| t j k rv|  j j |  |  j   n3 | r|  j j |  n |  j   t j |  |  d  S(   Nt   .t   :(   R   R   (   R)   t   keyt	   modifiersR   t   AltModifiert   ShiftModifiert   ControlModifiert
   Key_Returnt	   Key_EnterR7   t   Key_TabR;   t   Key_Leftt	   Key_RightR8   R2   t   keyPressEventt   Key_Upt   Key_Downt
   Key_PageUpt   Key_PageDownt   Key_Homet   Key_Endt   Key_CapsLockR   RL   t   Key_BackspaceRq   (   R<   t   eventR)   R   t   altt   shiftt   ctrlt   modifier(    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR      s.    !!

c         C   s   t  |  j j  } | r x t |  j  D]n \ } } |  j s] | GH| j   } | j   } n  | j |  r( |  j |  |  j	 |  j
   t j  Pq( q( W|  j   n
 |  j   d  S(   N(   R   R2   Rp   t	   enumerateR4   R6   t   lowert
   startswithRW   t   scrollTot   currentIndexR   t   PositionAtTopR8   (   R<   Rp   t   rowt
   completion(    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyRq      s    	
c         C   sL   | j    t j d k r> | j   t j k rH |  j   qH n
 |  j   d  S(   Nt   darwin(   t   ignoret   syst   platformt   reasonR   t   ActiveWindowFocusReasonR8   (   R<   R   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   focusOutEvent   s
    
c         C   sE   | d  k r |  j   } n  |  j j t | j     |  j   d  S(   N(   R3   t   currentItemR2   RM   R   R)   R8   (   R<   t   item(    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR;      s    N(   t   __name__t
   __module__t   __doc__R   t   objectRr   R.   RC   R"   R   R8   R   Rq   R   R3   R;   (    (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR-   4   s   	
	T				t   TextEditBaseWidgetc           B   s  e  Z d  Z dM Z dN Z e   Z e   Z e   Z	 e   Z
 e   Z e e  Z dN d  Z d   Z d   Z d   Z d   Z d   Z d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z dN e d  Z  d   Z! d   Z" d   Z# d   Z$ d   Z% dN d  Z& e'   d    Z( d   Z) d   Z* d   Z+ d   Z, d    Z- d!   Z. dN dN d"  Z/ d#   Z0 d$   Z1 d%   Z2 d&   Z3 d'   Z4 d(   Z5 d)   Z6 e7 d*  Z8 d+   Z9 d,   Z: e7 d-  Z; d.   Z< d/   Z= d0   Z> d1   Z? d2   Z@ d3   ZA d4   ZB d5   ZC d6   ZD e7 d7  ZE d8   ZF d9 e7 d:  ZG d;   ZH d<   ZI d=   ZJ d>   ZK d?   ZL d@   ZM dA   ZN dB   ZO dC   ZP dN dD  ZQ dE   ZR dF   ZS dG   ZT dH   ZU dI   ZV dJ   ZW dK   ZX dL   ZY RS(O   s   Text edit base widgett   soft   eofc         C   s  t  j |  |  t j |   |  j t j  t   |  _ |  j j	 |  j
  |  j j	 |  j  d |  _ d |  _ | d  k	 r | } x/ t | t  s | j   } | d  k r Pq q W| d  k	 r | } q n  t |  |  |  _ t |  _ t |  _ t |  _ d |  _ |  j   t |  d t |  _ t |  _ d  |  _ t |  _  t |  _! t" t j#  j$ d  |  _% t" t j#  j$ d  |  _& d  |  _' t" t j(  |  _) t" t j#  |  _* d  |  _+ d  S(   Nt    i   t    t   hide_timer_oni   i   s       (,   R   R.   R    t   setAttributeR   t   WA_DeleteOnCloseR    t   extra_selections_dictt   textChangedR:   t   changedt   cursorPositionChangedt   cursor_position_changedt   indent_charst   tab_stop_width_spacesR3   t
   isinstanceR   R=   R-   t   completion_widgetR5   t   codecompletion_autoR"   t   codecompletion_caset   codecompletion_enterRp   t   setup_completionR   t   calltip_widgett   calltipst   calltip_positiont   has_cell_separatorst   highlight_current_cell_enabledR	   t   redt   lightert   currentline_colort   currentcell_colort   bracepost   greent   matched_p_colort   unmatched_p_colort   last_cursor_cell(   R<   R=   t   mainwin(    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR.      sB    						
					c         C   s2   t  j d d  } t   } |  j j | |  d  S(   Nt   mains   completion/size(   R   RR   R   R   RC   (   R<   RA   RB   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR     s    	c         C   s   | |  _  d  S(   N(   R   (   R<   R   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   set_indent_chars   s    c         C   s   | |  _  |  j   d  S(   N(   R   t   update_tab_stop_width_spaces(   R<   R   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   set_tab_stop_width_spaces#  s    	c         C   s'   |  j  |  j   j d |  j   d  S(   NR   (   t   setTabStopWidtht   fontMetricsRh   R   (   R<   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR   '  s    c         C   s   t    } | j t  j |  | j t  j |  |  j |  t j d k r |  j   r d |  j   | j   | j   f } |  j	 |  q n  d S(   sh   
        Set text editor palette colors:
        background color and caret (text cursor) color
        R   s.   QPlainTextEdit#%s {background: %s; color: %s;}N(
   R   t   setColort   Baset   Textt
   setPaletteR   R   t
   objectNamet   namet   setStyleSheet(   R<   t
   backgroundt
   foregroundt   palettet   style(    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   set_palette+  s    	"c         C   sK   |  j  |  } | rC |  j | d j } | j   | j   } | Sd Sd  S(   Ni    (   t   get_extra_selectionsR   R(   t   selectionEndt   selectionStart(   R<   R   t	   selectionR(   t   selection_length(    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   extra_selection_length@  s    c         C   s   |  j  j | g   S(   N(   R   RR   (   R<   R   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR   I  s    c            sD   |   j  | <t t   j  j   d   f d   d t    _  d  S(   NR   c            s     j  |  d  S(   Ni    (   R   (   t   s(   R<   (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   <lambda>P  R   t   reverse(   R   R    t   sortedt   itemsR"   (   R<   R   t   extra_selections(    (   R<   s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   set_extra_selectionsL  s    c         C   s   g  } d |  j  k r, | j |  j  d  n  d |  j  k rR | j |  j  d  n  xK t |  j  j    D]4 \ } } | d k p | d k sh | j |  qh qh W|  j |  d  S(   Nt   current_cellt   current_line(   R   t   extendt   listR   t   setExtraSelections(   R<   R   R   t   extra(    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   update_extra_selectionsS  s    "c         C   s   g  |  j  | <|  j   d  S(   N(   R   R   (   R<   R   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   clear_extra_selectionsb  s    c         C   s    |  j  j |  j   j    d S(   s   Emit changed signalN(   t   modificationChangedRs   t   documentt
   isModified(   R<   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR   f  s    c         C   sx   t  j   } | j j t j t t   | j j |  j	  |  j
   | _ | j j   |  j d | g  |  j   d S(   s   Highlight current lineR   N(   R   t   ExtraSelectiont   formatt   setPropertyR   t   FullWidthSelectionR   R"   t   setBackgroundR   t
   textCursorR(   t   clearSelectionR   R   (   R<   R   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   highlight_current_linel  s    c         C   s   |  j  d  d S(   s   Unhighlight current lineR   N(   R   (   R<   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   unhighlight_current_linew  s    c         C   s   |  j  d k s |  j r d St j   } | j j t j t	 t
   | j j |  j  |  j   \ | _ } } | r |  j d  n\ | r |  j r |  j d | g  |  j   q |  j d  n |  j d | g  |  j   d S(   s   Highlight current cellNR   (   t   cell_separatorsR3   R   R   R   R  R  R   R  R   R"   R  R   t&   select_current_cell_in_visible_portionR(   R   R   R   R   (   R<   R   t   whole_file_selectedt   whole_screen_selected(    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   highlight_current_cell|  s"    
	c         C   s   |  j  d  d S(   s   Unhighlight current cellR   N(   R   (   R<   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   unhighlight_current_cell  s    c         C   s  |  j  \ } } | rQ i d d 6d d 6d d 6} |  j | |  } d } d }	 nM i d d 6d d 6d d 6} |  j | |  } t |  d } t |  d }	 x t r| r | j | | |	  }
 n | j | | d |	 d  }
 |
 d	 k r| r|
 d }	 | j | | |
  } n# |
 d }	 | j | |
 | d  } | d	 k rf| rY| d } q| d } q| rt| |
 S| t |  |
 Sq d  Sq Wd  S(
   Nt   )t   (t   ]t   [t   }t   {i   i    i(   t   BRACE_MATCHING_SCOPEt   get_textRL   R"   R#   t   rfind(   R<   t   positiont   bracet   forwardt	   start_post   end_post   bracemapR)   t   i_start_opent   i_start_closet   i_closet   i_open(    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   find_brace_match  s8    		

c         C   s   | r |  j  d  d  Sg  } x | D] } | |  j d  k rC d  St j   } | j j |  |  j   | _ | j j   | j j	 |  | j j
 t j t j  | j |  q$ W|  j d |  |  j   d  S(   Nt   brace_matchingR   (   R   t   get_positionR   R   R  R  R  R(   R  t   setPositiont   movePositionR   t   NextCharactert
   KeepAnchort   appendR   R   (   R<   t	   positionst   colort   cancelR   R  R   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   __highlight  s"    
c         C   s9  |  j  d k	 r1 |  j |  j  d t d |  _  n  |  j   } | j   d k rS d S| j t j t j	  t
 | j    } | j   } | d k r |  j | | d t } n+ | d k r |  j | | d t } n d S| d k	 r| | f |  _  |  j |  j  d |  j n% | f |  _  |  j |  j  d |  j d S(   s   Brace matchingR,  i    NR  R  R  R  R  R  R  R+  (   R  R  R  (   R  R  R  (   R   R3   t   _TextEditBaseWidget__highlightR"   R  R  R&  R   t   PreviousCharacterR(  R   t   selectedTextR"  R5   R   R   (   R<   R(   R)   t   pos1t   pos2(    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR     s(    
c         C   s   | |  _  d S(   s   Set code completion stateN(   R   (   R<   t   state(    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   set_codecompletion_auto  s    c         C   s   | |  _  | |  j _ d S(   s   Case sensitive completionN(   R   R   R6   (   R<   R3  (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   set_codecompletion_case  s    	c         C   s   | |  _  | |  j _ d S(   s%   Enable Enter key to select completionN(   R   R   R7   (   R<   R3  (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   set_codecompletion_enter  s    	c         C   s   | |  _  d S(   s   Set calltips stateN(   R   (   R<   R3  (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   set_calltips  s    c         C   sJ   | d k r t  j } n! | d k r0 t  j } n	 t  j } |  j |  d S(   sV   
        Set wrap mode
        Valid *mode* values: None, 'word', 'character'
        t   wordt	   characterN(   R   t   WrapAtWordBoundaryOrAnywheret   WrapAnywheret   NoWrapt   setWordWrapMode(   R<   t   modet	   wrap_mode(    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   set_wrap_mode   s    	c         C   s,   |  j    r( t j   j |  j     n  d S(   s]   
        Reimplement Qt method
        Copy text to clipboard with correct EOL chars
        N(   t   get_selected_textR   t	   clipboardt   setText(   R<   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   copy  s    c         C   sf   t  j d k rO t rO |  j d d  } | j d d  j d d  j d d  St t |   j   Sd S(	   sU   
        Reimplement Qt method
        Fix PyQt4 bug on Windows and Python 3
        t   ntR   R   s   \u2028s   
s   \u2029s   \u0085N(   t   osR   R   R  t   replacet   superR   t   toPlainText(   R<   R)   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyRI    s
    

c         C   s   | j    | j   } } | j   t j @} | j   t j @} | sK | rg | t j k rg |  j   n t t	 |   j
 |  d  S(   N(   R)   R   R   R   R   t   MetaModifiert   Key_CRD  RH  R   R   (   R<   R   R)   R   R   t   meta(    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR   )  s    c         C   s  |  j    } d   } |  j   \ } } |  j   } | s= d S| j |  } t |  d k r | |  j |   } d | | | d  | } n  d } d }	 | j |  } xf t t |  d d d  D]H }
 | |
 } | j   r| |  }	 t |	 |  } q d |	 | |
 <q W| r<g  | D] } | | ^ q#} n  xG | r| d j	   } | d k sq| d d	 k r| j
 d  q?Pq?Wt j d
  } t } d } x t |  D] \ } } | |  s| j |  j   } | r
| | k r
| | d c | 7<t } n  | rg| d k r+t } d } qd| d k rFt } d } qd| d k rdt } d } qdqgqqW| r| d j   d k r| d c | 7<q| j |  n  | j |  S(   sb   Return selected text as a processed text,
        to be executable in a Python/IPython interpreterc         S   s   t  |   t  |  j    S(   N(   RL   t   lstrip(   t   line(    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR   :  R   Ni   R   i    i  iR   t   #s   [a-zA-Z0-9_]*t   deft   fort   whilet   withRI   t   ift   elift   elset   tryt   exceptt   finally(    (   RP  RQ  RR  RS  RI   (    (   RU  RV  (   RX  RY  (   t   get_line_separatort   get_selection_boundsRA  t   splitRL   t   get_text_linet   ranget   stripRi   RM  t   popt   ret   compileR5   R   t   matcht   groupR"   R)  t   join(   R<   t   lst   _indentt	   line_fromt   line_toR)   t   linest   original_indentt
   min_indentt   current_indentt   iRN  t
   first_linet   varnamet   maybet
   nextexceptt   nR8  (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt    get_selection_as_executable_code5  sd    	#
 				c         C   s   t  |  j    } |  j   \ } } |  j   \ } } | sL |  j |  n  |  j   } | |  _ |  j | |  | d  k	 r | j	   } n  | S(   N(
   R   R  t#   _TextEditBaseWidget__save_selectiont   select_current_cellt   setTextCursorRt  R   t&   _TextEditBaseWidget__restore_selectionR3   t   rstrip(   R<   t   init_cursorR  R  R(   R  R)   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   __exec_cell  s    	c         C   s
   |  j    S(   s'   Return cell contents as executable code(   t   _TextEditBaseWidget__exec_cell(   R<   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   get_cell_as_executable_code  s    c         C   s<   d  } |  j r8 |  j |  j  |  j   |  j   } n  | S(   N(   R3   R   Rw  R  R|  (   R<   R)   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt    get_last_cell_as_executable_code  s    	
c         C   s   | d k	 s | d k	 s t  | d k	 r[ t |  } | j t j  t | j    } n t | j    } |  j d k r t	 S| j
   j |  j  Sd S(   s=   Return True if cursor (or text block) is on a block separatorN(   R3   t   AssertionErrorR   t   selectt   BlockUnderCursorR   R0  R)   R	  R5   RM  R   (   R<   R(   t   blockt   cursor0R)   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   is_cell_separator  s    c         C   sz  |  j    } | j t j  | j   } } xK |  j |  ry | j t j  | } | j   } | | k r/ | t f Sq/ W| } x^ |  j |  s | j t j  | } | j   } | | k r |  j |  r | t f SPq q W| j	 |  | j
   } xa |  j |  s]| j t j t j  | j   } | | k rT| j t j t j  Pn  | } q W| j   } | | ov| f S(   s   Select cell under cursor
        cell = group of lines separated by CELL_SEPARATORS
        returns the textCursor and a boolean indicating if the
        entire file is selected(   R  R&  R   t   StartOfBlockR  R  t	   NextBlockR5   t   PreviousBlockR%  t   atStartR(  t
   EndOfBlockt   atEnd(   R<   R(   t   cur_post   prev_post   cell_at_file_startt   cell_at_file_end(    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyRv    s>    



c         C   sd  |  j    } | j t j  | j   } } |  j t d d   j   } t |  j   j   d |  j   j	   d  } |  j |  j   } xN |  j
 |  r | j t j  | } | j   } | | k r | t t f Sq W| } xt |  j
 |  r[| j   | k r[| j t j  | } | j   } | | k r |  j
 |  rT| t t f SPq q W| j   | k } | j |  | j   } | s| j t j  | j t j t j  n  xt |  j
 |  r,| j   | k r,| j t j t j  | j   } | | k r#| j t j t j  Pn  | } qW| j   }	 | j   | k }
 | | oW|	 | o`|
 f S(   s3  Select cell under cursor in the visible portion of the file
        cell = group of lines separated by CELL_SEPARATORS
        returns 
         -the textCursor
         -a boolean indicating if the entire file is selected
         -a boolean indicating if the entire visible portion of the file is selectedi    i   (   R  R&  R   R  R  t   cursorForPositionR   t   viewportRh   Rk   R  R  R5   R  R%  R  R(  R  R  (   R<   R(   R  R  t   beg_post   bottom_rightR  t   cell_at_screen_startR  R  t   cell_at_screen_end(    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR
    sZ    


	c         C   s   |  j    } | j t j  | j   } } xE |  j |  ss | j t j  | } | j   } | | k r/ d Sq/ W|  j |  d S(   s   Go to the next cell of linesN(   R  R&  R   R  R  R  Rw  (   R<   R(   R  R  (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   go_to_next_cell  s    c         C   s   |  j    } | j   } } |  j |  rN | j t j  | j   } } n  xE |  j |  s | j t j  | } | j   } | | k rQ d SqQ W|  j |  d S(   s    Go to the previous cell of linesN(   R  R  R  R&  R   R  Rw  (   R<   R(   R  R  (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   go_to_previous_cell   s    c         C   s
   |  j    S(   s!   Return document total line number(   t
   blockCount(   R<   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   get_line_count4  s    c         C   s"   |  j    } | j   | j   f S(   s8   Save current cursor selection and return position bounds(   R  R   R   (   R<   R(   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   __save_selection8  s    c         C   s=   |  j    } | j |  | j | t j  |  j |  d S(   s-   Restore cursor selection from position boundsN(   R  R%  R   R(  Rw  (   R<   R  R  R(   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   __restore_selection=  s    c         C   s  |  j    } | j   |  j   \ } } t | j    r | j |  | j t j t j	  t | j    s | j t j
  | j   } q n  | j |  | j t j  x{ | j   | k r+| j t j t j	  | j   rt |  } | j   | j |  j    Pn  | j t j t j	  q W| j   } | j   | s| j |  | j t j  | t |  7} | t |  7} n  | j |  | j   |  j |  |  j | |  d S(   s'   Duplicate current line or selected textN(   R  t   beginEditBlockRu  R   R0  R%  R&  R   R  R(  R  R  R  R  R  R%   RZ  R  RL   t   endEditBlockRw  Rx  (   R<   t   after_current_lineR(   R  R  t   cursor_tempR)   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   __duplicate_line_or_selectionD  s>    




c         C   s   |  j  d t  d S(   s   
        Duplicate current line or selected text
        Paste the duplicated text *after* the current line/selected text
        R  N(   t0   _TextEditBaseWidget__duplicate_line_or_selectionR"   (   R<   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   duplicate_linel  s    c         C   s   |  j  d t  d S(   s~   
        Copy current line or selected text
        Paste the duplicated text *before* the current line/selected text
        R  N(   R  R5   (   R<   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt	   copy_lines  s    c         C   s  |  j    } | j   |  j   \ } } t } | j |  | j t j  | j   } | j |  | j	   s} | | k r | j t j
  | j t j  n  | j   } | j   r | j	   s | | k r t } q n  | j |  | j   r(| r(| j   |  j |  |  j | |  d S| j | t j  | rr| rr| j   |  j |  |  j | |  d St | j    } | j   | rt | j   j    } t j | d d !} | j t j
  | t |  d 7} | t |  7} | j   s| d 7} qn | rJ| j   | t j } | j t j  | d 7} n | j t j  t | j   j    } | t |  d 8} | t |  d 8} | j |  | j   |  j |  |  j | |  d S(   s"   Move current line or selected textNi    ii   (   R  R  Ru  R5   R%  R&  R   R  R  t   atBlockStartR  R  R  R"   R  R  Rw  Rx  R(  R   R0  t   removeSelectedTextR  R)   RF  t   linesepRL   R'   R  R%   (   R<   R  R(   R  R  t	   last_linet   sel_textR)   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   __move_line_or_selectionz  sd    





c         C   s   |  j  d t  d S(   s%   Move up current line or selected textR  N(   t+   _TextEditBaseWidget__move_line_or_selectionR5   (   R<   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   move_line_up  s    c         C   s   |  j  d t  d S(   s'   Move down current line or selected textR  N(   R  R"   (   R<   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   move_line_down  s    c         C   s'   |  j  t t  |  j |  j    d S(   s7   Go to the end of the current line and create a new lineN(   t
   stdkey_endR5   t   insert_textRZ  (   R<   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   go_to_new_line  s    c         C   s   |  j    } | j   | j   } } | j |  | j | t j  | j   r | j t j t j  | j t j	 t j  n  |  j
 |  d S(   s*   Extend current selection to complete linesN(   R  R   R   R%  R   R(  R  R&  R  R  Rw  (   R<   R(   R  R  (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt"   extend_selection_to_complete_lines  s    
c         C   s   |  j    } |  j   rK |  j   | j   | j   } } | j |  n | j   } } | j   | j |  | j t	 j
  xR | j   | k r | j t	 j t	 j  | j   r Pn  | j t	 j t	 j  q W| j   | j   |  j   d S(   s   Delete current lineN(   R  t   has_selected_textR  R   R   R%  R  R  R&  R   R  R  R(  R  R  R  R  t   ensureCursorVisible(   R<   R(   R  R  (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   delete_line  s"    



c         C   s=   |  j    } | j |  | j | t j  |  j |  d  S(   N(   R  R%  R   R(  Rw  (   R<   t   startt   endR(   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   set_selection  s    c         C   s{   |  j  |  } |  j   } | j   | j   } } | | k  rU t | | g  } n t | | g  } |  j | |  d S(   s.   Unselect read-only parts in shell, like promptN(   R$  R  R   R   t   maxR  (   R<   t   position_fromR(   R  R  (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   truncate_selection  s    c         C   sb   |  j  |  } |  j  |  } |  j   } | j   } | | k  sN | | k r^ |  j |  n  d S(   s:   In shell, avoid editing text except between prompt and EOFN(   R$  R  R  t   set_cursor_position(   R<   R  t   position_toR(   t   cursor_position(    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   restrict_cursor_position	  s    c         C   s   yq |  j  |  j  } |  j |  j d d } | t j t j t j f k } | d k sc | sc | rp t j   n  Wn! t	 t
 f k
 r t j   n Xd S(   s   Hide calltip when necessaryt   char_offseti   t   ?R  N(   R  R  (   t   get_characterR   t   is_cursor_beforeR   t   Key_ParenRightt
   Key_PeriodR   R   t   hideTextt
   IndexErrort	   TypeError(   R<   R   t   calltip_chart   beforet   other(    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   hide_tooltip_if_necessary  s    	c         C   s   |  j  j | d | d S(   s   Show completion widgetRt   N(   R   R   (   R<   t   textlistRt   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   show_completion_widget  s    c         C   s   |  j  j   d S(   s   Hide completion widgetN(   R   R8   (   R<   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   hide_completion_widget#  s    R   c         C   s   | s
 d St  | d t  s? g  | D] } | d f ^ q$ } n  t |  d k ri | d d | k ri d S| |  _ t g  | D]' \ } } | j d  r| | | f ^ q|  } t t |  | d d   } | t | d d   7} |  j | d	 | d S(
   s    Display the possible completionsNi    R   i   t   _R   c         S   s   t  |  d  S(   Ni    (   R   (   Re   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR   7  R   c         S   s   t  |  d  S(   Ni    (   R   (   Re   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR   8  R   Rt   (   R   t   tupleRL   Rp   t   setR   R   R  (   R<   t   completionsRp   Rt   Ru   t   compRx   t
   underscore(    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   show_completion_list'  s    "&	$c         C   s   |  j  j   d S(   s1   Completion list is active, Enter was just pressedN(   R   R;   (   R<   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   select_completion_list;  s    c         C   sR   | rN |  j    } | j t j t j t |  j   | j   |  j |  n  d  S(   N(	   R  R&  R   R/  R(  RL   Rp   R  R  (   R<   R)   R(   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyRM   ?  s    
c         C   s   |  j  j   S(   s0   Return True is completion list widget is visible(   R   t	   isVisible(   R<   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   is_completion_widget_visibleH  s    c         C   s3   |  j    s% |  j t j t j  n  |  j   d  S(   N(   R  t
   moveCursorR   R'  R(  t   remove_selected_text(   R<   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   stdkey_clearN  s    c         C   s3   |  j    s% |  j t j t j  n  |  j   d  S(   N(   R  R  R   R/  R(  R  (   R<   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   stdkey_backspaceS  s    c         C   s   | r t  j St  j S(   N(   R   R(  t
   MoveAnchor(   R<   R   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   __get_move_modeY  s    c         C   s    |  j  t j |  j |   d  S(   N(   R  R   t   Upt"   _TextEditBaseWidget__get_move_mode(   R<   R   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt	   stdkey_up\  s    c         C   s    |  j  t j |  j |   d  S(   N(   R  R   t   DownR  (   R<   R   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   stdkey_down_  s    c         C   s   |  j  |  j  d  S(   N(   R  R   (   R<   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt
   stdkey_tabb  s    c   	      C   s   |  j  |  } | r+ |  j t j |  n |  j   } | d k rU |  j d  } n |  j |  } |  j | d  } | t |  t | j	    } | j
   | k r | j | |  n | j | |  |  j |  d S(   si   Smart HOME feature: cursor is first moved at 
        indentation position, then at the start of the linet   solt   eolN(   R  R  R   t   StartR  R3   R$  R  RL   RM  R  R%  Rw  (	   R<   R   R   t
   prompt_post	   move_modeR(   t   start_positionR)   t
   indent_pos(    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   stdkey_homee  s     c         C   sB   |  j  |  } | r+ |  j t j |  n |  j t j |  d  S(   N(   R  R  R   t   EndR  (   R<   R   R   R  (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR  y  s    c         C   s   d  S(   N(    (   R<   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   stdkey_pageup  s    c         C   s   d  S(   N(    (   R<   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   stdkey_pagedown  s    c         C   s   d  S(   N(    (   R<   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   stdkey_escape  s    c         C   s*  t  j j d  r	| j   t j k r	|  j j   |  j   t	 t
 j | j   t j t j t j  } t j |  |  t j |  |  t j } t j } t j   j d |  } t j   j d |  } t j   j | d | |  j   t j   j | d | n |  j j   t j |  |  d S(   s   Reimplement Qt methodt   linuxR>  N(   R   R   R   t   buttonR   t	   MidButtonR   R8   R[   R   R   t   MouseButtonPresst   post
   LeftButtont
   NoModifierR   t   mousePressEventt   mouseReleaseEventR   t	   Clipboardt	   SelectionR   RB  R)   RC  t   paste(   R<   R   t	   mode_clipt   mode_selt	   text_clipt   text_sel(    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR    s     '
		
c         C   s8   |  j  j   |  j j   |  j   t j |  |  d S(   s   Reimplemented to handle focusN(   t   focus_changedRs   t   focus_inR  R   t   focusInEvent(   R<   R   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR    s    
c         C   s!   |  j  j   t j |  |  d S(   s   Reimplemented to handle focusN(   R  Rs   R   R   (   R<   R   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR     s    c         C   s   t  j d k r | j   t j @r t | d  r | j   j   d k  rY |  j j	   q | j   j   d k r |  j
 j	   q nV t | d  r | j   d k  r |  j j	   q | j   d k r |  j
 j	   q n  d Sn  t j |  |  |  j   d S(   s>   Reimplemented to emit zoom in/out signals when Ctrl is pressedR   t
   angleDeltai    t   deltaN(   R   R   R   R   R   t   hasattrR  Rj   t   zoom_outRs   t   zoom_inR  R   t
   wheelEventR  (   R<   R   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR    s    (   R   R   N(Z   R   R   R   R  R3   R	  R   R   R  R  t
   zoom_resetR  t   strt   sig_eol_chars_changedR.   R   R   R   R   R   R   R   R   R   R   R   R  R  R  R  R"  R5   R.  R   R4  R5  R6  R7  R@  R   RD  RI  R   Rt  R|  R}  R~  R  Rv  R
  R  R  R  Ru  Rx  R"   R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  RM   R  R  R  R  R  R  R  R  R  R  R  R  R  R  R   R  (    (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR      s   					1																	(									J				-	?					(		O								
																			t   QtANSIEscapeCodeHandlerc           B   s5   e  Z d    Z d   Z d   Z d   Z d   Z RS(   c         C   s#   t  j |   d  |  _ d  |  _ d  S(   N(   R!   R.   R3   t   base_formatt   current_format(   R<   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR.     s    	c         C   s1   | r d |  _  d |  _ n d |  _  d |  _ d  S(   Ni   i/   i%   i(   (   t   default_foreground_colort   default_background_color(   R<   R3  (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   set_light_background  s
    		c         C   s   | |  _  d  S(   N(   R  (   R<   R  (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   set_base_format  s    c         C   s   |  j  S(   N(   R  (   R<   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt
   get_format  s    c         C   s  |  j  d k r9 |  j d k	 s$ t  t |  j  |  _  n  |  j d k rZ |  j j   } n' |  j |  j d |  j } t	 |  } |  j  j
 |  |  j d k r |  j j   } n' |  j |  j d |  j } t	 |  } |  j  j |  |  j  j   } |  j d k r|  j j   } n	 |  j } | j |  |  j d k rV|  j j   j   } n	 |  j } | j |  |  j d k r|  j j   j   } n	 |  j } | j |  |  j  j |  d S(   s   
        Set font style with the following attributes:
        'foreground_color', 'background_color', 'italic',
        'bold' and 'underline'
        i   i(   N(   R  R3   R  R  R   t   foreground_colorR   t   ANSI_COLORSt	   intensityR	   t   setForegroundt   background_colorR   R  RB   t   italict
   fontItalict	   setItalict   boldt   setBoldt	   underlinet   setUnderlineR@   (   R<   t   qcolort   cstrRB   R  R  R  (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt	   set_style  s6    			(   R   R   R.   R  R  R  R!  (    (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR    s
   				c         C   s-   |  j  |  j   |  j   d |  j    d  S(   Ni   (   t   setHsvt   huet
   saturationt   value(   R+  (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   inverse_color  s    t   ConsoleFontStylec           B   s   e  Z d    Z d   Z RS(   c         C   s:   | |  _  | |  _ | |  _ | |  _ | |  _ d  |  _ d  S(   N(   t   foregroundcolort   backgroundcolorR  R  R  R3   R  (   R<   R(  R)  R  R  R  (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR.   
  s    					c         C   s   t    |  _ |  j j |  t |  j  } | rE | rE t |  n  |  j j |  t |  j  } | sw t |  n  |  j j |  |  j j	   } | j
 |  j  | j |  j  | j |  j  |  j j |  d  S(   N(   R   R  R@   R	   R(  R&  R  R)  R  RB   R  R  R  R  R  R  (   R<   RB   t   light_backgroundt
   is_defaultR   R   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   apply_style  s    (   R   R   R.   R,  (    (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR'  	  s   		t   ConsoleBaseWidgetc           B   s   e  Z d  Z d
 Z e j d  Z e e e	  Z
 e e e  Z e e  Z d d  Z d   Z d   Z d   Z d   Z d d	  Z RS(   s   Console base widgetR  R  s   \x01?\x1b\[(.*?)m\x02?c            s<  t  j   |  t   _   j d  t     _   j t    j	 j
   f d    t d d d d d t d t d	 t    _ t d d
 d d d t d t d	 t    _ t d d d d d t d t d	 t    _ t d d d d d t d t d	 t    _   j   j   j   j f   _   j     j t  d  S(   Ni,  c            s     j  j |  S(   N(   t   completion_widget_activatedRs   (   t   user_idR)   (   R<   (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR   :  s    R(  i    R)  i R  R  R  i   i   i   (   R   R.   R"   R*  t   setMaximumBlockCountR  t   ansi_handlert   setUndoRedoEnabledR5   t   userListActivatedR:   R'  t   default_stylet   error_stylet   traceback_link_stylet   prompt_stylet   font_stylest   set_pythonshell_fontt   setMouseTracking(   R<   R=   (    (   R<   s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR.   -  s,    	
c         C   s   | |  _  | r: |  j d t t j  d t t j   n( |  j d t t j  d t t j   |  j j	 |  |  j
   d  S(   NR   R   (   R*  R   R	   R   t   whitet   darkGrayt   blackt	   lightGrayR1  R  R9  (   R<   R3  (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR  N  s    	c         C   s    |  j    j | |  j j  d S(   s%   Reimplement TextEditBaseWidget methodN(   R  R%   R4  R  (   R<   R)   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR  Z  s    c         C   s6   |  j    r |  j   n  |  j t j   j    d S(   s   Reimplement Qt methodN(   R  R  R  R   RB  R)   (   R<   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR  `  s    c         C   sk  |  j    } | j t j  d | k rO | j d d  } | j d d  } n  xG t r | j t d   } | d k r} Pn  | | d } |  j   qR W| rCt	 } x | j
 t  D]t } | j d  r| j d  rt } | j d	 |  j j  | j | d
 |  j j  q | j | |  j j  q W|  j j | |  n| rbt | | |  j j  n d } x |  j j |  D] } t | | | | j   !|  j j  | j   } yP xI g  | j d  j d  D] }	 t |	  ^ qD] }
 |  j j |
  qWWn t k
 rn X|  j j   |  j _ q{Wt | | | |  j j  |  j  d  |  j! |  j j  d S(   sK  
        Append text to Python shell
        In a way, this method overrides the method 'insert_text' when text is 
        inserted at the end of the text widget for a Python shell
        
        Handles error messages and show blue underlined links
        Handles ANSI color sequences
        Handles ANSI FF sequence
        s   s   
s   
i   ii   s     Files	     File "<s     i   i    t   ;R   N("   R  R&  R   R  RG  R"   R#   R$   RN   R5   t
   splitlinesR   R%   R4  R  R6  R5  t   exception_occurredRs   R,   R7  t   COLOR_PATTERNt   finditerR  R  Rd  R\  t   intR1  t   set_codet
   ValueErrorR  R  t   setCurrentCharFormat(   R<   R)   t   errort   promptR(   R+   t   is_tracebackt   last_endRc  t   _ct   code(    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   append_text_to_shellf  sL    
	8
c      	   C   sn   | d k r t   } n  x9 |  j D]. } | j d | d |  j d | |  j k  q" W|  j j |  j j  d S(   s   Python Shell onlyRB   R*  R+  N(	   R3   R
   R8  R,  R*  R4  R1  R  R  (   R<   RB   R   (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR9    s    	(   R  R  N(   R   R   R   R  Ra  Rb  RB  R   R	  t   boolRA  RD  R3  R.  R3   R.   R  R  R  RN  R9  (    (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyR-  %  s   !				@(;   R   RF  Ra  R   t   collectionsR    t   qtpy.compatR   t   qtpy.QtCoreR   R   R   R   R   R   t
   qtpy.QtGuiR   R	   R
   R   R   R   R   R   R   t   qtpy.QtWidgetsR   R   R   R   R   R   R   R   t   spyder.config.guiR   t   spyder.config.mainR   t   spyder.py3compatR   R   R   t   spyder.utilsR   RT   t   spyder.widgets.calltipR   t   spyder.widgets.mixinsR    t"   spyder.widgets.sourcecode.terminalR!   R,   R-   R   R  R&  R   R'  R-  (    (    (    s=   lib/python2.7/site-packages/spyder/widgets/sourcecode/base.pyt   <module>   s2   .@:	   B	