
if 1:
    api_list = [
        
        
        '_alt',
        '_ctrl',
        '_feedback',
        '_special',
        'abort',
        'accept',
        'alias',
        'align',
        'alter',
        'alter_list',
        'alter_state',
        'angle',
        'attach',
        'auto_measure',
        'backward',
        'bg_color',
        'bg_colour',
        'bond',
        'button',
        'cache',
        'capture',
        'cartoon',    
        'cd',
        'center',
        'check',
        'clean', 
        'clip',
        'cls',
        'color',
        'colour',
        'commands',
        'config_mouse',
        'copy',
        'copy_image',
        'count_atoms',
        'count_frames',
        'count_states',
        'create',
        'cycle_valence',
        'decline',
        'del_colorection',
        'delete',
        'deprotect',
        'deselect',
        'dihedral',
        'dir',
        'dirty',
        'dirty_wizard',
        'disable',
        'dist',
        'distance',
        'do',
        'drag',
        'draw',
        'dss',
        'dummy',
        'dump',
        'edit',
        'edit_mode',
        'enable',
        'ending',
        'export_coords', # experimental
        'export_dots',
        'extend',
        'extract',
        'fab',
        'feedback',
        'fetch',
        'find_pairs',
        'finish_object',
        'fit',
        'fix_chemistry',
        'flag',
        'forward',
        'fragment',
        'frame',
        'full_screen',
        'fuse',
        'get',
        'get_angle',
        'get_area',
        'get_atom_coords',
        'get_bond_print',
        'get_busy',
        'get_chains',
        'get_color_index',
        'get_color_indices',
        'get_color_tuple',
        'get_colorection',
        'get_dihedral',
        'get_distance',
        'get_editor_scheme',
        'get_extent',
        'get_fastastr',
        'get_frame',
        'get_idtf',
        'get_legal_name',
        'get_modal_draw',
        'get_model',
        'get_movie_length',
        'get_movie_locked',
        'get_movie_playing',
        'get_mtl_obj',
        'get_names',
        'get_names_of_type',
        'get_object_color_index',
        'get_object_list',
        'get_object_matrix',
        'get_pdbstr',
        'get_phipsi',
        'get_position',
        'get_povray',
        'get_progress',
        'get_raw_alignment',
        'get_renderer',
        'get_scene_dict',
        'get_scene_list',
        'get_session',
        'get_setting_boolean', 
        'get_setting_float',   
        'get_setting_int',     
        'get_setting_legacy',  
        'get_setting_text',
        'get_setting_tuple',   
        'get_setting_updates', 
        'get_state',
        'get_symmetry',
        'get_title',
        'get_type',
        'get_unused_name',
        'get_version',
        'get_view',
        'get_vis',
        'get_vrml',
        'get_wizard',
        'get_wizard_stack',
        'gradient',
        'group',
        'h_add',
        'h_fill',
        'h_fix',
        'help',
        'hide',
        'id_atom',
        'identify',
        'import_coords', # experimental
        'index',
        'indicate',
        'interrupt',
        'intra_fit',
        'intra_rms',
        'intra_rms_cur',
        'invert',
        'isodot',
        'isolevel',
        'isomesh',
        'isosurface',
        'iterate',
        'iterate_state',
        'label',
        'label2',        
        'load',
        'load_brick',
        'load_callback',
        'load_cgo',
        'load_coords',
        'load_embedded',
        'load_map',
        'load_model',
        'load_object',
        'load_png',
        'load_raw',
        'load_traj',
        'log',
        'log_close',
        'log_open',
        'ls',
        'madd',
        'map_double',
        'map_halve',
        'map_new',
        'map_set',
        'map_set_border',
        'map_trim',
        'mappend',
        'mask',
        'matrix_copy',
        'matrix_reset',
        'matrix_transfer',
        'mclear',
        'mdo',
        'mdump',
        'mem',
        'meter_reset',
        'middle',
        'mmatrix',
        'mouse',
        'move',
        'mplay',
        'mpng',
        'mray',
        'mset',
        'mstop',
        'mtoggle',
        'multisave',
        'mview',
        'order',
        'orient',
        'origin',
        'overlap',
        'pair_fit',
        'phi_psi',
        'png', 
        'pop',
        'protect',
        'pseudoatom',
        'push_undo',
        'pwd',
        'quit',
        'ramp_new',
        'ray',
        'read_mmodstr',
        'read_molstr',
        'read_pdbstr',
        'read_sdfstr',
        'read_xplorstr',
        'ready',
        'rebuild',
        'recolor',
        'recolour',        
        'redo',
        'reference', 
        'refresh',
        'refresh_wizard',
        'reinitialize',
        'remove',
        'remove_picked',
        'rename',
        'replace',
        'replace_wizard',
        'reset',
        'resume',
        'rewind',
        'rms',
        'rms_cur',
        'rock',
        'rotate',
        'save',
        'scene',
        'scene_order',
        'sculpt_activate',
        'sculpt_deactivate',
        'sculpt_iterate',
        'sculpt_purge',
        'select',
        'select_list',
        'set',
        'set_bond',
        'set_color',
        'set_colorection',    
        'set_colorection_name',
        'set_colour',
        'set_colour',
        'set_dihedral',
        'set_geometry',
        'set_key',
        'set_name',
        'set_object_color',
        'set_object_color',
        'set_object_ttt',
        'set_session',
        'set_symmetry',
        'set_title',
        'set_view',
        'set_vis',
        'set_wizard',    
        'set_wizard_stack',
        'show',
        'show_as',
        'show_help',
        'slice_new',
        'smooth',
        'sort',
        'space',
        'spectrum',
        'spheroid',
        'splash',
        'split_states',
        'stereo',
        'super',
        'symexp',
        'sync',
        'system',
        'test',
        'toggle',
        'torsion',
        'transform_object',
        'transform_selection',
        'translate',
        'translate_atom',
        'turn',
        'unbond',
        'undo',
        'ungroup',
        'unmask',
        'unpick',
        'unprotect',
        'unset',
        'unset_bond',
        'update',
        'valence',
        'vdw_fit',
        'view',
        'viewport',
        'window',
        'wizard',
        'zoom',

    ]

import sys
import string

lines = open("cmd2.py").readlines()
if len(lines):
    file = open("cmd2.py","wa")
    for line in lines:
        file.write(line)
        if string.find(line, "AUTOGENERATED BEYOND THIS POINT")>=0:
            break

for fn in api_list:
    file.write('''
    def %s(self, *a, **k):
        k['_self']=self
        return apply(global_cmd.%s, a, k)
    '''%(fn,fn)) #this ' is here to trick emacs font-lock-mode

file.write("\n")

if __name__=='pymol':

    # the following symbols are either unneeded or provided elsewhere...
    
    exclude = [
        'DEFAULT_ERROR',
        'DEFAULT_SUCCESS',
        'QuietException',
        'Shortcut',
        '_COb',
        '__builtins__',
        '__doc__',
        '__file__',
        '__main__',
        '__name__',
        '__script__',
        '_adjust_coord',
        '_cache_clear',
        '_cache_get',
        '_cache_mark',
        '_cache_purge',
        '_cache_set',
        '_cmd',
        '_coordset_update_spawn',
        '_coordset_update_thread',
        '_copy_image',
        '_deferred_init_pymol_internals',
        '_do',
        '_dump_floats',
        '_dump_ufloats',
        '_expandvars',
        '_fake_drag',
        '_fb_dict',
        '_get_color_sc',
        '_get_feedback',
        '_interpret_color',
        '_interpret_color',
        '_invalidate_color_sc',
        '_invalidate_color_sc',
        '_load',
        '_load2str', 
        '_mpng',
        '_nt_expandvars',
        '_object_update_spawn',
        '_object_update_thread',
        '_parser',
        '_png',
        '_pymol',
        '_quit',
        '_raising',
        '_ray_anti_spawn',
        '_ray_hash_spawn',
        '_ray_spawn',
        '_refresh',
        '_sdof',
        '_sgi_stereo',
        '_validate_color_sc',
        'alt',
        'alt_special',
        'as',
        'auto_arg',
        'block_flush',
        'boolean_dict',
        'boolean_sc',
        'check_redundant_open',
        'cmd',
        'color_sc',
        'commanding',
        'completing',
        'contour_sc',
        'controlling',
        'creating',
        'ctrl',
        'ctrl_special',
        'ctsh_special',
        'editing',
        'editor',
        'exp_path',
        'expfit',
        'exporting',
        'fast_minimize',
        'fb_action',
        'fb_action_sc',
        'fb_debug',
        'fb_mask',
        'fb_mask_sc',
        'fb_module',
        'fb_module_sc',
        'file_ext_re',
        'get_feedback', # legacy
        'gz_ext_re',
        'help_only',
        'help_sc',
        'helping',
        'internal',
        'io',
        'is_dict',
        'is_error',
        'is_glut_thread',
        'is_list',
        'is_ok',
        'is_sequence',
        'is_string',
        'is_tuple',
        'keyboard',
        'keyword',
        'keywords',
        'kw_list',
        'kwhash',
        'loadable',
        'location_code',
        'location_sc',
        'lock',
        'lock_api',
        'lock_api_allow_flush',
        'lock_api_c',
        'lock_api_data',
        'lock_api_glut',
        'lock_api_status',
        'lock_attempt',
        'lock_c',
        'lock_data',
        'lock_glut',
        'lock_status',
        'lock_status_attempt',
        'lock_without_glut',
        'map_sc',
        'minimize',
        'movie',
        'moving',
        'nt_hidden_path_re',
        'object_sc',
        'os',
        'palette_dict',
        'palette_sc',
        'parsing',
        'paste',
        'pretty',
        'publication',
        'pymol',
        'python_help',
        'quote_alpha_list_re',
        're',
        'reaper',
        'repres',
        'repres_sc',
        'safe_alpha_list_eval',
        'safe_list_eval',
        'safe_oname_re',
        'sanitize_alpha_list_re',
        'sanitize_list_re',
        'selection_sc',
        'setting',
        'setup_global_locks',
        'shft_special',
        'simple',
        'space_sc',
        'special',
        'stereo_dict',
        'stereo_sc',
        'string',
        'sys',
        'technical',
        'thread',
        'threading',
        'time',
        'toggle_dict',
        'toggle_sc',
        'traceback',
        'types',
        'unblock_flush',
        'unlock',
        'unlock_c',
        'unlock_data',
        'unlock_glut',
        'unlock_status',
        'util',
        'viewing',
        'window_dict',
        'window_sc',
        'write_html_ref',

        ]
    from pymol import cmd
    print "symbols (if any) present in pymol.cmd but not pymol.cmd2.Cmd:"
    for method in dir(cmd):
        if (method not in api_list) and (method not in exclude):
            print "        '%s',"%method
            
    
    

