From 2c539ba0f8429f58bc24e7d60770de8d48d18e4f Mon Sep 17 00:00:00 2001 From: chrys Date: Sat, 1 Oct 2016 15:22:34 +0200 Subject: [PATCH] announce capital letters in keyecho, deleteecho, char review next,prev/current and arrow left right --- TODO | 3 ++- config/settings/settings.conf | 2 ++ config/settings/settings.conf.orig | 2 ++ config/settings/settings.conf.storm | 2 ++ config/sound/default/caps.opus | Bin 266 -> 0 bytes config/sound/default/caps.wav | Bin 3920 -> 0 bytes config/sound/default/soundicons.conf | 2 ++ config/sound/template/soundicons.conf | 2 ++ .../commands/commands/review_curr_char.py | 2 +- .../commands/commands/review_next_char.py | 2 +- .../commands/commands/review_prev_char.py | 2 +- ...present_char_if_cursor_change_horizontal.py | 2 +- .../commands/onInput/50000-char_echo.py | 2 +- .../commands/onInput/65000-char_delete_echo.py | 3 ++- src/fenrir-package/core/outputManager.py | 17 +++++++++++++---- src/fenrir-package/core/settings.py | 1 + 16 files changed, 33 insertions(+), 11 deletions(-) delete mode 100644 config/sound/default/caps.opus delete mode 100644 config/sound/default/caps.wav diff --git a/TODO b/TODO index 903523fc..3bb0f11b 100644 --- a/TODO +++ b/TODO @@ -23,7 +23,7 @@ ToDos in Priority order: curr item first item last item -- beep on cursor to capital letters in cursor and review + - implement onScreenUpdate commands read highlighted text mode - add the debugging to core @@ -222,3 +222,4 @@ ps a -o tty,comm | grep -e Xorg | grep -v "grep -e Xorg" - dictonary for special chars and string replacements - punctuation +- beep on cursor to capital letters in cursor and review diff --git a/config/settings/settings.conf b/config/settings/settings.conf index dd1a81ae..1f43f313 100644 --- a/config/settings/settings.conf +++ b/config/settings/settings.conf @@ -41,6 +41,8 @@ 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 diff --git a/config/settings/settings.conf.orig b/config/settings/settings.conf.orig index 13711a11..a9e8acdb 100644 --- a/config/settings/settings.conf.orig +++ b/config/settings/settings.conf.orig @@ -39,6 +39,8 @@ 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 diff --git a/config/settings/settings.conf.storm b/config/settings/settings.conf.storm index d7ac3576..ce9c571f 100644 --- a/config/settings/settings.conf.storm +++ b/config/settings/settings.conf.storm @@ -12,6 +12,8 @@ enabled=True driver=speechd rate=0.85 pitch=0.5 +# Pitch for capital letters +capitalPitch=0.9 module=espeak voice= language=english-us diff --git a/config/sound/default/caps.opus b/config/sound/default/caps.opus deleted file mode 100644 index 2e5d92e69affd4f6464ba998778a840b87b216cf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 266 zcmeZIPY-5bVt|5KQ#A@f%!SW+KQIdW7nBxzq$Z{?GFmV;>;{Q5fR%$;AOfVEk%56> z=h6qxjCLU9A&Ke5ybKHsK8a;%rsjGkhI)nu1|TJ}3=9mZdCB=HsYSLviDk(kNeewg z14D(J%%uE+(qgd5EI(L4<}xsVOa{4X`-?e8nT(7oTGt9*t(~l9a{v5{U#hPsK3;Z{ zzdhGaSu3rzZyAflT4u##-Y-5bdMd$Vub?ln&)NQB#h%m$k}Kvu<+A$E+qSlAjYN=P kq{ZeH3SzRGeKNH9DvRgyC2!c$XDQxSX7FZJ(mI5U|{(7pOK+qHv2Tiu`mf7VLchLy?RD;H?SH?AX(^{(%rN7AWi`*~c@xtZF2h0xbzaDY^XZgK%R|Ri;JaX|PcR`FDk6dk{+G0IMm74~iWqV^A z`FnL&{H`%|{U7HT{{F=2s29%*JKr-t<@!~Y+4kS?geIF$&!%62KdWD+Ok%uTpD2H+ z|4P!;D>joJ9#OdTDl_iQo9!*Hf6k4l`DHiT`rG>AqJP5eQyy;kcKY#&nT;2Y%`HF2 z#DDm*r!nh`!*|X?dDNCxUjf-jfsT4(-p&vx&J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cU1dR}XVix!Ip@@jQP`>%RYb zQJMZsVgJ4RehVXS?lX9C&7x@b>*E0zUcJ!!^zx#m$78Wl_m8QYzer7I`e_YHKYgwL zov&@#=$75jY7%GvUol(dDYt5x7sn?_v5)2{t?yb|*E>trtq99LnKoGt3PE{Ivh zr|fHlwfqMiJo+tTdVR_Mk!hrOz+A@b;e0< znv;cos@=RaMcj>{jazj0?my2om;Tx3s`kg~Y4!J86DNJzH^Yi+^Nv-buXnKjE95!w z`p+A+XXo`dJ>cHJakre$^ywBe_fOjyy8f(xGv%K_*<+@Kr6zydj@q`uxCu z7lUJq<&4icaB5!jzut8}pf~>J%T+(_bCfUrxXOPY(~s5pLP~B1@^^o;XeO<3(h^gP zQBIz?Sp1*nLiXqTm;b$&pZ;6yL(9Jvxeq=k3x4?_%khx2QAuAcNNV@5WS-oYXH1)( zx@BB=Fmw8x`!63?KYeGR^-VTv!rvoD&;4gJUBM(|CHwcV-L~JAlRkY@Iob3yexv;D zpXHx#m$Dzf9W`$AO4v=nysEPSH%sKj?T#iyB*wf)2VUc kJKgjJ+oVm_9^~*p8OyY}Xx@kUW?Ek-Y6c1AB=#u+02M(K*#H0l diff --git a/config/sound/default/soundicons.conf b/config/sound/default/soundicons.conf index f2ccf032..02782f10 100644 --- a/config/sound/default/soundicons.conf +++ b/config/sound/default/soundicons.conf @@ -46,3 +46,5 @@ HasAttributes='HasAttributes.opus' PromotedText='PromotedText.opus' # missspelled indicator mispell='mispell.opus' +# the for capital letter: +capital='Caps.opus' diff --git a/config/sound/template/soundicons.conf b/config/sound/template/soundicons.conf index f8ff12f9..fadbbb0b 100644 --- a/config/sound/template/soundicons.conf +++ b/config/sound/template/soundicons.conf @@ -46,3 +46,5 @@ HasAttributes='' PromotedText='' # misspelled indicator mispell='' +# the for capital letter: +capital='' diff --git a/src/fenrir-package/commands/commands/review_curr_char.py b/src/fenrir-package/commands/commands/review_curr_char.py index 9b9a1122..d57b792f 100644 --- a/src/fenrir-package/commands/commands/review_curr_char.py +++ b/src/fenrir-package/commands/commands/review_curr_char.py @@ -26,7 +26,7 @@ class command(): if currChar.strip(" \t\n") == '': self.env['runtime']['outputManager'].presentText("blank" ,interrupt=True) else: - self.env['runtime']['outputManager'].presentText(currChar ,interrupt=True, ignorePunctuation=True) + self.env['runtime']['outputManager'].presentText(currChar ,interrupt=True, ignorePunctuation=True, announceCapital=True) def setCallback(self, callback): pass diff --git a/src/fenrir-package/commands/commands/review_next_char.py b/src/fenrir-package/commands/commands/review_next_char.py index 66a1aebb..a35c4008 100644 --- a/src/fenrir-package/commands/commands/review_next_char.py +++ b/src/fenrir-package/commands/commands/review_next_char.py @@ -28,7 +28,7 @@ class command(): if currChar.strip(" \t\n") == '': self.env['runtime']['outputManager'].presentText("blank", interrupt=True) else: - self.env['runtime']['outputManager'].presentText(currChar, interrupt=True, ignorePunctuation=True) + self.env['runtime']['outputManager'].presentText(currChar, interrupt=True, ignorePunctuation=True, announceCapital=True) def setCallback(self, callback): pass diff --git a/src/fenrir-package/commands/commands/review_prev_char.py b/src/fenrir-package/commands/commands/review_prev_char.py index 61ea11dc..4f5c704b 100644 --- a/src/fenrir-package/commands/commands/review_prev_char.py +++ b/src/fenrir-package/commands/commands/review_prev_char.py @@ -28,7 +28,7 @@ class command(): if currChar.strip(" \t\n") == '': self.env['runtime']['outputManager'].presentText("blank", interrupt=True) else: - self.env['runtime']['outputManager'].presentText(currChar, interrupt=True, ignorePunctuation=True) + self.env['runtime']['outputManager'].presentText(currChar, interrupt=True, ignorePunctuation=True, announceCapital=True) def setCallback(self, callback): pass diff --git a/src/fenrir-package/commands/onInput/45000-present_char_if_cursor_change_horizontal.py b/src/fenrir-package/commands/onInput/45000-present_char_if_cursor_change_horizontal.py index 9c387055..a1920e8c 100644 --- a/src/fenrir-package/commands/onInput/45000-present_char_if_cursor_change_horizontal.py +++ b/src/fenrir-package/commands/onInput/45000-present_char_if_cursor_change_horizontal.py @@ -32,7 +32,7 @@ class command(): return currChar = self.env['screenData']['newContentText'].split('\n')[self.env['screenData']['newCursor']['y']][self.env['screenData']['newCursor']['x']] if not currChar.strip(" \t\n") == '': - self.env['runtime']['outputManager'].presentText(currChar, interrupt=True, ignorePunctuation=True) + self.env['runtime']['outputManager'].presentText(currChar, interrupt=True, ignorePunctuation=True, announceCapital=True) def setCallback(self, callback): pass diff --git a/src/fenrir-package/commands/onInput/50000-char_echo.py b/src/fenrir-package/commands/onInput/50000-char_echo.py index 82816112..528b6530 100644 --- a/src/fenrir-package/commands/onInput/50000-char_echo.py +++ b/src/fenrir-package/commands/onInput/50000-char_echo.py @@ -30,7 +30,7 @@ class command(): # big changes are no char (but the value is bigger than one maybe the differ needs longer than you can type, so a little strange random buffer for now) if len(self.env['screenData']['newDelta']) > 3: return - self.env['runtime']['outputManager'].presentText(self.env['screenData']['newDelta'], interrupt=True, ignorePunctuation=True) + self.env['runtime']['outputManager'].presentText(self.env['screenData']['newDelta'], interrupt=True, ignorePunctuation=True, announceCapital=True) def setCallback(self, callback): pass diff --git a/src/fenrir-package/commands/onInput/65000-char_delete_echo.py b/src/fenrir-package/commands/onInput/65000-char_delete_echo.py index bd7705a1..4b20a094 100644 --- a/src/fenrir-package/commands/onInput/65000-char_delete_echo.py +++ b/src/fenrir-package/commands/onInput/65000-char_delete_echo.py @@ -36,7 +36,8 @@ class command(): # too much for a single backspace... if len(self.env['screenData']['newNegativeDelta']) >= 5: return - self.env['runtime']['outputManager'].presentText(self.env['screenData']['newNegativeDelta'], interrupt=True, ignorePunctuation=True) + + self.env['runtime']['outputManager'].presentText(self.env['screenData']['newNegativeDelta'], interrupt=True, ignorePunctuation=True, announceCapital=True) def setCallback(self, callback): pass diff --git a/src/fenrir-package/core/outputManager.py b/src/fenrir-package/core/outputManager.py index 64ff9b6b..1a817acd 100644 --- a/src/fenrir-package/core/outputManager.py +++ b/src/fenrir-package/core/outputManager.py @@ -5,6 +5,7 @@ # By Chrys, Storm Dragon, and contributers. from core import debug +import string class outputManager(): def __init__(self): @@ -20,15 +21,20 @@ class outputManager(): self.env['runtime']['settingsManager'].shutdownDriver('soundDriver') self.env['runtime']['settingsManager'].shutdownDriver('speechDriver') - def presentText(self, text, interrupt=True, soundIcon = '', ignorePunctuation=False): + def presentText(self, text, interrupt=True, soundIcon = '', ignorePunctuation=False, announceCapital=False): self.env['runtime']['debug'].writeDebugOut("presentText:\nsoundIcon:'"+soundIcon+"'\nText:\n" + text ,debug.debugLevel.INFO) if self.playSoundIcon(soundIcon, interrupt): self.env['runtime']['debug'].writeDebugOut("soundIcon found" ,debug.debugLevel.INFO) return - self.speakText(text, interrupt, ignorePunctuation) + toAnnounceCapital = announceCapital and len(text.strip(' \n\t')) == 1 and text.strip(' \n\t').isupper() + if toAnnounceCapital: + if self.playSoundIcon('capital', False): + toAnnounceCapital = False + + self.speakText(text, interrupt, ignorePunctuation,toAnnounceCapital) self.brailleText(text, interrupt) - def speakText(self, text, interrupt=True, ignorePunctuation=False): + def speakText(self, text, interrupt=True, ignorePunctuation=False, announceCapital=False): if not self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'enabled'): self.env['runtime']['debug'].writeDebugOut("Speech disabled in outputManager.speakText",debug.debugLevel.INFO) return @@ -50,7 +56,10 @@ class outputManager(): self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR) try: - self.env['runtime']['speechDriver'].setPitch(self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'pitch')) + if announceCapital: + self.env['runtime']['speechDriver'].setPitch(self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'capitalPitch')) + else: + self.env['runtime']['speechDriver'].setPitch(self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'pitch')) except Exception as e: self.env['runtime']['debug'].writeDebugOut("setting speech pitch in outputManager.speakText",debug.debugLevel.ERROR) self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR) diff --git a/src/fenrir-package/core/settings.py b/src/fenrir-package/core/settings.py index 2940918c..7e97843f 100644 --- a/src/fenrir-package/core/settings.py +++ b/src/fenrir-package/core/settings.py @@ -20,6 +20,7 @@ settings = { 'driver': 'speechd', 'rate': 0.75, 'pitch': 0.5, + 'capitalPitch':0.8, 'volume': 1.0, 'module': '', 'voice': 'de',