add nex/prev word phonetic

This commit is contained in:
chrys 2016-10-17 23:08:19 +02:00
parent e65f880dfb
commit 1eed2e3479
7 changed files with 27 additions and 27 deletions

View File

@ -11,18 +11,18 @@ KEY_FENRIR,KEY_KP1=review_line_first_char
KEY_FENRIR,KEY_KP3=review_line_last_char
KEY_FENRIR,KEY_ALT,KEY_1=present_first_line
KEY_FENRIR,KEY_ALT,KEY_2=present_last_line
KEY_KP5=review_curr_word
KEY_KP4=review_prev_word
KEY_KP6=review_next_word
KEY_SHIFT,KEY_KP5=curr_word_phonetic
KEY_SHIFT,KEY_KP4=review_prev_word_phonetic
KEY_SHIFT,KEY_KP6=review_next_word_phonetic
#KEY_KP5=review_curr_word
#KEY_KP4=review_prev_word
#KEY_KP6=review_next_word
KEY_KP5=review_curr_word_phonetic
KEY_KP4=review_prev_word_phonetic
KEY_KP6=review_next_word_phonetic
#KEY_KP2=review_curr_char
#KEY_KP1=review_prev_char
#KEY_KP3=review_next_char
KEY_KP2=review_curr_char_phonetic
KEY_KP1=review_prev_char_phonetic
KEY_KP3=review_next_char_phonetic
#KEY_KP2=review_curr_char_phonetic
#KEY_KP1=review_prev_char_phonetic
#KEY_KP3=review_next_char_phonetic
#=review_up
#=review_down
KEY_KPDOT=cursor_position
@ -75,9 +75,8 @@ key_FENRIR,KEY_KPENTER=toggle_auto_read
KEY_FENRIR,KEY_Q=quit_fenrir
KEY_FENRIR,KEY_T=time
2,KEY_FENRIR,KEY_T=date
KEY_FENRIR,KEY_S=spell_check
2,KEY_FENRIR,KEY_S=add_word_to_spell_check
KEY_FENRIR,KEY_SHIFT,KEY_S=remove_word_from_spell_check
KEY_KP1=add_word_to_spell_check
KEY_KP2=remove_word_from_spell_check
KEY_FENRIR,KEY_BACKSPACE=forward_keypress
KEY_FENRIR,KEY_UP=inc_speech_volume
KEY_FENRIR,KEY_DOWN=dec_speech_volume

View File

@ -57,14 +57,14 @@ module=espeak
voice=
# Select the language you want fenrir to use.
language=de
language=english-us
# Read new text as it happens?
autoReadIncoming=True
[braille]
#braille is not implemented yet
enabled=True
enabled=False
driver=brlapi
layout=en
@ -83,7 +83,7 @@ device=AUTO
grabDevices=True
ignoreShortcuts=False
# the current shortcut layout located in /etc/fenrir/keyboard
keyboardLayout=test
keyboardLayout=desktop
# echo chars while typing.
charEcho=False
# echo deleted chars
@ -96,9 +96,9 @@ interruptOnKeyPress=False
doubleTapTimeout=0.2
[general]
debugLevel=1
debugLevel=0
punctuationProfile=default
punctuationLevel=Some
punctuationLevel=some
numberOfClipboards=10
emoticons=True
# define the current fenrir key

View File

@ -6,6 +6,7 @@
from core import debug
from utils import word_utils
import string
initialized = False
try:
import enchant
@ -35,14 +36,13 @@ class command():
if self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage') != self.language:
try:
self.updateSpellLanguage()
except:
except Exception as e:
return
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
# get the word
newContent = self.env['screenData']['newContentText'].split('\n')[cursorPos['y']]
x, y, currWord = word_utils.getCurrentWord(cursorPos['x'], 0, newContent)
x, y, currWord = word_utils.getCurrentWord(cursorPos['x'], 0, newContent)
currWord = currWord.strip(string.whitespace + '!"#$%&\()*+,-./:;<=§>?@[\\]^_{|}~')
if currWord != '':
if self.spellChecker.is_added(currWord):

View File

@ -6,6 +6,7 @@
from core import debug
from utils import word_utils
import string
initialized = False
try:
import enchant
@ -43,13 +44,12 @@ class command():
# get the word
newContent = self.env['screenData']['newContentText'].split('\n')[cursorPos['y']]
x, y, currWord = word_utils.getCurrentWord(cursorPos['x'], 0, newContent)
currWord = currWord.strip(string.whitespace + '!"#$%&\()*+,-./:;<=§>?@[\\]^_{|}~')
if not currWord.isspace():
if self.spellChecker.is_removed(currWord):
self.env['runtime']['outputManager'].presentText(currWord + ' is already removed from dict',soundIcon='Cancel', interrupt=True)
else:
self.spellChecker.remove(currWord)
self.env['runtime']['outputManager'].presentText(currWord + ' removed',soundIcon='Accept', interrupt=True)
def setCallback(self, callback):
pass

View File

@ -16,11 +16,11 @@ class command():
def shutdown(self):
pass
def getDescription(self):
return 'phonetically spells the current word'
return 'phonetically spells the current word and set review to it'
def run(self):
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
x, y, currWord = \
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currWord = \
word_utils.getCurrentWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
if currWord.isspace():
@ -29,7 +29,7 @@ class command():
firstSequence = True
for c in currWord:
currChar = char_utils.getPhonetic(c)
self.env['runtime']['outputManager'].presentText(currChar, interrupt=firstSequence)
self.env['runtime']['outputManager'].presentText(currChar, interrupt=firstSequence, announceCapital=True)
firstSequence = False
def setCallback(self, callback):

View File

@ -127,3 +127,4 @@ class command():
def setCallback(self, callback):
pass

View File

@ -12,7 +12,7 @@ class punctuationManager():
pass
def initialize(self, environment):
self.env = environment
self.allPunctNone = dict.fromkeys(map(ord, string.punctuation), ' ')
self.allPunctNone = dict.fromkeys(map(ord, string.punctuation +"§"), ' ')
# replace with space:
# dot, comma, grave, apostrophe
for char in [ord('.'),ord(','),ord('`'),ord("'")]: