³ņ
0Gc           @   s&  d  d k  Z  d  d k Z d  d k Z d  d k l Z d  d k Td  d k l Z l Z d  d k	 l
 Z
 l Z y d  d k l Z e Z Wn e j
 o e Z n Xd   Z d e
 f d	     YZ d
 e f d     YZ d d d     YZ d e f d     YZ d g d  Z d d  Z d   Z d S(   i’’’’N(   t   Tree(   t   *(   t   ManagedBaset
   WindowBase(   t   Sizert	   SizerSlot(   t	   EditPanelc         C   sS   |  i    } x- t |  i    D] } |  i |  i   q W|  i |  i   d S(   s@      The name should say all. The problem is hard to explain, so let me
    just illustrate a way to reproduce the bug:
    1. create a frame in wxGlade, add a notebook with two pages
    2. put a button on the first page, and a text ctrl on the second one
    3. save the app
    4. exit wxGlade, and comment out the body of this function
    5. restart wxGlade and load the previous app
    6. Try to click on the button on the first page of the notebook, and see
       what happens...

    If you don't see what I mean, please drop me an email with your version of
    Windows, Python and wxPython, because I really want to understand what's
    going on...

    So far I've not been able to reproduce the problem on a standalone minimal
    app, but as time permits I'll try again... if you succeed, please let me
    know.
    N(   t   GetSelectiont   ranget   GetPageCountt   GetPaget   Hidet   Show(   t   notebook_widgett   index_okt   i(    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyt!   _ugly_hack_for_win32_notebook_bug   s
     t   NotebookVirtualSizerc           B   sh   e  Z d  Z d   Z d d d d e d  Z d d d d d e d  Z e d  Z d   Z	 d   Z
 RS(	   sS       "Virtual sizer" responsible for the management of the pages of a Notebook.
    c         O   s    t  i |  | |  d |  _ d  S(   Ni    (   R   t   __init__t   _itempos(   t   selft   argst   kwds(    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyR   4   s    c   
      C   s`  |  i  i p d Sn | d 8} |  i  i | \ } } | p | i o d Sn | |  i  i i   j  p |  i  i i | i |  n |  i  i i |  | i j	 ou |  i  i i |  |  i  i i | | i |  |  i  i i |  y t	 i
 | i i  Wqt j
 o	 }	 qXn |  i  i d j	 o/ |  i  i i |  i  i d |  i  i i   n d S(   sA           Updates the layout of the item at the given pos.
        Ni   t   size(   t   windowt   widgett   tabsR	   t   AddPageR
   t
   DeletePaget
   InsertPaget   SetSelectiont   misct   wxCallAftert
   sel_markert   updatet   AttributeErrort   sizert   Nonet   set_itemt   post   GetBestSize(
   R   R'   t   optiont   flagt   borderR   t   force_layoutt   labelt   itemt   e(    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyR&   8   s&    
	i    c         C   s%   | |  i  i | d d <t | _ d S(   s-           Adds an item to self.window.
        i   N(   R   R   t   Truet   _dont_destroy(   R   R.   R'   R)   R*   R+   R   R,   (    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyt   add_itemS   s    c         C   s«   |  i  i p |  i  i o d Sn t |  i  |  |  } | i t  | d } |  i  i | \ } } |  i  i i |  |  i  i i | | i |  |  i  i i	 |  d S(   s?           Replaces the element at pos with an empty slot
        Ni   (
   R   t   _is_removing_pagesR   R   t   show_widgetR0   R   t
   RemovePageR   R   (   R   R'   R,   t   slotR-   R.   (    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyt	   free_slot\   s    
c         C   s   |  i  d 7_  |  i  S(   s?           Get position of sizer item (used in xml_parse)
        i   (   R   (   R   t   attrs(    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyt   get_itemposk   s    c         C   s   t  S(   N(   R0   (   R   (    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyt
   is_virtualr   s    N(   t   __name__t
   __module__t   __doc__R   R%   R0   R&   R2   R7   R9   R:   (    (    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyR   0   s   		t   NotebookPagesPropertyc           B   s   e  Z d    Z RS(   c         C   s0  d d k  l } l } | i } | d | d  d | d } d d  k } |  i   } xĄ t t |   D]¬ }	 | |	 }
 | | i |
 d   } d  } y7 |  i
 i |	 } | d |
 d j o | d } n Wn n X| o5 | d | | | i  f  | |  | d  qj qj W| d | d	  d  S(
   Ni’’’’(   t   escapet	   quoteattrs       s   <tabs>
i   i    s   %s<tab window=%s>s   </tab>
s   </tabs>
(   t   xml.sax.saxutilsR?   R@   t   writet   widget_propertiest	   get_valueR   t   lent   _encodeR%   t   ownerR   t   name(   R   t   outfileR   R?   R@   RB   t   tab_sRC   t   valueR   t   valt   vR   t   t(    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyRB   y   s(    	 
'
(   R;   R<   RB   (    (    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyR>   x   s   t   TabsHandlerc           B   s,   e  Z d    Z d   Z d   Z d   Z RS(   c         C   s   | |  _  g  |  _ g  |  _ d  S(   N(   t   parentt	   tab_namest   curr_tab(   R   RP   (    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyR      s    		c         C   s   d  S(   N(    (   R   RH   R8   (    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyt
   start_elem   s    c         C   sĄ   | d j oy g  } |  i  D] } | t i |  d  g q ~ |  i _ |  i i d i g  } |  i  D] } | | g qd ~  t Sn7 | d j o) |  i  i	 d i
 |  i   g  |  _ n t S(   NR   t   tabt    (   RQ   R   t   wxstrR%   RP   R   t
   propertiest	   set_valueR0   t   appendt   joinRR   t   False(   R   RH   t   _[1]t   _[2](    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyt   end_elem   s    2!c         C   s   |  i  i |  d  S(   N(   RR   RY   (   R   t   data(    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyt	   char_data¦   s    (   R;   R<   R   RS   R^   R`   (    (    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyRO      s   			t   EditNotebookc           B   s­   e  Z e Z d  d g Z e d  Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   t   EVT_NOTEBOOK_PAGE_CHANGEDt   EVT_NOTEBOOK_PAGE_CHANGINGc	   
      C   sF  t  i |  | d | | | | | d | t |   |  _ t |  _ | |  _ d d
 g g |  _ |  i	 |  i
 f |  i d <t |  d d t d  |  i d <|  i |  i f |  i d <d t i f g }	 t |  d d
 |	 d t d  |  i d <~	 d
 |  _ t |  _ t |  _ |  i |  i f |  i d <t |  d d t d	  |  i d <d
 S(   s3           Class to handle wxNotebook objects
        t
   wxNotebookt   showt   tab1t   styleR-   R   s	   Tab labelt   no_custom_classs)   Don't generate code for this custom classN(   R   R   R   t   virtual_sizerR[   R3   Rg   R%   R   t   get_tab_post   set_tab_post   access_functionst   HiddenPropertyt   _RW   t   get_tabst   set_tabst   GridPropertyt   STRINGR>   t   nb_sizert   _create_slotsRh   t   get_no_custom_classt   set_no_custom_classt   CheckBoxProperty(
   R   RH   RP   t   idRg   R$   R'   t   property_windowRe   t   tab_cols(    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyR   ±   s*    		"				c         C   sZ   t  i |  i i |  i d |  i |  _ t i d d d  p t  i |  i  |  _	 n d  S(   NRg   i   i   (
   t   wxt   NotebookRP   R   Rx   Rg   R   t   check_wx_versiont   NotebookSizerRs   (   R   (    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyt   create_widgetŠ   s    'c         C   sæ   t  i |  |  | o' t i d j o t i t |  i  n |  i os t	 |  _ xg t
 t |  i   D]L } |  i | d d  j o. |  i |  |  _ |  i d i |  i    qg qg Wn d  S(   Nt	   __WXMSW__t	   __WXMAC__i   R   (   s	   __WXMSW__s	   __WXMAC__(   R   R4   R{   t   PlatformR   R    R   R   Rt   R[   R   RE   R   R%   RW   RX   Ro   (   R   t   yesR   (    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyR4   Õ   s    
	 c         C   sD   t  i |   t i d d d  p |  i i |  i |  i  n d  S(   Ni   i   (   R   t   finish_widget_creationR   R}   R$   t   _fix_notebookR'   Rs   (   R   (    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyR   ą   s    c         C   s  t  i |   t i |  i d d t i } |  i d i |  |  i d i |  t i t i	  } | i
 |  i d i d t i t i Bd  | i
 |  i d i d t i t i Bd  | i t  | i |  | i |  |  i i | t d   |  i d i d g  d  S(	   Ni’’’’Rg   Rh   R   i    i   i   t   Widget(   R   t   create_propertiesR{   t   ScrolledWindowt   notebookt   TAB_TRAVERSALRW   t   displayt   BoxSizert   VERTICALt   Addt   panelt   ALLt   EXPANDt   SetAutoLayoutR0   t   SetSizert   FitR   Rn   t   set_col_sizes(   R   R   R$   (    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyR   ę   s    *c         C   s   |  i    | i   d  S(   N(   t   show_propertiest   Skip(   R   t   event(    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyt   on_set_focusõ   s    
c         C   sŠ   | d  j o. t |  |  i |  } | |  i | d d <n8 t | _ t i |  } | | _ t	 i
 i | |  i  |  i oP | i t  |  i i |  y t i | i i  WqĢ t j
 o	 } qĢ Xn d  S(   Ni   (   R%   R   Ri   R   R0   R1   R    t   Nodet   nodet   commont   app_treet   addR   R4   R&   R   R    R!   R"   R#   (   R   R   R'   R   R/   (    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyt   _add_tabł   s    		
c         C   s+   g  } |  i  D] \ } } | | g q ~ S(   N(   R   (   R   R\   t   nt   w(    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyRo     s    c   	      C   sJ  t  |  i  t  |  } | d j o t |  _ t  |  } |  i o? x< |  i | D]) \ } } |  i i |  | i t  qS Wn |  i | 3|  i o |  i i d  n t |  _ n(| d j  ot  |  i  d } x- t	 i
 i |  i d |  o | d 7} qÜ Wt  |  i  } x t |  D] } |  i i d d  g  | d 7} t o@ t |  i d | |  d |  i | |  i  } |  i | |  n |  i d  |  | d 7} q&W|  i o! |  i i |  i i   d  qąn xc t t  |   D]O } t i | | d  } |  i o |  i i | |  n | |  i | d <qóWd  S(   Ni    i   s   _pane_%sRU   i’’’’(   RE   R   R0   R3   R   R5   t   removeR[   R   R   R   t   has_nameRH   R   RY   R%   t
   _has_panelR   Ri   Ry   R   R	   R   RV   t   SetPageText(	   R   R   t   deltaR   R    R   t   numberR'   t   tt(    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyRp     sH    	
 
! 

% 
c         C   s,   |  i  o |  i  i   n t i |   d  S(   N(   R   t   DeleteAllPagesR   t   delete(   R   (    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyRŖ   5  s    
c         C   s+   | d j o t  |   Sn t i |  |  S(   NR   (   RO   R   t   get_property_handler(   R   RH   (    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyR«   :  s    c         C   st   |  i  p d Sn x[ t t |  i   D]D } |  i | d | j o& | |  i  i   j  o | Sql d Sq( q( Wd S(   so           returns the index of the given page in the notebook, or -1 if the page
        cannot be found
        i’’’’i   (   R   R   RE   R   R	   (   R   t   pageR   (    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyt	   find_page>  s     c         C   s=   h  d t  i <d t  i <d t  i <} | i |  i d  S(   Nt	   wxNB_LEFTt
   wxNB_RIGHTt   wxNB_BOTTOMt   0(   R{   t   NB_LEFTt   NB_RIGHTt	   NB_BOTTOMt   getRg   (   R   t   styles(    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyRj   J  s    c         C   sC   h  t  i d <t  i d <t  i d <} | i | d  |  _ d  S(   NR®   RÆ   R°   i    (   R{   R²   R³   R“   Rµ   Rg   (   R   RK   R¶   (    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyRk   O  s    c         C   s   |  i  S(   N(   Rh   (   R   (    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyRu   T  s    c         C   s   t  t |   |  _ d  S(   N(   t   boolt   intRh   (   R   RK   (    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyRv   W  s    (   R;   R<   R0   t   _custom_base_classest   eventsR   R   R4   R   R   R   R   Ro   Rp   RŖ   R«   R­   Rj   Rk   Ru   Rv   (    (    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyRa   ¬   s$   								'						i   c   
   
   C   sy  d t  i f d     Y} |   } | i   d | d } x6 t i i |  o" | d c d 7<d | d } q= Wt | |  t  i   | i | | t i	 d t
 } t o/ t | d | t  i   | i d t i	  } n t i |  }	 |	 | _ |	 | i _ | i d  | i d  | i t  t i i |	 | i | d  t o | i | d  n | i | i d t  i  d	 S(
   s3       factory function for EditNotebook objects.
    t   Dialogc           B   s   e  Z d    Z d   Z RS(   c      
   S   sC  t  i i |  d  d t d   d t  i t  i t  i g |  _ d |  _	 t
 |  d |  t d  t d  t d  t d  g d	 d
 d t d  } t  i t  i  } | i | i d t  i t  i Bd  t  i |  t  i t d   } | i   | i | d t  i t  i Bd  |  i t  |  i |  | i |   |  i   d  S(   Ni’’’’s   Select tab placementi    t   tab_placementt   Topt   Bottomt   Leftt   Rightt   columnsi   R-   i
   t   OK(   R{   R»   R   R%   Rn   R“   R²   R³   R¶   Rg   t   RadioPropertyR   R   R   R   R   R   t   Buttont   ID_OKt
   SetDefaultt   BOTTOMt   ALIGN_CENTERR   R0   R   R   t   CenterOnScreen(   R   t   propt   szrt   btn(    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyR   b  s    	*#
 c            s"     f d   }   f d   | f S(   Nc            s     i  |    _ d  S(   N(   R¶   Rg   (   t   s(   R   (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyt	   set_styles  s    c              s     i  S(    (   Rg   (    (   R   (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyt   <lambda>t  s    (    (   R   RK   RĪ   (    (   R   sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyt   __getitem__r  s    (   R;   R<   R   RŠ   (    (    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyR»   a  s   	s   notebook_%di    i   Re   t   _pane_1t   wxEXPANDN(   R{   R»   t	   ShowModalR   R   R£   Ra   t   NewIdRg   t   property_panelR[   R¤   R   Ri   R    R   R   t
   set_optiont   set_flagR4   R0   t   insertR   R&   R'   R   (
   RP   R$   R'   R§   R»   t   dialogRH   R   t   pane1R   (    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyt   builder]  s,    	
	c   	      C   s$  d d k  l } y |  d } Wn" t j
 o | t d   n X| p | o | t d   n t | | t i   d | | t i t	  } t	 | _
 | i | i d | i d | i d	 | i t i |  } | | _ | d j o t i i | | i  n t i i | | i | d
  | S(   s?       factory to build EditNotebook objects from an xml file
    i’’’’(   t   XmlParsingErrorRH   s   'name' attribute missings(   sizer or sizeritem object cannot be Nonei    R)   R*   R+   i   N(   t	   xml_parseRÜ   t   KeyErrorRn   Ra   R{   RŌ   R   RÕ   R0   Rt   R&   R'   R)   R*   R+   R    R   R   R%   R   R   RŲ   (	   R8   RP   R$   t	   sizeritemR'   RÜ   RH   R   R   (    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyt   xml_builder  s    "	!
	'c           C   s*   t  t i d <t t i d <t i d d  S(   sn       initialization function for the module: returns a wxBitmapButton to be
    added to the main palette.
    Ra   s   icons/notebook.xpm(   RŪ   R   t   widgetsRą   t   widgets_from_xmlt   make_object_button(    (    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pyt
   initializeØ  s    (    (   R{   R   R   t   treeR    RC   t   edit_windowsR   R   t   edit_sizers.edit_sizersR   R   R   R   R0   R¤   t   ImportErrorR[   R   R   Rq   R>   RO   Ra   RŪ   R%   Rą   Rä   (    (    (    sO   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\widgets\notebook\notebook.pys   <module>   s$   

	H±5