add curr_[char,word]_phonetic commands
This commit is contained in:
25
src/fenrir-package/commands/commands/curr_char_phonetic.py
Normal file
25
src/fenrir-package/commands/commands/curr_char_phonetic.py
Normal 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
|
28
src/fenrir-package/commands/commands/curr_word_phonetic.py
Normal file
28
src/fenrir-package/commands/commands/curr_word_phonetic.py
Normal 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
|
Reference in New Issue
Block a user