add next/pref char phoneteic

This commit is contained in:
chrys
2016-10-17 20:11:56 +02:00
parent ccc4a2776a
commit e65f880dfb
11 changed files with 100 additions and 139 deletions

View File

@ -15,19 +15,19 @@ class command():
def shutdown(self):
pass
def getDescription(self):
return 'phonetically presents the current character'
return 'set review and phonetically presents the current character'
def run(self):
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
x, y, currChar = \
char_utils.getCurrentChar(cursorPos['x'], cursorPos['y'], self.env['screenData']['newContentText'])
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currChar = \
char_utils.getCurrentChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
if currChar.isspace():
self.env['runtime']['outputManager'].presentText("blank" ,interrupt=True)
else:
currChar = char_utils.getPhonetic(currChar)
self.env['runtime']['outputManager'].presentText(currChar ,interrupt=True)
self.env['runtime']['outputManager'].presentText(currChar ,interrupt=True, announceCapital=True)
def setCallback(self, callback):
pass

View File

@ -19,9 +19,9 @@ class command():
return 'phonetically spells the current word'
def run(self):
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
x, y, currWord = \
word_utils.getCurrentWord(cursorPos['x'], cursorPos['y'], self.env['screenData']['newContentText'])
word_utils.getCurrentWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
if currWord.isspace():
self.env['runtime']['outputManager'].presentText("blank", interrupt=True)

View File

@ -18,10 +18,7 @@ class command():
return 'moves review to the next character and presents it'
def run(self):
self.env['screenData']['oldCursorReview'] = self.env['screenData']['newCursorReview']
if not self.env['screenData']['newCursorReview']:
self.env['screenData']['newCursorReview'] = self.env['screenData']['newCursor'].copy()
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currChar = \
char_utils.getNextChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])

View File

@ -0,0 +1,33 @@
#!/bin/python
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from core import debug
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 presents the next character and set review to it'
def run(self):
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], nextChar = \
char_utils.getNextChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
if nextChar.isspace():
self.env['runtime']['outputManager'].presentText("blank" ,interrupt=True)
else:
nextChar = char_utils.getPhonetic(nextChar)
self.env['runtime']['outputManager'].presentText(nextChar ,interrupt=True, announceCapital=True)
def setCallback(self, callback):
pass

View File

@ -0,0 +1,33 @@
#!/bin/python
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from core import debug
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 presents the previous character and set review to it'
def run(self):
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], nextChar = \
char_utils.getPrevChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
if nextChar.isspace():
self.env['runtime']['outputManager'].presentText("blank" ,interrupt=True)
else:
nextChar = char_utils.getPhonetic(nextChar)
self.env['runtime']['outputManager'].presentText(nextChar ,interrupt=True, announceCapital=True)
def setCallback(self, callback):
pass