diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-02-03 18:44:24 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-02-03 18:48:50 +0400 |
commit | a0e03bb5cf0a92b3108163429b1fac3961530890 (patch) | |
tree | bb4c8b42fe4e858ff80917086c6f3a7c81a0bc14 /release/scripts | |
parent | 3d8c1068baf4e2e2d8b40d3dd030c04e0783d117 (diff) |
Fix part of T38425: keymap editor search for "1" only showed numpad 1, not 1-key.
Diffstat (limited to 'release/scripts')
-rw-r--r-- | release/scripts/modules/rna_keymap_ui.py | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/release/scripts/modules/rna_keymap_ui.py b/release/scripts/modules/rna_keymap_ui.py index a5ae9c97d9d..831ba1ba597 100644 --- a/release/scripts/modules/rna_keymap_ui.py +++ b/release/scripts/modules/rna_keymap_ui.py @@ -210,6 +210,7 @@ def draw_kmi(display_keymaps, kc, km, kmi, layout, level): _EVENT_TYPES = set() _EVENT_TYPE_MAP = {} +_EVENT_TYPE_MAP_EXTRA = {} def draw_filtered(display_keymaps, filter_type, filter_text, layout): @@ -226,7 +227,7 @@ def draw_filtered(display_keymaps, filter_type, filter_text, layout): for key, item in enum.items()}) del enum - _EVENT_TYPE_MAP.update({ + _EVENT_TYPE_MAP_EXTRA.update({ "`": 'ACCENT_GRAVE', "*": 'NUMPAD_ASTERIX', "/": 'NUMPAD_SLASH', @@ -234,7 +235,7 @@ def draw_filtered(display_keymaps, filter_type, filter_text, layout): "LMB": 'LEFTMOUSE', "MMB": 'MIDDLEMOUSE', }) - _EVENT_TYPE_MAP.update({ + _EVENT_TYPE_MAP_EXTRA.update({ "%d" % i: "NUMPAD_%d" % i for i in range(9) }) # done with once off init @@ -275,19 +276,20 @@ def draw_filtered(display_keymaps, filter_type, filter_text, layout): kmi_type_set.add(kmi_type) else: # replacement table - kmi_type_test = _EVENT_TYPE_MAP.get(kmi_type) - if kmi_type_test is not None: - kmi_type_set.add(kmi_type_test) - else: - # print("Unknown Type:", kmi_type) - - # Partial match - for k, v in _EVENT_TYPE_MAP.items(): - if (kmi_type in k) or (kmi_type in v): - kmi_type_set.add(v) - - if not kmi_type_set: - return False + for event_type_map in (_EVENT_TYPE_MAP, _EVENT_TYPE_MAP_EXTRA): + kmi_type_test = event_type_map.get(kmi_type) + if kmi_type_test is not None: + kmi_type_set.add(kmi_type_test) + else: + # print("Unknown Type:", kmi_type) + + # Partial match + for k, v in event_type_map.items(): + if (kmi_type in k) or (kmi_type in v): + kmi_type_set.add(v) + + if not kmi_type_set: + return False kmi_test_dict["type"] = kmi_type_set |