Working with generated source code
As a simple rule; Don't modify the code in generated _init_* methods.
Boa currently generates / maintains the source code for:
- The wxApp class / modules
- The modules dictionary
- References, importing and the creation of the main frame
- Frame classes / modules (Frames, Dialogs and MDI frames)
- Importing of needed wxPython modules
- Window identifiers: wxID_* Each method has it's own window id list
- Special methods: _init_*
- _init_ctrls: Create and setup visual controls
- _init_utils: Create and setup non visible objects
- _init_coll_*: Create and setup of collections
- Event method declarations: On*
Note: Boa only defines the methods,
it does not maintain their code bodies, this is your responsibility
Unsupported controls
If you want to add controls or objects not available on the Palette, simply
add your code to the __init__ method below the call to _init_ctrls().
Don't add it in the Special methods listed above. Your code will be lost.
Also, don't add your own window identifier to the list Boa maintains.
Define your own window ids in a seperate list.
Generated code policy
Although is is possible to change the generated code by hand, it is not advised,
and under normal circumstances, not necessary.
If you really need to modify generated code, keep the following in mind:
- Only controls defined on the Palette may be used.
- Constructors need all parameters passed, and in keyword argument form
- Only methods defined or idenfified as property setter methods may be used
- Whitespace (blank lines) is significant for collection methods.
They are in the form:
Initialiser (optional)
blank line
Item definitions (1 or more lines)
blank line
Finaliser (optional)
In summary, if Boa can't generate the code, it will also not be able to parse it.
Renaming event methods (On*)
One thing that Boa does not support yet is to rename event methods. You have to
do this by hand. Remember to also change the EVT_* binding to the method in the
_init_* methods when you rename the method. Mind your spelling, Boa is not
forgiving ;) This will be automated in the future.