From 3ae357bbb1890f5da72bd6083372b221e0dad7bc Mon Sep 17 00:00:00 2001 From: yumoqing Date: Fri, 13 Nov 2020 21:56:44 +0800 Subject: [PATCH] bugfix --- kivyblocks/boxViewer.py | 16 +--------------- kivyblocks/ready.py | 21 ++++++--------------- 2 files changed, 7 insertions(+), 30 deletions(-) diff --git a/kivyblocks/boxViewer.py b/kivyblocks/boxViewer.py index 916694d..fdbf829 100644 --- a/kivyblocks/boxViewer.py +++ b/kivyblocks/boxViewer.py @@ -43,21 +43,7 @@ class BoxViewer(WidgetReady, BoxLayout): kwargs = {k:v for k,v in options.items() if k not in remind } BoxLayout.__init__(self, orientation='vertical', **kwargs) WidgetReady.__init__(self) - self.used_keys = [ - { - "keyname":"enter", - "modifiers":[] - }, - { - "keyname":"up", - "modifiers":[] - }, - { - "keyname":"down", - "modifiers":[] - }, - ] - self.use_keyboard(self.used_keys) + self.use_keyboard() self.selected_data = None self.options = options self.box_width = CSize(options['boxwidth']) diff --git a/kivyblocks/ready.py b/kivyblocks/ready.py index 4d207a6..af79508 100644 --- a/kivyblocks/ready.py +++ b/kivyblocks/ready.py @@ -70,21 +70,12 @@ class WidgetReady(EventDispatcher): return False # Keycode is composed of an integer + a string # If we hit escape, release the keyboard - if keycode[1] == 'escape': - keyboard.release() - - for ki in self.keyinfos: - if ki['keyname'] == keycode[1] and listequal(ki['modifiers'],modifiers): - keyinfo = { - "keyname":keycode[1], - "modifiers":modifiers - } - self.dispatch('on_key_down',keyinfo) - return True - - # Return True to accept the key. Otherwise, it will be used by - # the system. - return False + keyinfo = { + "keyname":keycode[1], + "modifiers":modifiers + } + self.dispatch('on_key_down',keyinfo) + return True def on_fullscreen(self, instance, value): window = self.get_parent_window()