³ò
0ŽGc           @   s¶  d  d k  Z  d  d k Z d  d k Z d  d k Z d  d k Z d  d k Z d  d k Z d  d k l Z d Z	 e  i
 e Z d d g Z e a h  Z e a g  a e a e e f \ a a e a e a d d f a d f  d	 „  ƒ  YZ d
 f  d „  ƒ  YZ e a d „  Z e a e a e i  d ƒ Z! d „  Z" e# 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 „  Z0 d a1 e d „ Z2 d „  Z3 d „  Z4 d  „  Z5 d! „  Z6 d" „  Z7 d# „  Z8 d$ „  Z9 d% f  d& „  ƒ  YZ: d' f  d( „  ƒ  YZ; d) e< f d* „  ƒ  YZ= d+ e< f d, „  ƒ  YZ> h  e: d- <e= d. <e> d/ <Z? h  Z@ h  ZA d0 „  ZB e d1 „ ZC d2 f  d3 „  ƒ  YZD d4 „  ZE d5 „  ZF d6 „  ZG d S(7   iÿÿÿÿN(   t   XmlParsingErrors   C++t   ht   cppi   i   t
   ClassLinesc           B   s   e  Z d  Z d „  Z RS(   s;       Stores the lines of python code for a custom class
    c         C   sp   g  |  _  g  |  _ g  |  _ g  |  _ g  |  _ g  |  _ g  |  _ g  |  _ t |  _	 g  |  _
 g  |  _ g  |  _ d  S(   N(   t   initt   parents_initt   idst   sizers_initt   propst   layoutt   sub_objst   dependenciest   Falset   donet   event_handlerst   extra_code_ht   extra_code_cpp(   t   self(    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyt   __init__<   s    											(   t   __name__t
   __module__t   __doc__R   (    (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyR   8   s   t   SourceFileContentc           B   s2   e  Z d  Z d „  Z d „  Z d „  Z d „  Z RS(   s¢       Keeps info about an existing file that has to be updated, to replace only
    the lines inside a wxGlade block, an to keep the rest of the file as it was
    c         C   s‚   | |  _  d  |  _ d  |  _ h  |  _ g  |  _ h  |  _ h  |  _ h  |  _ t	 i
 d ƒ |  _ t d  j o h  |  _ n |  i ƒ  d  S(   Ns&   ^\s*};\s*//\s+wxGlade:\s+end class\s*$(   t   namet   Nonet   header_contentt   source_contentt   classest   new_classesR   t   event_table_declt   event_table_deft   ret   compilet   end_class_ret   build_untouched_content(   R   R   (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyR   \   s    								c         C   s2   |  i  |  i d t ƒ |  i  |  i d t ƒ d S(   sÉ           Builds a string with the contents of the file that must be left as is,
        and replaces the wxGlade blocks with tags that in turn will be replaced
        by the new wxGlade blocks
        s   .hs   .cppN(   t   _build_untouchedR   t   TrueR   (   R   (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyR"   n   s    c         C   s=  d  } t } t i d ƒ } t i d ƒ } t i d ƒ } t i d ƒ } t i d ƒ }	 t i d ƒ }
 t i d ƒ } t } t } t } t } t | ƒ } g  } x:| D]2} | i d ƒ } | o- | d	 j o  | | i d
 ƒ j o
 t } n | o* | i d ƒ } | | j o
 t } q!n | p
 d  } n | i | ƒ } | oj | ob | d  j	 oU | d  j o | i d t	 ƒ t } n | i
 d ƒ } d |  i | <| i | ƒ q¦ | pþ| i | ƒ } | oC | d  j	 o6 t } | i d t	 | i
 d ƒ | i
 d ƒ f ƒ qØt } | oî | oæ | i | ƒ } | d  j	 o8 t } | i
 d ƒ } | } d |  i i | h  ƒ | <qœ| o' | i d t	 | f ƒ t } t } n4 | o+ |  i | ƒ o | i d t	 | f ƒ n |	 i | ƒ } | d  j	 o t |  i | <qœnŽ | p† | i | ƒ } | d  j	 o* | i d t	 | i
 d ƒ f ƒ t } n |
 i | ƒ } | d  j	 o  | i
 d ƒ } t |  i | <qœn | p | i | ƒ qØq¦ | i | ƒ d  j	 o
 t } q¦ q¦ W| o | o | i d t	 ƒ n | i ƒ  | o d i | ƒ |  _ n d i | ƒ |  _ d  S(   Ns   ^\s*class\s+([a-zA-Z_]\w*)\s*s,   ^\s*//\s*begin\s+wxGlade:\s*(\w*)::(\w+)\s*$s   ^\s*//\s*end\s+wxGlade\s*$sr   ^\s*(?:virtual\s+)?void\s+([A-Za-z_]+\w*)\s*\([A-Za-z_:0-9]+\s*&\s*\w*\)\s*;\s*//\s*wxGlade:\s*<event_handler>\s*$s*   ^\s*DECLARE_EVENT_TABLE\s*\(\s*\)\s*;?\s*$s7   ^\s*BEGIN_EVENT_TABLE\s*\(\s*(\w+)\s*,\s*(\w+)\s*\)\s*$s:   ^\s*//\s*wxGlade:\s*add\s+((?:\w|:)+)\s+event handlers\s*$s   /*iÿÿÿÿs   //s   */s   <%swxGlade insert new_classes>i   s   <%swxGlade replace %s %s>i   s   <%swxGlade event_handlers %s>s!   <%swxGlade add %s event handlers>t    (   R   R   R   R    t   opent   findR$   t   matcht   appendt   noncet   groupR   R   t
   setdefaultt   is_end_of_classR   R   t   closet   joinR   R   (   R   t   filenamet	   is_headert
   class_namet   new_classes_insertedt
   class_declt   block_startt	   block_endt   event_handlert   decl_event_tablet   def_event_tablet   event_handlers_markert   prev_was_handlert   events_tag_addedt   inside_blockt   inside_commentt   tmp_int	   out_linest   linet   comment_indext	   end_indext   resultt   dont_appendt   which_handlert   which_class(    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyR#   w   sž     
	
	'	
		

c         C   s   |  i  i | ƒ d  j	 S(   N(   R!   R(   R   (   R   RA   (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyR-   ï   s    (   R   R   R   R   R"   R#   R-   (    (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyR   W   s
   				xc         C   s   d |  S(   Ns       (    (   t   number(    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyt   tabsú   s    s   \\[natbv"]?c         C   s/   |  i  d ƒ d j o d Sn |  i  d ƒ Sd  S(   Ni    s   \s   \\(   R+   (   R(   (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyt   _do_replace  s    c         C   s~   |  p d Sn |  i  d d ƒ }  | o t i t |  ƒ }  n |  i  d d ƒ }  t o | o d |  d Sn d |  d Sd	 S(
   sŒ       returns a quoted version of 's', suitable to insert in a C++ source file
    as a string object. Takes care also of gettext support
    t   wxEmptyStringt   "s   \"s   \s   \\s   _("s   ")s   wxT("N(   t   replacet   _quote_str_patternt   subRJ   t   _use_gettext(   t   st	   translatet   escape_chars(    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyt	   quote_str
  s    c         C   sD  |  d } |  d } d d k  } d d k } d a y t |  d ƒ a Wn t t f j
 o t a n Xy t |  d ƒ a Wn t t f j
 o t a n XyB t	 g  } |  d i
 d	 ƒ d
  D] } | t | ƒ qÀ ~ ƒ a WnB t t f j
 o0 t i d j	 o t i i i a q%d a n Xd t | i  ƒ  ƒ i d	 d ƒ | i d  d! ƒ f a h  a d t i | i ƒ  t i ƒ  f d d g a t i i p! d t i t i ƒ  f t d <n g  a g  a | a t p@t i  i! | ƒ \ } } | a" t o' t i  i# | d ƒ o t$ | ƒ a% q@d a% t& i' ƒ  a( t& i' ƒ  a) x t D] }	 t( i* |	 ƒ qCWt i  i+ | d ƒ i, ƒ  i d	 d ƒ }
 t( i* d t ƒ t( i* d |
 |
 f ƒ t( i* d ƒ t( i* d t ƒ t) i* t d ƒ t) i* d t i  i+ | ƒ d f ƒ t) i* d t ƒ n0 d a% t i  i- | ƒ p t. d ƒ ‚ n | a/ d S("   sj       Writer initialization function.
    See py_codegen.initialize for a description of the parameter.
    t   patht   optioniÿÿÿÿNiè  t   use_gettextt	   overwritet   for_versiont   .i   i   s   %s%sR%   i
   i   i   s0   // -*- C++ -*- generated by wxGlade %s on %s%s

s   #include <wx/wx.h>
s   #include <wx/image.h>
s*   // -*- C++ -*- generated by wxGlade %s%s

i    s   .ht   _s"   <%swxGlade replace  dependencies>
s   
#ifndef %s
#define %s
s   
s    
<%swxGlade replace  extracode>
s   #include "%s%s"

s    <%swxGlade replace  extracode>

s@   'path' must be a directory when generating multiple output files(   i   i   i@B i€–˜ (0   t   timet   randomt   _last_generated_idt   intRP   t   KeyErrort
   ValueErrorR   t
   _overwritet   tuplet   splitRY   t   commont   app_treeR   t   appt   strRM   t	   randrangeR*   R   t   versiont   asctimet   generated_fromt   header_linest   configt   preferencest   write_timestampt   _current_extra_code_ht   _current_extra_code_cppt   multiple_filest   osRU   t   splitextt   output_namet   isfileR   t   previous_sourcet	   cStringIOt   StringIOt   output_headert   output_sourcet   writet   basenamet   uppert   isdirt   IOErrort   out_dir(   t	   app_attrst   out_patht   multi_filesR\   R]   t   _[1]t   tR   t   extRA   t   oh(    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyt
   initialize  sf    


8 (	c          C   s  t  d j	 oDd t }  t  i o5 d i g  } t  i D] } | | d q5 ~ ƒ } n d } t  i i |  | ƒ } d i g  } t  i D] } | | d q… ~ ƒ } t  i } d t }  d i d g t d g ƒ } | i |  | ƒ } d i d g t	 d g ƒ } | i |  | ƒ } t
 i d	 t | ƒ } x0| D](}  |  d
 d j o¼ g  }	 x$ t i ƒ  D] } |	 i | i ƒ qZWd g }
 xc t |	 ƒ D]U } | o7 d | d j o
 d j n o |
 i d | ƒ qŠ|
 i d | ƒ qŠW|
 i d ƒ d i |
 ƒ } n@ |  d
 d j o  d t d ƒ t d ƒ f } n d |  d
 } | i |  d | ƒ } q0Wt
 i d t | ƒ } x* | D]" }  d } | i |  d | ƒ } qyWt
 i d t | ƒ } x  | D] }  | i |  d ƒ } q¼Wt
 i d t | ƒ } x  | D] }  | i |  d ƒ } qõWt i t  i d | d ƒ t i t  i d | d | d ƒ nÅt p½t i i t ƒ i ƒ  d } t i d | ƒ t i ƒ  } t i ƒ  } t
 i d t | ƒ } g  }	 x$ t i ƒ  D] } |	 i | i ƒ qÆWd g }
 xc t |	 ƒ D]U } | o7 d | d j o
 d j n o |
 i d | ƒ qö|
 i d | ƒ qöW|
 i d ƒ | i d t d i |
 ƒ ƒ } d t }  d i d g t d g ƒ } | i |  | ƒ } d i d g t	 d g ƒ } | i |  | ƒ } t i t d | d ƒ t i t d | d ƒ n d S(    sR       Writer ``finalization'' function: flushes buffers, closes open files, ...
    s   <%swxGlade insert new_classes>R%   i    i   s   <%swxGlade replace  extracode>s   
s   // begin wxGlade: ::extracodes   // end wxGlade
s+   (<%swxGlade replace ([a-zA-Z_]*\w*) (\w+)>)i   R   s!   // begin wxGlade: ::dependencies
RL   t   <s   #include "%s.h"
s   #include %s
t   methodss-   %svoid set_properties();
%svoid do_layout();
sD   // content of this block (%s) not found: did you rename this class?
s+   (<%swxGlade replace ([a-zA-Z_]\w*) +(\w+)>)s?   // content of this block not found: did you rename this class?
s   <%swxGlade event_handlers \w+>s"   <%swxGlade add \w+ event_handlers>s   .ht   codegens   .cpps   

t   _Hs   
#endif // %s
s!   <%swxGlade replace  dependencies>N(    Rx   R   R*   R   R/   R   RM   R   Rq   Rr   R   t   findallR   t
   itervaluest   extendR   t   _uniqueR)   RI   Re   t	   save_fileR   Rs   Rt   RU   R~   Rv   R   R{   R}   t   getvalueR|   (   t   tagR†   t   ct   codeR   t   _[2]t   extra_sourceR   t   tagst   depst   tmpt   dept   linest   commentR‰   (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyt   finalizev  s¸    

51	


	  	 )	 	 	 	 	 )


c         C   s9   y t  |  i d ƒ SWn t t f j
 o t Sn Xd S(   sä       Returns True if 'obj' should be added as an attribute of its parent's
    class, False if it should be created as a local variable of __do_layout.
    To do so, tests for the presence of the special property 'attribute'
    t	   attributeN(   R_   t
   propertiesR`   Ra   R$   (   t   obj(    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyt   test_attributeé  s    c         C   sÍ  y t  |  i } Wn' t j
 o t ƒ  } t  |  i <n Xy t | i } Wn< t j
 o0 | i i d d | i | i f d g ƒ n@Xy | i	 | ƒ \ } } } } Wn | GH‚  n X| i
 o| i o) | i o | i ƒ  | i i | ƒ n | i i | ƒ t | d ƒ o | i i | i | ƒ ƒ nd d | i j oS t | ƒ \ } }	 x> | i d i ƒ  D]% \ }
 } | i i |	 |
 | f ƒ qlWn t | d | i i d d ƒ ƒ } | o» t i d d | ƒ } t i t i d t i ƒ | d	 ƒ } | i i | d
 ƒ t | ƒ d	 j o | i i | d	 ƒ n t  o
 t! } n t" d j	 } | o t$ i% d d | i ƒ q|n | i& i | ƒ | i d j o1 t' | ƒ o  | i( i | i | i f ƒ qÍq1na | i d j o@ | i( i) d
 d d | i f ƒ | i i) d	 | i* d
 ƒ ƒ n | i+ i | ƒ | i, i | ƒ | i- i | ƒ t  o4 | i o* | i | i j o | i. i | i ƒ n> | i t j o- t t | i d g  ƒ } | i. i | ƒ n d S(   sI       adds the code to build 'sub_obj' to the class body of 'top_obj'.
    s   
s@   // code for %s (type %s) not generated: no suitable writer foundt
   get_eventst   eventst	   extracodeR%   s   \\ns   ^###\s*$i   i    t   WARNINGsq   %s has extra code, but you are not overwriting existing sources: please check that the resulting code is correct!t   spacert   wxStaticBoxSizert   wxStaticBoxs   %s_staticboxt   extra_headersN(/   R   t   klassR`   R   t   obj_builderst   baseR   R‘   R   t   get_codet
   in_windowst   is_containert   is_toplevelt   reverseR   t   hasattrR   R¥   R¢   t   generate_code_idt	   iteritemsR)   t   getattrt   getR   RO   Rd   R    t   MR   t   lenR   Rs   R   Rx   R   Re   t   messageR   R¤   R
   t   insertt   popR   R   R	   R   (   t   top_objt   sub_objR­   t   builderR   R   R   R	   t   id_namet   idt   eventt   handlert
   extra_codet   warnt   headers(    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyt
   add_objectó  sv    '

 !	
( c   	   	   C   s¢   y t  |  i } Wn' t j
 o t ƒ  } t  |  i <n X| i } | i d j o t d j  o d | i } n d | i | | | | f } | i i | ƒ d S(   sc       writes the code to add the object 'obj' to the sizer 'sizer'
    in the 'toplevel' object.
    t
   wxNotebooki   i   s   new wxNotebookSizer(%s)s   %s->Add(%s, %s, %s, %s);
N(   i   i   (	   R   R­   R`   R   R   R¯   RY   R	   R)   (	   t   toplevelt   sizerR£   RV   t   flagt   borderR­   R   t   buffer(    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyt   add_sizeritemL  s    '	c   >   8   C   s¡  t  i |  i ƒ o t  |  i i o d Sn t p
 t } nl t i i t	 |  i i
 d d ƒ d ƒ } t p t i i | ƒ o
 d } n t t i i t	 |  i ƒ ƒ } | d j	 o  | i  i |  i ƒ o
 t } n t } g  } g  } | i } | i } t  i |  i ƒ p t ƒ  t  |  i <n y t |  i } Wn t j
 o |  GH‚  n Xt | d |  i i d d ƒ ƒ }	 |	 o¬ t i d d |	 ƒ }	 t i t i d	 t i ƒ |	 d
 ƒ }	 t  |  i i i |	 d ƒ t |	 ƒ d
 j o t  |  i i  i |	 d
 ƒ n | p t! i" d d |  i# ƒ q#n t oe |	 o^ t$ i d i t  |  i i d d d … ƒ ƒ t% i d i t  |  i i  d d d … ƒ ƒ n du dv g }
 t | d |
 ƒ } g  } xC | D]; } t | ƒ d j o | i | d ƒ q»| i d ƒ q»Wg  } | D] } | | d d | d
 q~ } d i | ƒ } xG t& t | ƒ ƒ D]3 } | | d j	 o | | c d | | 7<qMqMWd i | ƒ } d i g  } | D] } | | d
 q¤~ ƒ } t  |  i i' } t( | d ƒ o | i) | i* |  ƒ ƒ n t |  d |  i i d d ƒ ƒ } | o | i+ ƒ  o
 d } n | o( | d j	 o t! i" d d |  i# ƒ n | o|  i } | d j	 o= d i g  } | i d ƒ D] } | | i+ ƒ  q¢~ ƒ } n | d |  i | f ƒ | d ƒ | t, d
 ƒ d  |  i ƒ t  |  i i- } t( | d! ƒ o | i) | i. |  ƒ ƒ n | o] | t, d
 ƒ d" ƒ d# t, d ƒ i | ƒ } | t, d ƒ | ƒ | d t, d
 ƒ d$ ƒ n | t, d
 ƒ d% ƒ | t, d
 ƒ d& |  i | f ƒ | d' ƒ | t, d
 ƒ d( |  i ƒ | t, d
 ƒ d) ƒ | t, d
 ƒ d* ƒ | t, d
 ƒ d+ ƒ | d ƒ | d, ƒ | t, d
 ƒ d- |  i ƒ x< t  |  i i/ D]* \ } } | t, d
 ƒ d. | | f ƒ quW| t, d
 ƒ d+ ƒ | o´ t, d
 ƒ } | d | d/ ƒ | d0 ƒ h  } xƒ | D]w } t | ƒ d1 j o | \ } }  }! }" n | \ } }  }! d2 }" |! | j o& | | d3 |! |" f ƒ d
 | |! <qóqóWn | d4 ƒ n2| d j	 o$| t, d
 ƒ d  |  i ƒ t  |  i i- } t( | d! ƒ o | i) | i. |  ƒ ƒ n | o] | t, d
 ƒ d" ƒ d# t, d ƒ i | ƒ } | t, d ƒ | ƒ | d t, d
 ƒ d$ ƒ n | t, d
 ƒ d+ ƒ d5 t0 |  i f }# | i1 i2 |# ƒ d j  o t! i" d d6 |  i# ƒ n" | i1 i
 |# d i | ƒ ƒ | _1 t, d
 ƒ d( |  i t, d
 ƒ d) t, d
 ƒ d* t, d
 ƒ d+ g } d7 t0 |  i f }# | i1 i2 |# ƒ d j  o t! i" d d8 |  i# ƒ n" | i1 i
 |# d i | ƒ ƒ | _1 g  } | i } | t, d
 ƒ d- |  i ƒ x< t  |  i i/ D]* \ } } | t, d
 ƒ d. | | f ƒ q¦	W| t, d
 ƒ d+ ƒ d9 t0 |  i f }# | i1 i2 |# ƒ d j  o t! i" d d: |  i# ƒ n" | i1 i
 |# d i | ƒ ƒ | _1 g  } | i } | oß | i' i |  i h  ƒ } t, d
 ƒ } x | D]w } t | ƒ d1 j o | \ } }  }! }" n | \ } }  }! d2 }" |! | j o& | | d3 |! |" f ƒ d
 | |! <q‘
q‘
W|  i | i3 j o" | d; ƒ | t, d
 ƒ d< ƒ qEn d= t0 |  i f }# | i1 i2 |# ƒ d j  o t! i" d d> |  i# ƒ q±| i1 i
 |# d i | ƒ ƒ | _1 n |  i }$ |$ i d? d ƒ }% |% d j	 o | i
 d? d@ |% ƒ } n | oå dA |  i | f } | ož g  }& | i d ƒ D] } |& | i+ ƒ  q(~& }' |' oc dA |' d | f } d i g  }( |' d
 D] } |( | dB qt~( ƒ }) |) o | d |) 7} q®q²n | dC |  i |  i | t, d
 ƒ | f ƒ n | t, d
 ƒ dD |  i |  i f ƒ t, d
 ƒ }* t  |  i i4 }+ t  |  i i5 }, |, i6 ƒ  x |, D] }- | |* |- ƒ q@Wx |+ D] }- | |* |- ƒ q_Wt( | dE ƒ o, x) | i7 |  ƒ D] }- | |* |- ƒ q—Wn | d |* dF ƒ | |* dG ƒ | |* d+ ƒ | o | dH ƒ n | d j	 o’ | oŠ dI t0 |  i |  i f }# | i8 i2 |# ƒ d j  o$ t! i" d dJ |  i |  i f ƒ n" | i8 i
 |# d i | ƒ ƒ | _8 g  } | i } n | oA| d j	 o |  i | i9 j o
 t }. n t }. | p |. o | dK |  i |  i f ƒ n | |* dL |  i ƒ xB | D]: } | d  \ } }  }! | |* dM |  | |  i |! f ƒ qW| |* d+ ƒ | p |. o | dN ƒ n | d j	 oƒ | o{ dO t0 |  i f }# | i8 i2 |# ƒ d j  o t! i" d dP |  i ƒ n" | i8 i
 |# d i | ƒ ƒ | _8 g  } | i } n | d j	 o | i' i |  i h  ƒ } n h  } x´ | D]¬ } t | ƒ d1 j o | \ } }  }! }" n | \ } }  }! d2 }" |! | j o[ | dQ |  i |! |" f ƒ | |* dR ƒ | |* dS |  i |! f ƒ | dT ƒ d
 | |! <qDqDW| p | d j o | dU ƒ n | dV |  i ƒ | p | d j o | d ƒ n | d j	 oƒ | o{ dW t0 |  i f }# | i8 i2 |# ƒ d j  o t! i" d dX |  i ƒ n" | i8 i
 |# d i | ƒ ƒ | _8 g  } | i } qÝn t( | dY ƒ o | i: |  ƒ }/ n t; |  ƒ }/ | o | dZ |  i ƒ n | |* d[ |  i ƒ x |/ D] }- | |* |- ƒ qDWx& t  |  i i< D] }- | |* |- ƒ qmW| |* d+ ƒ | o | dH ƒ n | d j	 oƒ | o{ d\ t0 |  i f }# | i8 i2 |# ƒ d j  o t! i" d d] |  i ƒ n" | i8 i
 |# d i | ƒ ƒ | _8 g  } | i } n | o | d^ |  i ƒ n t  |  i i= }0 t  |  i i> }1 | |* d_ |  i ƒ |1 i6 ƒ  x |1 D] }- | |* |- ƒ qšWx |0 D] }- | |* |- ƒ q¹Wt( | d` ƒ o, x) | i? |  ƒ D] }- | |* |- ƒ qñWn | |* d+ ƒ | o | dH ƒ n | d j	 oƒ | o{ da t0 |  i f }# | i8 i2 |# ƒ d j  o t! i" d db |  i ƒ n" | i8 i
 |# d i | ƒ ƒ | _8 g  } | i } n t t  |  i _ t oH | d j	 o; | o, | i@ i d i | ƒ d i | ƒ f ƒ n d Sn t o¼|  i t j o. t  |  i iA i) t t |  i dc g  ƒ ƒ n | d j	 oðdd t0 }# | i1 i
 |# d ƒ | _1 t  |  i iA }2 de g }3 xc tB |2 ƒ D]U }4 |4 o7 df |4 d j o
 dg j n o |3 i dh |4 ƒ qº|3 i di |4 ƒ qºW|3 i d+ ƒ dj t0 }# | i1 i
 |# d i |3 ƒ ƒ | _1 d i t  |  i i d d d … ƒ }5 d i t  |  i i  d d d … ƒ }6 |5 p |6 o t! i" d dk |  i# ƒ n dl |5 }5 dl |6 }6 dm t0 }# | i1 i
 |# |5 ƒ | _1 | i8 i
 |# |6 ƒ | _8 t i i t	 |  i ƒ }7 t! iC |7 d | i1 dn ƒ t! iC |7 do | i8 dn ƒ d Sn t i i t	 |  i d ƒ }8 t i i t	 |  i do ƒ }9 tD iE ƒ  }: tD iE ƒ  }; |: iF } x tG D] }< | |< ƒ qÂWt i iH |8 ƒ iI ƒ  i
 dp d ƒ }= | dq |= |= f ƒ | dr ƒ t  |  i iA }2 x] tB |2 ƒ D]O }4 |4 o4 df |4 d j o
 dg j n o | dh |4 ƒ q5| di |4 ƒ q5W| d+ ƒ | d ƒ d i t  |  i i d d d … ƒ }5 dl |5 }5 | |5 ƒ | d ƒ x | D] }< | |< ƒ qçW| ds |= ƒ |; iF } | tG d ƒ | dt t i iH |8 ƒ ƒ d i t  |  i i  d d d … ƒ }6 dl |6 }6 | |6 ƒ | d ƒ x | D] }< | |< ƒ q…Wt! iC |8 |: iJ ƒ  dn ƒ t! iC |9 |; iJ ƒ  dn ƒ |: iK ƒ  |; iK ƒ  n» tL iF } x | D] }< | |< ƒ qóWtM iF } x | D] }< | |< ƒ qWt  |  i i o( t$ i) t  |  i i d d d … ƒ n t  |  i i  o( t% i) t  |  i i d d d … ƒ n d S(w   s/       Generates the code for a custom class.
    Ns   ::R[   s   .hR§   R%   s   \\ns   
s   ^###\s*$i   i    R¨   sq   %s has extra code, but you are not overwriting existing sources: please check that the resulting code is correct!iÿÿÿÿs	   wxWindow*t   parentR_   RÃ   t   constructori   i   t    s   , s   =%sR¥   t   custom_basesz   %s has custom base classes, but you are not overwriting existing sources: please check that the resulting code is correct!s	   , public t   ,s   
class %s: public %s {
s   public:
s   // begin wxGlade: %s::ids
t   get_ids_codes   enum {
s   ,
s   };
s   // end wxGlade

s   %s(%s);
s
   
private:
s   // begin wxGlade: %s::methods
s   void set_properties();
s   void do_layout();
s   // end wxGlade
s   protected:
s!   // begin wxGlade: %s::attributes
s   %s* %s;
s   DECLARE_EVENT_TABLE();
s	   
public:
i   t   wxCommandEvents8   virtual void %s(%s &event); // wxGlade: <event_handler>
s   }; // wxGlade: end class

s   <%swxGlade replace %s ids>sG   wxGlade ids block not found for %s, ids declarations code NOT generateds   <%swxGlade replace %s methods>sO   wxGlade methods block not found for %s, methods declarations code NOT generateds!   <%swxGlade replace %s attributes>sU   wxGlade attributes block not found for %s, attributes declarations code NOT generateds   
protected:
s   DECLARE_EVENT_TABLE()
s   <%swxGlade event_handlers %s>sE   wxGlade events block not found for %s, event table code NOT generatedt   styles   %ss   %s(%s)s   ()s   
%s::%s(%s):
%s%s
{
s   // begin wxGlade: %s::%s
t   get_init_codes   set_properties();
s   do_layout();
s   }

s   <%swxGlade replace %s %s>s;   wxGlade %s::%s block not found, relative code NOT generateds   
BEGIN_EVENT_TABLE(%s, %s)
s"   // begin wxGlade: %s::event_table
s   %s(%s, %s::%s)
s   END_EVENT_TABLE();
s"   <%swxGlade replace %s event_table>sD   wxGlade %s::event_table block not found, relative code NOT generateds   

void %s::%s(%s &event)
{
s   event.Skip();
s‚   wxLogDebug(wxT("Event handler (%s::%s) not implemented yet")); //notify the user that he hasn't implemented the event handler yet
s   }
s   

s"   // wxGlade: add %s event handlers
s!   <%swxGlade add %s event handlers>sG   wxGlade %s event handlers marker not found, relative code NOT generatedt   get_properties_codes   
void %s::set_properties()
{
s%   // begin wxGlade: %s::set_properties
s%   <%swxGlade replace %s set_properties>sG   wxGlade %s::set_properties block not found, relative code NOT generateds   
void %s::do_layout()
{
s    // begin wxGlade: %s::do_layout
t   get_layout_codes    <%swxGlade replace %s do_layout>sB   wxGlade %s::do_layout block not found, relative code NOT generatedR¬   s   <%swxGlade insert new_classes>s!   // begin wxGlade: ::dependencies
RL   R‹   s   #include "%s.h"
s   #include %s
s!   <%swxGlade replace  dependencies>s‘   %s (or one of its chilren) has extra code classes, but you are not overwriting existing sources: please check that the resulting code is correct!s0   // begin wxGlade: ::extracode
%s
// end wxGlade
s   <%swxGlade replace  extracode>R   s   .cppRZ   s   
#ifndef %s
#define %s
s"   
// begin wxGlade: ::dependencies
s   
#endif // %s
s   #include "%s"

(   s	   wxWindow*s   parent(   s   ints   id(N   R   t   has_keyR­   R   Rs   Rx   Rt   RU   R/   R‚   RM   Rb   t   existsR   R   R   R$   R)   R   R®   R¯   R`   R¸   R¢   R¹   R   RO   Rd   R    Rº   R   R»   R   Re   R¼   R   Rq   Rr   t   rangeR   Rµ   R‘   R¥   t   stripRI   R   RÖ   R
   R*   R   R'   R   R   R   R´   RÙ   R   R   RÚ   t   generate_common_propertiesR   R	   R   RÛ   R   R   R’   R“   Ry   Rz   R}   Rm   R~   R   R”   R.   R{   R|   (>   t   code_objt   prev_srcR0   t   is_newt   header_buffert   source_buffert   hwritet   swriteRÁ   RÆ   t   default_signt   signt   defaultsR‡   R†   t   tmp_signt
   sign_decl2t   it
   sign_decl1R˜   t	   sign_instR   RÔ   R¯   t   _[3]t   bR   t   o_typet   o_namet   already_theret   tplt   win_idRÄ   RÅ   t   evt_typeR•   t   propRØ   t   _[4]t   basest   _[5]t   restt   tabt
   init_linesR   t   lt   has_event_tablet   obj_pt   layout_linest   sizers_init_linest   extra_modulesR›   t   moduleR   R   R   t   header_filet   source_filet   houtt   soutRA   t   hn(    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyt	   add_class[  sH   $

#
			$!% (1  .	
	=
!


 "
 					 "			 	
		02!
   	
 		 	
	
  	
   	
	 )
	&&
			 $
 )

&

 	&

 
	 	 "c         C   s!  t  p
 t } nJ t i i t d ƒ } t i i | ƒ p
 d } n t o
 d } n d } | d j	 o d Sn |  i	 d ƒ } |  i	 d ƒ } | p | o d Sn g  } | i
 } t d ƒ } | d | ƒ | d ƒ | | d ƒ | d	 ƒ | d
 | ƒ | d | ƒ | | d ƒ | | d | | | f ƒ | | d | ƒ | | d | ƒ | | d ƒ t  o‹ t i i t d ƒ } t i ƒ  }	 |	 i }
 x t D] } |
 | ƒ qŸW|
 d | ƒ x | D] } |
 | ƒ qÈWt i | |	 i ƒ  d ƒ n% t i }
 x | D] } |
 | ƒ q	Wd S(   su       Generates the code for a wxApp instance.
    if the 'class' property has no value, the function does nothing
    s   main.cppi   Nt   classt
   top_windows   

class %s: public wxApp {
s   public:
s   bool OnInit();
s   };

s   IMPLEMENT_APP(%s)

s   bool %s::OnInit()
{
s   wxInitAllImageHandlers();
s0   %s* %s = new %s(NULL, wxID_ANY, wxEmptyString);
s   SetTopWindow(%s);
s   %s->Show();
s   return true;
}
s   #include "%s.h"

R   (   Rs   Rx   Rt   RU   R/   R‚   RÝ   R   Rb   R¹   R)   RI   Ry   Rz   R}   Rm   Re   R“   R”   R|   (   Rƒ   t   top_win_classRâ   R0   R­   t   top_winRž   R)   Rý   t   outR}   RA   (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyt   add_app»  sL    	

		  	 c         C   sÁ   |  i  o d } d } n d |  i } |  i } |  i i d d ƒ i ƒ  } | d d j } t d j  p |  i d j o
 d	 } n d
 } | o | | d | | d  f Sn | | d | Sd S(   sJ       returns the code fragment that sets the size of the given object.
    R%   t   thiss   %s->t   sizeiÿÿÿÿt   di   i   t   SetSizet
   SetMinSizes   (wxDLG_UNIT(%s, wxSize(%s)));
s   (wxSize(%s));
N(   i   i   (   R³   R   R¢   R¹   Rß   RY   RÑ   R   (   R£   t   name1t   name2R  t   use_dialog_unitst   method(    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyt   generate_code_sizeð  s    

c      	   C   s>   d t  |  d d !d ƒ t  |  d d !d ƒ t  |  d d ƒ f S(   Ns
   %d, %d, %di   i   i   i   (   R_   (   RQ   (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyt   _string_to_colour  s    c         C   su   |  i  p d |  i } n d } y d t |  i d ƒ } Wn* t t f j
 o d |  i d } n X| d | S(   s[       returns the code fragment that sets the foreground colour of
    the given object.
    s   %s->R%   s   wxColour(%s)t
   foregrounds   wxSystemSettings::GetColour(%s)s   SetForegroundColour(%s);
(   R³   R   R  R¢   t
   IndexErrorRa   (   R£   t   introt   color(    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyt   generate_code_foreground  s    c         C   su   |  i  p d |  i } n d } y d t |  i d ƒ } Wn* t t f j
 o d |  i d } n X| d | S(   s[       returns the code fragment that sets the background colour of
    the given object.
    s   %s->R%   s   wxColour(%s)t
   backgrounds   wxSystemSettings::GetColour(%s)s   SetBackgroundColour(%s);
(   R³   R   R  R¢   R  Ra   (   R£   R  R   (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyt   generate_code_background  s    c   	      C   s˜   |  i  d } | d } | d } | d } | d } | d } d | d i d	 d
 ƒ } |  i o
 d } n d |  i } | d | | | | | | f S(   sG       returns the code fragment that sets the font the given object.
    t   fontR  t   familyt
   underlinedRØ   t   weights   "%s"t   faceRL   s   \"R%   s   %s->s.   SetFont(wxFont(%s, %s, %s, %s, %s, wxT(%s)));
(   R¢   RM   R³   R   (	   R£   R$  R  R%  R&  RØ   R'  R(  R  (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyt   generate_code_font'  s    
iè  c         C   sÐ   | d j o |  i i d ƒ } n | p d Sn | i d ƒ } t | ƒ d j o | d  \ } } n d | d f S| p d | f Sn | i ƒ  d j o d	 t t ƒ } t d 7a n d
 | | f | f S(   sù       returns a 2-tuple of strings representing the LOC that sets the id of the
    given object: the first line is the declaration of the variable, and is
    empty if the object's id is a constant, and the second line is the value
    of the id
    RÃ   R%   t   wxID_ANYt   =i   i   i    t   ?s   wxID_HIGHEST + s   %s = %sN(   R%   R*  (   R   R¢   R¹   Rd   R»   Rß   Rh   R^   (   R£   RÃ   t   tokensR   t   val(    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyR¶   8  s    	'c         C   s:   |  i  p d |  i } n d } | d t |  i d ƒ S(   sQ       returns the code fragment that sets the tooltip of
    the given object.
    s   %s->R%   s   SetToolTip(%s);
t   tooltip(   R³   R   RT   R¢   (   R£   R  (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyt   generate_code_tooltipO  s    c         C   s!   |  i  p d |  i Sn d Sd  S(   Ns   %s->R%   (   R³   R   (   R£   (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyt   _get_code_nameY  s    c         C   sJ   t  |  ƒ } y t |  i d ƒ } Wn t } n X| o | d Sn d  S(   Nt   disableds   Enable(false);
(   R1  R_   R¢   R   (   R£   R   R2  (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyt   generate_code_disabled^  s
    c         C   sJ   t  |  ƒ } y t |  i d ƒ } Wn t } n X| o | d Sn d  S(   Nt   focuseds   SetFocus();
(   R1  R_   R¢   R   (   R£   R   R4  (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyt   generate_code_focusedf  s
    c         C   sJ   t  |  ƒ } y t |  i d ƒ } Wn t } n X| o | d Sn d  S(   Nt   hiddens   Hide();
(   R1  R_   R¢   R   (   R£   R   R6  (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyt   generate_code_hiddenn  s
    c         C   sY   t  |  ƒ } |  i d } g  } x3 t | ƒ D]% } | i | d | | | f ƒ q, W| S(   Nt   extrapropertiess   Set%s(%s);
(   R1  R¢   t   sortedR)   (   R£   R   Rø   t   retR   (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyt   generate_code_extrapropertiesv  s     #c         C   s†  |  i  } g  } | i d d ƒ i ƒ  o | i t |  ƒ ƒ n | i d ƒ o | i t |  ƒ ƒ n | i d ƒ o | i t |  ƒ ƒ n | i d ƒ o | i t |  ƒ ƒ n | i d ƒ o | i t |  ƒ ƒ n | i d ƒ o | i t	 |  ƒ ƒ n | i d ƒ o | i t
 |  ƒ ƒ n | i d	 ƒ o | i t |  ƒ ƒ n | i d
 ƒ o" |  i o | i t |  ƒ ƒ n | S(   s¶       generates the code for various properties common to all widgets (background
    and foreground colors, font, ...)
    Returns a list of strings containing the generated code
    R  R%   R"  R  R$  R/  R2  R4  R6  R8  (   R¢   R¹   Rß   R)   R  R#  R!  R)  R0  R3  R5  R7  t   previewR‘   R;  (   t   widgetRø   R  (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyRà     s    	0'''''''t   FontPropertyHandlerc           B   s¹   e  Z d  Z h  d d <d d <d d <d d <d	 d
 <d d <d d <Z h  d d <d d <d d <Z h  d d <d d <d d <Z d „  Z d „  Z d „  Z d „  Z	 RS(   s   Handler for font propertiest	   wxDEFAULTt   defaultt   wxDECORATIVEt
   decorativet   wxROMANt   romant   wxSWISSt   swisst   wxSCRIPTt   scriptt   wxMODERNt   modernt
   wxTELETYPEt   teletypet   wxNORMALt   normalt   wxSLANTt   slantt   wxITALICt   italict   wxLIGHTt   lightt   wxBOLDt   boldc         C   s‚   h  |  i  d <|  i d <|  i d <|  _ h  d d <d d <d d <d d <d d <d d <|  _ d  |  _ g  |  _ d  S(	   NR%  RØ   R'  t   0R  R&  R%   R(  (   t   font_familiest   font_stylest   font_weightst   dictst   attrsR   t   currentt	   curr_data(   R   (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyR   ¡  s    (	c         C   s@   g  |  _  | d j o | |  i j o | |  _ n
 d  |  _ d  S(   NR$  (   R^  R\  R]  R   (   R   R   R\  (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyt
   start_elem©  s    	c         C   s   | d j o |  i  | i d <t Snu |  i d  j	 od |  i i |  i ƒ } | o" | i d i |  i ƒ d ƒ } n d i |  i ƒ } | |  i  |  i <n d  S(   NR$  R%   RW  (	   R\  R¢   R$   R]  R   R[  R¹   R/   R^  (   R   R   Rá   t   decodeR.  (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyt   end_elem¯  s    )c         C   s   |  i  i | ƒ d  S(   N(   R^  R)   (   R   t   data(    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyt	   char_data¹  s    (
   R   R   R   RX  RY  RZ  R   R_  Ra  Rc  (    (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyR>  —  s   			
t   DummyPropertyHandlerc           B   s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   s2   Empty handler for properties that do not need codec         C   s   d  S(   N(    (   R   R   R\  (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyR_  Á  s    c         C   s   t  S(   N(   R$   (   R   R   Rá   (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyRa  Â  s    c         C   s   d  S(   N(    (   R   Rb  (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyRc  Ã  s    (   R   R   R   R_  Ra  Rc  (    (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyRd  ¿  s   		t   EventsPropertyHandlerc           B   s,   e  Z d  „  Z d „  Z d „  Z d „  Z RS(   c         C   s   h  |  _  d  |  _ g  |  _ d  S(   N(   t   handlersR   t
   event_namet   curr_handler(   R   (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyR   É  s    		c         C   s"   | d j o | d |  _  n d  S(   NRÅ   RÄ   (   Rg  (   R   R   R\  (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyR_  Î  s    c         C   s€   | d j oJ |  i  o* |  i o  d i |  i ƒ |  i |  i  <n d  |  _  g  |  _ n& | d j o |  i | i d <t Sn d  S(   NRÅ   R%   R¦   (   Rg  Rh  R/   Rf  R   R¢   R$   (   R   R   Rá   (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyRa  Ò  s     	c         C   s+   | i  ƒ  } | o |  i i | ƒ n d  S(   N(   Rß   Rh  R)   (   R   Rb  (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyRc  Ü  s    (   R   R   R   R_  Ra  Rc  (    (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyRe  È  s   			
t   ExtraPropertiesPropertyHandlerc           B   s,   e  Z d  „  Z d „  Z d „  Z d „  Z RS(   c         C   s   h  |  _  d  |  _ g  |  _ d  S(   N(   R   R   t	   prop_namet	   curr_prop(   R   (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyR   å  s    		c         C   s\   | d j oK | d } | o- | d i  ƒ  o | d i ƒ  | d } n | |  _ n d  S(   Nt   propertyR   i    i   (   t   islowerR   Rj  (   R   R   R\  (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyR_  ê  s
    
c         C   s€   | d j oJ |  i  o* |  i o  d i |  i ƒ |  i |  i  <n d  |  _  g  |  _ n& | d j o |  i | i d <t Sn d  S(   NRl  R%   R8  (   Rj  Rk  R/   R   R   R¢   R$   (   R   R   Rá   (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyRa  ñ  s     	c         C   s+   | i  ƒ  } | o |  i i | ƒ n d  S(   N(   Rß   Rk  R)   (   R   Rb  (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyRc  û  s    (   R   R   R   R_  Ra  Rc  (    (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyRi  ä  s   			
R$  R¦   R8  c         C   sP   y t  | |  } Wn% t j
 o t i |  d  ƒ } n X| o | ƒ  Sn d  S(   N(   t   _property_writersR`   t   _global_property_writersR¹   R   (   t   property_namet   widget_namet   cls(    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyt   get_property_handler  s    %c         C   sZ   | d j o | t |  <n< y | t | |  <Wn& t j
 o h  | |  <t | <n Xd S(   sà       sets a function to parse a portion of XML to get the value of the property
    property_name. If widget_name is not None, the function is called only if
    the property in inside a widget whose class is widget_name
    N(   R   Ro  Rn  R`   (   Rp  RÅ   Rq  (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyt   add_property_handler  s    t   WidgetHandlerc           B   sG   e  Z d  Z g  Z g  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 RS(   sM       Interface the various code generators for the widgets must implement
    c         C   s   g  g  g  g  f S(   sÜ           Handler for normal widgets (non-toplevel): returns 4 lists of strings,
        init, ids, properties and layout, that contain the code for the
        corresponding parts/methods of the class to generate
        (    (   R   R£   (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyR°   3  s    c         C   s   g  S(   s™           Handler for the code of the set_properties method of toplevel objects.
        Returns a list of strings containing the code to generate
        (    (   R   R£   (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyRÚ   ;  s    c         C   s   g  S(   s2          Handler for the code of the constructor of toplevel objects.  Returns a
        list of strings containing the code to generate.  Usually the default
        implementation is ok (i.e. there are no extra lines to add). The
        generated lines are appended at the end of the constructor
        (    (   R   R£   (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyRÙ   B  s    c         C   s   g  S(   sí           Handler for the code of the ids enum of toplevel objects.
        Returns a list of strings containing the code to generate.
        Usually the default implementation is ok (i.e. there are no
        extra lines to add)
        (    (   R   R£   (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyRÖ   K  s    c         C   s   g  S(   sõ           Handler for the code of the do_layout method of toplevel objects.
        Returns a list of strings containing the code to generate.
        Usually the default implementation is ok (i.e. there are no
        extra lines to add)
        (    (   R   R£   (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyRÛ   T  s    (
   R   R   R   RÒ   R¬   R°   RÚ   RÙ   RÖ   RÛ   (    (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyRu  %  s   						c         C   s   | t  |  <d  S(   N(   R®   (   Rq  RÅ   (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyt   add_widget_handler`  s    c         C   s+   h  } x |  D] } d | | <q W| i  ƒ  S(   s^       Strips all duplicates from sequence. Works only if items of sequence
    are hashable
    i   (   t   keys(   t   sequenceRœ   t   item(    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyR’   d  s     c         C   sq   g  } d |  i  j o | Sn t |  ƒ \ } } x: |  i  d i ƒ  D]% \ } } | i | | | | f ƒ qD W| S(   sœ       Returns the list of event handlers defined for `obj', setting the type of
    the argument of the handlers (i.e. the event parameter) to `evt_type'
    R¦   (   R¢   R¶   R·   R)   (   R£   R÷   R:  RÂ   RÃ   RÄ   RÅ   (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pyt   get_events_with_typen  s     (H   t   sysRt   t   os.pathRe   Rn   Ry   R   t	   xml_parseR    t   languaget   modulesR   t   writert   default_extensionsR   R   R®   R*   Rm   R   Rs   R{   R|   Rv   R‚   RY   R   R   Rx   RI   Rb   RP   R    RN   RJ   R$   RT   RŠ   R    R¤   RÉ   RÐ   R  R  R  R  R!  R#  R)  R^   R¶   R0  R1  R3  R5  R7  R;  Rà   R>  Rd  t   objectRe  Ri  Ro  Rn  t   _obj_headersRs  Rt  Ru  Rv  R’   Rz  (    (    (    sI   C:\Python25\Lib\site-packages\_spe\plugins\wxGlade\codegen\cpp_codegen.pys   <module>   s|   $ 			_	s	
	Y		ÿ ÿ b	5						
							(	 		;		
