
    Je                         d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZmZ e
j                  Z G d d	      Z G d
 de      Zy)z
Tours Container.
    )OrderedDict)SpyderAPIError)_)PluginMainContainer)TourIdentifiers)AnimatedTourOpenTourDialogc                       e Zd ZdZdZy)TourActionsz
    Tours actions.
    z	show tourN)__name__
__module____qualname____doc__ShowTour     @/usr/lib/python3/dist-packages/spyder/plugins/tours/container.pyr   r      s     Hr   r   c                   B     e Zd ZdZd fd	Zd Zd Zd Zd Zd Z	 xZ
S )	ToursContainerz
    Tours container.
    c                 l    t            |||       |j                   _        t	                _        t	                _        t         j                         _        t          fd       _
         j                  t        j                  t        d       j                  d       fd       _        y )N)parentc                  .     j                  t              S N	show_tourDEFAULT_TOURselfs   r   <lambda>z)ToursContainer.__init__.<locals>.<lambda>0   s    $..6 r   z	Show tourtourc                  .     j                  t              S r   r   r   s   r   r   z)ToursContainer.__init__.<locals>.<lambda>6   s    dnn\: r   )texticon	triggered)super__init__main_mainr   _tours_tour_titlesr   _tour_widgetr	   _tour_dialogcreate_actionr   r   r   create_icontour_action)r   namepluginr   	__class__s   `   r   r&   zToursContainer.__init__'   s    vf5[[
!m'M(4*68  --  ;!!&):	 . 
r   c                 D    | j                  dt        d            | _        y )N
tours_menuzInteractive tours)create_menur   r4   r   s    r   setupzToursContainer.setup;   s    **!/02r   c                      y r   r   r   s    r   update_actionszToursContainer.update_actions?   s    r   c                       j                   v rt        dj                              | j                   <   | j                  <    j	                  | fd      } 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.
        z.Tour with id '{}' has already been registered!c                  &     j                        S r   )r   )r   tour_ids   r   r   z.ToursContainer.register_tour.<locals>.<lambda>[   s    dnnW5 r   )r"   r$   )menuN)r)   r   formatr*   r-   add_item_to_menur4   )r   r;   title	tour_dataactions   ``   r   register_tourzToursContainer.register_tourD   s     dkk! @GG   )G%*'"##5 $ 

 	f4??;r   c                     | j                   j                          | j                  |   }d|d}| j                  j	                  ||| j
                         | j                  j                          y)z
        Show interactive tour.

        Parameters
        ----------
        tour_id: str
            Unique tour string identifier.
        r   )lastr    N)sig_unmaximize_plugin_requestedemitr)   r+   set_tourr(   
start_tour)r   r;   r@   dics       r   r   zToursContainer.show_tour_   s\     	,,113KK(	),""7C<$$&r   c                 l    | j                   j                          | j                   j                          y)zT
        Show message about starting the tour the first time Spyder starts.
        N)r,   showraise_r   s    r   show_tour_messagez ToursContainer.show_tour_messagen   s(     	   "r   r   )r   r   r   r   r&   r6   r8   rB   r   rM   __classcell__)r2   s   @r   r   r   "   s&    
(2
<6'#r   r   N)r   collectionsr   spyder.api.exceptionsr   spyder.api.translationsr   !spyder.api.widgets.main_containerr   spyder.plugins.tours.toursr   spyder.plugins.tours.widgetsr   r	   IntroductionTourr   r   r   r   r   r   <module>rV      sF    $ 1 % A 6 E // Q#( Q#r   