def menu_callback(m):
 if m.returnkey.startswith('# '):
  cmd = m.returnkey[2:]
  if (m.handler is not None):
   if (m.handler_result is None):
    return
   cmd += m.handler_result
  process_stdin(cmd)
 elif (m.returnkey == 'menuSettings'):
  wxsettings.WXSettings(mestate.settings)
 elif m.returnkey.startswith('mode-'):
  idx = int(m.returnkey[5:])
  mestate.flightmode_selections[idx] = m.IsChecked()
 elif m.returnkey.startswith('loadLog'):
  print ('File: ' + m.returnkey[8:])
 elif (m.returnkey == 'quit'):
  mestate.console.close()
  mestate.exit = True
  print 'Exited. Press Enter to continue.'
  sys.exit(0)
 else:
  print ('Unknown menu selection: %s' % m.returnkey)

def menu_callback ( m ) : if m . returnkey . startswith ( '# ' ) : cmd = m . returnkey [ 2 : ] if ( m . handler is not None ) : if ( m . handler_result is None ) : return cmd += m . handler_result process_stdin ( cmd ) elif ( m . returnkey == 'menuSettings' ) : wxsettings . WXSettings ( mestate . settings ) elif m . returnkey . startswith ( 'mode-' ) : idx = int ( m . returnkey [ 5 : ] ) mestate . flightmode_selections [ idx ] = m . IsChecked ( ) elif m . returnkey . startswith ( 'loadLog' ) : print ( 'File: ' + m . returnkey [ 8 : ] ) elif ( m . returnkey == 'quit' ) : mestate . console . close ( ) mestate . exit = True print 'Exited. Press Enter to continue.' sys . exit ( 0 ) else : print ( 'Unknown menu selection: %s' % m . returnkey )
called on menu selection .