[orca] Move setting keyval_name into input_event rather than the scripts
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Move setting keyval_name into input_event rather than the scripts
- Date: Mon, 11 Nov 2019 19:26:09 +0000 (UTC)
commit b4ed2ccb25f86bac54bac7b64f154b40f07ff81b
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Mon Nov 11 14:25:03 2019 -0500
Move setting keyval_name into input_event rather than the scripts
src/orca/input_event.py | 2 +-
src/orca/script.py | 13 +++----------
2 files changed, 4 insertions(+), 11 deletions(-)
---
diff --git a/src/orca/input_event.py b/src/orca/input_event.py
index 0df0d6485..47d984672 100644
--- a/src/orca/input_event.py
+++ b/src/orca/input_event.py
@@ -103,7 +103,7 @@ class KeyboardEvent(InputEvent):
self.hw_code = event.hw_code
self.modifiers = event.modifiers
self.event_string = event.event_string
- self.keyval_name = ""
+ self.keyval_name = Gdk.keyval_name(event.id)
self.timestamp = event.timestamp
self.is_duplicate = self in [orca_state.lastInputEvent,
orca_state.lastNonModifierKeyEvent]
diff --git a/src/orca/script.py b/src/orca/script.py
index 2ebb6da3c..ddf1dcaac 100644
--- a/src/orca/script.py
+++ b/src/orca/script.py
@@ -392,17 +392,10 @@ class Script:
- keyboardEvent: an instance of input_event.KeyboardEvent
"""
- try:
- from gi.repository import Gdk
- keyboardEvent.keyval_name = Gdk.keyval_name(keyboardEvent.id)
- except:
- msg = 'ERROR: Exception getting keyval_name for id: %d' % keyboardEvent.id
+ if keyboardEvent.event_string == '':
+ msg = 'INFO: Setting event_string to: %s' % keyboardEvent.keyval_name
debug.println(debug.LEVEL_INFO, msg, True)
- else:
- if keyboardEvent.event_string == '':
- msg = 'INFO: Setting event_string to: %s' % keyboardEvent.keyval_name
- debug.println(debug.LEVEL_INFO, msg, True)
- keyboardEvent.event_string = keyboardEvent.keyval_name
+ keyboardEvent.event_string = keyboardEvent.keyval_name
def consumesKeyboardEvent(self, keyboardEvent):
"""Called when a key is pressed on the keyboard.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]