ó
/¾I]c           @   sÃ   d  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
 m Z m Z d d l m Z d e e f d	 „  ƒ  YZ e d
 e f d „  ƒ  Yƒ Z e d e f d „  ƒ  Yƒ Z d S(   sp   SelectionContainer class.

Represents a multipage container that can be used to group other widgets into
pages.
i   (   t   Box(   t   register(   t
   CoreWidgetiÿÿÿÿ(   t   Unicodet   Dictt   CIntt
   TraitErrort   validate(   t   unicode_typet   _SelectionContainerc           B   sz   e  Z d  Z e d d ƒ j d e ƒ Z e d d d e ƒ j d e ƒ Z e	 d ƒ d „  ƒ Z
 d „  Z d	 „  Z d
 „  Z RS(   s2   Base class used to display multiple child widgets.t   helps   Titles of the pagest   syncs   The index of the selected page. This is either an integer selecting a particular sub-widget, or None to have no widgets selected.t
   allow_nonet   selected_indexc         C   sN   | j  d  k s7 d | j  k o2 t |  j ƒ k  n r> | j  St d ƒ ‚ d  S(   Ni    s&   Invalid selection: index out of bounds(   t   valuet   Nonet   lent   childrenR   (   t   selft   proposal(    (    sK   lib/python2.7/site-packages/ipywidgets/widgets/widget_selectioncontainer.pyt   _validated_index   s    7c         C   s0   t  t | ƒ ƒ } | |  j | <|  j d ƒ d S(   s½   Sets the title of a container page.

        Parameters
        ----------
        index : int
            Index of the container page
        title : unicode
            New title
        t   _titlesN(   R   t   intR   t
   send_state(   R   t   indext   title(    (    sK   lib/python2.7/site-packages/ipywidgets/widgets/widget_selectioncontainer.pyt	   set_title!   s    c         C   s4   t  t | ƒ ƒ } | |  j k r, |  j | Sd Sd S(   s   Gets the title of a container pages.

        Parameters
        ----------
        index : int
            Index of the container page
        N(   R   R   R   R   (   R   R   (    (    sK   lib/python2.7/site-packages/ipywidgets/widgets/widget_selectioncontainer.pyt	   get_title0   s    	c         c   s:   x" t  t |  ƒ j ƒ  D] } | Vq W|  j r6 d Vn  d  S(   NR   (   t   superR	   t
   _repr_keysR   (   R   t   key(    (    sK   lib/python2.7/site-packages/ipywidgets/widgets/widget_selectioncontainer.pyR   ?   s    		(   t   __name__t
   __module__t   __doc__R   t   tagt   TrueR   R   R   R   R   R   R   R   (    (    (    sK   lib/python2.7/site-packages/ipywidgets/widgets/widget_selectioncontainer.pyR	      s   			t	   Accordionc           B   s>   e  Z d  Z e d ƒ j d e ƒ Z e d ƒ j d e ƒ Z RS(   s4   Displays children each on a separate accordion page.t   AccordionViewR   t   AccordionModel(   R   R    R!   R   R"   R#   t
   _view_namet   _model_name(    (    (    sK   lib/python2.7/site-packages/ipywidgets/widgets/widget_selectioncontainer.pyR$   G   s   t   Tabc           B   s>   e  Z d  Z e d ƒ j d e ƒ Z e d ƒ j d e ƒ Z RS(   s3   Displays children each on a separate accordion tab.t   TabViewR   t   TabModel(   R   R    R!   R   R"   R#   R'   R(   (    (    (    sK   lib/python2.7/site-packages/ipywidgets/widgets/widget_selectioncontainer.pyR)   N   s   N(   R!   t
   widget_boxR    t   widgetR   t   widget_coreR   t	   traitletsR   R   R   R   R   t   ipython_genutils.py3compatR   R	   R$   R)   (    (    (    sK   lib/python2.7/site-packages/ipywidgets/widgets/widget_selectioncontainer.pyt   <module>   s   (6