From e2668f146770aad3247ede30ffee766d3bb37565 Mon Sep 17 00:00:00 2001 From: chrys Date: Fri, 15 Jul 2016 15:56:47 +0200 Subject: [PATCH] add horizontal and vertical announcements --- TODO | 9 ++++++++- ...k_incomming.py => 50000-speak_incomming.py} | 4 ++++ ...00-read_line_if_cursor_change_horizontal.py | 18 ++++++++++++++++++ ...7000-read_line_if_cursor_change_vertical.py | 17 +++++++++++++++++ 4 files changed, 47 insertions(+), 1 deletion(-) rename src/fenrir-package/commands/onInput/{70000-speak_incomming.py => 50000-speak_incomming.py} (66%) create mode 100644 src/fenrir-package/commands/onInput/54000-read_line_if_cursor_change_horizontal.py create mode 100644 src/fenrir-package/commands/onInput/57000-read_line_if_cursor_change_vertical.py diff --git a/TODO b/TODO index 6a9c8c59..bfcbd0b6 100644 --- a/TODO +++ b/TODO @@ -16,13 +16,20 @@ ToDos in Priority order: enable_disable_speech #enable, disable speech enable_disable_braile #enable, disable braile enable_disable_sound #enable, disable sound + set_area_mark + reset_area_marks + toggle_highlighted_mode - implement onInput commands read_line_if_cursor_change_vertical (needed if you arrow up and down, we want to announce the line) read_char_if_cursur_change_horizontal (needed if you arrow left and right, we want to announce the char under the cursor) echo_char (echos the last char on pressing space or return) echo_word (echos the last word on pressing space or return) - + +- implement onScreenChange commands + read highlighted text mode + window mode (define a area and just read that changes) + - default soundIcon theme (soundfiles) - autostart systemd - implement braille diff --git a/src/fenrir-package/commands/onInput/70000-speak_incomming.py b/src/fenrir-package/commands/onInput/50000-speak_incomming.py similarity index 66% rename from src/fenrir-package/commands/onInput/70000-speak_incomming.py rename to src/fenrir-package/commands/onInput/50000-speak_incomming.py index 5259addd..665d6876 100644 --- a/src/fenrir-package/commands/onInput/70000-speak_incomming.py +++ b/src/fenrir-package/commands/onInput/50000-speak_incomming.py @@ -4,6 +4,10 @@ class command(): def __init__(self): pass def run(self, environment): + return environment + if environment['screenData']['newCursor'] != environment['screenData']['oldCursor']: + print(environment['screenData']['newCursor'] != environment['screenData']['oldCursor']) + return environment if environment['screenData']['newDelta'] != environment['screenData']['oldDelta'] or \ environment['screenData']['newTTY'] != environment['screenData']['oldTTY']: environment['runtime']['outputManager'].speakText(environment, environment['screenData']['newDelta'], Interrupt=False) diff --git a/src/fenrir-package/commands/onInput/54000-read_line_if_cursor_change_horizontal.py b/src/fenrir-package/commands/onInput/54000-read_line_if_cursor_change_horizontal.py new file mode 100644 index 00000000..8dbbf565 --- /dev/null +++ b/src/fenrir-package/commands/onInput/54000-read_line_if_cursor_change_horizontal.py @@ -0,0 +1,18 @@ +#!/bin/python + +class command(): + def __init__(self): + pass + def run(self, environment): + if environment['screenData']['newCursor']['x'] == environment['screenData']['oldCursor']['x'] or\ + environment['screenData']['newCursor']['y'] != environment['screenData']['oldCursor']['y']: + return environment + if environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']][environment['screenData']['newCursor']['x']].replace(" ","").replace("\n","").replace("\t","") == '': + environment['runtime']['outputManager'].speakText(environment, "blank") + else: + environment['runtime']['outputManager'].speakText(environment, environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']][environment['screenData']['newCursor']['x']]) + return environment + def setCallback(self, callback): + pass + def shutdown(self): + pass diff --git a/src/fenrir-package/commands/onInput/57000-read_line_if_cursor_change_vertical.py b/src/fenrir-package/commands/onInput/57000-read_line_if_cursor_change_vertical.py new file mode 100644 index 00000000..f9f3f202 --- /dev/null +++ b/src/fenrir-package/commands/onInput/57000-read_line_if_cursor_change_vertical.py @@ -0,0 +1,17 @@ +#!/bin/python + +class command(): + def __init__(self): + pass + def run(self, environment): + if environment['screenData']['newCursor']['y'] == environment['screenData']['oldCursor']['y']: + return environment + if environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']].replace(" ","").replace("\n","").replace("\t","") == '': + environment['runtime']['outputManager'].speakText(environment, "blank") + else: + environment['runtime']['outputManager'].speakText(environment, environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']]) + return environment + def setCallback(self, callback): + pass + def shutdown(self): + pass