diff --git a/TODO b/TODO index d8f0d8ec..483844bc 100644 --- a/TODO +++ b/TODO @@ -34,6 +34,10 @@ https://wiki.gnome.org/Attic/LSR/ScratchPad/Braille/BrlAPI per application onInput - per application shortcuts - implement commands + next_char_phonetic + prev_char_phonetic + next_word_phonetic + prev_word_phonetic attributes_curr_char command for run configurable scripts as subprocess/ pass environment[screenData] toggle_highlighted_mode diff --git a/config/keyboard/desktop.conf b/config/keyboard/desktop.conf index 960a09db..5ce3c80a 100644 --- a/config/keyboard/desktop.conf +++ b/config/keyboard/desktop.conf @@ -14,11 +14,15 @@ 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_KP5=review_curr_word_phonetic +#=review_prev_word_phonetic +#=review_next_word_phonetic KEY_KP2=review_curr_char KEY_KP1=review_prev_char KEY_KP3=review_next_char -KEY_SHIFT,KEY_KP2=curr_char_phonetic +KEY_SHIFT,KEY_KP2=review_curr_char_phonetic +#=review_prev_char_phonetic +#=review_next_char_phonetic #=review_up #=review_down KEY_KPDOT=cursor_position diff --git a/config/keyboard/laptop.conf b/config/keyboard/laptop.conf index d51f9c59..69a96998 100644 --- a/config/keyboard/laptop.conf +++ b/config/keyboard/laptop.conf @@ -14,7 +14,9 @@ KEY_FENRIR,KEY_ALT,KEY_2=present_last_line KEY_FENRIR,KEY_K=review_curr_word KEY_FENRIR,KEY_J=review_prev_word KEY_FENRIR,KEY_L=review_next_word -2,KEY_FENRIR,KEY_K=curr_word_phonetic +2,KEY_FENRIR,KEY_K=review_curr_word_phonetic +#=review_prev_word_phonetic +#=review_next_word_phonetic KEY_FENRIR,KEY_COMMA=review_curr_char KEY_FENRIR,KEY_M=review_prev_char KEY_FENRIR,KEY_DOT=review_next_char diff --git a/config/keyboard/test.conf b/config/keyboard/test.conf index 960a09db..4356e272 100644 --- a/config/keyboard/test.conf +++ b/config/keyboard/test.conf @@ -15,10 +15,14 @@ KEY_KP5=review_curr_word KEY_KP4=review_prev_word KEY_KP6=review_next_word KEY_SHIFT,KEY_KP5=curr_word_phonetic -KEY_KP2=review_curr_char -KEY_KP1=review_prev_char -KEY_KP3=review_next_char -KEY_SHIFT,KEY_KP2=curr_char_phonetic +KEY_SHIFT,KEY_KP4=review_prev_word_phonetic +KEY_SHIFT,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 #=review_up #=review_down KEY_KPDOT=cursor_position diff --git a/config/settings/settings.conf b/config/settings/settings.conf index cd44ed61..ff6b691c 100644 --- a/config/settings/settings.conf +++ b/config/settings/settings.conf @@ -57,14 +57,14 @@ module=espeak voice= # Select the language you want fenrir to use. -language=english-us +language=de # Read new text as it happens? autoReadIncoming=True [braille] #braille is not implemented yet -enabled=False +enabled=True driver=brlapi layout=en @@ -83,7 +83,7 @@ device=AUTO grabDevices=True ignoreShortcuts=False # the current shortcut layout located in /etc/fenrir/keyboard -keyboardLayout=desktop +keyboardLayout=test # echo chars while typing. charEcho=False # echo deleted chars @@ -96,9 +96,9 @@ interruptOnKeyPress=False doubleTapTimeout=0.2 [general] -debugLevel=0 +debugLevel=1 punctuationProfile=default -punctuationLevel=some +punctuationLevel=Some numberOfClipboards=10 emoticons=True # define the current fenrir key diff --git a/config/settings/settings.conf.chrys b/config/settings/settings.conf.chrys deleted file mode 100644 index ff6b691c..00000000 --- a/config/settings/settings.conf.chrys +++ /dev/null @@ -1,116 +0,0 @@ -[sound] -# Turn sound on or off: -enabled=True - -# Select the driver used to play sounds, choices are generic and gstreamer. -# Sox is the default. -driver=generic - -# Sound themes. This is the pack of sounds used for sound alerts. -# Sound packs may be located at /usr/share/sounds -# For system wide availability, or ~/.local/share/fenrir/sounds -# For the current user. -theme=default - -# Sound volume controls how loud the sounds for your chosen soundpack are. -# 0 is quietest, 1.0 is loudest. -volume=1.0 - -# shell commands for generic sound driver -# the folowing variable are substituded -# fenrirVolume = the current volume setting -# fenrirSoundFile = the soundfile for an soundicon -# fenrirFrequence = the frequence to play -# fenrirDuration = the duration of the frequence -# the following command is used for play a soundfile -genericPlayFileCommand=play -q -v fenrirVolume fenrirSoundFile -#the following command is used for generating a frequence beep -genericFrequencyCommand=play -q -v fenrirVolume -n -c1 synth fenrirDuration sine fenrirFrequence - -[speech] -# Turn speech on or off: -enabled=True - -# Select speech driver, options are speechd (default) or espeak: -driver=speechd -#driver=espeak - - -# The rate selects how fast fenrir will speak. Options range from 0, slowest, to 1.0, fastest. -rate=0.45 - -# Pitch controls the pitch of the voice, select from 0, lowest, to 1.0, highest. -pitch=0.5 -# Pitch for capital letters -capitalPitch=0.9 - -# Volume controls the loudness of the voice, select from 0, quietest, to 1.0, loudest. -volume=1.0 - -# Module is used for speech-dispatcher, to select the speech module you want to use. -# Consult speech-dispatcher's configuration and help ti find out which modules are available. -# The default is espeak. -module=espeak - -# Voice selects the varient you want to use, for example, f5 will use the female voice #5 in espeak, -# or if using the espeak module in speech-dispatcher. To find out which voices are available, consult the documentation provided with your chosen synthesizer. -voice= - -# Select the language you want fenrir to use. -language=de - -# Read new text as it happens? -autoReadIncoming=True - -[braille] -#braille is not implemented yet -enabled=True -driver=brlapi -layout=en - -[screen] -driver=linux -encoding=cp850 -screenUpdateDelay=0.4 -suspendingScreen= -autodetectSuspendingScreen=True - -[keyboard] -driver=evdev -# filter input devices AUTO, ALL or a DEVICE NAME -device=AUTO -# gives fenrir exclusive access to the keyboard and let consume keystrokes. just disable on problems. -grabDevices=True -ignoreShortcuts=False -# the current shortcut layout located in /etc/fenrir/keyboard -keyboardLayout=test -# echo chars while typing. -charEcho=False -# echo deleted chars -charDeleteEcho=True -# echo word after pressing space -wordEcho=False -# interrupt speech on any keypress -interruptOnKeyPress=False -# timeout for double tap in sec -doubleTapTimeout=0.2 - -[general] -debugLevel=1 -punctuationProfile=default -punctuationLevel=Some -numberOfClipboards=10 -emoticons=True -# define the current fenrir key -fenrirKeys=KEY_KP0,KEY_META -timeFormat=%H:%M:%P -dateFormat=%A, %B %d, %Y -autoSpellCheck=True -spellCheckLanguage=en_US - -[promote] -enabled=True -inactiveTimeoutSec=120 -list= - - diff --git a/src/fenrir/commands/commands/curr_char_phonetic.py b/src/fenrir/commands/commands/review_curr_char_phonetic.py similarity index 62% rename from src/fenrir/commands/commands/curr_char_phonetic.py rename to src/fenrir/commands/commands/review_curr_char_phonetic.py index 8408b41e..a0ba1949 100644 --- a/src/fenrir/commands/commands/curr_char_phonetic.py +++ b/src/fenrir/commands/commands/review_curr_char_phonetic.py @@ -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 diff --git a/src/fenrir/commands/commands/curr_word_phonetic.py b/src/fenrir/commands/commands/review_curr_word_phonetic.py similarity index 80% rename from src/fenrir/commands/commands/curr_word_phonetic.py rename to src/fenrir/commands/commands/review_curr_word_phonetic.py index 737e70c5..6b5865cd 100644 --- a/src/fenrir/commands/commands/curr_word_phonetic.py +++ b/src/fenrir/commands/commands/review_curr_word_phonetic.py @@ -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) diff --git a/src/fenrir/commands/commands/review_next_char.py b/src/fenrir/commands/commands/review_next_char.py index aa74a972..366e9a70 100644 --- a/src/fenrir/commands/commands/review_next_char.py +++ b/src/fenrir/commands/commands/review_next_char.py @@ -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']) diff --git a/src/fenrir/commands/commands/review_next_char_phonetic.py b/src/fenrir/commands/commands/review_next_char_phonetic.py new file mode 100644 index 00000000..73cd2f82 --- /dev/null +++ b/src/fenrir/commands/commands/review_next_char_phonetic.py @@ -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 diff --git a/src/fenrir/commands/commands/review_prev_char_phonetic.py b/src/fenrir/commands/commands/review_prev_char_phonetic.py new file mode 100644 index 00000000..846cb8de --- /dev/null +++ b/src/fenrir/commands/commands/review_prev_char_phonetic.py @@ -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