
    Je                         d Z ddlmZmZ ddlmZmZ ddlmZ ddl	m
Z
mZ ddlmZ ddlmZmZ ddlmZmZ dd	lmZmZ  G d
 de      Zy)z
Tours Plugin.
    )PluginsSpyderPluginV2)on_plugin_availableon_plugin_teardown_)get_safe_moderunning_under_pytest)ApplicationActions)TourActionsToursContainer)
INTRO_TOURTourIdentifiers)ApplicationMenusHelpMenuSectionsc                       e Zd ZdZdZeZej                  gZdZ	e
Zed        Zd Zd Zd Z eej                        d	        Z eej                        d
        Zd Zd Zd ZddZy)Toursz
    Tours Plugin.
    toursFc                      t        d      S )NzInteractive toursr        =/usr/lib/python3/dist-packages/spyder/plugins/tours/plugin.pyget_namezTours.get_name'   s    $%%r   c                     t        d      S )NzProvide interactive tours.r   selfs    r   get_descriptionzTours.get_description+   s    -..r   c                 $    | j                  d      S )Ntour)create_iconr   s    r   get_iconzTours.get_icon.   s    ''r   c                 `    | j                  t        j                  t        d      t               y )NzIntroduction to Spyder)register_tourr   IntroductionTourr   r   r   s    r   on_initializezTours.on_initialize1   s%    ,,&'	
r   )pluginc                    | j                  t        j                        }|j                  | j	                         j
                  t        j                  t        j                  t        j                  t        j                         y )N)menu_idsectionbefore_sectionbefore)
get_pluginr   MainMenuadd_item_to_application_menuget_containertour_actionr   Helpr   DocumentationSupportr   SpyderDocumentationActionr   mainmenus     r   on_main_menu_availablezTours.on_main_menu_available8   s`    ??7#3#34-- ,,$))$22+33%?? 	. 	Ar   c                     | j                  t        j                        }|j                  t        j
                  t        j                         y )N)r(   )r,   r   r-   !remove_item_from_application_menur   ShowTourr   r1   r5   s     r   on_main_menu_teardownzTours.on_main_menu_teardownC   s;    ??7#3#3422  $)) 	3 	+r   c                 $    | j                          y )N)show_tour_messager   s    r   on_mainwindow_visiblezTours.on_mainwindow_visibleJ   s     r   c                 F    | j                         j                  |||       y)a  
        Register a new interactive tour on spyder.

        Parameters
        ----------
        tour_id: str
            Unique tour string identifier.
        title: str
            Localized tour name.
        tour_data: dict
            The tour steps.
        N)r/   r#   )r   tour_idtitle	tour_datas       r   r#   zTours.register_tourO   s     	**7E9Er   c                 B    | j                         j                  |       y)z
        Show interactive tour.

        Parameters
        ----------
        index: int
            The tour index to display.
        N)r/   	show_tour)r   indexs     r   rD   zTours.show_tour^   s     	&&u-r   c                     | j                  d      }|s|rGt               s<t               s1| j                  dd       | j	                         j                          yyyy)z
        Show message about starting the tour the first time Spyder starts.

        Parameters
        ----------
        force: bool
            Force the display of the tour message.
        r=   FN)get_confr
   r	   set_confr/   r=   )r   forceshould_show_tours      r   r=   zTours.show_tour_messagei   sW      ==)<=%.B.D*_MM-u5 224 - /E%r   N)F)__name__
__module____qualname____doc__NAMECONF_SECTIONr   r-   OPTIONAL	CONF_FILEr   CONTAINER_CLASSstaticmethodr   r   r!   r%   r   r7   r   r;   r>   r#   rD   r=   r   r   r   r   r      s     DL  !HI$O & &/(
  0 01A 2A w//0+ 1+!
F	.5r   r   N)rN   spyder.api.pluginsr   r   )spyder.api.plugin_registration.decoratorsr   r   spyder.api.translationsr   spyder.config.baser	   r
   spyder.plugins.application.apir   spyder.plugins.tours.containerr   r   spyder.plugins.tours.toursr   r   spyder.plugins.mainmenu.apir   r   r   r   r   r   <module>r]      s4   
 7- % B = F B J
[5N [5r   