³ò
˜iìDc           @   s/   d  Z  d d k Z d e i f d „  ƒ  YZ d S(   t   
iÿÿÿÿNt   Formc           B   sS   e  Z d  Z d „  Z d d d „ Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 RS(	   s3  A form that automatically will contain all named widgets.
    
    <p>After a form is created, all named widget that are subsequently created are added
    to that form.  You may use dict style access to access named widgets.</p>
    
    <pre>Form()</pre>
    
    <strong>Example</strong>
    <code>
    f = gui.Form()
    
    w = gui.Input("Phil",name="firstname")
    w = gui.Input("Hassey",name="lastname")
    
    print f.results()
    print ''
    print f.items()
    print ''
    print f['firstname'].value
    print f['lastname'].value
    </code>
    c         C   s>   t  i i |  d t ƒg  |  _ h  |  _ d |  _ |  t _ d  S(   Nt   decoratei    (	   t   widgett   Widgett   __init__t   Falset   _elistt   _emapt   _dirtyR   t   form(   t   self(    (    s   ../pgu/gui/form.pyR      s
    			c         C   sQ   | d  j o | | _ n | d  j o | | _ n |  i i | ƒ d |  _ d  S(   Ni   (   t   Nonet   namet   valueR   t   appendR	   (   R   t   eR   R   (    (    s   ../pgu/gui/form.pyt   add$   s    c         C   s„   xG |  i  D]; } t | d ƒ p | i d  j o |  i  i | ƒ q q Wh  |  _ x! |  i  D] } | |  i | i <q] Wd |  _ d  S(   NR   i    (   R   t   hasattrR   R   t   removeR   R	   (   R   R   (    (    s   ../pgu/gui/form.pyt   _clean*   s     !	
 c         C   s#   |  i  o |  i ƒ  n |  i | S(   N(   R	   R   R   (   R   t   k(    (    s   ../pgu/gui/form.pyt   __getitem__3   s    c         C   s4   |  i  o |  i ƒ  n | |  i j o t Sn t S(   N(   R	   R   R   t   TrueR   (   R   R   (    (    s   ../pgu/gui/form.pyt   __contains__7   s    c         C   sF   |  i  o |  i ƒ  n h  } x! |  i D] } | i | | i <q( W| S(   sa   Return a dict of name => values.
        
        <pre>Form.results(): return dict</pre>
        (   R	   R   R   R   R   (   R   t   rR   (    (    s   ../pgu/gui/form.pyt   results<   s    
 c         C   s   |  i  ƒ  i ƒ  S(   sa   Return a list of name, value keys.
        
        <pre>Form.items(): return list</pre>
        (   R   t   items(   R   (    (    s   ../pgu/gui/form.pyR   G   s    N(   t   __name__t
   __module__t   __doc__R   R   R   R   R   R   R   R   (    (    (    s   ../pgu/gui/form.pyR      s   						(   R   R   R   R   (    (    (    s   ../pgu/gui/form.pys   <module>   s   