add curr_[char,word]_phonetic commands

This commit is contained in:
chrys
2016-08-29 01:11:11 +02:00
parent 083b59a1fd
commit 71da9c7dad
5 changed files with 59 additions and 0 deletions

View File

@ -0,0 +1,25 @@
#!/bin/python
from utils import char_utils
class command():
def __init__(self):
pass
def run(self, environment):
if (environment['screenData']['newCursorReview'] != None):
cursorPos = environment['screenData']['newCursorReview'].copy()
else:
cursorPos = environment['screenData']['newCursor'].copy()
x, y, currChar = \
char_utils.getCurrentChar(cursorPos['x'], cursorPos['y'], environment['screenData']['newContentText'])
if currChar.strip() == '':
environment['runtime']['outputManager'].presentText(environment, "blank" ,interrupt=True)
else:
currChar = char_utils.getPhonetic(currChar)
environment['runtime']['outputManager'].presentText(environment, currChar ,interrupt=True)
return environment
def setCallback(self, callback):
pass
def shutdown(self):
pass

View File

@ -0,0 +1,28 @@
#!/bin/python
from utils import word_utils
from utils import char_utils
class command():
def __init__(self):
pass
def run(self, environment):
if (environment['screenData']['newCursorReview'] != None):
cursorPos = environment['screenData']['newCursorReview'].copy()
else:
cursorPos = environment['screenData']['newCursor'].copy()
x, y, currWord = \
word_utils.getCurrentWord(cursorPos['x'], cursorPos['y'], environment['screenData']['newContentText'])
if currWord.strip() == '':
environment['runtime']['outputManager'].presentText(environment, "blank", interrupt=True)
else:
firstSequence = True
for c in currWord:
currChar = char_utils.getPhonetic(c)
environment['runtime']['outputManager'].presentText(environment, currChar, interrupt=firstSequence)
firstSequence = False
return environment
def setCallback(self, callback):
pass
def shutdown(self):
pass