summaryrefslogtreecommitdiff
path: root/mpv.py
diff options
context:
space:
mode:
authorjaseg <code@jaseg.net>2019-11-26 12:24:16 +0100
committerjaseg <code@jaseg.net>2019-11-26 12:26:37 +0100
commit35e69cd93e2f1c265157400d7aa2b5e64f962b23 (patch)
tree34daf0cae61a5c08104c9df697464ad084f33f46 /mpv.py
parent9d6d973f91e993fb5fcdd60d279a865e77697f8f (diff)
downloadpython-mpv-35e69cd93e2f1c265157400d7aa2b5e64f962b23.tar.gz
python-mpv-35e69cd93e2f1c265157400d7aa2b5e64f962b23.tar.bz2
python-mpv-35e69cd93e2f1c265157400d7aa2b5e64f962b23.zip
key bindings: Introduce key char parameter
Adapt key binding script message handling to be compatible with the new key char parameter introduced upstream in https://github.com/mpv-player/mpv/commit/21f2468d67e11eff7ede0d85fa6f4ab5c4f7de84 This change is backwards-compatible. With older mpv versions this parameter will be None.
Diffstat (limited to 'mpv.py')
-rw-r--r--mpv.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/mpv.py b/mpv.py
index 413182e..7e8e4ae 100644
--- a/mpv.py
+++ b/mpv.py
@@ -950,7 +950,7 @@ class MPV(object):
def register(fun):
@self.key_binding(keydef, mode)
@wraps(fun)
- def wrapper(state='p-', name=None):
+ def wrapper(state='p-', name=None, char=None):
if state[0] in ('d', 'p'):
fun()
return wrapper
@@ -969,7 +969,7 @@ class MPV(object):
player = mpv.MPV()
@player.key_binding('Q')
- def binding(state, name):
+ def binding(state, name, char):
print('blep')
binding.unregister_mpv_key_bindings()
@@ -1015,8 +1015,8 @@ class MPV(object):
raise TypeError('register_key_binding expects either an str with an mpv command or a python callable.')
self.command('enable-section', binding_name, 'allow-hide-cursor+allow-vo-dragging')
- def _handle_key_binding_message(self, binding_name, key_state, key_name=None):
- self._key_binding_handlers[binding_name](key_state, key_name)
+ def _handle_key_binding_message(self, binding_name, key_state, key_name=None, key_char=None):
+ self._key_binding_handlers[binding_name](key_state, key_name, key_char)
def unregister_key_binding(self, keydef):
"""Unregister a key binding by keydef."""