本文整理汇总了Python中Actions.get_action_name_from_key_name方法的典型用法代码示例。如果您正苦于以下问题:Python Actions.get_action_name_from_key_name方法的具体用法?Python Actions.get_action_name_from_key_name怎么用?Python Actions.get_action_name_from_key_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Actions
的用法示例。
在下文中一共展示了Actions.get_action_name_from_key_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _handle_key_press
# 需要导入模块: import Actions [as 别名]
# 或者: from Actions import get_action_name_from_key_name [as 别名]
def _handle_key_press(self, widget, event):
"""
Handle key presses from the keyboard and translate key combinations into actions.
This key press handler is called prior to the gtk key press handler.
This handler bypasses built in accelerator key handling when in focus because
* some keys are ignored by the accelerators like the direction keys,
* some keys are not registered to any accelerators but are still used.
When not in focus, gtk and the accelerators handle the the key press.
@return false to let gtk handle the key action
"""
#dont allow key presses to queue up
if gtk.events_pending(): return True
#extract action name from this key press
key_name = gtk.gdk.keyval_name(event.keyval)
mod_mask = event.state
action_name = Actions.get_action_name_from_key_name(key_name, mod_mask)
#handle the action if flow graph is in focus
if action_name and self.get_focus_flag():
self.handle_states(action_name)
return True #handled by this method
return False #let gtk handle the key press