1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # ##### END GPL LICENSE BLOCK #####
21 # simple script to test 'keyconfig_utils' contains correct values.
24 from bpy_extras import keyconfig_utils
31 for km_name, km_space_type, km_region_type, km_sub in ls:
32 maps[km_name] = (km_space_type, km_region_type)
35 fill_maps(keyconfig_utils.KM_HIERARCHY)
38 keyconf = bpy.context.window_manager.keyconfigs.active
39 maps_bl = set(keyconf.keymaps.keys())
40 maps_py = set(maps.keys())
43 # Check keyconfig contains only maps that exist in blender
44 test = maps_py - maps_bl
46 print("Keymaps that are in 'keyconfig_utils' but not blender")
47 for km_id in sorted(test):
51 test = maps_bl - maps_py
53 print("Keymaps that are in blender but not in 'keyconfig_utils'")
54 for km_id in sorted(test):
55 km = keyconf.keymaps[km_id]
56 print(" ('%s', '%s', '%s', [])," % (km_id, km.space_type, km.region_type))
59 # Check space/region's are OK
60 print("Comparing keymap space/region types...")
61 for km_id, km in keyconf.keymaps.items():
62 km_py = maps.get(km_id)
64 km_space_type, km_region_type = km_py
65 if km_space_type != km.space_type or km_region_type != km.region_type:
67 print(" expected -- ('%s', '%s', '%s', [])," % (km_id, km.space_type, km.region_type))
68 print(" got -- ('%s', '%s', '%s', [])," % (km_id, km_space_type, km_region_type))
78 if err and bpy.app.background:
79 # alert CTest we failed
84 if __name__ == "__main__":