
,]c           @   s  d  Z  d d l m Z d d l 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 d d l m Z m Z m Z m Z m Z m Z 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& d d l' m( Z( d d	 l) m* Z* m+ Z+ d
 e, f d     YZ- e. d  Z/ d   Z0 d e f d     YZ1 d e1 f d     YZ2 d e1 f d     YZ3 d e# f d     YZ4 d e f d     YZ5 d   Z6 e7 d k re6   n  d S(   s   Spyder interactive toursi(   t   divisionN(   t   QEasingCurvet   QPointt   QPropertyAnimationt   QRectFt   Qtt   Signal(   t   QBrusht   QColort   QIcont   QPaintert   QPainterPatht   QPent   QPixmapt   QRegion(   t   QActiont   QApplicationt	   QComboBoxt   QDialogt   QGraphicsOpacityEffectt   QHBoxLayoutt   QLabelt   QLayoutt   QMainWindowt   QMenut   QPushButtont   QSpacerItemt   QToolButtont   QVBoxLayoutt   QWidget(   t   _t   get_image_path(   t   to_binary_string(   t   add_actionst   create_actiont   SpyderWidgetsc           B   s   e  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 d	 Z d	 Z d	 Z d	 Z RS(
   s/   List of supported widgets to highlight/decoratet
   ipyconsolet   editors*   editor.get_current_editor().linenumberareas*   editor.get_current_editor().scrollflagareat   explorert   helpt   variableexplorert
   historylogt    (   t   __name__t
   __module__t   __doc__t   ipython_consoleR%   t   editor_line_number_areat   editor_scroll_flag_areat   file_explorert   help_plugint   variable_explorert   history_logt   toolbarst   toolbars_activet   toolbar_filet   toolbar_editt   toolbar_runt   toolbar_debugt   toolbar_maint
   status_bart   menu_bart	   menu_filet	   menu_edit(    (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyR#   &   s(   c         C   s
   t  |   S(   sY   
    Get the list of available tours (if index=None), or the your given by
    index
    (   t   get_tour(   t   index(    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt	   get_toursA   s    c      	   C   s  t  } d } i d d 6d d 6d d 6i d d 6d	 d 6d
 g d 6d g d 6t d 6i d d 6d	 d 6d
 g d 6d
 g d 6t d 6i d d 6d	 d 6d
 g d 6t d 6i d d 6d d 6d g d 6d g d 6t d 6g } i t d  d 6t d  d 6d d 6i t d  d 6t d  d 6| j g d 6| j g d 6i t d  d 6t d  j |  d 6| j g d 6d d g d 6i t d  d 6t d  d 6| j g d 6t d 6i t d  d 6t d  d 6| j	 g d 6t d 6i t d  d 6t d   d 6| j
 g d 6t d 6i t d!  d 6t d"  d 6| j g d 6t d 6g } i d# d 6t d$  d 6d% d 6i t d  d 6t d&  d 6d' g d 6g } i t d(  d) 6| d* 6i t d+  d) 6| d* 6g } |  d- k r| S|  d, k r| g S| |  g Sd- S(.   s  
    This function generates a list of tours.
    
    The index argument is used to retrieve a particular tour. If None is
    passed, it will return the full list of tours. If instead -1 is given,
    this function will return a test tour

    To add more tours a new variable needs to be created to hold the list of
    dicts and the tours variable at the bottom of this function needs to be
    updated accordingly
    s5   https://qtconsole.readthedocs.io/en/stable/index.htmls#   Welcome to Spyder introduction tourt   titles   <b>Spyder</b> is an interactive development                          environment. This tip panel supports rich text. <br>                         <br> it also supports image insertion to the right so                         fart   contents   tour-spyder-logo.pngt   images   Widget displaysd   This show how a widget is displayed. The tip panel is adjusted based on the first widget in the listt   button1t   widgetst   button2t
   decorationt   interacts   Widget display and highlights)   This shows how a highlighted widget lookst   buttons    Welcome to the Introduction tours  <b>Spyder</b> is a powerful Interactive Development Environment (or IDE) for the Python programming language.<br><br>Here we are going to guide you through its most important features.<br><br>Please use the arrow keys or click on the buttons below to move along the tour.s
   The Editors  This is the pane where you write Python code before evaluating it. You can get automatic suggestions and completions while writing, by pressing the <b>Tab</b> key next to a given text.<br><br>The Editor comes with a line number area (highlighted here in red), where Spyder shows warnings and syntax errors. They can help you to detect potential problems before running the code.<br><br>You can also set debug breakpoints in the line number area, by doing a double click next to a non-empty line.s   The IPython consoles  This is one of panes where you can run or execute the code you wrote on the Editor. To do it you need to press the <b>F5</b> key.<br><br>This console comes with several useful features that greatly improve your programming workflow (like syntax highlighting and inline plots). If you want to know more about them, please follow this <a href="{0}">link</a>.<br><br>Please click on the button below to run some simple code in this console. This will be useful to show you other important features.s   li = list(range(100))s   d = {'a': 1, 'b': 2}t   runs   The Variable Explorers{  In this pane you can view and edit the variables generated during the execution of a program, or those entered directly in one of Spyder consoles.<br><br>As you can see, the Variable Explorer is showing the variables generated during the last step of this tour. By doing a double-click on any of them, a new window will be opened, where you can inspect and modify their contents.t   Helps#  This pane displays documentation of the functions, classes, methods or modules you are currently using in the Editor or the Consoles.<br><br>To use it, you need to press <b>Ctrl+I</b> in front of an object. If that object has some documentation associated with it, it will be displayed here.s   The File Explorers/  This pane lets you navigate through the directories and files present in your computer.<br><br>You can also open any of these files with its corresponding application, by doing a double click on it.<br><br>There is one exception to this rule: plain-text files will always be opened in the Spyder Editor.s   The History LogsM   This pane records all commands introduced in the Python and IPython consoles.s   New features in Spyder 3.0sD   <b>Spyder</b> is an interactive development environment based on blas
   spyder.pngs=   Spyder is an interactive development environment based on blaR(   s   Introduction tourt   namet   tours   New features in version 3.0iN(   R#   t   Truet   FalseR   R%   R/   t   formatR.   R3   R2   R1   R4   t   None(   RA   t   swt   qtconsole_linkt   testt   introt   feat30t   tours(    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyR@   I   s    












	,
t   FadingDialogc           B   s   e  Z d  Z e   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 RS(   s>   A general fade in/fade out QDialog with some builtin functionsc         C   s   t  t |   j |  | |  _ t |  |  _ t |  |  _ | d |  _ | d |  _	 | d |  _
 | d |  _ d  |  _ d  |  _ t |  _ g  |  _ g  |  _ g  |  _ g  |  _ |  j t  d  S(   Ni    i(   t   superRZ   t   __init__t   parentt   mint   opacity_mint   maxt   opacity_maxt   duration_fadeint   duration_fadeoutt   easing_curve_int   easing_curve_outRS   t   effectt   animRQ   t   _fade_runningt   _funcs_before_fade_int   _funcs_after_fade_int   _funcs_before_fade_outt   _funcs_after_fade_outt   setModal(   t   selfR]   t   opacityt   durationt   easing_curve(    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyR\     s     								c         C   s   x | D] } |   q Wd S(   t    N(    (   Rn   t   funcst   func(    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   _run(  s    c         C   s   |  j  |  j  d S(   Rr   N(   Ru   Ri   (   Rn   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   _run_before_fade_in-  s    c         C   s   |  j  |  j  d S(   Rr   N(   Ru   Rj   (   Rn   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   _run_after_fade_in1  s    c         C   s   |  j  |  j  d S(   Rr   N(   Ru   Rk   (   Rn   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   _run_before_fade_out5  s    c         C   s   |  j  |  j  d S(   Rr   N(   Ru   Rl   (   Rn   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   _run_after_fade_out9  s    c         C   s   t  |  _ d S(   Rr   N(   RQ   Rh   (   Rn   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   _set_fade_finished=  s    c         C   sG   t  |  _ t |   |  _ |  j |  j  t |  j t d   |  _ d S(   Rr   Ro   N(   RP   Rh   R   Rf   t   setGraphicsEffectR   R    Rg   (   Rn   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   _fade_setupA  s    	c         C   s   |  j    |  j   |  j   |  j   |  j j |  j  |  j j |  j  |  j j	 |  j
  |  j j |  j  |  j j j |  |  j j j |  j  |  j j j |  j  |  j j   d S(   Rr   N(   Rv   R|   t   showt   raise_Rg   t   setEasingCurveRd   t   setStartValueR_   t   setEndValueRa   t   setDurationRb   t   finishedt   connectRz   Rw   t   start(   Rn   t   on_finished_connect(    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   fade_inI  s    



c         C   s   |  j    |  j   |  j j |  j  |  j j |  j  |  j j |  j  |  j j	 |  j
  |  j j j |  |  j j j |  j  |  j j j |  j  |  j j   d S(   Rr   N(   Rx   R|   Rg   R   Re   R   Ra   R   R_   R   Rc   R   R   Rz   Ry   R   (   Rn   R   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   fade_outX  s    

c         C   s   |  j  S(   Rr   (   Rh   (   Rn   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   is_fade_runninge  s    c         C   s   | |  _  d S(   Rr   N(   Ri   (   Rn   Rs   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   set_funcs_before_fade_ini  s    c         C   s   | |  _  d S(   Rr   N(   Rj   (   Rn   Rs   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   set_funcs_after_fade_inm  s    c         C   s   | |  _  d S(   Rr   N(   Rk   (   Rn   Rs   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   set_funcs_before_fade_outq  s    c         C   s   | |  _  d S(   Rr   N(   Rl   (   Rn   Rs   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   set_funcs_after_fade_outu  s    (   R+   R,   R-   R   t   sig_key_pressedR\   Ru   Rv   Rw   Rx   Ry   Rz   R|   R   R   R   R   R   R   R   (    (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyRZ     s"   															t   FadingCanvasc           B   sk   e  Z d  Z d d  Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z d	   Z d
   Z RS(   s=   The black semi transparent canvas that covers the applicationc            s9  t  t    j | | | |  |   _ |   _ |   _ t j   _ d   _	 d   _ d   _ d   _ d   _ d   _ t   _ d   _ d   _ d   _ d   _   j t j t j B   j t j    j t j    j t    j t j    j   j  g    j!   f d     f d   g  d S(   s;   Create a black semi transparent canvas that covers the app.i   c              s     j  d   S(   N(   t   update_widgetsRS   (    (   Rn   (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   <lambda>  R*   c              s     j  d   S(   N(   t   update_decorationRS   (    (   Rn   (    s.   lib/python2.7/site-packages/spyder/app/tour.pyR     R*   N("   R[   R   R\   R]   RO   t   colorR   t   redt   color_decorationt   stroke_decorationRS   t   region_maskt   region_subtractt   region_decorationRG   RI   RQ   t   interaction_ont   path_currentt   path_subtractt	   path_fullt   path_decorationt   setWindowFlagst   Dialogt   FramelessWindowHintt   setAttributet   WA_TranslucentBackgroundt   WA_TransparentForMouseEventsRm   t   setFocusPolicyt   NoFocusR   t   update_canvasR   (   Rn   R]   Ro   Rp   Rq   R   RO   (    (   Rn   s.   lib/python2.7/site-packages/spyder/app/tour.pyR\   |  s2    														c         C   s   | |  _  d S(   Rr   N(   R   (   Rn   t   value(    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   set_interaction  s    c         C   sD  |  j  j   j   |  j  j   j   } } t   |  _ t   |  _ t   |  _ t d d | |  |  _	 |  j j
 d d | |  |  j d k	 rx |  j D] } t   } | d k	 rX| j   | j   | j   } | j   | j   } } | j |  j  t d d   } | j   | j   }	 }
 | j
 t |	 |
 | |   t |	 |
 | |  } n  |  j ry|  j	 j |  |  _	 n  |  j j |  |  _ q W|  j j |  j  |  _ n |  j |  _ |  j d k	 rxQ|  j D]*} t   } | j   | j   | j   } | j   | j   } } | j |  j  t d d   } | j   | j   }	 }
 | j
 t |	 |
 | |   t |	 d |
 d | d | d  } t |	 d |
 d | d | d  } | j |  } |  j r|  j	 j |  |  _	 n  |  j j |  |  _ qWn |  j j
 d d d d  |  j |  j	  |  j   |  j   d S(   Rr   i    i   i   N(   R]   t   sizet   widtht   heightR   R   R   R   R   R   t   addRectRG   RS   R~   R}   t   frameGeometryt   mapToR   t   xt   yR   R   t
   subtractedt   unitedR   RI   t   setMaskt   updatet   repaint(   Rn   t   wt   ht   widgett	   temp_patht   geoR   R   t   pointR   R   t   temp_regiont   temp_region_1t   temp_region_2(    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyR     sV    +	

		

%%	
c         C   s   | |  _  d S(   Rr   N(   RG   (   Rn   RG   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyR     s    c         C   s   | |  _  d S(   Rr   N(   RI   (   Rn   RG   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyR     s    c         C   s^   t  |   } | j t  j  | j |  j t |  j   | j |  j t	 |  j
 |  j   d S(   s   Override Qt methodN(   R
   t   setRenderHintt   Antialiasingt   fillPathR   R   R   t
   strokePathR   R   R   R   (   Rn   t   eventt   painter(    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt
   paintEvent  s
    c         C   s2   |  j    s. t j } | |  _ |  j j   n  d S(   s   Override Qt methodN(   R   R   t
   Key_Escapet   key_pressedR   t   emit(   Rn   t   key(    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   reject  s    		c         C   s   d S(   s   Override Qt methodN(    (   Rn   R   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   mousePressEvent  s    c         C   s    |  j    r |  j j   n  d S(   s   Override Qt method.N(   t   hasFocusRO   t
   gain_focus(   Rn   R   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   focusInEvent  s    c         C   s&   |  j  j d k r" |  j  j   n  d S(   s   Override Qt method.i    N(   RO   t   step_currentt
   lost_focus(   Rn   R   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   focusOutEvent  s    N(   R+   R,   R-   RS   R\   R   R   R   R   R   R   R   R   R   (    (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyR   z  s   #		?						t   FadingTipBoxc           B   s   e  Z d  Z d d  Z d   Z d   Z d d d  Z d   Z d   Z	 d   Z
 d   Z d	   Z d
   Z d   Z d   Z RS(   Rr   c         C   s  t  t |   j | | | |  |  j |  _ | |  _ | |  _ d  |  _ t	 j
 d d d  |  _ t	 j
 d d d  |  _ d |  _ d |  _ d  |  _ |  j t j  |  j t j t j Bt j B |  j t  t d  |  _ t d  |  _ t d  |  _ t d  |  _ t d	  |  _ t t d
   |  _  d  |  _! t"   |  _# t$   |  _% t$   |  _& t'   |  _( t$   |  _) t$   |  _* |  j* j+ |  j  |  j* j, |  j  |  j) j- t j.  |  j* j/ t0  |  j* |  j& |  j) |  j( |  j |  j  |  j |  j |  j |  j |  j# g |  _1 t2 d  } d | d |  _3 |  j3 j4 d d  |  _3 |  j5 t j6  x1 |  j1 D]& } | j5 t j7  | j8 |  j3  q`Wt9   } | j: |  j(  | j;   | j: |  j  | j< t= |  j |  j   t9   }	 |	 j: |  j*  |	 j: |  j%  |	 j< t= d d   t9   }
 |
 j;   |
 j: |  j   |
 j;   |
 j< t= |  j |  j   t9   } | j: |  j  | j: |  j  | j;   | j: |  j)  | j;   | j: |  j  | j: |  j  | j< t= |  j |  j   t>   } | j? |  | j;   | j< t= d d   | j? |	  | j? |
  | j;   | j< t= d d   | j? |  | j< t= |  j |  j   | j@ tA jB  |  jC |  |  jD |  jE g  |  jF |  jG |  jH g  |  jI |  jE g  |  jJ t jK  d  S(   Ni   i   i    i,  s   <<t   Xs    < s   >>s    > s   Run codes   hide.pngsS  QPushButton {
                             background-color: rgbs(200,200,200,100%);
                             color: rgbs(0,0,0,100%);
                             border-style: outset;
                             border-width: 1px;
                             border-radius: 3px;
                             border-color: rgbs(100,100,100,100%);
                             padding: 2px;
                             }

                             QPushButton:hover {
                             background-color: rgbs(150, 150, 150, 100%);
                             }

                             QPushButton:disabled {
                             background-color: rgbs(230,230,230,100%);
                             color: rgbs(200,200,200,100%);
                             border-color: rgbs(200,200,200,100%);
                             }

                             QComboBox {
                             padding-left: 5px;
                             background-color: rgbs(230,230,230,100%);
                             border-width: 0px;
                             border-radius: 0px;
                             min-height:20px;
                             max-height:20px;
                             }

                             QComboBox::drop-down  {
                             subcontrol-origin: padding;
                             subcontrol-position: top left;
                             border-width: 0px;
                             }
                             
                             QComboBox::down-arrow {
                             image: url(s]   );
                             }
                             
                             s   \t   /i   i   (L   R[   R   R\   Rg   t   holderR]   RO   RS   t   framesR   t   fromRgbt	   color_topt
   color_backt   offset_shadowt   fixed_widthR   R   R   R   R   R   R   t   WindowStaysOnTopHintRm   RQ   R   t   button_homet   button_closet   button_previoust
   button_endt   button_nextR   t
   button_runt   button_disableR   t   button_currentR   t   label_imaget   label_titleR   t   combo_titlet   label_currentt   label_contentt   setMinimumWidtht   setMaximumWidtht   setAlignmentt   AlignCentert   setWordWrapRP   RG   R   t
   stylesheett   replaceR   t   StrongFocusR   t   setStyleSheetR   t	   addWidgett
   addStretcht   addSpacerItemR   R   t	   addLayoutt   setSizeConstraintR   t   SetFixedSizet	   setLayoutR   t   _disable_widgetsR   t   _enable_widgetst   setFocusR   t   setContextMenuPolicyt   CustomContextMenu(   Rn   R]   Ro   Rp   Rq   RO   t   arrowR   t
   layout_topt   layout_contentt
   layout_runt   layout_navigationt   layout(    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyR\     s    							&
	
		

	

	

c         C   s%   x |  j  D] } | j t  q
 Wd S(   Rr   N(   RG   t   setDisabledRP   (   Rn   R   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyR     s    c         C   s   |  j  t j t j Bt j B x |  j D] } | j t  q( W|  j d k rq |  j	 j t
  |  j j t
  n2 |  j d k r |  j j t
  |  j j t
  n  d S(   Rr   t   previoust   nextN(   R   R   R   R   R   RG   R  RQ   R   R   RP   R   R   R   (   Rn   R   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyR     s    c   	      C   sO  |  j  j |  |  j j   |  j j |  |  j j |  |  j j |  |  j j |  |  j j |  | |  _	 | d k r |  j j d  |  j j d  nW | j d  d } t t |  |  |  _	 |  j j |  j	  |  j j |  j	 j    | d k r|  j j t  n  |  j j t  |  j j t  |  j   j   d S(   Rr   i   t   .iN(   R   t   setTextR   t   cleart   addItemst   setCurrentIndexR   R   R   RE   RS   R   t   setFixedHeightt   setFixedWidtht   splitR   R   t	   setPixmapt   setFixedSizeR   R   t
   setVisibleRQ   R  RP   R  t   activate(	   Rn   RC   RD   t   currentRE   RL   R   t   stept	   extension(    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   set_data  s(    	c         C   s,   | |  _  | |  _ |  j t | |   d S(   Rr   N(   R   R   t   moveR   (   Rn   R   R   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   set_pos  s    		c         C   sW  |  j    } d } |  j } | j   | j   } } | j   | | j   | } } d
 \ } }	 | | }
 } t   |  _ |  j j |
 |	 |  |  j j	 |
 | |	 | | d d  |  j j
 | | |	  |  j j	 | |	 | | d d  |  j j
 | | |  |  j j	 | | | | | d d  |  j j
 |
 | |  |  j j	 |
 | | | | | d d  |  j j   d } d } | | } }	 | | }
 t   |  _ |  j j
 |
 |	 |  |  j j |
 |	 |  |  j j	 |
 | |	 | | d d  |  j j
 | | |	  |  j j	 | |	 | | d d  |  j j
 | |	 |  |  j j
 |
 |	 |  d	 S(   Rr   i   i    g        g     V@g     f@g     p@i$   i   N(   i    i    (   t   geometryR   R   R   R   R   R   t   round_rect_patht   moveTot   arcTot   lineTot   closeSubpatht   top_rect_path(   Rn   R   t   radiust   shadowt   x0t   y0R   R   t   leftt   topt   rightt   bottomt   headert   offset(    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   build_paths  s@    	!

#c         C   su   |  j    t |   } | j t j  | j |  j |  j  | j |  j |  j  | j	 |  j t
 t j d   d S(   Rr   i   N(   R,  R
   R   R   R   R  R   R!  R   R   R   R   t   gray(   Rn   R   R   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyR     s    
c      
   C   s   | j    } | |  _ t j t j t j t j t j t j t j	 t j
 t j t j g
 } | | k r |  j   s |  j j   q n  d S(   Rr   N(   R   R   R   t	   Key_Rightt   Key_Leftt   Key_Downt   Key_UpR   t
   Key_PageUpt   Key_PageDownt   Key_Homet   Key_Endt   Key_MenuR   R   R   (   Rn   R   R   t   keys(    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   keyReleaseEvent  s    	c         C   s3   |  j  j   |  j   | j   t j k r/ n  d S(   s   override Qt methodN(   R]   R~   RK   R   t   RightButton(   Rn   R   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyR   '  s    
c         C   s   |  j  j   d S(   s   Override Qt method.N(   RO   R   (   Rn   R   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyR   3  s    c         C   s   t  | j   | j    } t |   } g  } t |  t d  d t   } | j t  | j	 |  t
 | |  | j |  j |   d S(   Rr   s   Go to step: t   iconN(   R   R   R   R   R"   R   R	   R  RP   t   appendR!   t   popupt   mapToGlobal(   Rn   R   t   post   menut   actionst   action_title(    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   context_menu_requested8  s    c         C   s2   |  j    s. t j } | |  _ |  j j   n  d S(   s$   Qt method to handle escape key eventN(   R   R   R   R   R   R   (   Rn   R   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyR   G  s    		N(   R+   R,   R-   RS   R\   R   R   R  R  R,  R   R8  R   R   RB  R   (    (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyR     s   		!		'					t   AnimatedTourc           B   s  e  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 d   Z d   Z d   Z d   Z d   Z d   Z d d  Z d   Z d   Z d   Z d   Z d   Z RS(   Rr   c            su  t  j   |  |   _ d d g   _ d d g   _ d d g   _ d d g   _ t j   _	 t
 j g   _ d   _ d   _ d   _ d    _ d    _ d    _ d    _ d    _ d    _ d    _ d    _ t   _ t   _ t   j   j   j   j   j	 d     _ t   j   j   j   j d     _   j t j    j j  j! j"   j#    j j$ j! j"   j%    j j& j! j"   j'    j j( j! j"   j)    j j* j! j"   j+    j j, j! j"   j-    j j( j! j"   f d      j j. j/ j"   j0    j j1 j"   j2    j j3 j"   j4    j j5 j"   j6  t   _7 t   _8 d  S(	   Ni  iM  g        gffffff?g      ?i    RO   c              s     j  j j t  S(   N(   t   tipsR   R  RP   (    (   Rn   (    s.   lib/python2.7/site-packages/spyder/app/tour.pyR     R*   (9   R   R\   R]   t   duration_canvast   duration_tipst   opacity_canvast   opacity_tipsR   t   blackR   R   t   LinearRq   t   current_stepR   t   stepsRS   t   canvasRD  R   t
   spy_windowRG   t   dockwidgetsRI   RL   RQ   t   is_tour_sett
   is_runningR   R   R   R   R   t   clickedR   t	   next_stepR   t   previous_stepR   t
   close_tourR   t   run_codeR   t
   first_stepR   t	   last_stepR   t   currentIndexChangedt
   go_to_stept   sig_resizedt   _resizedt	   sig_movedt   _movedR   t   _key_pressedt   setting_datat   hidden(   Rn   R]   (    (   Rn   s.   lib/python2.7/site-packages/spyder/app/tour.pyR\   R  sT    															c         C   sO   |  j  rK | j   } |  j j |  |  j j   |  j rK |  j   qK n  d S(   Rr   N(   RQ  R   RM  R  R   RP  t	   _set_data(   Rn   R   R   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyR\    s    		c         C   sW   |  j  rS | j   } |  j j t | j   | j     |  j rS |  j   qS n  d S(   Rr   N(	   RQ  R>  RM  R  R   R   R   RP  Rb  (   Rn   R   R>  (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyR^    s
    	%	c         C   s'   |  j  j   |  j j |  j j  d S(   Rr   N(   RD  t   hideRM  R   (   Rn   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   _close_canvas  s    c         C   s1   |  j  j d  |  j  j d  |  j  j   d S(   Rr   N(   RM  R   RS   R   R   (   Rn   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   _clear_canvas  s    c         C   s   |  j    |  j } | d k	 rO | d } | d k	 rO | j   | j   qO n  |  j   |  j j |  j j	  |  j j   d S(   Rr   i    N(
   Rb  RO  RS   R}   R~   t   _locate_tip_boxRD  R   RM  R   (   Rn   RG   R   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt
   _move_step  s    
	


c         C   sr   t  j j   } d | k r nP d | k r_ xA | D]' } | j |  | j   | j   q1 Wn d | k rn n  d S(   Rr   t   linuxt   wint   darwinN(   t   syst   platformt   lowerRm   Rc  R}   (   Rn   R   RG   Rl  R   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt
   _set_modal  s    
c         C   s   g  } g  } x | D] } | j  d  d } t | |  } d | k rr | j   } t | | j  d  d  } n  | j |  t | d |  } | j |  q W| | f S(   Rr   R	  i    s   get_current_editor()it
   dockwidget(   R  t   getattrt   get_current_editorR;  (   Rn   t   namesRN  RG   RO  RN   t   baset   temp(    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   _process_widgets  s    c      
   C   s  t  |  _ |  j |  j |  j } } } d j | d |  } | | } g  t |  D]& \ } } d j | d | d  ^ qS } d \ }	 }
 } d \ } } } d } d | k r | d }	 n  d | k r | d }
 n  d | k r| | d } |  j | |  j	  \ } } n  | |  _
 | |  _ d | k r`| | d } |  j | |  j	  \ } } | |  _ n  d	 | k r}| | d	 } n  d
 | k r|  j j | d
  | d
 r|  j t |  j g  q|  j t  |  j g  n& |  j j t  |  j t  |  j g  d | k r!| d } | |  _ n  |  j j |	 |
 | | | d | d | |  j   |  j j |  |  j j |  t |  _ d S(   s4   Set data that is displayed in each step of the tour.s   {0}/{1}i   u   {0}. {1}RC   R*   RD   RG   RI   RE   RJ   RL   R   R  N(   R*   R*   N(   NNN(   RP   R`  R   RL  R   RR   t	   enumerateRS   Ru  RN  RG   RO  RI   RM  R   Rn  RQ   RD  RL   R  t   _check_buttonsR   R   (   Rn   R  RL  R   R  t   framet   it   ft   combobox_framesRC   RD   RE   RG   RO  RI   RL   t   widget_namest   deco(    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyRb    sT    	
6				


c         C   s  |  j  } |  j j   } | j   | j   | j   | j   f \ } } } } | |  _ | |  _ | |  _	 | |  _
 d } | d k	 r+| d d k	 ru| d j   } | j   | j   | j   | j   f \ } } } } | d j t d d   } | j   | j   }	 }
 | |  j d } | d k r| |  j j   k  rq|	 | | } |
 | d |  j j   d } q%|	 |  j j   | } |
 | d |  j j   d } q(| |  j j   k  r|	 | d |  j j   d } |
 | | } q(|	 | d |  j j   d } |
 | |  j j   } qunJ |  j	 |  j d |  j j   d } |  j
 |  j d |  j j   d } |  j j | |  d S(   Rr   i   i    id   i<   i   N(   RO  R]   R   R   R   R   R   t
   width_maint   height_maint   x_maint   y_mainRS   R  R=  R   RD  R  (   Rn   RO  R   R   R   R   R   t   deltaR   t   x_globt   y_globt   y_fac(    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyRf  (  s:    	6				6""%%c         C   s]   |  j  |  j } } d |  j _ | d k r: d |  j _ n  | | d k rY d |  j _ n  d S(   Rr   i    R  i   R  N(   R   RL  RS   RD  R   (   Rn   R  RL  (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyRw  X  s    c         C   sV  |  j  j } | t j k s9 | t j k s9 | t j k r\ |  j |  j d k r\ |  j   n | t j	 k s | t j
 k s | t j k r |  j d k r |  j   n | t j k r |  j   n | t j k r |  j d k r |  j   nf | t j k r|  j |  j d k r|  j   n4 | t j k rR|  j  j j   } |  j  j |  n  d S(   Rr   i   i    N(   RD  R   R   R.  R0  R3  R   RL  RS  R/  R1  R2  RT  R   RU  R4  RW  R5  RX  R6  R   R>  RB  (   Rn   R   R>  (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyR_  c  s     %%c         C   s   t  |  _ |  j j   d  S(   N(   RP   Ra  RD  Rc  (   Rn   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   _hidingw  s    	c         C   s8   |  j  } |  j d } x | D] } | j |  q Wd S(   Rr   i    N(   RL   RG   t   execute_code(   Rn   t	   codelinest   consolet   codeline(    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyRV  |  s    	c         C   sK   | |  _  | |  _ | d |  _ | d |  _ t |  j  |  _ t |  _ d S(   Rr   t   lastRO   N(   RN  t   active_tour_indext   last_frame_activeR   t   lenRL  RP   RP  (   Rn   RA   R   RN  (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   set_tour  s    		c         C   s   |  j  j   } | j   | j   | j   | j   f \ } } } } |  j |  _ |  j j	 | |  |  j j
 t | |   |  j j |  j  |  j   t |  _ d S(   Rr   N(   R]   R  R   R   R   R   R  R   RM  R  R  R   R   Rg  Re  RP   RQ  (   Rn   R   R   R   R   R   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt
   start_tour  s    6
c         C   s{   |  j  j |  j  |  j j t  |  j t |  j  g  |  j j   y |  j	 |  j
 j |  j d <Wn n Xt |  _ d S(   Rr   R  N(   RD  R   Rd  RM  R   RQ   Rn  RP   Rc  R   R]   t   tours_availableR  RQ  (   Rn   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyRU    s    c         C   s!   |  j    |  j j |  j  d S(   s2   Hide tips dialog when the main window loses focus.N(   Re  RD  R   R  (   Rn   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt	   hide_tips  s    
c         C   s!   |  j    |  j   t |  _ d S(   s4   Unhide tips dialog when the main window loses focus.N(   Re  Rg  RQ   Ra  (   Rn   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   unhide_tips  s    

c         C   s0   |  j    |  j d 7_ |  j j |  j  d S(   Rr   i   N(   Re  R   RD  R   Rg  (   Rn   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyRS    s    
c         C   s0   |  j    |  j d 8_ |  j j |  j  d S(   Rr   i   N(   Re  R   RD  R   Rg  (   Rn   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyRT    s    
c         C   s*   |  j    | |  _ |  j j |  j  d S(   Rr   N(   Re  R   RD  R   Rg  (   Rn   t   numbert   id_(    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyRZ    s    
	c         C   s   |  j  |  j d  d S(   Rr   i   N(   RZ  RL  (   Rn   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyRX    s    c         C   s   |  j  d  d S(   Rr   i    N(   RZ  (   Rn   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyRW    s    c         C   s;   |  j  r7 |  j   r7 |  j r7 |  j r7 |  j   n  d S(   s3   Confirm if the tour loses focus and hides the tips.N(   RQ  t   any_has_focusR`  Ra  R  (   Rn   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyR     s    c         C   s9   |  j  r5 |  j   r5 |  j r5 |  j r5 |  j   n  d S(   s7   Confirm if the tour regains focus and unhides the tips.N(   RQ  R  R`  Ra  R  (   Rn   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyR     s    c         C   s=   |  j    p6 |  j j    p6 |  j j    p6 |  j j    } | S(   s3   Returns if tour or any of its components has focus.(   R   R]   RD  RM  (   Rn   Rz  (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyR    s    N(   R+   R,   R-   R\   R\  R^  Rd  Re  Rg  Rn  Ru  Rb  Rf  Rw  R_  R  RV  R  R  RU  R  R  RS  RT  RS   RZ  RX  RW  R   R   R  (    (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyRC  O  s8   	?	
								>	0					
										t   TourTestWindowc           B   sS   e  Z d  Z e d  Z e d  Z d   Z d   Z d   Z d   Z	 d   Z
 RS(   Rr   t   QResizeEventt
   QMoveEventc         C   s  t  t |   j   |  j d d d d  |  j d  t d |   |  _ |  j j d  |  j   } | j	 d  } | j
 |  j  |  j   t |   |  _ t d	  |  _ t d
  |  _ t d  |  _ t |  j  } |  j j |  t | t d   |  _ |  j j d  |  j j d  |  j j d  t   } | j |  j  | j   | j |  j  | j |  j  |  j j |  |  j |  j  |  j j j  |  j!  |  j j j  |  j"  t# |   |  _$ d  S(   Ni,  id   i  iX  s   Exploring QMainWindowt   Exits   Exit programs   &FileRV   t   1t   2Ro   g{Gz?g      ?i  (%   R[   R  R\   t   setGeometryt   setWindowTitleR   t   exitt   setStatusTipt   menuBart   addMenut	   addActiont	   statusBarR   R   R   RK   RF   RH   R   R{   R   R    Rg   R   R   R   R   R   R   R   t   setCentralWidgetRR  R   t   action1t   action2RC  RO   (   Rn   t   menubart   file_Rf   t   lay(    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyR\     s:    
	
c         C   sM   t  d  } d } i d d 6| d 6} |  j j | | |   |  j j   d S(   Rr   RV   i    R  RO   N(   R@   RO   R  R  (   Rn   R   RA   t   dic(    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyR    s
    c         C   s   |  j  j   d S(   Rr   N(   Rg   R   (   Rn   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyR  '  s    c         C   s$   t  j |  |  |  j j |  d S(   s   Reimplement Qt methodN(   R   t   resizeEventR[  R   (   Rn   R   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyR  +  s    c         C   s$   t  j |  |  |  j j |  d S(   s   Reimplement Qt methodN(   R   t	   moveEventR]  R   (   Rn   R   (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyR  0  s    (   R+   R,   R-   R   R[  R]  R\   R  R  R  R  (    (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyR    s   	,			c          C   s-   t  g   }  t   } | j   |  j   d S(   Rr   N(   R   R  R}   t   exec_(   t   appRi  (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyRV   6  s    	
t   __main__(8   R-   t
   __future__R    Rk  t   qtpy.QtCoreR   R   R   R   R   R   t
   qtpy.QtGuiR   R   R	   R
   R   R   R   R   t   qtpy.QtWidgetsR   R   R   R   R   R   R   R   R   R   R   R   R   R   R   t   spyder.config.baseR   R   t   spyder.py3compatR    t   spyder.utils.qthelpersR!   R"   t   objectR#   RS   RB   R@   RZ   R   R   RC  R  RV   R+   (    (    (    s.   lib/python2.7/site-packages/spyder/app/tour.pyt   <module>   s*   .:d	k A H	