From c555bef0ebc4456e4a67cb12ea8a6b3525f54c5b Mon Sep 17 00:00:00 2001 From: Chrys Date: Wed, 19 May 2021 12:03:54 +0200 Subject: [PATCH] make beep for indentation work and configurable --- config/settings/espeak.settings.conf | 6 ++++++ config/settings/settings-daemon.conf | 6 ++++++ config/settings/settings-pty.conf | 6 ++++++ config/settings/settings.conf | 6 ++++++ config/settings/settings.conf.example | 6 ++++++ config/settings/settings.conf.storm | 6 ++++++ config/settings/speech-dispatcher.settings.conf | 6 ++++++ ...5000-present_line_if_cursor_change_vertical.py | 13 ++++++++----- src/fenrirscreenreader/core/fenrirManager.py | 6 +----- src/fenrirscreenreader/core/settingsData.py | 15 ++++++++------- 10 files changed, 59 insertions(+), 17 deletions(-) diff --git a/config/settings/espeak.settings.conf b/config/settings/espeak.settings.conf index 37d42ac9..c929283e 100644 --- a/config/settings/espeak.settings.conf +++ b/config/settings/espeak.settings.conf @@ -179,7 +179,13 @@ commandPath= #fenrirFont = the font #fenrirFontSize = the fontsize attributeFormatString=Background fenrirBGColor,Foreground fenrirFGColor,fenrirUnderline,fenrirBold,fenrirBlink, Font fenrirFont,Fontsize fenrirFontSize +# present indentation autoPresentIndent=False +# speak is only invoked on changeing ident level, sound always +# 0 = sound and speak +# 1 = sound only +# 2 = speak only +autoPresentIndentMode=1 # play a sound when attributes are changeing hasAttributes=True # shell for PTY emulatiun (empty = default shell) diff --git a/config/settings/settings-daemon.conf b/config/settings/settings-daemon.conf index 85321301..67a2c140 100644 --- a/config/settings/settings-daemon.conf +++ b/config/settings/settings-daemon.conf @@ -184,7 +184,13 @@ commandPath= #fenrirFont = the font #fenrirFontSize = the fontsize attributeFormatString=Background fenrirBGColor,Foreground fenrirFGColor,fenrirUnderline,fenrirBold,fenrirBlink, Font fenrirFont,Fontsize fenrirFontSize +# present indentation autoPresentIndent=False +# speak is only invoked on changeing ident level, sound always +# 0 = sound and speak +# 1 = sound only +# 2 = speak only +autoPresentIndentMode=1 # play a sound when attributes are changeing hasAttributes=True # shell for PTY emulatiun (empty = default shell) diff --git a/config/settings/settings-pty.conf b/config/settings/settings-pty.conf index 85321301..67a2c140 100644 --- a/config/settings/settings-pty.conf +++ b/config/settings/settings-pty.conf @@ -184,7 +184,13 @@ commandPath= #fenrirFont = the font #fenrirFontSize = the fontsize attributeFormatString=Background fenrirBGColor,Foreground fenrirFGColor,fenrirUnderline,fenrirBold,fenrirBlink, Font fenrirFont,Fontsize fenrirFontSize +# present indentation autoPresentIndent=False +# speak is only invoked on changeing ident level, sound always +# 0 = sound and speak +# 1 = sound only +# 2 = speak only +autoPresentIndentMode=1 # play a sound when attributes are changeing hasAttributes=True # shell for PTY emulatiun (empty = default shell) diff --git a/config/settings/settings.conf b/config/settings/settings.conf index 251c8798..31fc23c3 100644 --- a/config/settings/settings.conf +++ b/config/settings/settings.conf @@ -185,7 +185,13 @@ commandPath= #fenrirFont = the font #fenrirFontSize = the fontsize attributeFormatString=Background fenrirBGColor,Foreground fenrirFGColor,fenrirUnderline,fenrirBold,fenrirBlink, Font fenrirFont,Fontsize fenrirFontSize +# present indentation autoPresentIndent=False +# speak is only invoked on changeing ident level, sound always +# 0 = sound and speak +# 1 = sound only +# 2 = speak only +autoPresentIndentMode=1 # play a sound when attributes are changeing hasAttributes=True # shell for PTY emulatiun (empty = default shell) diff --git a/config/settings/settings.conf.example b/config/settings/settings.conf.example index ac58a765..c844d29a 100644 --- a/config/settings/settings.conf.example +++ b/config/settings/settings.conf.example @@ -185,7 +185,13 @@ commandPath= #fenrirFont = the font #fenrirFontSize = the fontsize attributeFormatString=Background fenrirBGColor,Foreground fenrirFGColor,fenrirUnderline,fenrirBold,fenrirBlink, Font fenrirFont,Fontsize fenrirFontSize +# present indentation autoPresentIndent=False +# speak is only invoked on changeing ident level, sound always +# 0 = sound and speak +# 1 = sound only +# 2 = speak only +autoPresentIndentMode=1 # play a sound when attributes are changeing hasAttributes=True # shell for PTY emulatiun (empty = default shell) diff --git a/config/settings/settings.conf.storm b/config/settings/settings.conf.storm index 1b59cc58..df276049 100644 --- a/config/settings/settings.conf.storm +++ b/config/settings/settings.conf.storm @@ -130,7 +130,13 @@ commandPath= #fenrirFont = the font #fenrirFontSize = the fontsize attributeFormatString=Background fenrirBGColor,Foreground fenrirFGColor,fenrirUnderline,fenrirBold,fenrirBlink, Font fenrirFont,Fontsize fenrirFontSize +# present indentation autoPresentIndent=False +# speak is only invoked on changeing ident level, sound always +# 0 = sound and speak +# 1 = sound only +# 2 = speak only +autoPresentIndentMode=1 # play a sound when attributes are changeing hasAttributes=False # shell for PTY emulatiun (empty = default shell) diff --git a/config/settings/speech-dispatcher.settings.conf b/config/settings/speech-dispatcher.settings.conf index 664086ca..adf108f1 100644 --- a/config/settings/speech-dispatcher.settings.conf +++ b/config/settings/speech-dispatcher.settings.conf @@ -184,7 +184,13 @@ commandPath= #fenrirFont = the font #fenrirFontSize = the fontsize attributeFormatString=Background fenrirBGColor,Foreground fenrirFGColor,fenrirUnderline,fenrirBold,fenrirBlink, Font fenrirFont,Fontsize fenrirFontSize +# present indentation autoPresentIndent=False +# speak is only invoked on changeing ident level, sound always +# 0 = sound and speak +# 1 = sound only +# 2 = speak only +autoPresentIndentMode=1 # play a sound when attributes are changeing hasAttributes=True # shell for PTY emulatiun (empty = default shell) diff --git a/src/fenrirscreenreader/commands/onCursorChange/65000-present_line_if_cursor_change_vertical.py b/src/fenrirscreenreader/commands/onCursorChange/65000-present_line_if_cursor_change_vertical.py index 5ccbd0cd..4c33cce5 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/65000-present_line_if_cursor_change_vertical.py +++ b/src/fenrirscreenreader/commands/onCursorChange/65000-present_line_if_cursor_change_vertical.py @@ -40,13 +40,16 @@ class command(): currIdent = len(currLine) - len(currLine.lstrip()) if self.lastIdent == -1: self.lastIdent = currIdent - doInterrupt = True + doInterrupt = True if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'autoPresentIndent'): - if self.lastIdent != currIdent: - self.env['runtime']['outputManager'].presentText(_('indented ') + str(currIdent) + ' ', interrupt=doInterrupt, flush=False) - doInterrupt = False + if self.env['runtime']['settingsManager'].getSettingAsInt('general', 'autoPresentIndentMode') in [0,1]: + self.env['runtime']['outputManager'].playFrequence(currIdent * 50, 0.1, interrupt=doInterrupt) + if self.env['runtime']['settingsManager'].getSettingAsInt('general', 'autoPresentIndentMode') in [0,2]: + if self.lastIdent != currIdent: + self.env['runtime']['outputManager'].presentText(_('indented ') + str(currIdent) + ' ', interrupt=doInterrupt, flush=False) + doInterrupt = False # barrier - sayLine = currLine + sayLine = currLine if self.env['runtime']['settingsManager'].getSettingAsBool('barrier','enabled'): isBarrier, barrierLine = self.env['runtime']['barrierManager'].handleLineBarrier(self.env['screen']['newContentText'].split('\n'), self.env['screen']['newCursor']['x'],self.env['screen']['newCursor']['y']) if isBarrier: diff --git a/src/fenrirscreenreader/core/fenrirManager.py b/src/fenrirscreenreader/core/fenrirManager.py index 281788c2..037a1290 100644 --- a/src/fenrirscreenreader/core/fenrirManager.py +++ b/src/fenrirscreenreader/core/fenrirManager.py @@ -23,11 +23,7 @@ class fenrirManager(): raise RuntimeError('Cannot Initialize. Maybe the configfile is not available or not parseable') except RuntimeError: raise - for m in range(1, 280): - if m % 4 ==0: - self.environment['runtime']['outputManager'].playFrequence(m * 40, 0.2, interrupt=True) - time.sleep(0.3) - #self.environment['runtime']['outputManager'].presentText(_("Start Fenrir"), soundIcon='ScreenReaderOn', interrupt=True) + self.environment['runtime']['outputManager'].presentText(_("Start Fenrir"), soundIcon='ScreenReaderOn', interrupt=True) signal.signal(signal.SIGINT, self.captureSignal) signal.signal(signal.SIGTERM, self.captureSignal) self.initialized = True diff --git a/src/fenrirscreenreader/core/settingsData.py b/src/fenrirscreenreader/core/settingsData.py index 5eceffe1..373262d9 100644 --- a/src/fenrirscreenreader/core/settingsData.py +++ b/src/fenrirscreenreader/core/settingsData.py @@ -9,7 +9,7 @@ from fenrirscreenreader.core import debug settingsData = { 'sound': { 'enabled': True, - 'driver': 'genericDriver', + 'driver': 'genericDriver', 'theme': 'default', 'volume': 1.0, 'genericPlayFileCommand': 'play -q -v fenrirVolume fenrirSoundFile', @@ -22,7 +22,7 @@ settingsData = { 'rate': 0.75, 'pitch': 0.5, 'capitalPitch':0.8, - 'volume': 1.0, + 'volume': 1.0, 'module': '', 'voice': 'en-us', 'language': '', @@ -33,7 +33,7 @@ settingsData = { 'fenrirMinPitch':0, 'fenrirMaxPitch':99, 'fenrirMinRate':80, - 'fenrirMaxRate':450, + 'fenrirMaxRate':450, }, 'braille':{ 'enabled': False, @@ -43,7 +43,7 @@ settingsData = { 'flushTimeout': 3, 'cursorFocusMode':'page', # page,fixCell 'fixCursorOnCell': -1, - 'cursorFollowMode': 'review', # none, review, last, text + 'cursorFollowMode': 'review', # none, review, last, text 'panSizeHorizontal': 0 # 0 = display size }, 'screen':{ @@ -64,7 +64,7 @@ settingsData = { 'numberOfClipboards': 10, 'emoticons': True, 'fenrirKeys': 'KEY_KP0,KEY_META', - 'scriptKeys': 'KEY_COMPOSE', + 'scriptKeys': 'KEY_COMPOSE', 'timeFormat': '%I:%M%P', 'dateFormat': '%A, %B %d, %Y', 'autoSpellCheck': False, @@ -73,6 +73,7 @@ settingsData = { 'commandPath': '/usr/share/fenrirscreenreader/commands', 'attributeFormatString': 'Background fenrirBGColor,Foreground fenrirFGColor,fenrirUnderline,fenrirBold,fenrirBlink, Font fenrirFont,Fontsize fenrirFontSize', 'autoPresentIndent': False, + 'autoPresentIndentMode': 1, 'hasAttributes': True, 'shell': '', }, @@ -111,7 +112,7 @@ settingsData = { 'time':{ 'enabled': False, 'presentTime': True, - 'presentDate': True, + 'presentDate': True, 'delaySec': 0, 'onMinutes': '00,30', 'announce': True, @@ -121,7 +122,7 @@ settingsData = { 'driver': 'evdev', 'device': 'all', 'grabDevices': True, - 'ignoreShortcuts': False, + 'ignoreShortcuts': False, 'keyboardLayout': "desktop", 'charEcho': False, 'charDeleteEcho': True,