From 3bffb8b80c3783376133746a265c1a98054f1599 Mon Sep 17 00:00:00 2001 From: chrys Date: Tue, 29 May 2018 00:06:52 +0200 Subject: [PATCH] add to char review --- TODO v2.0 | 8 ++++---- config/settings/espeak.settings.conf | 2 ++ config/settings/settings.conf | 2 ++ config/settings/settings.conf.example | 2 ++ config/settings/settings.conf.storm | 2 ++ config/settings/speech-dispatcher.settings.conf | 2 ++ .../commands/commands/review_curr_char.py | 7 +++++++ .../commands/commands/review_next_char.py | 9 ++++++++- .../commands/commands/review_prev_char.py | 9 ++++++++- .../commands/onCursorChange/77000-has_attribute.py | 3 +++ src/fenrirscreenreader/core/settingsData.py | 1 + 11 files changed, 41 insertions(+), 6 deletions(-) diff --git a/TODO v2.0 b/TODO v2.0 index 1ee66b0d..11e40fa6 100644 --- a/TODO v2.0 +++ b/TODO v2.0 @@ -24,8 +24,8 @@ General (Easy for contribution) [=================> ] 100% ######################## 100% Imporove attribute handling - [W] improve attributes_curr_char (Easy for contribution) - [] add an attribute sound (Easy for contribution) + [X] improve attributes_curr_char (Easy for contribution) + [W] add an attribute sound (Easy for contribution) [] beep on cursor/ review by char (capital wins) (Easy for contribution) [] beep on review by word (once for multiple, capital wins) (Easy for contribution) [] configurable (by char, by word, none) (Easy for contribution) @@ -79,8 +79,8 @@ Driver (screen, input): [X] resize on colum / line change [X] make shell command configurable (or detect it) [X] stop emulation properly - [W] attributes - [W] unify hilgight tracking + [X] attributes + [X] unify hilgight tracking [X] make pasteing text work again https://docs.python.org/3.2/library/pty.html http://sqizit.bartletts.id.au/2011/02/14/pseudo-terminals-in-python/ diff --git a/config/settings/espeak.settings.conf b/config/settings/espeak.settings.conf index 82e1557e..4fb506f7 100644 --- a/config/settings/espeak.settings.conf +++ b/config/settings/espeak.settings.conf @@ -178,6 +178,8 @@ commandPath= #fenrirFontSize = the fontsize attributeFormatString=Background fenrirBGColor,Foreground fenrirFGColor,fenrirUnderline,fenrirBold,fenrirBlink, Font fenrirFont,Fontsize fenrirFontSize autoPresentIndent=False +# play a sound when attributes are changeing +hasAttributes=True # shell for PTY emulatiun (empty = default shell) shell= diff --git a/config/settings/settings.conf b/config/settings/settings.conf index 573e2f4e..39ad1e8d 100644 --- a/config/settings/settings.conf +++ b/config/settings/settings.conf @@ -186,6 +186,8 @@ commandPath= #fenrirFontSize = the fontsize attributeFormatString=Background fenrirBGColor,Foreground fenrirFGColor,fenrirUnderline,fenrirBold,fenrirBlink, Font fenrirFont,Fontsize fenrirFontSize autoPresentIndent=False +# play a sound when attributes are changeing +hasAttributes=True # shell for PTY emulatiun (empty = default shell) shell= diff --git a/config/settings/settings.conf.example b/config/settings/settings.conf.example index ac0a327e..bf7e926f 100644 --- a/config/settings/settings.conf.example +++ b/config/settings/settings.conf.example @@ -187,6 +187,8 @@ commandPath= #fenrirFontSize = the fontsize attributeFormatString=Background fenrirBGColor,Foreground fenrirFGColor,fenrirUnderline,fenrirBold,fenrirBlink, Font fenrirFont,Fontsize fenrirFontSize autoPresentIndent=False +# play a sound when attributes are changeing +hasAttributes=True # shell for PTY emulatiun (empty = default shell) shell= diff --git a/config/settings/settings.conf.storm b/config/settings/settings.conf.storm index cf8aaf61..bbe429f2 100644 --- a/config/settings/settings.conf.storm +++ b/config/settings/settings.conf.storm @@ -132,6 +132,8 @@ commandPath= #fenrirFontSize = the fontsize attributeFormatString=Background fenrirBGColor,Foreground fenrirFGColor,fenrirUnderline,fenrirBold,fenrirBlink, Font fenrirFont,Fontsize fenrirFontSize autoPresentIndent=False +# play a sound when attributes are changeing +hasAttributes=True # shell for PTY emulatiun (empty = default shell) shell= diff --git a/config/settings/speech-dispatcher.settings.conf b/config/settings/speech-dispatcher.settings.conf index b2874e8c..c2a122eb 100644 --- a/config/settings/speech-dispatcher.settings.conf +++ b/config/settings/speech-dispatcher.settings.conf @@ -186,6 +186,8 @@ commandPath= #fenrirFontSize = the fontsize attributeFormatString=Background fenrirBGColor,Foreground fenrirFGColor,fenrirUnderline,fenrirBold,fenrirBlink, Font fenrirFont,Fontsize fenrirFontSize autoPresentIndent=False +# play a sound when attributes are changeing +hasAttributes=True # shell for PTY emulatiun (empty = default shell) shell= diff --git a/src/fenrirscreenreader/commands/commands/review_curr_char.py b/src/fenrirscreenreader/commands/commands/review_curr_char.py index 33ba9534..e4a32e8b 100644 --- a/src/fenrirscreenreader/commands/commands/review_curr_char.py +++ b/src/fenrirscreenreader/commands/commands/review_curr_char.py @@ -24,6 +24,13 @@ class command(): char_utils.getCurrentChar(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText']) self.env['runtime']['outputManager'].presentText(currChar ,interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) + # is has attribute it enabled? + if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'hasAttributes'): + cursorPos = self.env['screen']['newCursorReview'] + + if not self.env['runtime']['attributeManager'].hasAttributes(cursorPos): + return + self.env['runtime']['outputManager'].presentText('has attribute', soundIcon='HasAttributes', interrupt=False) def setCallback(self, callback): pass diff --git a/src/fenrirscreenreader/commands/commands/review_next_char.py b/src/fenrirscreenreader/commands/commands/review_next_char.py index e9983370..93909310 100644 --- a/src/fenrirscreenreader/commands/commands/review_next_char.py +++ b/src/fenrirscreenreader/commands/commands/review_next_char.py @@ -28,6 +28,13 @@ class command(): self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen') if lineBreak: if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'): - self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine') + self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine') + # is has attribute it enabled? + if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'hasAttributes'): + cursorPos = self.env['screen']['newCursorReview'] + + if not self.env['runtime']['attributeManager'].hasAttributes(cursorPos): + return + self.env['runtime']['outputManager'].presentText('has attribute', soundIcon='HasAttributes', interrupt=False) def setCallback(self, callback): pass diff --git a/src/fenrirscreenreader/commands/commands/review_prev_char.py b/src/fenrirscreenreader/commands/commands/review_prev_char.py index c4038b72..e5f935cf 100644 --- a/src/fenrirscreenreader/commands/commands/review_prev_char.py +++ b/src/fenrirscreenreader/commands/commands/review_prev_char.py @@ -31,6 +31,13 @@ class command(): self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen') if lineBreak: if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'): - self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine') + self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine') + # is has attribute it enabled? + if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'hasAttributes'): + cursorPos = self.env['screen']['newCursorReview'] + + if not self.env['runtime']['attributeManager'].hasAttributes(cursorPos): + return + self.env['runtime']['outputManager'].presentText('has attribute', soundIcon='HasAttributes', interrupt=False) def setCallback(self, callback): pass diff --git a/src/fenrirscreenreader/commands/onCursorChange/77000-has_attribute.py b/src/fenrirscreenreader/commands/onCursorChange/77000-has_attribute.py index a6f85d06..b3678759 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/77000-has_attribute.py +++ b/src/fenrirscreenreader/commands/onCursorChange/77000-has_attribute.py @@ -17,6 +17,9 @@ class command(): def getDescription(self): return _('Reads attributes of current cursor position') def run(self): + # is it enabled? + if not self.env['runtime']['settingsManager'].getSettingAsBool('general', 'hasAttributes'): + return # is a vertical change? if not (self.env['runtime']['cursorManager'].isCursorVerticalMove() or\ self.env['runtime']['cursorManager'].isCursorHorizontalMove()): diff --git a/src/fenrirscreenreader/core/settingsData.py b/src/fenrirscreenreader/core/settingsData.py index a5c7fe41..f17d8947 100644 --- a/src/fenrirscreenreader/core/settingsData.py +++ b/src/fenrirscreenreader/core/settingsData.py @@ -74,6 +74,7 @@ settingsData = { 'commandPath': '/usr/share/fenrir/commands', 'attributeFormatString': 'Background fenrirBGColor,Foreground fenrirFGColor,fenrirUnderline,fenrirBold,fenrirBlink, Font fenrirFont,Fontsize fenrirFontSize', 'autoPresentIndent': False, + 'hasAttributes': True, 'shell': '', }, 'focus':{