Package pyplusplus :: Package gui :: Module wizard

Source Code for Module pyplusplus.gui.wizard

 1  """generates Py++ code from the user data""" 
 2   
 3  CODE_TEMPLATE = \ 
 4  """ 
 5  import os 
 6  from pyplusplus import module_builder 
 7   
 8  #Creating an instance of class that will help you to expose your declarations 
 9  mb = module_builder.module_builder_t( [r"%(file_path)s"] 
10                                        , gccxml_path=r"%(gccxml_path)s"  
11                                        , working_directory=r"%(working_dir)s" 
12                                        , include_paths=%(include_paths)s 
13                                        , define_symbols=%(define_symbols)s ) 
14   
15   
16  #Well, don't you want to see what is going on? 
17  mb.print_declarations() 
18   
19  #Creating code creator. After this step you should not modify/customize declarations. 
20  mb.build_code_creator( module_name='pyplusplus' ) 
21   
22  #Writing code to file. 
23  mb.write_module( './bindings.cpp' ) 
24  """ 
25   
26 -class wizard_t( object ):
27 """code generator that creates Py++ code"""
28 - def __init__( self 29 , parser_configuration 30 , source_file ):
31 object.__init__( self ) 32 self._parser_configuration = parser_configuration 33 self._source_file = source_file
34
35 - def create_code( self ):
36 global CODE_TEMPLATE 37 return CODE_TEMPLATE % { 38 'gccxml_path' : self._parser_configuration.gccxml_path 39 , 'working_dir' : self._parser_configuration.working_directory 40 , 'include_paths' : `self._parser_configuration.include_paths` 41 , 'define_symbols' : `self._parser_configuration.define_symbols` 42 , "file_path" : self._source_file 43 }
44