From 12734e3930eaad3e72307241cb6533076a24dfe5 Mon Sep 17 00:00:00 2001 From: chrys Date: Wed, 13 Jul 2016 21:40:27 +0200 Subject: [PATCH] initial say prev,curr,next line --- .../commands/commands/next_line.py | 22 ++++++++++++++++++ .../commands/commands/prev_line.py | 23 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 src/fenrir-package/commands/commands/next_line.py create mode 100644 src/fenrir-package/commands/commands/prev_line.py diff --git a/src/fenrir-package/commands/commands/next_line.py b/src/fenrir-package/commands/commands/next_line.py new file mode 100644 index 00000000..163ca994 --- /dev/null +++ b/src/fenrir-package/commands/commands/next_line.py @@ -0,0 +1,22 @@ +#!/bin/python + +class command(): + def __init__(self): + pass + def run(self, environment): + environment['runtime']['speechDriver'].cancel() + environment['screenData']['oldCursorReview'] = environment['screenData']['newCursorReview'] + if environment['screenData']['newCursorReview']['y'] == -1: + environment['screenData']['newCursorReview'] = environment['screenData']['newCursor'].copy() + if environment['screenData']['newCursorReview']['y'] + 1 < environment['screenData']['lines']: + environment['screenData']['newCursorReview']['y'] = environment['screenData']['newCursorReview']['y'] + 1 + + if environment['screenData']['newContentText'].replace(" ","") == '': + environment['runtime']['speechDriver'].speak("empty line") + else: + environment['runtime']['speechDriver'].speak(environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursorReview']['y']]) + return environment + def setCallback(self, callback): + pass + def shutdown(self): + pass diff --git a/src/fenrir-package/commands/commands/prev_line.py b/src/fenrir-package/commands/commands/prev_line.py new file mode 100644 index 00000000..94425d80 --- /dev/null +++ b/src/fenrir-package/commands/commands/prev_line.py @@ -0,0 +1,23 @@ +#!/bin/python + +class command(): + def __init__(self): + pass + def run(self, environment): + environment['runtime']['speechDriver'].cancel() + environment['screenData']['oldCursorReview'] = environment['screenData']['newCursorReview'] + if environment['screenData']['newCursorReview']['y'] == -1: + environment['screenData']['newCursorReview'] = environment['screenData']['newCursor'].copy() + if environment['screenData']['newCursorReview']['y'] - 1 >= 0: + environment['screenData']['newCursorReview']['y'] = environment['screenData']['newCursorReview']['y'] - 1 + + if environment['screenData']['newContentText'].replace(" ","") == '': + environment['runtime']['speechDriver'].speak("empty line") + else: + environment['runtime']['speechDriver'].speak(environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursorReview']['y']]) + + return environment + def setCallback(self, callback): + pass + def shutdown(self): + pass