patch [#34437] Fix text editor bug: ctrl+F is not configurable

in fact the keymap editor was missing other keymaps so added these too,
also updated keymap checker to make sure there is no mismatch with region/space types.
This commit is contained in:
Campbell Barton 2013-02-26 05:22:04 +00:00
parent bba6b535de
commit 8558fdd4c7
2 changed files with 53 additions and 16 deletions

View File

@ -18,6 +18,11 @@
# <pep8 compliant>
# bpy.type.KeyMap: (km.name, km.space_type, km.region_type, [...])
# ('Script', 'EMPTY', 'WINDOW', []),
KM_HIERARCHY = [
('Window', 'EMPTY', 'WINDOW', []), # file save, window change, exit
('Screen', 'EMPTY', 'WINDOW', [ # full screen, undo, screenshot
@ -42,6 +47,7 @@ KM_HIERARCHY = [
('Vertex Paint', 'EMPTY', 'WINDOW', []),
('Weight Paint', 'EMPTY', 'WINDOW', []),
('Weight Paint Vertex Selection', 'EMPTY', 'WINDOW', []),
('Face Mask', 'EMPTY', 'WINDOW', []),
('Image Paint', 'EMPTY', 'WINDOW', []), # image and view3d
('Sculpt', 'EMPTY', 'WINDOW', []),
@ -49,9 +55,12 @@ KM_HIERARCHY = [
('Armature Sketch', 'EMPTY', 'WINDOW', []),
('Particle', 'EMPTY', 'WINDOW', []),
('Knife Tool Modal Map', 'EMPTY', 'WINDOW', []),
('Paint Stroke Modal', 'EMPTY', 'WINDOW', []),
('Object Non-modal', 'EMPTY', 'WINDOW', []), # mode change
('3D View Generic', 'VIEW_3D', 'WINDOW', []) # toolbar and properties
('3D View Generic', 'VIEW_3D', 'WINDOW', []), # toolbar and properties
]),
('Frames', 'EMPTY', 'WINDOW', []), # frame navigation (per region)
@ -59,53 +68,65 @@ KM_HIERARCHY = [
('Animation', 'EMPTY', 'WINDOW', []), # frame change on click, preview range (per region)
('Animation Channels', 'EMPTY', 'WINDOW', []),
('Graph Editor', 'GRAPH_EDITOR', 'WINDOW', [
('Graph Editor Generic', 'GRAPH_EDITOR', 'WINDOW', [])
('Graph Editor Generic', 'GRAPH_EDITOR', 'WINDOW', []),
]),
('Dopesheet', 'DOPESHEET_EDITOR', 'WINDOW', []),
('NLA Editor', 'NLA_EDITOR', 'WINDOW', [
('NLA Channels', 'NLA_EDITOR', 'WINDOW', []),
('NLA Generic', 'NLA_EDITOR', 'WINDOW', [])
('NLA Generic', 'NLA_EDITOR', 'WINDOW', []),
]),
('Image', 'IMAGE_EDITOR', 'WINDOW', [
('UV Editor', 'EMPTY', 'WINDOW', []), # image (reverse order, UVEdit before Image
('Image Paint', 'EMPTY', 'WINDOW', []), # image and view3d
('UV Sculpt', 'EMPTY', 'WINDOW', []),
('Image Generic', 'IMAGE_EDITOR', 'WINDOW', [])
('Image Generic', 'IMAGE_EDITOR', 'WINDOW', []),
]),
('Timeline', 'TIMELINE', 'WINDOW', []),
('Outliner', 'OUTLINER', 'WINDOW', []),
('Node Editor', 'NODE_EDITOR', 'WINDOW', [
('Node Generic', 'NODE_EDITOR', 'WINDOW', [])
('Node Generic', 'NODE_EDITOR', 'WINDOW', []),
]),
('Sequencer', 'SEQUENCE_EDITOR', 'WINDOW', [
('SequencerCommon', 'SEQUENCE_EDITOR', 'WINDOW', []),
('SequencerPreview', 'SEQUENCE_EDITOR', 'WINDOW', []),
]),
('Sequencer', 'SEQUENCE_EDITOR', 'WINDOW', []),
('Logic Editor', 'LOGIC_EDITOR', 'WINDOW', []),
('File Browser', 'FILE_BROWSER', 'WINDOW', [
('File Browser Main', 'FILE_BROWSER', 'WINDOW', []),
('File Browser Buttons', 'FILE_BROWSER', 'WINDOW', [])
('File Browser Buttons', 'FILE_BROWSER', 'WINDOW', []),
]),
('Info', 'INFO', 'WINDOW', []),
('Property Editor', 'PROPERTIES', 'WINDOW', []), # align context menu
('Text', 'TEXT_EDITOR', 'WINDOW', []),
('Text', 'TEXT_EDITOR', 'WINDOW', [
('Text Generic', 'TEXT_EDITOR', 'WINDOW', []),
]),
('Console', 'CONSOLE', 'WINDOW', []),
('Clip', 'CLIP_EDITOR', 'WINDOW', [
('Clip Editor', 'CLIP_EDITOR', 'WINDOW', []),
('Clip Graph Editor', 'CLIP_EDITOR', 'WINDOW', []),
('Clip Dopesheet Editor', 'CLIP_EDITOR', 'WINDOW', []),
('Mask Editing', 'EMPTY', 'WINDOW', []), # image (reverse order, UVEdit before Image
]),
('View3D Gesture Circle', 'EMPTY', 'WINDOW', []),
('Gesture Straight Line', 'EMPTY', 'WINDOW', []),
('Gesture Zoom Border', 'EMPTY', 'WINDOW', []),
('Gesture Border', 'EMPTY', 'WINDOW', []),
('Standard Modal Map', 'EMPTY', 'WINDOW', []),
('Transform Modal Map', 'EMPTY', 'WINDOW', []),
('View3D Fly Modal', 'EMPTY', 'WINDOW', []),
('View3D Rotate Modal', 'EMPTY', 'WINDOW', []),
('View3D Move Modal', 'EMPTY', 'WINDOW', []),
('View3D Zoom Modal', 'EMPTY', 'WINDOW', []),
('View3D Dolly Modal', 'EMPTY', 'WINDOW', []),
]

View File

@ -25,40 +25,56 @@ from bpy_extras import keyconfig_utils
def check_maps():
maps = set()
maps = {}
def fill_maps(ls):
for entry in ls:
maps.add(entry[0])
fill_maps(entry[3])
for km_name, km_space_type, km_region_type, km_sub in ls:
maps[km_name] = (km_space_type, km_region_type)
fill_maps(km_sub)
fill_maps(keyconfig_utils.KM_HIERARCHY)
import bpy
maps_bl = set(bpy.context.window_manager.keyconfigs.active.keymaps.keys())
keyconf = bpy.context.window_manager.keyconfigs.active
maps_bl = set(keyconf.keymaps.keys())
maps_py = set(maps.keys())
err = False
# Check keyconfig contains only maps that exist in blender
test = maps - maps_bl
test = maps_py - maps_bl
if test:
print("Keymaps that are in 'keyconfig_utils' but not blender")
for km_id in sorted(test):
print("\t%s" % km_id)
err = True
test = maps_bl - maps
test = maps_bl - maps_py
if test:
print("Keymaps that are in blender but not in 'keyconfig_utils'")
for km_id in sorted(test):
print("\t%s" % km_id)
km = keyconf.keymaps[km_id]
print(" ('%s', '%s', '%s', [])," % (km_id, km.space_type, km.region_type))
err = True
# Check space/region's are OK
print("Comparing keymap space/region types...")
for km_id, km in keyconf.keymaps.items():
km_py = maps.get(km_id)
if km_py is not None:
km_space_type, km_region_type = km_py
if km_space_type != km.space_type or km_region_type != km.region_type:
print(" Error:")
print(" expected -- ('%s', '%s', '%s', [])," % (km_id, km.space_type, km.region_type))
print(" got -- ('%s', '%s', '%s', [])," % (km_id, km_space_type, km_region_type))
print("done!")
return err
def main():
err = check_maps()
import bpy
if err and bpy.app.background:
# alert CTest we failed
import sys