Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-07-13 10:18:46 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-07-13 10:18:46 +0300
commitb2d8f834446c5545efae8a824a6197e2b338ec00 (patch)
tree04e8e50692d4db637f1179792efd76bb86e66c14 /release/scripts
parent06b9f000e5d539420e3885bf1a0f4088dc718bf0 (diff)
Keymap: run search by its key in tools popup
The button & key are displayed here, so its best if the shortcut works.
Diffstat (limited to 'release/scripts')
-rw-r--r--release/scripts/startup/bl_ui/space_toolsystem_common.py27
1 files changed, 21 insertions, 6 deletions
diff --git a/release/scripts/startup/bl_ui/space_toolsystem_common.py b/release/scripts/startup/bl_ui/space_toolsystem_common.py
index 7fe8360b4da..ffd95ec7c64 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_common.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_common.py
@@ -625,6 +625,16 @@ def keymap_from_context(context, space_type):
Keymap for popup toolbar, currently generated each time.
"""
+ def modifier_keywords_from_item(kmi):
+ return {
+ "any": kmi.any,
+ "shift": kmi.shift,
+ "ctrl": kmi.ctrl,
+ "alt": kmi.alt,
+ "oskey": kmi.oskey,
+ "key_modifier": kmi.key_modifier,
+ }
+
use_search = False # allows double tap
use_simple_keymap = False
@@ -677,12 +687,7 @@ def keymap_from_context(context, space_type):
idname="wm.tool_set_by_name",
type=kmi_found_type,
value='PRESS',
- any=kmi_found.any,
- shift=kmi_found.shift,
- ctrl=kmi_found.ctrl,
- alt=kmi_found.alt,
- oskey=kmi_found.oskey,
- key_modifier=kmi_found.key_modifier,
+ **modifier_keywords_from_item(kmi_found),
)
kmi.properties.name = item.text
@@ -695,6 +700,16 @@ def keymap_from_context(context, space_type):
# Support double-tap for search.
if kmi_search_type:
keymap.keymap_items.new("wm.search_menu", type=kmi_search_type, value='PRESS')
+ else:
+ # The shortcut will show, so we better support running it.
+ kmi_search = wm.keyconfigs.find_item_from_operator(idname="wm.search_menu")[1]
+ if kmi_search:
+ keymap.keymap_items.new(
+ "wm.search_menu",
+ type=kmi_search.type,
+ value='PRESS',
+ **modifier_keywords_from_item(kmi_search),
+ )
wm.keyconfigs.update()
return keymap