mς
­fIc           @   sΤ  d  Z  d k Td e f d     YZ d e f d     YZ d e f d     YZ d e f d	     YZ e d
 j o^e	   Z
 e e
 d d d g Z e i d e d e  e e i d d d d d d i   e e i d d d d d d i   e e i d d d d i   e e
  Z e e
 d d d d   Z e e
 d d d d   Z e e
 d d Z e i d d d d  e i d d d d  e i d d  e i d d  e i   e
 i   n d S(   sI   
a couple of classes for implementing partial tabbed-page like behaviour
(   t   *t   InvalidTabPagec           B   s   t  Z RS(   N(   t   __name__t
   __module__(    (    (    t,   /mit/python/lib/python2.4/idlelib/tabpage.pyR      s    t   AlreadyExistsc           B   s   t  Z RS(   N(   R   R   (    (    (    R   R      s    t   PageTabc           B   s   t  Z d  Z d   Z RS(   s)   
    a 'page tab' like framed button
    c         C   so   t  i |  | d d d t t |  d d d d d t d t d	 d
 d d
 d |  i d  |  _ |  i i	   d  S(   Nt   borderwidthi   t   relieft   padxi   t   padyt	   takefocust   indicatoront   highlightthicknessi    t   selectcolort   bg(
   t   Framet   __init__t   selft   parentt   RIDGEt   Radiobuttont   FALSEt   cgett   buttont   pack(   R   R   (    (    R   R      s
    (   R   R   t   __doc__R   (    (    (    R   R   
   s    t
   TabPageSetc           B   sA   t  Z d  Z g  d  Z e d  Z d   Z d   Z d   Z RS(   sH   
    a set of 'pages' with TabButtons for controlling their display
    c         K   sΊ   t  i |  | |  |  i d d  |  i d d d |  i d d d t  |   |  _ |  i i	 d d d d d t
  t |   |  _ d |  _ h  |  _ x | D] } |  i |  q Wd S(	   s  
        pageNames - a list of strings, each string will be the dictionary key
        to a page's data, and the name displayed on the page's tab. Should be
        specified in desired page order. The first page will be the default
        and first active page.
        i    t   weighti   t   rowt   columnt   stickyt    N(   R   R   R   R   t   kwt   grid_locationt   columnconfiguret   rowconfiguret   tabBart   gridt   EWt	   StringVart
   activePaget   defaultPaget   pagest	   pageNamest   namet   AddPage(   R   R   R,   R!   R-   (    (    R   R      s     		 c         C   s³   | o7 | |  i i   j o |  i i |  q> t d  n x2 |  i i   D]! } |  i | d i d t	  qN W|  i |  i
   d i d t  |  i |  i
   d i   d  S(   Ns   Invalid TabPage Namet   tabR   t   page(   t   pageNameR   R+   t   keysR)   t   setR   R0   t   configR   t   GetActivePaget   RAISEDt   lift(   R   R1   R0   (    (    R   t
   ChangePage,   s     !c         C   s   |  i i   S(   N(   R   R)   t   get(   R   (    (    R   R5   9   s    c      	   C   s  | |  i i   j o t d  n h  d t |  i  <d t |  d d d t <|  i | <|  i | d i	 i
 d | d |  i d	 |  i d
 |  |  i | d i d t  |  i | d i d d d d d t  t |  i  d j o* | |  _ |  i i |  i  |  i   n d  S(   Ns   TabPage Name Already ExistsR/   R0   R   i   R   t   textt   commandt   variablet   valuet   sideR   i   R   i    R   (   R1   R   R+   R2   R   R   R%   R   R6   R   R4   R8   R)   R   t   LEFTR&   t   NSEWt   lenR*   R3   (   R   R1   (    (    R   R.   <   s    :
'	c         C   s
  | |  i i   j o t d  n |  i | d i   |  i | d i   |  i | d i   |  i | d i   |  i | =|  i p d |  _ d  Sn | |  i j o& |  i	 i
   d i i d  |  _ n | |  i   j o |  i i |  i  n |  i   d  S(   Ns   Invalid TabPage NameR/   R0   R    i    R:   (   R1   R   R+   R2   R   t   pack_forgett   grid_forgett   destroyR*   R%   t   winfo_childrenR   R   R5   R)   R3   R8   (   R   R1   (    (    R   t
   RemovePageK   s    

	&(	   R   R   R   R   t   NoneR8   R5   R.   RF   (    (    (    R   R      s    		t   __main__R,   t   Foobart   Bazt   expandt   fillR0   R:   t   FooR
   i   t   Bars   Add PageR;   c           C   s   t  i t i    S(   N(   t   tabPageR.   t   entryPgNameR9   (    (    (    R   t   <lambda>h   s    s   Remove Pagec           C   s   t  i t i    S(   N(   RO   RF   RP   R9   (    (    (    R   RQ   j   s    s   name of page to add/remove:R	   i   N(   R   t   Tkintert	   ExceptionR   R   R   R   R   R   t   Tkt   rootRO   R   t   TRUEt   BOTHt   LabelR+   t   EntryRP   t   Buttont	   buttonAddt   buttonRemovet   labelPgNameR8   t   mainloop(
   R\   R]   RO   R[   R   R   RU   R   R   RP   (    (    R   t   ?   s0   I	''!
