add mouse buttons to pointing device
This commit is contained in:
11
kmk/keys.py
11
kmk/keys.py
@@ -20,6 +20,7 @@ class KeyType:
|
||||
SIMPLE = const(0)
|
||||
MODIFIER = const(1)
|
||||
CONSUMER = const(2)
|
||||
MOUSE = const(3)
|
||||
|
||||
|
||||
FIRST_KMK_INTERNAL_KEY = const(1000)
|
||||
@@ -697,6 +698,10 @@ class ConsumerKey(Key):
|
||||
pass
|
||||
|
||||
|
||||
class MouseKey(Key):
|
||||
pass
|
||||
|
||||
|
||||
def make_key(
|
||||
code: Optional[int] = None,
|
||||
names: Tuple[str, ...] = tuple(), # NOQA
|
||||
@@ -727,6 +732,8 @@ def make_key(
|
||||
constructor = ModifierKey
|
||||
elif type == KeyType.CONSUMER:
|
||||
constructor = ConsumerKey
|
||||
elif type == KeyType.MOUSE:
|
||||
constructor = MouseKey
|
||||
else:
|
||||
raise ValueError('Unrecognized key type')
|
||||
|
||||
@@ -759,6 +766,10 @@ def make_consumer_key(*args, **kwargs) -> Key:
|
||||
return make_key(*args, **kwargs, type=KeyType.CONSUMER)
|
||||
|
||||
|
||||
def make_mouse_key(*args, **kwargs) -> Key:
|
||||
return make_key(*args, **kwargs, type=KeyType.MOUSE)
|
||||
|
||||
|
||||
# Argumented keys are implicitly internal, so auto-gen of code
|
||||
# is almost certainly the best plan here
|
||||
def make_argumented_key(
|
||||
|
Reference in New Issue
Block a user