ó
‹²,]c           @   sˆ   d  Z  d d l j Z d d l 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 e e
 f d	 „  ƒ  YZ d S(
   s   Online Help PluginiÿÿÿÿN(   t   Signal(   t   _t   get_conf_path(   t   SpyderPluginMixin(   t   to_text_string(   t   PydocBrowsert
   OnlineHelpc           B   s   e  Z d  Z e e e ƒ Z d Z e e ƒ Z	 d „  Z
 d d „ Z d „  Z d „  Z d „  Z d „  Z e d „ Z d	 „  Z d
 „  Z d „  Z RS(   s   
    Online Help Plugin
    t
   onlinehelpc         C   s   | |  _  t j |  | ƒ t j |  | ƒ |  j ƒ  |  j |  j ƒ |  j j |  j	 d ƒ ƒ |  j
 j |  j	 d ƒ ƒ |  j
 j |  j ƒ  ƒ d  S(   Nt   zoom_factort   max_history_entries(   t   mainR   t   __init__R   t   initialize_plugint   register_widget_shortcutst   find_widgett   webviewt   set_zoom_factort
   get_optiont	   url_combot   setMaxCountt   addItemst   load_history(   t   selft   parent(    (    s8   lib/python2.7/site-packages/spyder/plugins/onlinehelp.pyR      s    	
c         C   sV   t  j |  j ƒ rL g  t |  j d ƒ j ƒ  D] } | j d d ƒ ^ q+ } n g  } | S(   s4   Load history from a text file in user home directoryt   rs   
t    (   t   ospt   isfilet   LOG_PATHt   opent	   readlinest   replace(   R   t   objt   linet   history(    (    s8   lib/python2.7/site-packages/spyder/plugins/onlinehelp.pyR   -   s
    7c         C   sZ   t  |  j d ƒ j d j g  t |  j j ƒ  ƒ D] } t |  j j | ƒ ƒ ^ q. ƒ ƒ d S(   s2   Save history to a text file in user home directoryt   ws   
N(	   R   R   t   writet   joint   rangeR   t   countR   t   itemText(   R   t   index(    (    s8   lib/python2.7/site-packages/spyder/plugins/onlinehelp.pyt   save_history6   s    c         C   s4   t  j |  | ƒ | r0 |  j ƒ  r0 |  j ƒ  n  d S(   s!   DockWidget visibility has changedN(   R   t   visibility_changedt   is_server_runningt
   initialize(   R   t   enable(    (    s8   lib/python2.7/site-packages/spyder/plugins/onlinehelp.pyR+   =   s    c         C   s
   t  d ƒ S(   s   Return widget titles   Online help(   R   (   R   (    (    s8   lib/python2.7/site-packages/spyder/plugins/onlinehelp.pyt   get_plugin_titleD   s    c         C   s   |  j  j ƒ  j ƒ  |  j  S(   sq   
        Return the widget to give focus to when
        this plugin's dockwidget is raised on top-level
        (   R   t   lineEditt	   selectAll(   R   (    (    s8   lib/python2.7/site-packages/spyder/plugins/onlinehelp.pyt   get_focus_widgetH   s    c         C   s'   |  j  ƒ  |  j d |  j j ƒ  ƒ t S(   s3   Perform actions before parent main window is closedR   (   R*   t
   set_optionR   t   get_zoom_factort   True(   R   t
   cancelable(    (    s8   lib/python2.7/site-packages/spyder/plugins/onlinehelp.pyt   closing_pluginP   s    
c         C   s   d S(   s   Refresh widgetN(    (   R   (    (    s8   lib/python2.7/site-packages/spyder/plugins/onlinehelp.pyt   refresh_pluginV   s    c         C   s   g  S(   s*   Return a list of actions related to plugin(    (   R   (    (    s8   lib/python2.7/site-packages/spyder/plugins/onlinehelp.pyt   get_plugin_actionsZ   s    c         C   s   |  j  j |  ƒ d S(   s'   Register plugin in Spyder's main windowN(   R
   t   add_dockwidget(   R   (    (    s8   lib/python2.7/site-packages/spyder/plugins/onlinehelp.pyt   register_plugin^   s    N(   t   __name__t
   __module__t   __doc__R    t   strt   objectt   sig_option_changedt   CONF_SECTIONR   R   R   t   NoneR   R*   R+   R/   R2   t   FalseR7   R8   R9   R;   (    (    (    s8   lib/python2.7/site-packages/spyder/plugins/onlinehelp.pyR      s   								(   R>   t   os.patht   pathR   t   qtpy.QtCoreR    t   spyder.config.baseR   R   t   spyder.pluginsR   t   spyder.py3compatR   t   spyder.widgets.pydocguiR   R   (    (    (    s8   lib/python2.7/site-packages/spyder/plugins/onlinehelp.pyt   <module>   s   