
,]c           @  sL  d  Z  d d l m Z d d l Z d d l Z d d l Z d d l j Z d d l	 Z	 d d l
 Z
 d d l Z d d l Z d d l Z d d l Z d d l Z e j Z d d l m Z e j   e j   e j   e Z e Z e Z e j d k rd d l m Z m Z m Z n  y d d l Z Wn e k
 r7n Xd d l  m! Z! m" Z" d d l# 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/ d d
 l0 m1 Z1 m2 Z2 m3 Z3 m4 Z4 m5 Z5 d d l6 m7 Z7 m8 Z8 m9 Z9 m: Z: m; Z; m< Z< m= Z= m> Z> m? Z? d d l  m@ Z@ d d l  mA ZA y d d lB mC ZC mD ZD Wn eE k
 rce ZC ZD n Xd d lF mG ZG d d lH mI ZI eJ e* d  re' jK e* jL eI jM d d   n  d d lN mO ZO mP ZP d d lQ mR ZR eO   aS e" re3 eR d   ZT n e3 eR d   ZT tS jU eT  d d lQ mV ZV mR ZR mW ZW mX ZX eX   re> e5 eR d    ZY eY jZ   Z[ e[ j\ d  eY j] e[  eY j^   eY j_ eV d  e* j` e* ja Be* jb Be1 e* jc   e8 jd   n e ZY d d l me Ze mf Zf mg Zg mh Zh mi Zi mj Zj mk Zk d d lQ ml Zl mm Zm mn Zn mo Zo mp Zp mq Zq mr Zr ms Zs mt Zt mu Zu d d lH mv Zv d d lw mx Zx my Zy d d  lz m{ Z{ d d! l m| Z| d d" l} 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 d d& l m Z d d' l m Z m Z m Z d d( l m Z y d d) l m Z Wn e k
 r_e Z n Xd d* lN m Z 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 e   Z d.   Z d/   Z d0 e: f d1     YZ d2   Z d3 e f d4     YZ d5   Z d6   Z e d7 k rHe   n  d S(8   s&  
Spyder, the Scientific Python Development Environment
=====================================================

Developped and maintained by the Spyder Project
Contributors

Copyright © Spyder Project Contributors
Licensed under the terms of the MIT License
(see spyder/__init__.py for details)
i(   t   print_functionN(   t   requirementst   nt(   t   set_attached_console_visiblet   is_attached_console_visiblet   set_windows_appusermodelid(   t   APIt   PYQT5(   t   from_qvariant(
   t
   QByteArrayt   QCoreApplicationt   QPointt   QSizet   Qtt   QThreadt   QTimert   QUrlt   Signalt   Slot(   t   QColort   QDesktopServicest   QIcont   QKeySequencet   QPixmap(	   t   QActiont   QApplicationt   QDockWidgett   QMainWindowt   QMenut   QMessageBoxt	   QShortcutt   QSplashScreent   QStyleFactory(   t   QtSvg(   t   QtWebEngineWidgets(   t   QQuickWindowt   QSGRendererInterface(   t	   FontError(   t   CONFt   AA_EnableHighDpiScalingt   maint   high_dpi_scaling(   t   qapplicationt   MENU_SEPARATOR(   t   get_image_paths
   spyder.svgs
   spyder.png(   t   _R,   t   DEVt   running_under_pytests
   splash.svgi
   s   Initializing...(   t   __version__t   __project_url__t   __forum_url__t   __trouble_url__t   __trouble_url_short__t   __website_url__t   get_versions(
   t   get_conf_patht   get_module_source_patht   STDERRt   DEBUGt   debug_printt   MAC_APP_NAMEt   get_home_dirt   running_in_mac_appt   get_module_patht   reset_config_files(   t   OPEN_FILES_PORT(   t
   IMPORT_EXTt   is_gtk_desktop(   t   get_options(   t   dependencies(   t   is_text_stringt   to_text_stringt   PY3t   qbytearray_to_strt   configparser(   t   encodingt   programs(   t   icon_manager(   t   module_completion(   t   is_module_installed(   t   select_portt   getcwd_or_homet   get_python_executable(   t   FileSwitcher(   t   WinUserEnvDialog(	   t   create_actiont   add_actionst   get_icont   add_shortcut_to_tooltipt   create_module_bookmark_actionst   create_program_actiont   DialogManagert   create_python_script_actiont   file_uri(   t   get_shortcut(   t   get_spyderplugins_mods(   t   tourc          C  s   t  j d k r t j t j d  }  t j |   s7 d Sg  t  j |   D] } t j	 d |  rG | ^ qG } | r t
 t j |  | d   Sn! t j } d | d | d f }  t j |  d  } t j |  r t
 |  Sd S(	   sc   
    Return Python documentation path
    (Windows: return the PythonXX.chm path if available)
    R   t   DocNs   (?i)Python[0-9]{3,6}.chmi    s   /usr/share/doc/python%d.%d/htmli   s
   index.html(   t   ost   namet   ospt   joint   syst   prefixt   isdirt   listdirt   ret   matchR]   t   version_infot   isfile(   t   doc_patht   patht
   python_chmt   vinft
   python_doc(    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   get_python_doc_path   s    	c         C  s   |  d k r> t  j t j  t d k	 r t j t j  q n| |  d k r| t  j t j	  t d k	 r t j t j
  q n> |  d k r t  j t j  t d k	 r t j t j
  q n  d S(   s\   
    Set the OpenGL implementation used by Spyder.

    See issue 7447 for the details.
    t   softwaret   desktopt   glesN(   R
   t   setAttributeR   t   AA_UseSoftwareOpenGLR#   t   Nonet   setSceneGraphBackendR$   t   Softwaret   AA_UseDesktopOpenGLt   OpenGLt   AA_UseOpenGLES(   t   option(    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   set_opengl_implementation   s    t
   MainWindowc        
   B  s=  e  Z d  Z e j e j BZ e j   Z	 e
 d  Z e
 d  Z d d e d  f d d e d  f d	 d
 e d  f d d e d  f d d e d  f d d e d  f d d e d  f f Z d Z e   Z e   Z e   Z e e  Z e d  Z e d  Z e d  Z d   Z d d  Z d   Z d   Z d    Z d!   Z e  d" d#  Z! d$   Z" d%   Z# d" e  d&  Z$ d'   Z% e  d(  Z& d)   Z' d*   Z( e)   d+    Z* e)   d,    Z+ d- d.  Z, d/   Z- e)   d0    Z. d1   Z/ d2   Z0 d3   Z1 d4   Z2 d5   Z3 d6   Z4 d7   Z5 e)   d8    Z6 d9   Z7 d:   Z8 d;   Z9 d<   Z: d=   Z; d>   Z< d?   Z= d@   Z> dA   Z? dB   Z@ dC   ZA dD   ZB dE   ZC dF   ZD dG   ZE dH   ZF dI   ZG e  dJ  ZH dK   ZI e)   dL    ZJ dM   ZK dN   ZL e)   e) eM  e  dO    ZN dP   ZO e)   dQ    ZP dR   ZQ e)   dS    ZR e)   dT    ZS dU dU dV  ZT e)   e e e  dW   ZU e)   dX    ZV e)   dY    ZW e)   dZ    ZX d[   ZY e  d\  ZZ d]   Z[ e  d^  Z\ d_   Z] d`   Z^ da   Z_ db   Z` e)   dc    Za dd   Zb e)   de    Zc df   Zd dg   Ze dh   Zf e)   di    Zg dj   Zh dk   Zi e  dl  Zj dm   Zk e)   dn    Zl do   Zm e)   dp    Zn e)   e  dq   Zo dr   Zp e  ds  Zq dt   Zr du   Zs dv   Zt e)   e  dw   Zu dx   Zv RS(y   s   Spyder main windowRo   t   not_active_patht   Python2s$   https://docs.python.org/2/index.htmls   Python2 documentationt   Python3s$   https://docs.python.org/3/index.htmls   Python3 documentationt   numpys   https://docs.scipy.org/doc/s   Numpy and Scipy documentationt
   matplotlibs$   https://matplotlib.org/contents.htmls   Matplotlib documentationt   PyQt5s'   http://pyqt.sourceforge.net/Docs/PyQt5/s   PyQt5 Reference Guides;   http://pyqt.sourceforge.net/Docs/PyQt5/class_reference.htmls   PyQt5 API Referencet	   winpythons   https://winpython.github.io/t	   WinPythoni   t   QResizeEventt
   QMoveEventc         C  s'  t  j |   t j   } t r2 | j t j  n  t | j	   j
    |  _ t   |  _ | j |  _ | j |  _ | j |  _ | j |  _ | j |  _ | j |  _ |  j d  d  d  } t j d k r y  d d  l } | j | t  Wq/t k
 r q/Xn/ t j t j |  t  s/t j t j! |  n  t" j# d k rt$ d  } t% j& | d  } t' t% j& | d d	   j(   } | j) d
 |  } |  j* |  n  g  |  _+ g  |  _, g  |  _- g  |  _. t% j/ |  j0  r!t1 j2 |  j0  \ |  _, } g  |  j, D] }	 t% j3 |	  r|	 ^ q|  _, n  t% j/ |  j4  rt1 j2 |  j4  \ |  _- } g  |  j- D] }	 t% j3 |	  rX|	 ^ qX|  _- n  |  j5   |  j6   d  |  _7 d  |  _8 d  |  _9 d  |  _: d  |  _; d  |  _< d  |  _= d  |  _> d  |  _? d  |  _@ d  |  _A d  |  _B d  |  _C g  |  _D d  |  _E d  |  _F d  |  _G d  |  _H d  |  _I d  |  _J t |  _K d d lL mM }
 mN } d d lO mP } d d lQ mR } d d lS mT } |
 | | | | g |  _U d  |  _V d  |  _W d d lX mY } mZ } | |  _[ | |  _\ d  |  _] d  |  _^ d  |  __ d  |  _` d  |  _a d  |  _b d  |  _c d  |  _d d  |  _e d  |  _f d  |  _g d  |  _h g  |  _i d  |  _j g  |  _k d  |  _l g  |  _m d  |  _n g  |  _o d  |  _p g  |  _q d  |  _r g  |  _s d  |  _t g  |  _u d  |  _v g  |  _w d  |  _x g  |  _y d  |  _z g  |  _{ d  |  _| d  |  _} g  |  _~ d  |  _ d  |  _ g  |  _ d  |  _ d  |  _ g  |  _ g  |  _ d  |  _ g  |  _ d  |  _ g  |  _ d  |  _ g  |  _ d  |  _ g  |  _ d  |  _ g  |  _ d  |  _ g  |  _ d  |  _ g  |  _ d  |  _ g  |  _ t   rt j d d t  n  |  j   t d  k r>t   } t d t |   n  t j j d d   } | d  k	 rd } t |   |  _ |  j j j t j  |  j j |  n  t |  _ t j d d d  t k rt j d d t  n  g  |  _ t |  _ t |  _ t |  _ t j d d  |  _ g  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ t j d k ry% t j t j t j t j  |  _ Wqt k
 r} d  |  _ t j d  d t d   qXn! t j t j t j t j  |  _ |  j   |  j d  d  S(   Ns   Start of MainWindow constructorc         S  s/   t  j j d |   t  j j   t j   d S(   s   Handler for signals.s   Handling signal: %s
N(   Rf   t   stdoutt   writet   flushR   t   quit(   t   signumt   frame(    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   signal_handler*  s    R   it   darwint   spydert   imagest   apps   mac_stylesheet.qsss   $IMAGE_PATH(   t   MainConfigPaget   ColorSchemeConfigPage(   t   ShortcutsConfigPage(   t   RunConfigPage(   t   MainInterpreterConfigPage(   t   LayoutSaveDialogt   LayoutSettingsDialogR(   t   show_internal_errorss   appusermodelid: t   TEST_CI_APPi0u  t   current_versiont    t   panes_lockedt   Spyders   An error occurred while creating a socket needed by Spyder. Please, try to run as an Administrator from cmd.exe the following command and then restart your computer: <br><br><span style='color: #555555'><b>netsh winsock reset</b></span><br>s   End of MainWindow constructor(   R   t   __init__R   t   instanceR   Rw   R   t   AA_UseHighDpiPixmapst   strt   stylet
   objectNamet   default_styleR[   t   dialog_managert   working_directoryt   init_workdirt   profilet   multithreadedt   new_instancet   projectt   open_projectt   window_titleR;   Ry   Rb   Rc   t   win32apit   SetConsoleCtrlHandlert   Truet   ImportErrort   signalt   SIGTERMR.   t   SIGINTRf   t   platformR8   Rd   Re   t   opent   readt   replacet   setStyleSheett   shortcut_dataRo   R   t   project_pathRm   t   SPYDER_PATHRK   t	   readlinesRh   t   SPYDER_NOT_ACTIVE_PATHt   remove_path_from_sys_patht   add_path_to_sys_patht   consolet   workingdirectoryt   editort   explorert   helpt
   onlinehelpt   projectst   outlineexplorert
   historylogt
   extconsolet
   ipyconsolet   variableexplorert   findinfilest   thirdparty_pluginsR`   t   tours_availablet   fileswitchert   check_updates_actiont   thread_updatest   worker_updatest   give_updates_feedbackt   spyder.plugins.configdialogR   R   t   spyder.plugins.shortcutsR   t   spyder.plugins.runconfigR   t   spyder.plugins.maininterpreterR   t   general_prefst   prefs_indext   prefs_dialog_sizet   spyder.plugins.layoutdialogR   R   t   dialog_layout_savet   dialog_layout_settingst   lock_dockwidgets_actiont   show_toolbars_actiont   close_dockwidget_actiont   undo_actiont   redo_actiont   copy_actiont
   cut_actiont   paste_actiont   selectall_actiont   maximize_actiont   fullscreen_actiont	   file_menut   file_menu_actionst	   edit_menut   edit_menu_actionst   search_menut   search_menu_actionst   source_menut   source_menu_actionst   run_menut   run_menu_actionst
   debug_menut   debug_menu_actionst   consoles_menut   consoles_menu_actionst   projects_menut   projects_menu_actionst
   tools_menut   tools_menu_actionst   external_tools_menut   external_tools_menu_actionst	   view_menut   plugins_menut   plugins_menu_actionst   toolbars_menut	   help_menut   help_menu_actionst
   mem_statust
   cpu_statust   visible_toolbarst   toolbarslistt   main_toolbart   main_toolbar_actionst   file_toolbart   file_toolbar_actionst   edit_toolbart   edit_toolbar_actionst   search_toolbart   search_toolbar_actionst   source_toolbart   source_toolbar_actionst   run_toolbart   run_toolbar_actionst   debug_toolbart   debug_toolbar_actionst   layout_toolbart   layout_toolbar_actionsR/   R&   t   sett   Falset   set_window_titleR   t   environt   getR   t   timer_shutdownt   timeoutt   connectt   MAIN_APPR   t   startt   SPLASHt   splashR0   t
   widgetlistt   already_closedt   is_starting_upt   is_setting_upt   dockwidgets_lockedt   floating_dockwidgetst   window_sizet   window_positiont   state_before_maximizingt   current_quick_layoutt   previous_layout_settingst   last_plugint   fullscreen_flagt   maximized_flagt   saved_normal_geometryt   last_focused_widgett   previous_focused_widgett   sockett   AF_INETt   SOCK_STREAMt   IPPROTO_TCPt   open_files_servert   OSErrorR   t   warningR-   t   apply_settings(   t   selft   optionst   qappR   R   t   spy_patht   img_patht	   mac_stylet   _xRc   R   R   R   R   R   R   R   t   rest   test_travist   timer_shutdown_timet   e(    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR     sb   !				11

																																																																																			
																			
c         C  s   t  |  d S(   s   Debug printsN(   R;   (   RC  t   message(    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR;     s    i   c         C  sF   |  j  |  } | j |  | j t | |   |  j j |  | S(   s8   Create and return toolbar with *title* and *object_name*(   t
   addToolBart   setObjectNamet   setIconSizeR   R  t   append(   RC  t   titlet   object_namet   iconsizet   toolbar(    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   create_toolbar  s
    c   M        sX   j  d   j  d  t  d t j d  d t d  d  j d t j  _  j	  j d	 d
  t  t d  d  j
 d t j  _  j	  j d	 d  t  t d  d  j d t j  _ t  t d  d  j d t j  _  j	  j d	 d   j	  j d	 d  t  t d  d t j d  d t d  d  j d t j  _  j	  j d d	 d d t  t d  d t j d  d t d  d  j d t j  _  j	  j d d	 d d d t  j  j g  _  f d   } | d t d  t j d    _ | d t d  t j d    _ | d  t d   t j d!    _ | d" t d"  t j d#    _ | d$ t d$  t j d%    _ | d& t d&  t j d'    _  j  j d  j  j  j  j g  _ d }  j  d(   j   j t d)    _   j! t d*  d+   _"  j   j t d,    _#  j! t d-  d.   _$  j   j t d/    _%  j! t d0  d1   _&  j   j t d2    _'  j! t d3  d4   _(  j   j t d5    _)  j! t d6  d7   _*  j   j t d8    _+  j! t d9  d:   _,  j   j t d;    _-  j   j t d<    _.  j. j/ j0  j1   j   j t d=    _2  j   j t d>    _3  j   j t d?    _4  j5   } | j6 d@  | j7 t dA  dB   j  dC  t  t dD  d t j dE  d  j8 d t j }  j	 | d	 dF d t t  t dG  d d t j dH  d  j9 d t dI  dJ t: j; } t  t dK  d dL   d t dM  } t  t dN  d  j< } | | g  _= t> d k	 rt  t dO  d dP d t dQ  d  j? }  j= j@ |  n   j= | tA | g 7_= tB t dR    _C g   _D t  t dS  d tE dT  d dU    _F tG jH dV k r?tI dW  r? jD j@  jF  n  g  }	 x0 d D]( }
 tJ  t dZ  |
  } | rLPqLqLWx0 d D]( }
 tJ  t d]  d\  } | rPqqWtG jH dV k rd^ g n g  } x* | | f D] } | r|	 j@ |  qqW|	 r!tI dW  r! jD d g |	 7_D n   j  d_  g  } yj d` da lK mL } d` db lK mM } | jE dc  } tN  t dd  | de tO jP df dg   } | | g 7} Wn n Xy d` da lK mL } d` db lQ mM } | jE dh  } tN  t di  | dj tO jP df dg   } | r	| | g 7} n  | jE dk  } tN  t dl  | dj tO jP df dm   } | ri	| | g 7} n  Wn n X| r	 jD d g | 7_D n  t  dn d  jR d t j  _S  j	  jS d	 do   jT   t  t dp  d  jU d t j  _V  j	  jV d	 dp d t  jS  jV d | | g  _W  j! t dq  dr   _X  j  ds  d` dt lY mZ } |  | du  j[ dv  j\ dw  j] dx t dy   _^  j^ j_    j  dz  d` d{ l` ma } |   jb d|   _c  jc j_    jd j@  jc  te jf d} d~  re jg t d   d` d lh mi } |    _j  jj j_   n  te jf d d~  r jg t d   d` d lk ml } |    _m  jm j_   n   jg t d   d` d ln mo } |    _p  jp j_   t  t d  d t j d  d t d  d  j^ jq d t j }  j	 | d	 d  t  t d  d t j d  d t d  d  jr d t j }  j	 | d	 d   js  j  j d | | g 7_s  jg dn   j  d  te jf d d~  r7 jg t d   d` d lt mu } |    _v  jv j_   n  te jf d d~  r jg t d   d` d lw mx }  |     _y  jy j_   n  y d` d lz m{ }! Wn t| k
 rd }! n Xte jf d d~  r	|! d k	 r	 jg t d   |!    _}  j} j_   n   jg t d   d` d l~ m }" |"    _  j j_    j j d t   _ te jf d d~  rd` d l m }# |#    _  j j_   n   jg t d   d` d l m }$ |$    _  j j_    jg t d   d` d l m }% |%    _  j j_    jg t d   t  t d  d  j }& t  t d  d  j d t j d  }' t  t d  d t j d  d  j }( t  t d  d  j }) t  t d  d  j  _ d  t  t d  d t j d  d  f d   }*  j	 |* d	 d   jj d k	 rht  t d  d  jj j }+ n d }+ t  t d  d d d  j }, t j    _ tB t d    _ g   _ t j d   _ xw t  j  D]f \ }- }. d  j |- d <|. d }/ |-  d  }0 t  |/ d dn d |0   }1  j |1 g 7_ qW j j  j  |* |+ |,  j tA |& |( |'  j |) tA g  _ t   d k	 rt  t d  d d   }2  j j@ |2  n   jj d k	 rtB t d    }3 t  t d  d  j j }4 t  t d  d  j j }5 t  t d  d  j j }6 t |3 |4 |6 |5 f   j j@ |3  n  g       f d   }7 tO jP t j d  }8 tO j |8  r9xy tG j |8  D]e }9 d }: t j |: |9  }; |; d k	 r|; j   d }< |< d k r2|7 |< tO jP |8 |9   q2qqWn    rttB t d    }= t |=     j j@ |=  n  tB t d   }> t   j  }? |? j d d  |? j d d  |? j d d  t |> |?   j j@ |>  t j j d  rt rd }@ n d }@ tJ  t d  |@  }A |A rC j |A d g 7_ n  t  t d  d d t j d  d  j }B  j tA |B g 7_ d` d l m }C m }D |C  |   _ |D  |   _  j   x t   D] }E yd |E j   }F y |F j   d }G Wn t k
 rt }G n X|G r@ j j@ |F  |F j_   n  Wqt k
 r}H t d |E t |H  f d t t j d t  qXqWtB t d     _ tB t d     _ tB t d     _  j    j3 j  j  t  j3  j  j  jS tA f  t  t d  d  j d t j  _  j	  j d	 d   j3 j  j   j3 j  j  t  j3 tA  j  j  j tA  jV f  t d k	 rt  t d  d t }I |I j t    t  j3 tA |I f  n   jD r?t  t dR   }J |J j  jC   j= d |J g 7_= n  t  j   js  t  j#  j  t  j%  j  t  j'  j  t  j)  j  t  j+  j  t  j-  j  t  j.  j  t  j2  j=  t  jC  jD  t  j4  j  t  jX  jW  t  j"  j  t  j$  j  t  j&  j  t  j(  j  t  j,  j  t  j*  j   j    j j    j  d   j d t  t j d k rRxw d d d d d d d d d g	 D]Q }
 t  |
 d  }K |K j/ j0 |
  f d   |K j j0 |
  f d   qWn   j d k	 rq j j   n  te jf d| d  rxK  j   j   D]4 }L t |L tB  r|L  j4 k r|L j t  qqWn  xj  j   j   D]V }L t |L tB  ry* |L j/ j0  j  |L j/ j0  j  Wq:t k
 r6q:XqqW j  d  t  _ d S(   s   Setup main windows!   *** Start of MainWindow setup ***s     ..core actionst   icont   DialogCloseButtont   texts   Close current panet	   triggeredt   contextR-   s
   Close panes
   Lock panest   toggleds   Lock unlock paness   Use next layouts   Use previous layouts   File switcher...t   filelistt   tips   Fast switch between filesRc   s   File switchers   Symbol finder...t   symbol_finds   Fast symbol search in files   symbol findert   add_sc_to_tipc           st   |  j  d  } | d j   d j | d  } t   | d | d   j d | d t j }   j | d	 |   | S(
   Nt    i    R   i   RX  R[  t   dataR\  t   Editor(   t   splitt   lowerRe   RU   t   global_callbackR   t   WidgetShortcutt   register_shortcut(   RZ  t   tr_textRX  t   textseqt   method_namet   action(   RC  (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   create_edit_actionY  s    !	t   Undot   undot   Redot   redot   Copyt   editcopyt   Cutt   editcutt   Pastet	   editpastes
   Select Allt	   selectalls     ..toolbarss   &Files   File toolbarR  s   &Edits   Edit toolbarR  s   &Searchs   Search toolbarR  s   Sour&ces   Source toolbarR  s   &Runs   Run toolbarR  s   &Debugs   Debug toolbarR  s	   C&onsoless	   &Projectss   &Toolss   &Views   &Helpt	   StatusBars   Welcome to Spyder!i  s	     ..toolss   Pre&ferencest	   configuret   Preferencess   PYTHONPATH managert
   pythonpaths   Python Path Managert   menuroles   Update module names listc           S  s
   t  j   S(   N(   RN   t   reset(    (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   <lambda>  s    s4   Refresh list of module names available in PYTHONPATHs    Reset Spyder to factory defaultss%   Current user environment variables...s   win_env.pngs\   Show and edit current user environment variables in Windows registry (i.e. for all sessions)s   External Toolss   WinPython control panels   winpython.svgc           S  s   t  j d d  S(   NR   t   controlpanel(   RL   t   run_python_script(    (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    s    R   R   s   designer-qt4t   designers   Qt Designers   linguist-qt4t   linguists   Qt Linguists
   -no-opengls	     ..sift?i(   t   configtools(   t   configs   guidata.svgs   guidata examplest   guidatat   testsR   s
   guiqwt.svgs   guiqwt examplest   guiqwts   sift.svgt   Siftt   siftR   s   Maximize panes   Fullscreen modes   Main toolbarR  s     ..plugin: internal console(   t   Consolet   exitfuncR   R   RN  s   Spyder Internal Console

This console is used to report application
internal errors and to inspect Spyder
internals with the following commands:
  spy.app, spy.window, dir(spy)

Please don't use it to run your code

s     ..plugin: working directory(   t   WorkingDirectoryR(   R   t   enables   Loading help...(   t   Helpt   outline_explorers   Loading outline explorer...(   t   OutlineExplorers   Loading editor...(   Rd  s   &Quitt   exitt   Quits   &Restartt   restartt   Restarts     ..widgetsR   s   Loading file explorer...(   t   ExplorerR   s   Loading history plugin...(   t
   HistoryLog(   t
   OnlineHelpR   s   Loading online help...s   Loading project explorer...(   t   Projectst   at_startt   find_in_files(   t   FindInFiless   Loading namespace browser...(   t   VariableExplorers   Loading IPython console...(   t   IPythonConsoles   Setting up main window...s   Troubleshooting...s   Dependencies...t   advanceds   Report issue...t   bugs   Spyder support...s   Check for updates...s   https://docs.spyder-ide.org/s   Spyder documentationt   DialogHelpButtonc             s   t  j    S(   N(   RL   t
   start_file(    (   t
   spyder_doc(    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    s    s   spyder documentations   Spyder tutorials   Shortcuts Summaryt   shortcuts   Meta+F1s   Interactive toursi    t   lastc           s      f d   S(   Nc             s    j     S(   N(   t	   show_tour(    (   t   iRC  (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    R   (    (   R  RC  (    (   R  RC  s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   trigger  s    s   Python documentationc           S  s   t  j t    S(   N(   RL   R  Rs   (    (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    s    s   IPython documentations   Intro to IPythons   Quick references   Console helpc           st   t  |  } t d k s' | d  } n | d  } t  |  d d t j |  d d d | }   j |  d S(	   s6   Add installed Python module doc action to help submenut   pysidec         S  s   t  j |  S(   N(   RL   R  (   t   _checkedRo   (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    R   c         S  s   t  j |   S(   N(   RL   R  (   Ro   (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    R   RX  s   %s.pngi   R[  N(   R]   R   RU   Rd   t   splitextRR  (   RZ  Ro   t   slotRm  (   t   ipm_actionsRC  (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   add_ipm_action  s    	Ra   s3   ([a-zA-Z\_]*)(doc)?(-dev)?(-ref)?(-user)?.(chm|pdf)t   Pythons   Installed Python moduless   Online documentationi   i   i   t   linuxs   assistant-qt4t	   assistants   Qt documentations   About %s...R   t   MessageBoxInformation(   t   MemoryStatust	   CPUStatuss   %s: %st   filet   Panest   Toolbarss   Window layoutss   Show toolbarss#   Attached console window (debugging)s   Setting up window...t   defaultR   t   editt   searcht   sourcet   runt   debugR   t   toolst   pluginst   _menuc           s     j  |   S(   N(   t   show_shortcuts(   Rc   (   RC  (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    R   c           s     j  |   S(   N(   t   hide_shortcuts(   Rc   (   RC  (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    R   t   tear_off_menuss   *** End of MainWindow setup ***N(   s   designer-qt4R  (   s   linguist-qt4R  (   R  (   R;   RU   t   imaRX  R-   t   close_current_dockwidgetR   t   ApplicationShortcutR   Ri  t   toggle_lock_dockwidgetsR   t   toggle_next_layoutt   toggle_next_layout_actiont   toggle_previous_layoutt   toggle_previous_layout_actiont   open_fileswitchert   file_switcher_actiont   open_symbolfindert   symbol_finder_actionR   R  R   R   R   R   R   R   Ry   R   t   menuBart   addMenuR   RW  R  R   R  R   R  R   R  R   R  R   R  R   R   t   aboutToShowR%  t   valid_projectR   R  R  t	   statusBarRP  t   showMessaget   edit_preferencest   path_manager_callbackR   t   ApplicationSpecificRolet   reset_spyderR  RT   t   win_envRR  R+   R   R  R  RW   t	   wp_actionRb   Rc   RO   RZ   R  R  R  R\   Rd   Re   R  t   maximize_dockwidgetR   t#   _MainWindow__update_maximize_actiont   toggle_fullscreenR   R  R  t   spyder.plugins.consoleR  t   closingR   R   R   t   register_plugint   spyder.plugins.workingdirectoryR  R   R   R  R&   R"  t
   set_splasht   spyder.plugins.helpR  R   t   spyder.plugins.outlineexplorerR  R   t   spyder.plugins.editorRd  R   R   R  R   t   spyder.plugins.explorerR  R   t   spyder.plugins.historyR  R   t   spyder.plugins.onlinehelpR  R   R   t   spyder.plugins.projectsR  R   t   get_pythonpathR   t   spyder.plugins.findinfilesR  R   t   spyder.plugins.variableexplorerR  R   t   spyder.plugins.ipythonconsoleR  R   t   trouble_guidet   show_dependenciest   report_issuet   google_groupt   check_updatesR   t   show_tutorialt   show_shortcuts_dialogR`   t   AnimatedTourt
   tours_menut   tour_menu_actionst	   get_toursR   t	   enumeratet
   addActionsR	  Rs   t
   show_introt   show_quickreft   show_guirefRV   Rf   Rg   Rh   Ri   Rj   Rk   t   groupsRY   t	   BOOKMARKSt   insertR   t
   startswithR   t   aboutt   spyder.widgets.statusR  R  R
  R  t   apply_statusbar_settingsR_   t   PLUGIN_CLASSt   check_compatibilityt   AttributeErrorR   t	   Exceptiont   printR   R9   t	   tracebackt	   print_excR  R  t   quick_layout_menut   quick_layout_set_menut   show_toolbarsR   t	   addActionR   t
   setCheckedR   t   setMenuR   R   R   R   R   R   R  R  R  R  R  t   apply_shortcutst   all_actions_definedt   emitt   setup_layoutR  t   getattrt   aboutToHideR)  t   hidet   childrent
   isinstancet   setTearOffEnabledt   update_edit_menut   update_search_menut	   TypeErrorR,  (M   RC  Rn  t	   namespacet   statust   prefs_actiont   spyder_path_actiont   update_modules_actiont   reset_spyder_actiont   winenv_actiont   additactRc   t   qtdactt   qtlactt   argst   actt   gdgq_actR  R  t   guidata_icont   guidata_actt   guiqwt_icont
   guiqwt_actt	   sift_icont   sift_actR  R  R  R  Rd  t   quit_actiont   restart_actionR  R  R  R  R  R  R  t   trouble_actiont
   dep_actiont   report_actiont   support_actiont
   doc_actiont
   tut_actiont   shortcuts_actionR  t   tour_availablet	   tour_nameR  t   temp_actiont	   pydoc_actt   ipython_menut   intro_actiont   quickref_actiont   guiref_actionR  t	   sysdocptht   docfnt   ptRk   t   pnamet   pymods_menut   web_resourcest   webres_actionst   qta_exet   qta_actt   about_actionR  R  t   modt   plugint   checkt   errort   cmd_actt   external_tools_actt   menu_objectt   child(    (   R  RC  R  s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   setup'  s   														
					
		
		
&		

 

				

		c         C  s  |  j  j   x |  j D] } | j t  q Wt   rj t j t  } t |  } t	 j
 d | t g  n  t j d d  r |  j r |  j r t j d |  j  } | j t  | j   |  j j |  j  n  |  j   |  j   t j d d  |  _ |  j   |  j j |  j  |  j   |  j j  j!   ret" d	 k re|  j j$ j t%  |  j j  j&   n  |  j' g } |  j( d	 k	 r| j) |  j(  n  x- | D]% } | j  j!   r| j  j*   qqW|  j' j+ s|  j, j- t. d   n  |  j/ r|  j0 j/ |  j/  n2 |  j0 j1   |  j0 j2   d	 k r9|  j3 j4   n  t" d	 k rst j d d  rst% |  _5 |  j6 d t  n  |  j7   t% |  _8 d	 S(
   sX   Actions to be performed only after the main window's `show` method
        was triggeredR   R(   t   single_instancet   targett   toolbars_visibles
   history.pyt   check_updates_on_startupt   startupN(9   t   restore_scrollbar_positionR  R/  t   setFloatingR   R>   t   __file__t   indexR<   t
   subprocesst   callR&   R"  R   R?  t	   threadingt   Threadt   start_open_files_servert	   setDaemonR'  t   sig_open_external_fileR%  t   open_external_filet   create_plugins_menut   create_toolbars_menuRZ  t   load_last_visible_toolbarsR   R  R.  t   apply_panes_settingsR   t
   dockwidgett	   isVisibleR.   Ry   t   toggle_view_actionR  R  R   R   RR  t   raise_t	   isvisibleR   t   add_historyR7   R   R   t   reopen_last_projectt   get_active_projectR   t   setup_open_filesR   R  t   report_missing_dependenciesR-  (   RC  t   widgett   idxt   app_patht   tt   plugins_to_showRP  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   post_visible_setup  sP    	
	




		
c         C  s   t  d	 k	 r0 d t t j d t j d f } n d t j d t j d f } t re | d t 7} n  |  j d	 k	 r | d t |  j  7} n  |  j d	 k	 r |  j j	   } | r | j
 t   d  } d j | |  } q n  | |  _ |  j |  j  d	 S(
   s   Set window title.u   Spyder %s (Python %s.%s)i    i   u   Spyder (Python %s.%s)u    [DEBUG MODE %d]u    -- u   ~u	   {0} - {1}N(   R.   Ry   R0   Rf   Rl   R:   R   RG   R   t   get_active_project_pathR   R=   t   formatt
   base_titlet   setWindowTitle(   RC  RS  Ro   (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR     s"    
	c         C  sB   t  j   } | r> t j |  t d  t d  | t j  n  d S(   s;   Show a QMessageBox with a list of missing hard dependenciest   Errors  <b>You have missing dependencies!</b><br><br><tt>%s</tt><br><br><b>Please install them to avoid this message.</b><br><br><i>Note</i>: Spyder could work without some of these dependencies, however to have a smooth experience when using Spyder we <i>strongly</i> recommend you to install all the listed missing dependencies.<br><br>Failing to install these dependencies might result in bugs. Please be sure that any found bugs are not the direct result of missing dependencies, prior to reporting a new issue.N(   RE   t   missing_dependenciesR   t   criticalR-   t   Ok(   RC  t   missing_deps(    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyRv    s
    	R(   c         C  s!  | r t  j n t  j } | | | d  } | | | d  } | rM d	 } n | | | d d	  } | | | d  } | d }	 | d }
 t j   j   } | j   } | j   } | |	 k  s | |
 k  r t  j | | d  } n  | | | d  } | | | d  } | | | | | | f S(
   s   Load window layout settings from userconfig-based configuration
        with *prefix*, under *section*
        default: if True, do not restore inner layoutt   sizeR   t   statet   positioni    i   t   is_maximizedt   is_fullscreenN(	   R&   t   get_defaultR"  Ry   R   Ru   t   geometryt   widtht   height(   RC  Rg   R  t   sectiont   get_funcR0  R   t   hexstatet   posR  R  t   screen_shapet   current_widtht   current_heightR  R  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   load_window_settings!  s$    	

c         C  s   |  j  j   |  j  j   f } |  j   } | r< |  j } n |  j   } |  j j   |  j j   f } |  j	 j   |  j	 j   f } t
 |  j    } | | | | | | f S(   sS   Return current window settings
        Symetric to the 'set_window_settings' setter(   R0  R  R  t   isFullScreenR7  t   isMaximizedR1  t   xt   yR   RI   t	   saveState(   RC  R0  R  R  R  R   R  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   get_window_settings=  s    c         C  sm  |  j  t  t | d | d  |  _ t | d | d  |  _ t | d | d  |  _ |  j t j	  |  j
 |  j  |  j |  j  | r|  j t   j t |  j d    xR |  j   D]A } t | t  r | j   r |  j j |  | j t  q q Wn  | r'|  j t j  n  |  j   | rC| |  _ n | r\|  j t j  n  |  j  t  d S(   sJ   Set window settings
        Symetric to the 'get_window_settings' accessori    i   s   utf-8N(   t   setUpdatesEnabledR  R   R0  R   R   R1  t   setWindowStateR   t   WindowNoStatet   resizet   movet   restoreStateR	   t   fromHexR   t   encodeR  R  R   t
   isFloatingR/  RR  R^  t   WindowFullScreent%   _MainWindow__update_fullscreen_actionR7  t   WindowMaximizedR   (   RC  R  R0  R   R  R  R  Rw  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   set_window_settingsM  s.    

c         C  sQ  |  j  } |  j } t j | | d | j   | j   f  t j | | d | j   | j   f  t j | | d |  j    t j | | d |  j    |  j } t j | | d | j	   | j
   f  |  j d t  | r t j | | d d	  n) |  j   } t j | | d t |   t j | | d |  j   j    d	 S(
   si   Save current window settings with *prefix* in
        the userconfig-based configuration, under *section*R  R   R  R  R  t   restoreR  t	   statusbarN(   R0  R   R&   R  R  R  R  R  R1  R  R  R  R   Ry   R  RI   R  t   isHidden(   RC  Rg   R  t
   none_statet   win_sizet
   prefs_sizeR  t   qba(    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   save_current_window_settingsr  s     		)	)c         C  s   |  j  | j | j  d S(   s   Tabify plugin dockwigdetsN(   t   tabifyDockWidgetRm  (   RC  t   firstt   second(    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   tabify_plugins  s    c         C  s  d } |  j  | |  } | d } t |  _ | d k rI|  j t j  t |  _ |  j d |  d } | ru t	 j
 n t	 j } | | d  } | r t	 j | d |  t	 j | d |  t	 j | d |  n  x? t |  D]1 \ } }	 d	 j |  } |  j | | d
 t q Wd } d } |  j | | d
 t d |  _ |  j   n  |  j |   xe |  j D]Z }
 y |
 j   Wq`t k
 r} t d |
 t |  f d t t j d t  q`Xq`Wd S(   s   Setup window layoutt   windowt   /i    R  t   quick_layoutst   ordert   activet   namess   layout_{0}/R  s   layout_default/s   %s: %sR  Ns   window/(   R  R  t   first_spyder_runRy   R  R   R  R   t   setup_default_layoutsR&   R  R"  R  R  R~  R  R3  R  R  R*  t&   initialize_plugin_in_mainwindow_layoutR
  R  R   R9   R  R  (   RC  R  Rg   t   settingsR  R  R  R  R`  Rc   RP  RR  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    s>    
			 c   3      C  sx  |  j  d t  |  j |   |  j t  t |  j  \ } } } } |  j } |  j } |  j	 }	 |  j
 }
 |  j } |  j } |  j } |  j } |  j } |  j } |  j } |  j } | |	 | | g | } |  j |  j |  j g } i | g g | g g |
 g g | | | | | g | |	 | | g g g d 6d d d d g d 6d g d g d g d d	 g g d
 6|
 g d 6g  d 6} i | g | |	 g g | | |
 | g | | | | | g g g d 6d d g d 6d d g d d g g d
 6|
 g d 6g  d 6} i | | g |
 g g | g | |	 g g | | g | | | | g g g d 6d d d g d 6d d g d d g d d g g d
 6g  d 6g  d 6} i | g | |	 | | | | | |
 | | g
 | g g d 6d g d 6d d g g d
 6|
 g d 6g  d 6} i | g g | |	 | | | | | |
 | | g
 | g g d 6d d g d 6d g d g g d
 6|
 g d 6g  d 6} i | d 6| | 6| | 6| | 6| | 6} | | } | d } g  } xL | D]D } x; | D]3 } x* | D]" }  |  d k	 r| j |   qqWqWqWx: | D]2 }  |  j t  |  j }! |! j |  j j    qWxn t t |  d  D]V }" | |" | |" d }# }$ |# d k	 r5|$ d k	 r5|  j |# j |$ j t j   q5q5Wx | D] } xv t t |  d  D]^ }" | |" | |" d }% }& |% d k	 r|& d k	 r|  j |% d j |& d j t j!  qqWqWx | D] } x | D] } xb t t |  d  D]J }" | |" | |" d }# }$ |# d k	 rJ|$ d k	 rJ|  j" |# |$  qJqJW| d j j#   | d j j$   q-Wq W| | d }' x' |' D] }( |( d k	 r|( j%   qqW| | d }) x* |) D]" }  |  d k	 r|  j j%   qqWg  |  _& |  j' j(   |  j' j)   }* }+ x t* |  D] \ }, } x t t |  d  D] }- | |- d }  |  j }. |. j+   }/ |. j,   }0 i |  d 6|/ d 6|0 d 6}1 |  j& j |1  t- | d
 |, |- |+ d  }2 |. j. |2  |. j/ |2  qWqjWt0 |   |  _1 |  j1 j2 j3 |  j4  |  j1 j5 t  |  j1 j6 d  d S(   s1   Setup default layouts when run for the first timeR  t   widgetsg        g?g?s   width fractiong      ?gq=
ףp?gHzG?s   height fractions   hidden widgetss   hidden toolbarsg?g?R  i   i    Rw  s   dock min heights   dock max heightgffffff?i  N(7   R  R   R  R  R  t   ranget   DEFAULT_LAYOUTSR   R   R   R   R   R   R   R   R   R   R   R   R  R  R  Ry   RR  t   toggle_viewRo  R  Rm  Rn  t   lent   splitDockWidgetR   t
   Horizontalt   VerticalR  t   showRp  t   closet   _layout_widget_infoR0  R  R  R  t   minimumHeightt   maximumHeightt   intt   setMinimumHeightt   setMaximumHeightR   t   _custom_layout_timerR$  R%  t   layout_fix_timert   setSingleShotR'  (3   RC  R`  R  t   MATLABt   RSTUDIOt   VERTICALt
   HORIZONTALR   t   console_ipyt   console_intt   outlinet   explorer_projectt   explorer_filet   explorer_variablet   historyt   findert   help_plugint   helperR  t   global_hidden_widgetst   global_hidden_toolbarst   s_layoutt   r_layoutt   m_layoutt   v_layoutt   h_layoutt   layoutst   layoutt   widgets_layoutR  t   columnt   rowRw  Rm  R  R  R  t	   first_rowt
   second_rowt   hidden_toolbarsRV  t   hidden_widgetsR  R  t   ct   rRm  t
   dock_min_ht
   dock_max_ht   infot
   new_height(    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    s&   																




	

		
		
		


			






	
		

 c         C  s   |  j  } x | D] } | d j } d | k rT | j | d  | j | d  n  d | k r | j | d  | j | d  n  | j   q W|  j t  d S(   s4   Fixes the height of docks after a new layout is set.Rw  s   dock min widths   dock max widths   dock min heights   dock max heightN(	   R  Rm  t   setMinimumWidtht   setMaximumWidthR  R  t   updateGeometryR  R   (   RC  R  R  Rm  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    s    	c         C  s   |  j  d  d S(   Rb  t   previousN(   t   toggle_layout(   RC  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    s    c         C  s   |  j  d  d S(   Rb  t   nextN(   R  (   RC  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    s    R  c         C  s  t  j } | d d  } | d d  } | d d  } t |  d k rL d Sd g } x3 | D]+ } | | k r\ | j | j |   q\ q\ W|  j } i d d	 6d
 d 6}	 | d k r d } n  | | k r | j |  }
 n d }
 |
 |	 | t |  } |  j | |  d S(   Rb  R  R  R  R  i    NR  i   R  iR  (   R&   R"  R  RR  R`  R3  Ry   t   quick_layout_switch(   RC  t	   directionR"  R  R  R  t   layout_indexRc   t   current_layoutt   dict   current_indext	   new_index(    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    s&    				c   
        s  t  j } | d d  } | d d  } | d d  } g  } t   t d  d   f d   g } x` | D]X } | | k rj | j |  } |   d  } t   | d |   }	 | |	 g 7} qj qj Wt   t d	  d   f d
   d t j   _ t   t d  d   f d   d t j   _ t   t d  d   j	   _
   j   j d d	    j   j d d  | d g 7} |   j   j   j
 g 7}   j j   t   j |  t |  d k r  j j t  n   j j t  d S(   Rb  R  R  R  R  s   Spyder Default LayoutR[  c             s     j  d  S(   NR  (   R  (    (   RC  (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    s    c           s      f d   S(   Nc             s    j     S(   N(   R  (    (   R  RC  (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    R   (    (   R  RC  (    (   R  RC  s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    s    s   Save current layoutc             s
     j    S(   N(   t   quick_layout_save(    (   RC  (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    s    R\  s   Layout preferencesc             s
     j    S(   N(   t   quick_layout_settings(    (   RC  (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    s    s   Reset to spyder defaultR-   i    N(   R&   R"  RU   R-   R`  R   R  t   ql_savet   ql_preferencest   reset_window_layoutt   ql_resetRi  Ry   R  t   clearRV   R  t
   setEnabledR  R   (
   RC  R"  R  R  R  t
   ql_actionsRc   R`  R  t   qli_act(    (   RC  s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    s<    	c         C  sT   t  j |  t d  t d  t  j t  j B } | t  j k rP |  j d t  n  d S(   s   Reset window layout to defaultt   Warnings}   Window layout will be reset to default settings: this affects window position, size and dockwidgets.
Do you want to continue?R  N(   R   RA  R-   t   Yest   NoR  R   (   RC  t   answer(    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    s
    	c   
      C  s  t  j } t  j } | d d  } | d d  } | d d  } |  j |  |  } | j   r| j j   } | | k r t j |  t	 d  t	 d  | t j
 t j B } | j |  }	 nT t } d	 | k r | j d	  }	 | | |	 <n t |  }	 | j |  | j |  | | k r,| j |  n  | r|  j d j |	  d d | d d |  | d d |  | d d |  |  j   qn  d	 S(
   s   Save layout dialogR  R  R  R  R  s   Layout <b>%s</b> will be                                                overwritten. Do you want to                                                continue?s
   layout_{}/R  N(   R&   R"  R  R   t   exec_t	   combo_boxt   currentTextR   RA  R-   R  R  R`  R   Ry   R  RR  R  R~  R  (
   RC  R"  t   set_R  R  R  t   dlgRc   R  R`  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    s<    		
c         C  s   t  j } t  j } d } | | d  } | | d  } | | d  } |  j |  | | |  } | j   r | | d | j  | | d | j  | | d | j  |  j   n  d S(   s   Layout settings dialogR  R  R  R  N(	   R&   R"  R  R   R  R  R  R  R  (   RC  R"  R  R  R  R  R  R  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR  =  s    		c         C  s+  d } y |  j  d j |  d | } | \ } } } } } }	 | d k r | d k r | |  j k r t j |  t d  t d   d S|  j | |  n  Wn> t j	 k
 r t j |  t d  t d  t
 |   d SX|  j |   | |  _ x0 |  j D]% }
 |
 j } | j |
 j j    q Wd S(	   s%   Switch to quick layout number *index*R  s
   layout_{}/R  R  R  s   Error opening the custom layout.  Please close Spyder and try again.  If the issue persists, then you must use 'Reset to Spyder default' from the layout menu.Ns1   Quick switch layout #%s has not yet been defined.(   R  R~  Ry   R  R   R  R-   R  t   cpt   NoOptionErrorR   R  R3  R*  Ro  R  Rm  Rn  (   RC  R`  R  R  R  R0  R   R  R  R  RP  Rm  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR  O  s,    				c         C  s`   |  j  r$ t d  } t d  } n t d  } t d  } |  j j |  |  j j |  d S(   s,   Update the text displayed in the menu entry.s   Hide toolbarss   Show toolbarsN(   RZ  R-   R   t   setTextt
   setToolTip(   RC  RZ  R_  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   _update_show_toolbars_actionz  s    	c         C  sD   g  } x$ |  j  D] } | j | j    q Wt j d d |  d S(   s8   Saves the name of the visible toolbars in the .ini file.R(   t   last_visible_toolbarsN(   R  RR  R   R&   R  (   RC  t   toolbarsRV  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   save_visible_toolbars  s    c         C  sI   g  } x3 |  j  D]( } | j   j   r | j |  q q W| |  _ d S(   s   Collects the visible toolbars.N(   R  t   toggleViewActiont	   isCheckedRR  R  (   RC  R  RV  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   get_visible_toolbars  s
    c         C  s   t  j d d d g  } | r i  } x! |  j D] } | | | j   <q. Wg  } x. | D]& } | | k rU | j | |  qU qU W| |  _ n
 |  j   |  j   d S(   s3   Loads the last visible toolbars from the .ini file.R(   R  R  N(   R&   R"  R  R   RR  R  R!  R  (   RC  t   toolbars_namesR  RV  R  Rc   (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyRk    s    
c         C  s   |  j  } t j d d |  | r0 |  j   n
 |  j   x1 |  j D]& } | j   j |  | j |  qD W| |  _  |  j	   d S(   s   Show/Hides toolbars.R(   RZ  N(
   RZ  R&   R  R  R!  R  R  R  t
   setVisibleR  (   RC  t   valueRV  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    s    

	c         C  s   y |  j  j   } Wn t k
 r' d SXt |  r |  j  j |  s | rw t j |  t d  t d  j |   n  |  j  j	   q n  d S(   s!   Handle an invalid active project.NR  sw   <b>{}</b> is no longer a valid Spyder project! Since it is the current active project, it will be closed automatically.(
   R   R}  R	  t   boolt   is_valid_projectR   R  R-   R~  t   close_project(   RC  Ro   (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    s    	c         C  s   t  j   d S(   s   Free memory after event.N(   t   gct   collect(   RC  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   free_memory  s    c         C  s   |  j    |  j   d S(   s,   Focus has changed from one plugin to anotherN(   R  R  (   RC  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   plugin_focus_changed  s    
c         C  s\   xU t  |  | d  D]@ } | r t | t  r | j d k	 rT | j | j  qT q q Wd S(   s   Show action shortcuts in menut   _menu_actionsN(   R  R  R   t   _shown_shortcutRy   t   setShortcut(   RC  t   menut   element(    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    s    c         C  s\   xU t  |  | d  D]@ } | r t | t  r | j d k	 rT | j t    qT q q Wd S(   s   Hide action shortcuts in menuR,  N(   R  R  R   R-  Ry   R.  R   (   RC  R/  R0  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    s    c         C  s   d d l  m } d d l m } t j   } d } t | | | f  r t | |  } | j   } | om | } | | | f } n  | | f S(   s   Get properties of focus widget
        Returns tuple (widget, properties) where properties is a tuple of
        booleans: (is_console, not_readonly, readwrite_editor)i(   t   TextEditBaseWidget(   t   ControlWidgetN(	   t   spyder.widgets.editorR1  t   spyder.widgets.ipythonconsoleR2  R   t   focusWidgetRy   R  t
   isReadOnly(   RC  R1  R2  Rw  t   textedit_propertiesR   t   not_readonlyt   readwrite_editor(    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   get_focus_widget_properties  s    c   	      C  sG  |  j    \ } } | d k r" d S| \ } } } | rR | rR |  j j   rR d Sx$ |  j j   D] } | j t  qb W|  j j t	  |  j
 j | o | j   j    |  j j | o | j   j    | j   } |  j j |  |  j j | o |  |  j j |  | rC| rCx$ |  j j D] } | j t	  q)Wn  d S(   s   Update edit menuN(   R:  Ry   R   t   is_file_openedR   t   actionsR  R  R   R   R   t   documentt   isUndoAvailableR   t   isRedoAvailablet   has_selected_textR   R   R   R   (	   RC  Rw  R7  R   R8  R9  RV  t   has_selectionRm  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    s(    c         C  s   x( |  j  j   d  D] } | j t  q W|  j   \ } } | d k rM d S| \ } } } | s x? |  j  j   D]+ } y | j t  Wqr t k
 r qr Xqr Wn  |  j d j |  d S(   s   Update search menuiNi   (	   R   R<  R  R  R:  Ry   R   t   RuntimeErrorR   (   RC  RV  Rw  R7  R   R8  R9  Rm  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    s    c         C  s"  d d d d d d  d d d d	 d  d
 d d d d  d d g } x |  j D] } | j } | j | j j    y | j } | j |  } Wn t k
 r d  } n X| d  k	 r | | | <qF | j	 |  qF W| } x0 | D]( } t
 |  t k r | j |  q q W| |  _ t |  j |  d  S(   NR   R   t   ipython_consolet   variable_explorerR   R   R  t   project_explorerR  R   t   profilert   breakpointst   pylintR   t   internal_console(   Ry   R*  Ro  R  Rm  Rn  t   CONF_SECTIONR`  t
   ValueErrorRR  t   typeR   t   removeR  RV   R  (   RC  R  RP  Rm  Rc   R  R<  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyRi  0  s,    		
	c      	   C  s   d d d d d d  d d d g	 } x| |  j D]q } | j   } | j   } y | j |  } Wn t k
 ru d  } n X| d  k	 r | | | <q+ | j |  q+ Wt |  j |  d  S(	   NR  R  R  R  s   Global working directoryR  R  R  (	   Ry   R  R  R   R`  RK  RR  RV   R  (   RC  R  RV  Rm  Rc   R  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyRj  I  s    		
c         C  s>   t  d |   } |  j d  d  |  j d g } t | |  | S(   NR   i   i(   R   R	  Ry   RV   (   RC  R/  R<  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   createPopupMenuZ  s
    
c         C  st   |  j  d k r d S| r) |  j |  n  |  j  j   |  j  j | t j t j Bt j Bt	 t j
   t j   d S(   s   Set splash messageN(   R)  Ry   R;   R  R  R   t   AlignBottomt   AlignCentert   AlignAbsoluteR   t   whiteR   t   processEvents(   RC  RN  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR  a  s    c         C  s*   |  j  t  r | j   n
 | j   d S(   s   closeEvent reimplementationN(   R  R   t   acceptt   ignore(   RC  t   event(    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt
   closeEventl  s    c         C  sM   |  j    r) |  j r) |  j   |  _ n  t j |  |  |  j j |  d S(   s   Reimplement Qt methodN(   R  R6  R  R0  R   t   resizeEventt   sig_resizedR  (   RC  RV  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyRX  s  s    c         C  sM   |  j    r) |  j r) |  j   |  _ n  t j |  |  |  j j |  d S(   s   Reimplement Qt methodN(   R  R6  R  R1  R   t	   moveEventt	   sig_movedR  (   RC  RV  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyRZ  |  s    c         C  sr   yJ x3 |  j  D]( } | j |  j  r | j t  q q Wt j |  |  Wn! t k
 rm t j |  |  n Xd S(   s   Reimplement Qt methodN(   R*  t   isAncestorOfR9  t   visibility_changedR   R   t	   hideEventRB  (   RC  RV  RP  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR^    s    c         C  se   | d k r@ t j   d k	 r@ t j   j   t j   |  _ n | d k	 rX | |  _ n  | |  _ d S(   s+   To keep track of to the last focused widgetN(   Ry   R   t   activeWindowt   setFocusR5  R9  R:  (   RC  t   oldt   now(    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   change_last_focused_widget  s    c         C  s!  |  j  s |  j r t S| re t j d d  re t j |  d d t j t j  } | t j k re t	 Sn  d } |  j
 |  t j d d  r |  j r |  j j   n  x$ |  j D] } | j |  s t	 Sq Wx$ |  j D] } | j |  s t	 Sq W|  j j   |  j r|  j   n  t |  _  t S(	   s
   Exit tasksR(   t   prompt_on_exitR   s   Do you really want to exit?R  R  RX  s   window/(   R+  R,  R   R&   R"  R   R  R  R  R  R  R?  R  R   t   closing_pluginR*  R   t	   close_allRZ  R  (   RC  t
   cancelablet   replyRg   RP  Rw  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    s.    		c         C  se   | j    \ } } t j d d  rA | j | j   t j B n  |  j | |  |  j j	 |  d S(   s$   Add QDockWidget and toggleViewActionR(   t   vertical_dockwidget_titlebarsN(
   t   create_dockwidgetR&   R"  t   setFeaturest   featuresR   t   DockWidgetVerticalTitleBart   addDockWidgetR*  RR  (   RC  RV  Rm  t   location(    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   add_dockwidget  s    c         C  sD   t  j   } x1 |  j D]& } | j |  r | j j   Pq q Wd  S(   N(   R   R5  R*  R\  Rm  R  (   RC  Rw  RP  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    s
    c         C  s*   | |  _  |  j   t j d d |  d S(   s   Lock/Unlock dockwidgetsR(   R   N(   R.  Rl  R&   R  (   RC  R$  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    s    	
c         C  s   |  j  d  k r9 t d  } t d  } t j d  } n' t d  } t d  } t j d  } |  j j |  |  j j |  |  j j |  d  S(   Ns   Maximize current panet   maximizes   Restore current panes!   Restore pane to its original sizet
   unmaximize(	   R2  Ry   R-   R  RX  R   R  t   setIconR  (   RC  RZ  R_  RX  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   __update_maximize_action  s    c         C  s  |  j  d k r!| r d S|  j   |  _  t j   } x9 |  j D]. } | j j   | j |  r> | |  _	 q> q> W|  j	 d k r |  j
 |  _	 n  |  j	 j j   j t  |  j |  j	  t |  j	 _ |  j	 j   |  j	 j t  |  j	 |  j
 k r|  j t j |  j j  |  j j j   qnt |  j	 j j |  j	  |  j	 j j   j t  |  j d  t |  j	 _ |  j |  j   d |  _  |  j	 j   j   |  j   d S(   s   Shortcut: Ctrl+Alt+Shift+M
        First call: maximize current dockwidget
        Second call (or restore=True): restore original window layoutN(   R2  Ry   R  R   R5  R*  Rm  R  R\  R5  R   R  t   setDisabledR   t   setCentralWidgett   ismaximizedR  R]  Rn  R   t   RightDockWidgetAreaR   t	   setWidgetR  R  R  t   get_focus_widgetR`  R  (   RC  R  t   focus_widgetRP  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    s8    	c         C  sY   |  j  r t j d  } n t j d  } t |  rE t |  } n  |  j j |  d  S(   Nt   window_nofullscreent   window_fullscreen(   R6  R  RX  RF   RW   R   Rs  (   RC  RX  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   __update_fullscreen_action	  s    	c         C  sD  |  j  rx t |  _  t j d k rU |  j |  j   t j t j BA |  j	 |  j
  n  |  j   |  j r6|  j   q6n |  j   |  _ t |  _  |  j   |  _
 t j d k r,|  j |  j   t j Bt j B t j   j   } |  j	 | j   d | j   d | j   d | j   d  |  j   n
 |  j   |  j   d  S(   NR   i   i   (   R6  R  Rb   Rc   t   setWindowFlagst   windowFlagsR   t   FramelessWindowHintt   WindowStaysOnTopHintt   setGeometryR8  t
   showNormalR7  t   showMaximizedR  R   t   normalGeometryR   Ru   t   screenGeometryt   leftt   topR  R  t   showFullScreenR  (   RC  R  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR  	  s,    			
		8
c         C  s)   | j  } | d k	 r% t | |  n  d S(   s   Add widget actions to toolbarN(   t   toolbar_actionsRy   RV   (   RC  RV  Rw  R<  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   add_to_toolbar5	  s    	c         C  s.  t    } d } | d r6 | d } d | | f } n  t |   } | j d j d | d d | d t d t d	 t d
 t d | d d | d d | d d | d d | d d | d d | d   | j t	 d  d  | j
 t j  | j t j t d d    | j t j t j B | j   d S(   s4   Create About Spyder dialog with general information.R   t   revisionsJ    (<a href='https://github.com/spyder-ide/spyder/commit/%s'>Commit: %s</a>)st
  
            <b>Spyder {spyder_ver}</b> {revision}
            <br>The Scientific Python Development Environment |
            <a href="{website_url}">Spyder-IDE.org</a>
            <br>Copyright &copy; 2009-2019 Spyder Project Contributors and
            <a href="{github_url}/blob/master/AUTHORS.txt">others</a>
            <br>Distributed under the terms of the
            <a href="{github_url}/blob/master/LICENSE.txt">MIT License</a>.

            <p>Created by Pierre Raybaut; current maintainer is Carlos Cordoba.
            <br>Developed by the
            <a href="{github_url}/graphs/contributors">international
            Spyder community</a>.
            <br>Many thanks to all the Spyder beta testers and dedicated users.

            <p>For help with Spyder errors and crashes, please read our
            <a href="{trouble_url}">Troubleshooting Guide</a>, and for bug
            reports and feature requests, visit our
            <a href="{github_url}">Github site</a>.
            For project discussion, see our
            <a href="{forum_url}">Google Group</a>.
            <p>This project is part of a larger effort to promote and
            facilitate the use of Python for scientific and engineering
            software development.
            The popular Python distributions
            <a href="https://www.anaconda.com/download/">Anaconda</a> and
            <a href="https://winpython.github.io/">WinPython</a>
            also contribute to this plan.

            <p>Python {python_ver} {bitness}-bit | Qt {qt_ver} |
            {qt_api} {qt_api_ver} | {os_name} {os_ver}

            <small><p>Certain source files under other compatible permissive
            licenses and/or originally by other authors.
            Spyder 3 theme icons derived from
            <a href="https://fontawesome.com/">Font Awesome</a> 4.7
            (&copy; 2016 David Gandy; SIL OFL 1.1).
            Most Spyder 2 theme icons sourced from the
            <a href="https://www.everaldo.com">Crystal Project iconset</a>
            (&copy; 2006-2007 Everaldo Coelho; LGPL 2.1+).
            Other icons from
            <a href="http://p.yusukekamiyamane.com/">Yusuke Kamiyamane</a>
            (&copy; 2013 Yusuke Kamiyamane; CC-BY 3.0),
            the <a href="http://www.famfamfam.com/lab/icons/silk/">FamFamFam
            Silk icon set</a> 1.3 (&copy; 2006 Mark James; CC-BY 2.5), and
            the <a href="https://www.kde.org/">KDE Oxygen icons</a>
            (&copy; 2007 KDE Artists; LGPL 3.0+).</small>

            <p>See the <a href="{github_url}/blob/master/NOTICE.txt">NOTICE</a>
            file for full legal information.
            t
   spyder_verR   t   website_urlt
   github_urlt   trouble_urlt	   forum_urlt
   python_vert   pythont   bitnesst   qt_vert   qtt   qt_apit
   qt_api_vert   os_namet   systemt   os_vert   releases   About %sR   i@   N(   R6   R   R  R~  R5   R1   R3   R2   R  R-   t   setStandardButtonsR  t   setIconPixmapt   APP_ICONt   pixmapR   t   setTextInteractionFlagsR   t   LinksAccessibleByMouset   TextSelectableByMouseR  (   RC  t   versionst   revlinkt   revt   msgBox(    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR  ;	  s8    	

3	






c         C  s:   d d l  m } | d  } | j t j  | j   d S(   s%   Show Spyder's Dependencies dialog boxi(   t   DependenciesDialogN(   t   spyder.widgets.dependenciesR  Ry   t   set_dataRE   t   DEPENDENCIESR  (   RC  R  R  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR  	  s    R   c         C  s   t    } d } | d r& | d } n  | s5 d } n  | rM d j |  } n d } d j d | d | d | d	 d
 | d | d d | d d | d d | d d | d d | d d t j    } | S(   s(   Render issue before sending it to GithubR   R  s%   ### What steps reproduce the problem?s(   ### Traceback
```python-traceback
{}
```s&  ## Description

{description}

{error_section}

## Versions

* Spyder version: {spyder_version} {commit}
* Python version: {python_version}
* Qt version: {qt_version}
* {qt_api_name} version: {qt_api_version}
* Operating System: {os_name} {os_version}

### Dependencies

```
{dependencies}
```
t   descriptiont   error_sectiont   spyder_versionR   t   committ   python_versionR  t
   qt_versionR  t   qt_api_nameR  t   qt_api_versionR  R  R  t
   os_versionR  RE   (   R6   R~  RE   R"  (   RC  R  R  R  R  R  t   issue_template(    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   render_issue	  s,    	
	






c   
      C  s   | d	 k r; d d l m } | |  d t } | j   n | r t rZ d d l m } n d d l m } d d l	 m
 } t t d  } |   }	 |	 j d | |   | r |	 j d | |   n  | j |	  t j |  n  d	 S(
   s@   Report a Spyder issue to github, generating body text if needed.i(   t   SpyderErrorDialogt	   is_report(   t   quote(   t	   QUrlQuerys   /issues/newt   bodyRS  N(   Ry   t   spyder.widgets.reporterrorR  R   R  RH   t   urllib.parseR  t   urllibt   qtpy.QtCoreR  R   R1   t   addQueryItemt   setQueryR   t   openUrl(
   RC  R  RS  t   open_webpageR  t
   report_dlgR  R  t   urlt   query(    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR  	  s     	c         C  s   t  t  } t j |  d S(   s3   Open Spyder troubleshooting guide in a web browser.N(   R   R3   R   R  (   RC  R  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR  	  s    c         C  s   t  t  } t j |  d S(   s*   Open Spyder Google Group in a web browser.N(   R   R2   R   R  (   RC  R  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR  	  s    c         C  s}   t  j   } |  j   } t | j   t  } d d l m } d d l m	 } t
 | | | f  ru t | |    n d Sd S(   s   Global callbacki(   R1  (   R2  N(   R   R5  t   senderR   Rc  RG   R3  R1  R4  R2  R  R  (   RC  Rw  Rm  t   callbackR1  R2  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyRg  	  s    c         C  s3   | r |  j  j j j   n |  j  j j j   d  S(   N(   R   t   shellt   interpretert   redirect_stdst   restore_stds(   RC  R  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   redirect_internalshell_stdio 
  s    c
         C  s   | r yS t  j d d  r' t   }
 n t  j d d  }
 t j | | | | | | |
  Wq t k
 r t j |  t d  t d  t	 j
  q Xn  d S(   s   Open external consolet   main_interpreterR  t
   executablet   RunsD   Running an external system terminal is not supported on platform %s.N(   R&   R"  RR   RL   t   run_python_script_in_terminalt   NotImplementedErrorR   R  R-   Rb   Rc   (   RC  t   fnamet   wdirR+  t   interactR  R  t   python_argst   systermt   post_mortemR  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   open_external_console
  s    	c         C  s:   |  j  } | j   | j |  | r6 |  j j   n  d S(   sb   
        Execute lines in IPython console and eventually set focus
        to the Editor.
        N(   R   t   switch_to_plugint   execute_codeR   (   RC  t   linest   focus_to_editorR   (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   execute_in_external_console
  s
    	
c         C  s   t  |  } t j |  d } t j |  rA |  j j |  nP |  j d k	 ro | t	 k ro |  j j
 |  n" | s t |  } t j |  n  d S(   s   
        Open filename with the appropriate application
        Redirect to the right widget (txt -> editor, spydata -> workspace, ...)
        or open file outside Spyder (if extension is not supported)
        i   N(   RG   Rd   R  RK   t   is_text_fileR   t   loadR   Ry   RB   t   import_dataR]   RL   R  (   RC  R  t   externalt   ext(    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt	   open_file$
  s    c         C  su   t  j |  } t j |  r4 |  j | d t n= t j t j t |   rq |  j t j t |  d t n  d S(   s~   
        Open external files that can be handled either by the Editor or the
        variable explorer inside Spyder.
        R  N(   RK   t   to_unicode_from_fsRd   Rm   R  R   Re   t   CWD(   RC  R  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyRh  4
  s
    c         C  s6   g  |  j  D] } | |  j k r
 | ^ q
 } | |  j S(   s   Return Spyder PYTHONPATH(   Ro   R   R   (   RC  t   pt   active_path(    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   get_spyder_pythonpath@
  s    +c         C  s4   x- t  |  j    D] } t j j d |  q Wd S(   s   Add Spyder path to sys.pathi   N(   t   reversedR  Rf   Ro   R  (   RC  Ro   (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR   E
  s    c         C  sE   x> |  j  |  j D], } x# | t j  k r< t j  j |  q Wq Wd S(   s    Remove Spyder path from sys.pathN(   Ro   R   Rf   RM  (   RC  Ro   (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR   J
  s    c         C  s   d d l  m } |  j   |  j j   } | |  |  j | |  j d t } | j j	 |  j
  | j   |  j   y0 t j |  j |  j  t j |  j |  j  Wn t k
 r n X|  j j   d S(   s   Spyder path manageri(   t   PathManagert   syncN(   t   spyder.widgets.pathmanagerR  R   R   R  Ro   R   R   t   redirect_stdioR%  R  R  R   RK   t
   writelinesR   R   t   EnvironmentErrort   sig_pythonpath_changedR  (   RC  R  R   t   dialog(    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR  P
  s    


c         C  s7   |  j    |  j j   |  _ |  j   |  j j   d S(   s,   Projects PYTHONPATH contribution has changedN(   R   R   R  R   R   R  R  (   RC  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   pythonpath_changedc
  s    

c         C  s   |  j  j t |    d S(   s/   Show Windows current user environment variablesN(   R   R  RT   (   RC  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR  j
  s    c         C  sH  t  j   } t   rE d t j   k rE y | j d  Wq q XnS t j d d |  j  } t j	 |  } | d
 k	 r | j d |  | j |  n  |  j } t j d d  r | t j B} n  t j d d  r | t j B} n  |  j |  |  j   |  j   t j d d  r4| j t j d d	   n | j |  j  d
 S(   s2   Apply settings changed in 'Preferences' dialog boxs   GTK+s   gtk+R(   t   windows_styleRc   t   vertical_tabst   animated_dockst   use_custom_cursor_blinkingt   custom_cursor_blinkingN(   R   R   RC   R    t   keyst   setStyleR&   R"  R   t   createRy   t   setPropertyt   DOCKOPTIONSR   t   VerticalTabst   AnimatedDockst   setDockOptionsRl  R  t   setCursorFlashTimet   CURSORBLINK_OSDEFAULT(   RC  RE  t
   style_nameR   R  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyRB  p
  s.    	

c         C  sv   xo |  j  D]d } | j } t j d d  r; | t j B} n  |  j sT | t j B} n  | j j	 |  | j
   q
 Wd S(   s$   Update dockwidgets features settingsR(   Ri  N(   R*  t   FEATURESR&   R"  R   Rm  R.  t   DockWidgetMovableRm  Rk  t   update_margins(   RC  RV  Rl  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyRl  
  s    		c         C  s   t  j d d  } |  j   j |  | r x| |  j d f |  j d f f D]U \ } } | d k	 rJ | j t  j d d |   | j t  j d d |   qJ qJ Wn d Sd S(   s"   Update status bar widgets settingsR(   t   show_status_bart   memory_usaget	   cpu_usages	   %s/enables
   %s/timeoutN(   R&   R"  R  R#  R
  R  Ry   t   set_interval(   RC  R  Rw  Rc   (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR  
  s    'c      
   C  s  d d l  m } | |   } | j j |  j  |  j d k	 rQ | j |  j  n  x: |  j D]/ } | | d |  } | j	   | j
 |  q[ Wx |  j |  j |  j |  j |  j |  j |  j |  j |  j |  j g
 |  j D]k } | d k	 r y/ | j |  } | d k	 r| j
 |  n  WqCt k
 r?t j d t j  qCXq q W|  j d k	 ri| j |  j  n  | j   | j   | j  j! j |  j"  | j#   d S(   s   Edit Spyder preferencesi(   t   ConfigDialogR(   R  N($   R   R  t   size_changeR%  t   set_prefs_sizeR   Ry   R  R   t
   initializet   add_pageR   R   R   R   R   R   R   R   R   R   R   t   create_configwidgetR
  R  R  Rf   t   stderrR   t   set_current_indexR  t   check_all_settingst   pages_widgett   currentChangedt$   _MainWindow__preference_page_changedR  (   RC  R  R  t   PrefPageClassRw  RP  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR  
  s6    


c         C  s   | |  _  d S(   s!   Preference page index has changedN(   R   (   RC  R`  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   __preference_page_changed
  s    c         C  s   | |  _  d S(   s   Save preferences dialog sizeN(   R   (   RC  R  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR  
  s    c         C  s    |  j  j | | | | f  d S(   sz   
        Register QAction or QShortcut to Spyder main application,
        with shortcut (context, name, default)
        N(   R   RR  (   RC  t   qaction_or_qshortcutR\  Rc   Ra  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyRi  
  s    c         C  s  g  } x t  |  j  D] \ } \ } } } } t t | |   } y t | t  r t j d k r | j d k r | | _ n | j	 |  | r t
 | | |  q n t | t  r | j |  n  Wq t k
 r | j |  q Xq Wx* t | d t D] } |  j j |  q Wd S(   s/   Apply shortcuts settings to all widgets/pluginsR   t   missingt   reverseN(   R  R   R   R^   R  R   Rf   R   R-  R.  RX   R   t   setKeyRB  RR  t   sortedR   t   pop(   RC  t   toberemovedR`  t   qobjectR\  Rc   Ra  t   keyseq(    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR  
  s$    %c         C  s*   d d l  m } | d   } | j   d  S(   Ni(   t   ShortcutsSummaryDialog(   t   spyder.widgets.shortcutssummaryR#  Ry   R  (   RC  R#  R  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR  
  s    c         C  sZ  |  j  j t j t j d  t d t  } t j d d |  |  j  j	 d | f  |  j  j
 d  x y |  j  j   \ } } Wn t j k
 r} t j d k r t j n t j } | j d | k r qg n  t j d k r t j n t j } | j d t j | g k rd  S  n X| j d	  } | j d
  } |  j j |  | j d  qg Wd  S(   Ni   t   default_portR(   t   open_files_ports	   127.0.0.1i   R   i    i   s   utf-8Rb  (   R?  t
   setsockoptR;  t
   SOL_SOCKETt   SO_REUSEADDRRP   RA   R&   R  t   bindt   listenRT  RR  Rb   Rc   t   errnot   WSAEINTRt   EINTRR+  t   WSAENOTSOCKt   ENOTSOCKt   ECONNABORTEDt   recvt   decodeRg  R  t   sendall(   RC  t   portt   reqt   dummyRM  t   eintrt   enotsockR  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyRe  
  s,    !	c         C  sT   t  j |  t d  t d  t  j t  j B } | t  j k rP |  j d t  n  d S(   sE   
        Quit and reset Spyder and then Restart application.
        R  sS   Spyder will restart and reset to default settings: <br><br>Do you want to continue?R  N(   R   RA  R-   R  R  R  R   (   RC  R  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    s
    	c         C  s  t  d  } t j | d d  } t j j   } | j d d  } | j d  } t j   } t	 j
 } | d k	 r | } t }	 n t }	 | | d <t |  | d <t |	  | d <t |  | d <t rt j d	 k r d
 j t	 j  | d <qd j t	 j  | d <n  t j d	 k r>t j   }
 |
 j t j O_ t } n d }
 t } d } | j | |  } yB |  j t  rt j | d | d | d |
 |  j j   n  Wn' t k
 r} t |  t |  n Xd S(   ss   
        Quit and Restart Spyder application.

        If reset True it allows to reset spyder on restart.
        R   R   s
   restart.pyt   SPYDER_BOOTSTRAP_ARGSt   SPYDER_ARGSt
   SPYDER_PIDt   SPYDER_IS_BOOTSTRAPt   SPYDER_RESETR   t   ;t
   PYTHONPATHt   :s   "{0}" "{1}"R  t   envt   startupinfoN(   R?   Rd   Re   Rb   R!  t   copyR  Ry   t   getpidRf   R  R   R  R   R.   Rc   Ro   Ra  t   STARTUPINFOt   dwFlagst   STARTF_USESHOWWINDOWR~  R  t   PopenR   R   R
  R  (   RC  R  t   spyder_start_directoryt   restart_scriptRB  t   bootstrap_argst   spyder_argst   pidR  t   is_bootstrapRC  R  t   commandRR  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR  #  sF    		
	
c         C  sD   |  j  d t  |  j | } |  j j | | |   |  j j   d S(   s   Show interactive tour.R  N(   R  R   R   R`   t   set_tourt
   start_tour(   RC  R`  t   frames(    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR  d  s    c         C  s   |  j  d k	 r8 |  j  j r8 |  j  j   t |  j  _ d S| r` |  j |  j  _ |  j  j d  n |  j  j d  |  j  j   t	 |  j  _ d S(   s%   Open file list management dialog box.Nt   @R   (
   R   Ry   t
   is_visibleR  R  R   RP  t   set_search_textR  R   (   RC  t   symbol(    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR  l  s    c         C  s   |  j  d t  d S(   s'   Open symbol list management dialog box.RW  N(   R  R   (   RC  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR  {  s    c         C  sf   |  j  d k r- t |  | | | |  |  _  n |  j  j | | | |  |  j  j j | j   j  d S(   s"   Add a plugin to the File Switcher.N(   R   Ry   RS   t
   add_plugint   sig_goto_fileR%  t   get_current_tab_managert   set_stack_index(   RC  RP  t   tabsRc  RX  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   add_to_fileswitcher  s
    c         C  s#  d d l  m } |  j } |  j j } |  j j } |  j j } t d } d } | d t j	 d |   } | j
 t d   | j t d   | j t j  | j t j  d \ }	 }
 t j |	 |
  } | j |  | d k	 r| } | j |  | j t  | j   | j   } n | rd } d t j k sEd t j k rTt d  } n  t d  | | | f } | d | 7} | j |  | j t  | j   | j   } nE | rt d  } | j |  | j t  | j   | j   } n  t j |	 |
 |  |  j j t  t |  _ d S(   s"   Called by WorkerUpdates when readyi(   t   MessageCheckBoxs	   /releasess-   https://docs.spyder-ide.org/installation.htmlRX  t   parents   Spyder updatess   Check for updates on startupR(   R[  R   t   Anacondas   conda-forges;  <hr><b>IMPORTANT NOTE:</b> It seems that you are using Spyder with <b>Anaconda/Miniconda</b>. Please <b>don't</b> use <code>pip</code> to update it as that will probably break your installation.<br><br>Instead, please wait until new conda packages are available and use <code>conda</code> to perform the update.<hr>s  <b>Spyder %s is available!</b> <br><br>Please use your package manager to update Spyder or go to our <a href="%s">Releases</a> page to download this new version. <br><br>If you are not sure how to proceed to update Spyder please refer to our  <a href="%s">Installation</a> instructions.s   <br>s   Spyder is up to date.N(   R(   R[  (   t   spyder.widgets.helperwidgetsR^  R   R   t   update_availablet   latest_releaseRR  R1   R   t   InformationR  R-   t   set_checkbox_textR  R  t   setDefaultButtonR&   R"  t   set_checkedRy   R  t   set_check_visibleR  R  t
   is_checkedRf   t   versionR   R  R   Ru  (   RC  R^  t   feedbackRb  Rc  t	   error_msgt   url_rt   url_it   boxR  R   R  t   msgt   anaconda_msg(    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   _check_updates_ready  sT    	
	

	

c         C  s   d d l  m } |  j j t  |  j d k	 r? |  j j   n  t |   |  _ | |  d | |  _	 |  j	 j
 j |  j  |  j	 j
 j |  j j  |  j	 j |  j  |  j j j |  j	 j  |  j j   d S(   sN   
        Check for spyder updates on github releases using a QThread.
        i(   t   WorkerUpdatesR\  N(   t   spyder.workers.updatesRs  R   Ru  R   R   Ry   t	   terminateR   R   t	   sig_readyR%  Rr  R   t   moveToThreadt   startedR'  (   RC  R\  Rs  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    s    c         C  sX   | d k r t  j t j  S| d k r8 t  j t j  S| d k rT t  j t j  Sd S(   s,   Get the current OpenGL implementation in useRt   Ru   Rv   N(   R
   t   testAttributeR   Rx   R|   R~   (   RC  R   (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   _test_setting_opengl  s    (w   t   __name__t
   __module__t   __doc__R   t   AllowTabbedDockst   AllowNestedDocksR  R   t   cursorFlashTimeR  R7   R   R   R-   R  R  R   R]  R  R  R   Rg  RY  R[  Ry   R   R;   RW  RW  R|  R   Rv  R  R  R  R  R  R  R  R  R  R   R  R  R  R  R  R  R  R  R  R  R!  Rk  R  R  R*  R+  R  R  R:  R  R  Ri  Rj  RN  R  RW  RX  RZ  R^  Rc  R  Rp  R  R  R  R%  R  R  R  R  R  R  R  R  R  R  Rg  R  R  R  R  Rh  R  R   R   R  R  R  RB  Rl  R  R  R  R  Ri  R  R  Re  R  R  R  R  R  R]  Rr  R  Rz  (    (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR      s   			 		  |	T				%	1			4	+		+											%											
	
					3		 	T8								!						@				Nc            s   t        j t  d t f   f d     Y}  d d l m } |  | _ g  d  } | t _ t r{ d   } | t _	 n  d g t _
 y d d l m } d	 | _ Wn t k
 r n X  S(
   s>   Initialize Qt, patching sys.exit and eventually setting up ETSt   FakeQApplicationc             s,   e  Z d  Z   f d   Z e d    Z RS(   s   Spyder's fake QApplicationc           s
     }  d  S(   N(    (   RC  R+  (   R   (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR     s    c           S  s   d S(   s5   Do nothing because the Qt mainloop is already runningN(    (    (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR  
  s    (   R{  R|  R}  R   t   staticmethodR  (    (   R   (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    s   i(   t	   QtWidgetsc         S  s   d  S(   N(    (   t   arg(    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   fake_sys_exit  s    c         S  s   t  j |  | |  d  S(   N(   Rf   t   __excepthook__(   t   type_R$  t   tback(    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   spy_excepthook  s    R   (   t	   ETSConfigt   qt4(   R*   t   setWindowIconR  R   t   qtpyR  Rf   R  R   t
   excepthookt   argvt   enthought.etsconfig.apiR  t   toolkitR   (   R  R  R  R  R  (    (   R   s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR    s"    				t   Spyc           B  s)   e  Z d  Z d   Z d   Z d   Z RS(   s   
    Inspect Spyder internals

    Attributes:
        app       Reference to main QApplication object
        window    Reference to spyder.MainWindow widget
    c         C  s   | |  _  | |  _ d  S(   N(   R   R  (   RC  R   R  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR   1  s    	c         C  sC   t  |  j j    g  t |  j  D] } | d d k r" | ^ q" S(   Ni    R-   (   t   listt   __dict__R  t   dirt	   __class__(   RC  R  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   __dir__4  s    c         C  s   t    S(   N(   R6   (   RC  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR  7  s    (   R{  R|  R}  R   R  R  (    (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR  )  s   		c         C  sH  t  |  } y | j   WnN t k
 rj | j d k	 rd y | j j j   Wqd t k
 r` qd Xn    n X| j   | j   | j r t	 d |  d |  | j j j
 j d <n  | r x | D] } | j |  q Wn  t j d k r t j t j t  n  t   r|  j j | j  n  |  j j | j  t   sD|  j   n  | S(   sP   
    Create and show Spyder's main window
    Start QApplication event loop
    R   R  t   spyR   N(   R   RW  t   BaseExceptionR   Ry   R  t   exit_interpreterR  R|  R  R  R!  Rh  Rf   R   R
   Rw   R   t   AA_DontShowIconsInMenusR   R>   Rg  R%  t   focusChangedRc  R/   R  (   R   RD  R+  R(   t   a(    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt
   run_spyder;  s2    

	(		c    
   	   C  sr  t    r y d d l m }  Wn! t k
 r@ d d l m }  n X|    } d | _ t | _ t | _	 t | _
 d | _ d | _ d | _ t j d d  d k r t j d d  } t |  n  t   } t | | d  } | St   \ } } | j r| j } t |  n7 t j d d  d k rDt j d d  } t |  n  | j rZt d  n  t d k	 rt | j p| j p| j p| j pt t   n  t   } | j rt   d S| j rt j d t  d S| j rd d l } t j  d	 d
 d | j! d g d d g  d St j d d t  rt" rt j# d d t  t$ d k	 rbt$ j%   n  t& j' d d d t(   t) t* t+ t* f  n  d } y t | | |  } Wn t, k
 r} t& j' d d d  t j# d d d  nY t- k
 r=t j# d d t  d d l. }	 |	 j/ d t0  |	 j/ d t1 d d   n X| d k rgt$ d k	 rct$ j%   n  d St2   d S(   s   Main functioni(   t   MockR(   t   openglt	   automatics   (Deprecated) --show console does nothing, now the default  behavior is to show the console, use --hide-console if you want to hide itNt   savet   modulet
   compileallR+  i    t   p_argss   -Ot   crashR   sH  Spyder crashed during last session.<br><br>If Spyder does not start at all and <u>before submitting a bug report</u>, please try to reset settings to defaults by running Spyder with the command line option '--reset':<br><span style='color: #555555'><b>spyder --reset</b></span><br><br><span style='color: #ff5555'><b>Warning:</b></span> this command will remove all your Spyder configuration files located in '%s').<br><br>If Spyder still fails to launch, you should consult our comprehensive <b><a href="%s">Troubleshooting Guide</a></b>, which when followed carefully solves the vast majority of crashes; also, take the time to search for <a href="%s">known bugs</a> or <a href="%s">discussions</a> matching your situation before submitting a report to our <a href="%s">issue tracker</a>. Your feedback will always be greatly appreciated.s   Spyder was unable to load the <i>Spyder 3</i> icon theme. That's why it's going to fallback to the theme used in Spyder 2.<br><br>For that, please close this window and start Spyder again.t
   icon_themes   spyder 2R  s   spyder_crash.logt   w(3   R/   t   unittest.mockR  R   t   mockRy   R   R  R   R   R   R   R   t   opengl_implementationR&   R"  R   R  R  RD   t   show_consoleR  R   t   hide_consoleR@   t   reset_to_defaultst   optimizeR%  R:   R   R   RL   R  t   __path__R.   R  R(  R  R   t   informationR7   R3   R1   R2   R%   R  R  R  R9   R   t   ORIGINAL_SYS_EXIT(
   R  RD  R   R   R  R+  R   t
   mainwindowt	   fontErrorR  (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyR(   m  s    																			t   __main__(   R}  t
   __future__R    R,  R(  Rb   t   os.pathRo   Rd   Rj   R   R;  Ra  Rf   Rc  R  R  R  R   R   t
   check_patht   check_qtt   check_spyder_kernelsRy   R   R   R   Rc   t   spyder.utils.windowst   rope.base.projectt   ropeR   R  R   R   t   qtpy.compatR   R  R	   R
   R   R   R   R   R   R   R   R   t
   qtpy.QtGuiR   R   R   R   R   t   qtpy.QtWidgetsR   R   R   R   R   R   R   R   R    R!   R"   t   qtpy.QtQuickR#   R$   R
  t   qtawesome.iconic_fontR%   t   spyder.config.mainR&   t   hasattrRw   R'   R"  t   spyder.utils.qthelpersR*   R+   t   spyder.config.baseR,   R&  R  R  R-   R.   R/   R(  t   fontt   SPLASH_FONTt   setPixelSizet   setFontR  R  RO  RP  RQ  RR  RS  R0   R1   R2   R3   R4   R5   R6   R7   R8   R9   R:   R;   R<   R=   R>   R?   R@   RA   t   spyder.config.utilsRB   RC   t   spyder.app.cli_optionsRD   RE   t   spyder.py3compatRF   RG   RH   RI   RJ   R  t   spyder.utilsRK   RL   RM   R  t   spyder.utils.introspectionRN   t   spyder.utils.programsRO   t   spyder.utils.miscRP   RQ   RR   t   spyder.widgets.fileswitcherRS   t   spyder.utils.environRT   RU   RV   RW   RX   RY   RZ   R[   R\   R]   t   spyder.config.guiR^   t   spyder.otherpluginsR_   t
   spyder.appR`   R  Rs   R   R   R  t   objectR  R  R(   R{  (    (    (    s4   lib/python2.7/site-packages/spyder/app/mainwindow.pyt   <module>   s   	


	F(@	"

4F(	
@			           	.	2	~