## explore keymap generated by addons
import bpy

exclude = (
### add lines here to exclude specific attribute
'bl_rna', 'identifier','name_property','rna_type','properties', 'compare', 'to_string',#basic
## To avoid recursion/crash on direct object call (comment for API check on deeper props)
#'data', 'edges', 'faces', 'edge_keys', 'polygons', 'loops', 'face_maps', 'original',
'is_user_defined', 'is_user_modified',
##  Avoid some specific properties
#'matrix_local', 'matrix_parent_inverse', 'matrix_basis','location','rotation_euler', 'rotation_quaternion', 'rotation_axis_angle', 'scale', 'translation',
)

print('== Addons keymaps print ==')
wm = bpy.context.window_manager
for cat, keymap in wm.keyconfigs.user.keymaps.items():#wm.keyconfigs.addon.keymaps.items():
    # if not '3d view' in cat.lower() or 'generic'  in cat.lower(): continue#filter
    print(f'--- {cat} - {keymap.space_type}')
    # print(dir(keymap))
    for k in keymap.keymap_items:#seems to be only user modified keymaps
        # print(dir(k))
        
        # all_prop = [f'{prop} : {getattr(k, prop)}' for prop in dir(k) if not prop.startswith('__') and not prop in exclude]
        # print(k.idname)
        
        #for p in all_prop: print('  ', p)
        #print(f"{k.name}: {'ctrl ' if k.ctrl else ''}{'shift ' if k.shift else ''}{'alt ' if k.alt else ''}{k.type} ({k.value.lower()}) {k.idname}")
        
        ## dpiplay clearly the shortcuts
        mods = ' + '.join([m for m in ('ctrl','shift','alt') if getattr(k, m)])
        val = f' ({k.value.lower()})' if k.value != 'PRESS' else ''
        print(f"{k.name}: {mods + ' ' if mods else ''}{k.type}{val} - {k.idname}")
    print()