Execute the action hander for a give key event
| Parameters: |
-
key_event
(KeyEvent)
–
Key event to be processed
|
Source code in pzp/actions.py
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87 | def process_key_event(self, key_event: KeyEvent) -> None:
"""
Execute the action hander for a give key event
Args:
key_event: Key event to be processed
Raises:
MissingHander: If there is no handler for the given key event
"""
action: str = key_event.action or "default"
fn = self.actions.get(action)
if not fn:
raise MissingHander(action=action, ch=key_event.ch)
# Check if the function has the key_event argument
if "key_event" in inspect.getargs(fn.__code__).args:
fn(key_event=key_event) # type: ignore
else:
fn() # type: ignore
|