wxPython/wxGlade-0.9.1/codegen/cpp_codegen.py
def generate_code_event_table(self, code_obj, is_new, tab, prev_src, event_handlers):
        """Generate code for event table declaration.
        
        code_obj: Object to generate code for (CodeObject)
        is_new: Indicates if previous source code exists (bool)
        tab: Indentation of function body (str)
        prev_src: Previous source code (SourceFileContent)
        event_handlers: List of event handlers (strings)"""
        code_lines = []
        write = code_lines.append

        if not event_handlers:
            return code_lines

        if prev_src and code_obj.klass in prev_src.event_table_decl:
            has_event_table = True
        else:
            has_event_table = False

        if is_new or not has_event_table:
            write('\nBEGIN_EVENT_TABLE(%s, %s)\n' % (code_obj.klass, code_obj.base))
        write(tab + '// begin wxGlade: %s::event_table\n' % code_obj.klass)

        for win_id, event, handler, evt_type in event_handlers:
            if win_id is None: continue
            if 'EVT_NAVIGATION_KEY' in event:
                tmpl = '%(tab)s%(event)s(%(klass)s::%(handler)s)\n'
            else:
                tmpl = '%(tab)s%(event)s(%(win_id)s, %(klass)s::%(handler)s)\n'
            details = { 'tab': tab, 'event': event, 'win_id': win_id, 'klass': code_obj.klass, 'handler': handler }
            write(tmpl % details)

        write(tab + '// end wxGlade\n')
        if is_new or not has_event_table:
            write('END_EVENT_TABLE();\n\n')

        return code_lines
Generate code for event table declaration.
        
        code_obj: Object to generate code for (CodeObject)
        is_new: Indicates if previous source code exists (bool)
        tab: Indentation of function body (str)
        prev_src: Previous source code (SourceFileContent)
        event_handlers: List of event handlers (strings)
Generate code for event table declaration.
Generate code for event table declaration .
def generate_code_event_table(self, code_obj, is_new, tab, prev_src, event_handlers):
        code_lines = []
        write = code_lines.append
        if not event_handlers:
            return code_lines
        if prev_src and code_obj.klass in prev_src.event_table_decl:
            has_event_table = True
        else:
            has_event_table = False
        if is_new or not has_event_table:
            write('\nBEGIN_EVENT_TABLE(%s, %s)\n' % (code_obj.klass, code_obj.base))
        write(tab + '// begin wxGlade: %s::event_table\n' % code_obj.klass)
        for win_id, event, handler, evt_type in event_handlers:
            if win_id is None: continue
            if 'EVT_NAVIGATION_KEY' in event:
                tmpl = '%(tab)s%(event)s(%(klass)s::%(handler)s)\n'
            else:
                tmpl = '%(tab)s%(event)s(%(win_id)s, %(klass)s::%(handler)s)\n'
            details = { 'tab': tab, 'event': event, 'win_id': win_id, 'klass': code_obj.klass, 'handler': handler }
            write(tmpl % details)
        write(tab + '// end wxGlade\n')
        if is_new or not has_event_table:
            write('END_EVENT_TABLE();\n\n')
        return code_lines
def generate_code_event_table ( self , code_obj , is_new , tab , prev_src , event_handlers ) : code_lines = [ ] write = code_lines . append if not event_handlers : return code_lines if prev_src and code_obj . klass in prev_src . event_table_decl : has_event_table = True else : has_event_table = False if is_new or not has_event_table : write ( '\nBEGIN_EVENT_TABLE(%s, %s)\n' % ( code_obj . klass , code_obj . base ) ) write ( tab + '// begin wxGlade: %s::event_table\n' % code_obj . klass ) for win_id , event , handler , evt_type in event_handlers : if win_id is None : continue if 'EVT_NAVIGATION_KEY' in event : tmpl = '%(tab)s%(event)s(%(klass)s::%(handler)s)\n' else : tmpl = '%(tab)s%(event)s(%(win_id)s, %(klass)s::%(handler)s)\n' details = { 'tab' : tab , 'event' : event , 'win_id' : win_id , 'klass' : code_obj . klass , 'handler' : handler } write ( tmpl % details ) write ( tab + '// end wxGlade\n' ) if is_new or not has_event_table : write ( 'END_EVENT_TABLE();\n\n' ) return code_lines
Generate code for event table declaration.
Generate code for event table declaration .
"""Generate code for event table declaration.
        
        code_obj: Object to generate code for (CodeObject)
        is_new: Indicates if previous source code exists (bool)
        tab: Indentation of function body (str)
        prev_src: Previous source code (SourceFileContent)
        event_handlers: List of event handlers (strings)"""
self
code_obj
is_new
tab
prev_src
event_handlers