mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-10 22:24:24 +02:00
More typing work
This commit is contained in:
9
kitty/key_encoding.py
generated
9
kitty/key_encoding.py
generated
@@ -3,7 +3,7 @@
|
||||
# License: GPL v3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
import string
|
||||
from collections import namedtuple
|
||||
from typing import NamedTuple
|
||||
|
||||
from . import fast_data_types as defines
|
||||
from .key_names import key_name_aliases
|
||||
@@ -451,9 +451,14 @@ def update_encoding():
|
||||
subprocess.check_call(['yapf', '-i', __file__])
|
||||
|
||||
|
||||
class KeyEvent(NamedTuple):
|
||||
type: int
|
||||
mods: int
|
||||
key: str
|
||||
|
||||
|
||||
PRESS, REPEAT, RELEASE = 1, 2, 4
|
||||
SHIFT, ALT, CTRL, SUPER = 1, 2, 4, 8
|
||||
KeyEvent = namedtuple('KeyEvent', 'type mods key')
|
||||
type_map = {'p': PRESS, 't': REPEAT, 'r': RELEASE}
|
||||
rtype_map = {v: k for k, v in type_map.items()}
|
||||
mod_map = {c: i for i, c in enumerate('ABCDEFGHIJKLMNOP')}
|
||||
|
||||
Reference in New Issue
Block a user