diff --git a/src/fenrir/commands/commands/review_next_word_phonetic.py b/src/fenrir/commands/commands/review_next_word_phonetic.py new file mode 100644 index 00000000..f646dbb0 --- /dev/null +++ b/src/fenrir/commands/commands/review_next_word_phonetic.py @@ -0,0 +1,36 @@ +#!/bin/python +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from core import debug +from utils import word_utils +from utils import char_utils + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'phonetically spells the current word and set review to it' + + def run(self): + self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() + self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], nextWord = \ + word_utils.getNextWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) + + if nextWord.isspace(): + self.env['runtime']['outputManager'].presentText("blank", interrupt=True) + else: + firstSequence = True + for c in nextWord: + currChar = char_utils.getPhonetic(c) + self.env['runtime']['outputManager'].presentText(currChar, interrupt=firstSequence, announceCapital=True) + firstSequence = False + + def setCallback(self, callback): + pass diff --git a/src/fenrir/commands/commands/review_prev_word_phonetic.py b/src/fenrir/commands/commands/review_prev_word_phonetic.py new file mode 100644 index 00000000..f1f5ba5c --- /dev/null +++ b/src/fenrir/commands/commands/review_prev_word_phonetic.py @@ -0,0 +1,36 @@ +#!/bin/python +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from core import debug +from utils import word_utils +from utils import char_utils + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'phonetically spells the current word and set review to it' + + def run(self): + self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() + self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], prevWord = \ + word_utils.getPrevWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) + + if prevWord.isspace(): + self.env['runtime']['outputManager'].presentText("blank", interrupt=True) + else: + firstSequence = True + for c in prevWord: + currChar = char_utils.getPhonetic(c) + self.env['runtime']['outputManager'].presentText(currChar, interrupt=firstSequence, announceCapital=True) + firstSequence = False + + def setCallback(self, callback): + pass