From c7eefb7d5ec47600ef57e73e5a1a0fd09942b28d Mon Sep 17 00:00:00 2001 From: chrys Date: Fri, 29 Jun 2018 09:50:05 +0200 Subject: [PATCH 01/12] Update textManager.py --- src/fenrirscreenreader/core/textManager.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/fenrirscreenreader/core/textManager.py b/src/fenrirscreenreader/core/textManager.py index 05633f30..f7e701c9 100644 --- a/src/fenrirscreenreader/core/textManager.py +++ b/src/fenrirscreenreader/core/textManager.py @@ -9,6 +9,7 @@ import re, string class textManager(): def __init__(self): + # https://regex101.com/ self.regExSingle = re.compile(r'(([^\w\s])\2{5,})') self.regExDouble = re.compile(r'([^\w\s]{2,}){5,}') def initialize(self, environment): From 2eebb12dcabd263418fb4ad4af67aaa8a7b07200 Mon Sep 17 00:00:00 2001 From: chrys Date: Fri, 29 Jun 2018 17:30:23 +0200 Subject: [PATCH 02/12] add settings for barrier --- TODO v2.0 | 4 ++++ config/settings/espeak.settings.conf | 6 +++++- config/settings/settings.conf | 8 ++++++-- config/settings/settings.conf.example | 6 +++++- config/settings/settings.conf.storm | 6 +++++- config/settings/speech-dispatcher.settings.conf | 6 +++++- .../55000-present_line_if_cursor_change_vertical.py | 2 +- src/fenrirscreenreader/core/settingsData.py | 7 ++++++- 8 files changed, 37 insertions(+), 8 deletions(-) diff --git a/TODO v2.0 b/TODO v2.0 index f69e9192..b5b251a7 100644 --- a/TODO v2.0 +++ b/TODO v2.0 @@ -40,6 +40,10 @@ Imporove attribute handling - [X] Soundicon on barrier detection - [] Barrier detection in hilight tracking - [] valid barriers by window edges + - [] make barrirs configurable + - [] enter barrier mode detection + - [] leave barrier mode detection + - [] soundicon barrier start/end Improved Say all [] speech callbacks diff --git a/config/settings/espeak.settings.conf b/config/settings/espeak.settings.conf index b74dfb29..42d8d7c8 100644 --- a/config/settings/espeak.settings.conf +++ b/config/settings/espeak.settings.conf @@ -186,7 +186,11 @@ shell= [focus] cursor=True highlight=False -barrier=True + +[barrier] +enabled=True +leftBarriers=│,└,┌,─ +rightBarriers=│,┘,┐,─ [review] lineBreak=True diff --git a/config/settings/settings.conf b/config/settings/settings.conf index 048d2507..505e7725 100644 --- a/config/settings/settings.conf +++ b/config/settings/settings.conf @@ -196,8 +196,12 @@ shell= cursor=True #follow highlighted text changes highlight=False -barrier=True - + +[barrier] +enabled=True +leftBarriers=│,└,┌,─ +rightBarriers=│,┘,┐,─ + [review] lineBreak=True endOfScreen=True diff --git a/config/settings/settings.conf.example b/config/settings/settings.conf.example index 7a9b2b96..66f1f3cf 100644 --- a/config/settings/settings.conf.example +++ b/config/settings/settings.conf.example @@ -197,7 +197,11 @@ shell= cursor=True #follow highlighted text changes highlight=False -barrier=True + +[barrier] +enabled=True +leftBarriers=│,└,┌,─ +rightBarriers=│,┘,┐,─ [review] lineBreak=True diff --git a/config/settings/settings.conf.storm b/config/settings/settings.conf.storm index 0668ae1a..f87acb0a 100644 --- a/config/settings/settings.conf.storm +++ b/config/settings/settings.conf.storm @@ -142,7 +142,11 @@ shell= cursor=True #follow highlighted text changes highlight=False -barrier=True + +[barrier] +enabled=True +leftBarriers=│,└,┌,─ +rightBarriers=│,┘,┐,─ [review] lineBreak=True diff --git a/config/settings/speech-dispatcher.settings.conf b/config/settings/speech-dispatcher.settings.conf index 3ee9788c..82524334 100644 --- a/config/settings/speech-dispatcher.settings.conf +++ b/config/settings/speech-dispatcher.settings.conf @@ -196,7 +196,11 @@ shell= cursor=True #follow highlighted text changes highlight=False -barrier=True + +[barrier] +enabled=True +leftBarriers=│,└,┌,─ +rightBarriers=│,┘,┐,─ [review] lineBreak=True diff --git a/src/fenrirscreenreader/commands/onCursorChange/55000-present_line_if_cursor_change_vertical.py b/src/fenrirscreenreader/commands/onCursorChange/55000-present_line_if_cursor_change_vertical.py index b42da4d6..e36ca032 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/55000-present_line_if_cursor_change_vertical.py +++ b/src/fenrirscreenreader/commands/onCursorChange/55000-present_line_if_cursor_change_vertical.py @@ -47,7 +47,7 @@ class command(): doInterrupt = False # barrier sayLine = currLine - if self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'barrier'): + if self.env['runtime']['settingsManager'].getSettingAsBool('barrier','enabled'): sayLine = self.env['runtime']['barrierManager'].handleLineBarrier(sayLine, self.env['screen']['newCursor']['x']) # output self.env['runtime']['outputManager'].presentText(sayLine, interrupt=doInterrupt, flush=False) diff --git a/src/fenrirscreenreader/core/settingsData.py b/src/fenrirscreenreader/core/settingsData.py index e3b0d681..db08a324 100644 --- a/src/fenrirscreenreader/core/settingsData.py +++ b/src/fenrirscreenreader/core/settingsData.py @@ -80,7 +80,12 @@ settingsData = { 'focus':{ 'cursor': True, 'highlight': False, - 'barrier': True, + +}, +'barrier':{ + 'enabled': True, + 'leftBarriers': '│,└,┌,─', + 'rightBarriers': '│,┘,┐,─', }, 'review':{ 'lineBreak': True, From 97a0f4bfbd9b3e608b8b956a39db4781d018c68f Mon Sep 17 00:00:00 2001 From: chrys Date: Wed, 4 Jul 2018 16:23:38 +0200 Subject: [PATCH 03/12] WIP barrir rework --- src/fenrirscreenreader/core/barrierManager.py | 74 +++++++++++++++---- 1 file changed, 58 insertions(+), 16 deletions(-) diff --git a/src/fenrirscreenreader/core/barrierManager.py b/src/fenrirscreenreader/core/barrierManager.py index 169fc0ed..5ec39eeb 100644 --- a/src/fenrirscreenreader/core/barrierManager.py +++ b/src/fenrirscreenreader/core/barrierManager.py @@ -33,27 +33,69 @@ class barrierManager(): self.env['runtime']['outputManager'].playSoundIcon(soundIcon='BarrierFound', interrupt=doInterrupt) return sayLine - def hasBarrier(self, start, end): + def hasBorder(self, text, xCursor, yCursor, validBorder): # check for corners here + lastLineNo = len(text) - 1 + if yCursor <= 0: + if not (text[0][xCursor] in validBorder): + return False + if len(text) > 1: + if not (text[1][xCursor] in validBorder): + return False + if len(text) > 2: + if not (text[2][xCursor] in validBorder): + return False + elif yCursor >= lastLineNo: + if not (text[lastLineNo][xCursor] in validBorder): + return False + if len(text) > 1: + if not (text[lastLineNo - 1][xCursor] in validBorder): + return False + if len(text) > 2: + if not (text[lastLineNo - 2][xCursor] in validBorder): + return False + else: + if not (text[yCursor][xCursor] in validBorder): + return False + if not (text[yCursor - 1][xCursor] in validBorder): + return False + if not (text[yCursor + 1][xCursor] in validBorder): + return False return True - def getBarrierText(self, line, xCursor): - offset = xCursor + def getBarrierText(self, text, xCursor, yCursor): + line = text[yCursor] + if not self.env['runtime']['settingsManager'].getSettingAsBool('barrier', 'enabled'): + return False, line + offset = xCursor + + leftBarriers = self.env['runtime']['settingsManager'].getSetting('barrier', 'barrier') + rightBarriers = self.env['runtime']['settingsManager'].getSetting('barrier', 'grabDevices') # is the cursor at the begin or end of an entry: #print(line[:offset + 1].count('│'),line[offset:].count('│')) - if line[:offset + 1].count('│') > line[offset:].count('│'): - offset = xCursor - 1 - - start = line[:offset + 1].rfind('│') + 1 - end = line[offset + 1:].find('│') + # start + for b in leftBarriers: + if line[:offset + 1].count(b) > line[offset:].count(b): + offset = xCursor - 1 + + start = line[:offset + 1].rfind(b) + 1 + if start != -1: + if not self.hasBorder(text, xCursor, yCursor): + start = -1 + break + if start == -1: + return False, line + # end + for b in rightBarriers: + end = line[offset + 1:].find(b) + if end != -1: + if not self.hasBorder(text, xCursor, yCursor): + end = -1 + break + if end == -1: + return False, line if start == end: return False, line - if start == -1: - return False, line - if end == -1: - return False, line - else: - end += offset + 1 - if not self.hasBarrier(start, end): - return False, line + end += offset + 1 + return True, line[start:end] From 8ade798ba5f5aab9c2e928010368ad1b9842951f Mon Sep 17 00:00:00 2001 From: chrys Date: Thu, 5 Jul 2018 01:23:26 +0200 Subject: [PATCH 04/12] add file --- play zone/split.txt | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 play zone/split.txt diff --git a/play zone/split.txt b/play zone/split.txt new file mode 100644 index 00000000..74dfc21d --- /dev/null +++ b/play zone/split.txt @@ -0,0 +1,34 @@ +./play zone/wrapWord.py:21: wrappedLines = currText.split('\n') +./play zone/wrapWord.py:50: wrappedLines = currText.split('\n') +./play zone/wrapWord.py:93: wrappedLines = currText.split('\n') +./src/fenrirscreenreader/screenDriver/vcsaDriver.py:281: apps = subprocess.Popen('ps -t tty' + currScreen + ' -o comm,tty,stat', shell=True, stdout=subprocess.PIPE).stdout.read().decode()[:-1].split('\n') +./src/fenrirscreenreader/utils/line_utils.py:14: wrappedLines = currText.split('\n') +./src/fenrirscreenreader/utils/line_utils.py:30: wrappedLines = currText.split('\n') +./src/fenrirscreenreader/utils/line_utils.py:41: wrappedLines = currText.split('\n') +./src/fenrirscreenreader/utils/char_utils.py:14: wrappedLines = currText.split('\n') +./src/fenrirscreenreader/utils/char_utils.py:35: wrappedLines = currText.split('\n') +./src/fenrirscreenreader/utils/char_utils.py:43: wrappedLines = currText.split('\n') +./src/fenrirscreenreader/utils/char_utils.py:58: wrappedLines = currText.split('\n') +./src/fenrirscreenreader/utils/char_utils.py:73: wrappedLines = currText.split('\n') +./src/fenrirscreenreader/utils/char_utils.py:85: wrappedLines = currText.split('\n') +./src/fenrirscreenreader/utils/mark_utils.py:13: inText = inText.split('\n') +./src/fenrirscreenreader/utils/mark_utils.py:59: inText = inText.split('\n') +./src/fenrirscreenreader/utils/word_utils.py:20: wrappedLines = currText.split('\n') +./src/fenrirscreenreader/utils/word_utils.py:62: wrappedLines = currText.split('\n') +./src/fenrirscreenreader/utils/word_utils.py:91: wrappedLines = currText.split('\n') +./src/fenrirscreenreader/core/outputManager.py:173: currline = text.split('\n')[offset['y']] +./src/fenrirscreenreader/core/attributeManager.py:250: textLines = text.split('\n') +./src/fenrirscreenreader/core/screenManager.py:166: diffList = ['+ ' + self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] +'\n'] +./src/fenrirscreenreader/core/screenManager.py:169: diff = self.differ.compare(oldScreenText.split('\n'),\ +./src/fenrirscreenreader/core/screenManager.py:170: newScreenText.split('\n')) +./src/fenrirscreenreader/core/screenManager.py:225: windowList = text.split('\n') +./src/fenrirscreenreader/commands/onCursorChange/62000-spell_check.py:66: newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] +./src/fenrirscreenreader/commands/onCursorChange/60000-word_echo_type.py:39: newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] +./src/fenrirscreenreader/commands/onCursorChange/50000-present_char_if_cursor_change_horizontal.py:41: newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] +./src/fenrirscreenreader/commands/onCursorChange/61000-word_echo_navigation.py:37: newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] +./src/fenrirscreenreader/commands/commands/spell_check.py:47: newContent = self.env['screen']['newContentText'].split('\n')[cursorPos['y']] +./src/fenrirscreenreader/commands/commands/remove_word_from_spell_check.py:45: newContent = self.env['screen']['newContentText'].split('\n')[cursorPos['y']] +./src/fenrirscreenreader/commands/commands/add_word_to_spell_check.py:43: newContent = self.env['screen']['newContentText'].split('\n')[cursorPos['y']] +./src/fenrirscreenreader/commands/onScreenUpdate/60000-history.py:38: prevLine = self.env['screen']['oldContentText'].split('\n')[self.env['screen']['newCursor']['y']] +./src/fenrirscreenreader/commands/onScreenUpdate/60000-history.py:39: currLine = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] +./TODO v2.0:72: w.fill(i).split('\n') From 671a5e00f8ca1146ed4b82aeb7852fb39ef6ef00 Mon Sep 17 00:00:00 2001 From: chrys Date: Sat, 7 Jul 2018 15:35:07 +0200 Subject: [PATCH 05/12] make barrir in/ out working --- config/sound/default/soundicons.conf | 4 ++ config/sound/template/soundicons.conf | 4 ++ ...-present_line_if_cursor_change_vertical.py | 4 +- src/fenrirscreenreader/core/barrierManager.py | 65 +++++++++++-------- 4 files changed, 50 insertions(+), 27 deletions(-) diff --git a/config/sound/default/soundicons.conf b/config/sound/default/soundicons.conf index 830ccb13..8ad2c0ec 100644 --- a/config/sound/default/soundicons.conf +++ b/config/sound/default/soundicons.conf @@ -15,6 +15,10 @@ StartOfLine='StartOfLine.wav' EndOfLine='EndOfLine.wav' # barrier was detected BarrierFound='barrier.wav' +# barrier mode starts +BarrierStart='barrier_start.wav' +# barrier mode ends +BarrierEnd='barrier_end.wav' # the Line is empty EmptyLine='EmptyLine.wav' # Is the first line on the screen. diff --git a/config/sound/template/soundicons.conf b/config/sound/template/soundicons.conf index e5039970..6304abce 100644 --- a/config/sound/template/soundicons.conf +++ b/config/sound/template/soundicons.conf @@ -15,6 +15,10 @@ StartOfLine='' EndOfLine='' # barrier was detected BarrierFound='' +# barrier mode starts +BarrierStart='' +# barrier mode ends +BarrierEnd='' # the Line is empty EmptyLine='' # Is the first line on the screen. diff --git a/src/fenrirscreenreader/commands/onCursorChange/55000-present_line_if_cursor_change_vertical.py b/src/fenrirscreenreader/commands/onCursorChange/55000-present_line_if_cursor_change_vertical.py index e36ca032..5ccbd0cd 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/55000-present_line_if_cursor_change_vertical.py +++ b/src/fenrirscreenreader/commands/onCursorChange/55000-present_line_if_cursor_change_vertical.py @@ -48,7 +48,9 @@ class command(): # barrier sayLine = currLine if self.env['runtime']['settingsManager'].getSettingAsBool('barrier','enabled'): - sayLine = self.env['runtime']['barrierManager'].handleLineBarrier(sayLine, self.env['screen']['newCursor']['x']) + 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: + sayLine = barrierLine # output self.env['runtime']['outputManager'].presentText(sayLine, interrupt=doInterrupt, flush=False) self.lastIdent = currIdent diff --git a/src/fenrirscreenreader/core/barrierManager.py b/src/fenrirscreenreader/core/barrierManager.py index 5ec39eeb..a3764412 100644 --- a/src/fenrirscreenreader/core/barrierManager.py +++ b/src/fenrirscreenreader/core/barrierManager.py @@ -24,43 +24,53 @@ class barrierManager(): self.prefIsBarrier = False def isBarrierChange(self): return self.currIsBarrier != self.prefIsBarrier - def handleLineBarrier(self, line, xCursor, output=True, doInterrupt=True): - isBarrier, sayLine = self.getBarrierText(line, xCursor) + def handleLineBarrier(self, text, xCursor, yCursor, output=True, doInterrupt=True): + isBarrier = False + try: + isBarrier, sayLine = self.getBarrierText(text, xCursor, yCursor) + except Exception as e: + return False, '' + self.updateBarrierChange(isBarrier) - #if self.isBarrierChange(): - if isBarrier: - if output: - self.env['runtime']['outputManager'].playSoundIcon(soundIcon='BarrierFound', interrupt=doInterrupt) - return sayLine + if self.isBarrierChange(): + if output: + if isBarrier: + self.env['runtime']['outputManager'].playSoundIcon(soundIcon='BarrierStart', interrupt=doInterrupt) + else: + self.env['runtime']['outputManager'].playSoundIcon(soundIcon='BarrierEnd', interrupt=doInterrupt) + + if not isBarrier: + sayLine = '' + return isBarrier, sayLine - def hasBorder(self, text, xCursor, yCursor, validBorder): + def hasBorder(self, text, xCursor, yCursor, validBorder, barrierPos): # check for corners here lastLineNo = len(text) - 1 if yCursor <= 0: - if not (text[0][xCursor] in validBorder): + if not (text[0][barrierPos] in validBorder): return False if len(text) > 1: - if not (text[1][xCursor] in validBorder): + if not (text[1][barrierPos] in validBorder): return False if len(text) > 2: - if not (text[2][xCursor] in validBorder): + if not (text[2][barrierPos] in validBorder): return False elif yCursor >= lastLineNo: - if not (text[lastLineNo][xCursor] in validBorder): + if not (text[lastLineNo][barrierPos] in validBorder): return False if len(text) > 1: - if not (text[lastLineNo - 1][xCursor] in validBorder): + if not (text[lastLineNo - 1][barrierPos] in validBorder): return False if len(text) > 2: - if not (text[lastLineNo - 2][xCursor] in validBorder): + if not (text[lastLineNo - 2][barrierPos] in validBorder): return False else: - if not (text[yCursor][xCursor] in validBorder): + if not (text[yCursor][barrierPos] in validBorder): return False - if not (text[yCursor - 1][xCursor] in validBorder): + if not (text[yCursor - 1][barrierPos] in validBorder): return False - if not (text[yCursor + 1][xCursor] in validBorder): - return False + if not (text[yCursor + 1][barrierPos] in validBorder): + return False return True def getBarrierText(self, text, xCursor, yCursor): line = text[yCursor] @@ -68,27 +78,30 @@ class barrierManager(): return False, line offset = xCursor - leftBarriers = self.env['runtime']['settingsManager'].getSetting('barrier', 'barrier') - rightBarriers = self.env['runtime']['settingsManager'].getSetting('barrier', 'grabDevices') + leftBarriers = self.env['runtime']['settingsManager'].getSetting('barrier', 'leftBarriers') + rightBarriers = self.env['runtime']['settingsManager'].getSetting('barrier', 'rightBarriers') # is the cursor at the begin or end of an entry: #print(line[:offset + 1].count('│'),line[offset:].count('│')) # start + for b in leftBarriers: if line[:offset + 1].count(b) > line[offset:].count(b): offset = xCursor - 1 - - start = line[:offset + 1].rfind(b) + 1 + start = line[:offset + 1].rfind(b) if start != -1: - if not self.hasBorder(text, xCursor, yCursor): - start = -1 + if not self.hasBorder(text, xCursor, yCursor, leftBarriers, start): + start = -1 + else: + start += 1 break if start == -1: return False, line # end for b in rightBarriers: - end = line[offset + 1:].find(b) + end = line[start + 1:].find(b) if end != -1: - if not self.hasBorder(text, xCursor, yCursor): + end = start + end + if not self.hasBorder(text, xCursor, yCursor,rightBarriers, end + 1): end = -1 break if end == -1: From 96977c93a62a54b337e38167dbc26983f94981cb Mon Sep 17 00:00:00 2001 From: chrys Date: Sat, 7 Jul 2018 15:37:10 +0200 Subject: [PATCH 06/12] remove , --- config/settings/espeak.settings.conf | 4 ++-- config/settings/settings.conf | 4 ++-- config/settings/settings.conf.example | 4 ++-- config/settings/settings.conf.storm | 4 ++-- config/settings/speech-dispatcher.settings.conf | 4 ++-- src/fenrirscreenreader/core/settingsData.py | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/config/settings/espeak.settings.conf b/config/settings/espeak.settings.conf index 42d8d7c8..665d8289 100644 --- a/config/settings/espeak.settings.conf +++ b/config/settings/espeak.settings.conf @@ -189,8 +189,8 @@ highlight=False [barrier] enabled=True -leftBarriers=│,└,┌,─ -rightBarriers=│,┘,┐,─ +leftBarriers=│└┌─ +rightBarriers=│┘┐─ [review] lineBreak=True diff --git a/config/settings/settings.conf b/config/settings/settings.conf index 505e7725..8105e537 100644 --- a/config/settings/settings.conf +++ b/config/settings/settings.conf @@ -199,8 +199,8 @@ highlight=False [barrier] enabled=True -leftBarriers=│,└,┌,─ -rightBarriers=│,┘,┐,─ +leftBarriers=│└┌─ +rightBarriers=│┘┐─ [review] lineBreak=True diff --git a/config/settings/settings.conf.example b/config/settings/settings.conf.example index 66f1f3cf..9094763b 100644 --- a/config/settings/settings.conf.example +++ b/config/settings/settings.conf.example @@ -200,8 +200,8 @@ highlight=False [barrier] enabled=True -leftBarriers=│,└,┌,─ -rightBarriers=│,┘,┐,─ +leftBarriers=│└┌─ +rightBarriers=│┘┐─ [review] lineBreak=True diff --git a/config/settings/settings.conf.storm b/config/settings/settings.conf.storm index f87acb0a..33b23765 100644 --- a/config/settings/settings.conf.storm +++ b/config/settings/settings.conf.storm @@ -145,8 +145,8 @@ highlight=False [barrier] enabled=True -leftBarriers=│,└,┌,─ -rightBarriers=│,┘,┐,─ +leftBarriers=│└┌─ +rightBarriers=│┘┐─ [review] lineBreak=True diff --git a/config/settings/speech-dispatcher.settings.conf b/config/settings/speech-dispatcher.settings.conf index 82524334..e936de42 100644 --- a/config/settings/speech-dispatcher.settings.conf +++ b/config/settings/speech-dispatcher.settings.conf @@ -199,8 +199,8 @@ highlight=False [barrier] enabled=True -leftBarriers=│,└,┌,─ -rightBarriers=│,┘,┐,─ +leftBarriers=│└┌─ +rightBarriers=│┘┐─ [review] lineBreak=True diff --git a/src/fenrirscreenreader/core/settingsData.py b/src/fenrirscreenreader/core/settingsData.py index db08a324..88ae1653 100644 --- a/src/fenrirscreenreader/core/settingsData.py +++ b/src/fenrirscreenreader/core/settingsData.py @@ -84,8 +84,8 @@ settingsData = { }, 'barrier':{ 'enabled': True, - 'leftBarriers': '│,└,┌,─', - 'rightBarriers': '│,┘,┐,─', + 'leftBarriers': '│└┌─', + 'rightBarriers': '│┘┐─', }, 'review':{ 'lineBreak': True, From bddb67e634045917276028722660d75d99458344 Mon Sep 17 00:00:00 2001 From: chrys Date: Sat, 7 Jul 2018 16:26:41 +0200 Subject: [PATCH 07/12] fix barrier Toggle --- src/fenrirscreenreader/commands/commands/toggle_barrier.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fenrirscreenreader/commands/commands/toggle_barrier.py b/src/fenrirscreenreader/commands/commands/toggle_barrier.py index f8e814ab..fe5925d0 100644 --- a/src/fenrirscreenreader/commands/commands/toggle_barrier.py +++ b/src/fenrirscreenreader/commands/commands/toggle_barrier.py @@ -16,8 +16,8 @@ class command(): return _('enables or disables the barrier mode') def run(self): - self.env['runtime']['settingsManager'].setSetting('focus', 'barrier', str(not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'barrier'))) - if self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'barrier'): + self.env['runtime']['settingsManager'].setSetting('barrier', 'enabled', str(not self.env['runtime']['settingsManager'].getSettingAsBool('barrier', 'enabled'))) + if self.env['runtime']['settingsManager'].getSettingAsBool('barrier', 'enabled'): self.env['runtime']['outputManager'].presentText(_("barrier mode enabled"), soundIcon='', interrupt=True) else: self.env['runtime']['outputManager'].presentText(_("barrier mode disabled"), soundIcon='', interrupt=True) From 45971a8acc90396764755b52e16bb6304f41967f Mon Sep 17 00:00:00 2001 From: chrys Date: Sat, 7 Jul 2018 16:46:48 +0200 Subject: [PATCH 08/12] sync --- .../onScreenChanged/70000-barrier_detect.py | 27 +++++++++++++++++ .../onScreenUpdate/80000-barrier_detect.py | 29 +++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 src/fenrirscreenreader/commands/onScreenChanged/70000-barrier_detect.py create mode 100644 src/fenrirscreenreader/commands/onScreenUpdate/80000-barrier_detect.py diff --git a/src/fenrirscreenreader/commands/onScreenChanged/70000-barrier_detect.py b/src/fenrirscreenreader/commands/onScreenChanged/70000-barrier_detect.py new file mode 100644 index 00000000..4f764092 --- /dev/null +++ b/src/fenrirscreenreader/commands/onScreenChanged/70000-barrier_detect.py @@ -0,0 +1,27 @@ +#!/bin/python +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No Description found' + + def run(self): + if not self.env['runtime']['settingsManager'].getSettingAsBool('barrier','enabled'): + return + + self.env['runtime']['barrierManager'].handleLineBarrier(self.env['screen']['newContentText'].split('\n'), self.env['screen']['newCursor']['x'],self.env['screen']['newCursor']['y']) + + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/onScreenUpdate/80000-barrier_detect.py b/src/fenrirscreenreader/commands/onScreenUpdate/80000-barrier_detect.py new file mode 100644 index 00000000..87d119b0 --- /dev/null +++ b/src/fenrirscreenreader/commands/onScreenUpdate/80000-barrier_detect.py @@ -0,0 +1,29 @@ +#!/bin/python +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No Description found' + + def run(self): + if not self.env['runtime']['settingsManager'].getSettingAsBool('barrier','enabled'): + return + if not self.env['runtime']['screenManager'].isDelta(ignoreSpace=True): + return + + self.env['runtime']['barrierManager'].handleLineBarrier(self.env['screen']['newContentText'].split('\n'), self.env['screen']['newCursor']['x'],self.env['screen']['newCursor']['y']) + + def setCallback(self, callback): + pass + From ed989942418221c975b1b5920a897cfc014813f8 Mon Sep 17 00:00:00 2001 From: chrys Date: Sat, 7 Jul 2018 17:21:22 +0200 Subject: [PATCH 09/12] fix issues with barrier --- src/fenrirscreenreader/core/barrierManager.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/fenrirscreenreader/core/barrierManager.py b/src/fenrirscreenreader/core/barrierManager.py index a3764412..fa4c2d62 100644 --- a/src/fenrirscreenreader/core/barrierManager.py +++ b/src/fenrirscreenreader/core/barrierManager.py @@ -87,28 +87,27 @@ class barrierManager(): for b in leftBarriers: if line[:offset + 1].count(b) > line[offset:].count(b): offset = xCursor - 1 - start = line[:offset + 1].rfind(b) + start = line[:offset].rfind(b) if start != -1: if not self.hasBorder(text, xCursor, yCursor, leftBarriers, start): start = -1 else: - start += 1 + start += 1 break if start == -1: return False, line # end for b in rightBarriers: - end = line[start + 1:].find(b) + end = line[start:].find(b) if end != -1: - end = start + end - if not self.hasBorder(text, xCursor, yCursor,rightBarriers, end + 1): + end = start + end + if not self.hasBorder(text, xCursor, yCursor,rightBarriers, end): end = -1 break if end == -1: return False, line if start == end: return False, line - end += offset + 1 return True, line[start:end] From 2d5609dd840445ba878abe9c5aef88a94fd1d0a9 Mon Sep 17 00:00:00 2001 From: chrys Date: Sat, 7 Jul 2018 17:33:56 +0200 Subject: [PATCH 10/12] add has attribute toggle --- config/keyboard/desktop.conf | 1 + config/keyboard/laptop.conf | 1 + config/keyboard/pty.conf | 1 + .../commands/commands/toggle_has_attribute.py | 26 +++++++++++++++++++ 4 files changed, 29 insertions(+) create mode 100644 src/fenrirscreenreader/commands/commands/toggle_has_attribute.py diff --git a/config/keyboard/desktop.conf b/config/keyboard/desktop.conf index 638be423..547fd1fa 100644 --- a/config/keyboard/desktop.conf +++ b/config/keyboard/desktop.conf @@ -88,6 +88,7 @@ KEY_FENRIR,KEY_T=time 2,KEY_FENRIR,KEY_T=date KEY_KPSLASH=toggle_auto_indent KEY_KPMINUS=attribute_cursor +#=toggle_has_attribute 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 diff --git a/config/keyboard/laptop.conf b/config/keyboard/laptop.conf index 9d9a15f0..fcc16e14 100644 --- a/config/keyboard/laptop.conf +++ b/config/keyboard/laptop.conf @@ -88,6 +88,7 @@ KEY_FENRIR,KEY_T=time 2,KEY_FENRIR,KEY_T=date KEY_FENRIR,KEY_BACKSLASH=toggle_auto_indent KEY_FENRIR,KEY_MINUS=attribute_cursor +#=toggle_has_attribute 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 diff --git a/config/keyboard/pty.conf b/config/keyboard/pty.conf index f70fb948..989688de 100644 --- a/config/keyboard/pty.conf +++ b/config/keyboard/pty.conf @@ -2,6 +2,7 @@ ^[OP=toggle_tutorial_mode # double tap control+end read attributes 2,^[[1;5F=attribute_cursor +#=toggle_has_attribute # escape - stop speech ^[=shut_up # context menu key - stop speech diff --git a/src/fenrirscreenreader/commands/commands/toggle_has_attribute.py b/src/fenrirscreenreader/commands/commands/toggle_has_attribute.py new file mode 100644 index 00000000..21ae5348 --- /dev/null +++ b/src/fenrirscreenreader/commands/commands/toggle_has_attribute.py @@ -0,0 +1,26 @@ +#!/bin/python +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('enables or disables the announcement of attributes') + + def run(self): + self.env['runtime']['settingsManager'].setSetting('general', 'hasAttributes', str(not self.env['runtime']['settingsManager'].getSettingAsBool('general', 'hasAttributes'))) + if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'hasAttributes'): + self.env['runtime']['outputManager'].presentText(_("announcement of attributes enabled"), soundIcon='', interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_("announcement of attributes disabled"), soundIcon='', interrupt=True) + + def setCallback(self, callback): + pass From b96be611d6a9cddb76ebe5f27d0b706c93e6ac61 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sat, 7 Jul 2018 12:49:46 -0400 Subject: [PATCH 11/12] Updated storm prefs. --- config/settings/settings.conf.storm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/settings/settings.conf.storm b/config/settings/settings.conf.storm index 0668ae1a..94afd4fc 100644 --- a/config/settings/settings.conf.storm +++ b/config/settings/settings.conf.storm @@ -9,10 +9,10 @@ genericFrequencyCommand=play -q -v fenrirVolume -n -c1 synth fenrirDuration sine [speech] enabled=True -driver=speechdDriver -#driver=genericDriver +#driver=speechdDriver +driver=genericDriver serverPath= -rate=0.95 +rate=0.80 pitch=0.5 # Pitch for capital letters capitalPitch=0.9 @@ -133,7 +133,7 @@ commandPath= attributeFormatString=Background fenrirBGColor,Foreground fenrirFGColor,fenrirUnderline,fenrirBold,fenrirBlink, Font fenrirFont,Fontsize fenrirFontSize autoPresentIndent=False # play a sound when attributes are changeing -hasAttributes=True +hasAttributes=False # shell for PTY emulatiun (empty = default shell) shell= From 44d0513360c76b3a4c26931bb0de2ef7682562f7 Mon Sep 17 00:00:00 2001 From: chrys Date: Sun, 8 Jul 2018 15:41:33 +0200 Subject: [PATCH 12/12] update todo --- TODO v2.0 | 11 ----------- realese nots/1.9.1 | 3 ++- splits.txt | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 12 deletions(-) create mode 100644 splits.txt diff --git a/TODO v2.0 b/TODO v2.0 index b5b251a7..ba9174c5 100644 --- a/TODO v2.0 +++ b/TODO v2.0 @@ -34,17 +34,6 @@ Imporove attribute handling [] configurable (by char, by word, none) (Easy for contribution) https://github.com/jwilk/vcsapeek/blob/master/linuxvt.py -[W] Barrier Mode - - [X] Initial barrier mode - - [X] add command to toggle barrier mode - - [X] Soundicon on barrier detection - - [] Barrier detection in hilight tracking - - [] valid barriers by window edges - - [] make barrirs configurable - - [] enter barrier mode detection - - [] leave barrier mode detection - - [] soundicon barrier start/end - Improved Say all [] speech callbacks [] speech process by word diff --git a/realese nots/1.9.1 b/realese nots/1.9.1 index 35a8563f..b024bb5d 100644 --- a/realese nots/1.9.1 +++ b/realese nots/1.9.1 @@ -1,4 +1,5 @@ - import clipboard from x (xclip) -- initial barrier mode +- barrier mode (respect pseudo cli window borders like used in dialog or pdmenu) - toggle for barrier mode +- soundicon for barrier mode when enter and leave the barrier detection - imporove accuracy of speak history (arrow up/ down in bash) diff --git a/splits.txt b/splits.txt new file mode 100644 index 00000000..74dfc21d --- /dev/null +++ b/splits.txt @@ -0,0 +1,34 @@ +./play zone/wrapWord.py:21: wrappedLines = currText.split('\n') +./play zone/wrapWord.py:50: wrappedLines = currText.split('\n') +./play zone/wrapWord.py:93: wrappedLines = currText.split('\n') +./src/fenrirscreenreader/screenDriver/vcsaDriver.py:281: apps = subprocess.Popen('ps -t tty' + currScreen + ' -o comm,tty,stat', shell=True, stdout=subprocess.PIPE).stdout.read().decode()[:-1].split('\n') +./src/fenrirscreenreader/utils/line_utils.py:14: wrappedLines = currText.split('\n') +./src/fenrirscreenreader/utils/line_utils.py:30: wrappedLines = currText.split('\n') +./src/fenrirscreenreader/utils/line_utils.py:41: wrappedLines = currText.split('\n') +./src/fenrirscreenreader/utils/char_utils.py:14: wrappedLines = currText.split('\n') +./src/fenrirscreenreader/utils/char_utils.py:35: wrappedLines = currText.split('\n') +./src/fenrirscreenreader/utils/char_utils.py:43: wrappedLines = currText.split('\n') +./src/fenrirscreenreader/utils/char_utils.py:58: wrappedLines = currText.split('\n') +./src/fenrirscreenreader/utils/char_utils.py:73: wrappedLines = currText.split('\n') +./src/fenrirscreenreader/utils/char_utils.py:85: wrappedLines = currText.split('\n') +./src/fenrirscreenreader/utils/mark_utils.py:13: inText = inText.split('\n') +./src/fenrirscreenreader/utils/mark_utils.py:59: inText = inText.split('\n') +./src/fenrirscreenreader/utils/word_utils.py:20: wrappedLines = currText.split('\n') +./src/fenrirscreenreader/utils/word_utils.py:62: wrappedLines = currText.split('\n') +./src/fenrirscreenreader/utils/word_utils.py:91: wrappedLines = currText.split('\n') +./src/fenrirscreenreader/core/outputManager.py:173: currline = text.split('\n')[offset['y']] +./src/fenrirscreenreader/core/attributeManager.py:250: textLines = text.split('\n') +./src/fenrirscreenreader/core/screenManager.py:166: diffList = ['+ ' + self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] +'\n'] +./src/fenrirscreenreader/core/screenManager.py:169: diff = self.differ.compare(oldScreenText.split('\n'),\ +./src/fenrirscreenreader/core/screenManager.py:170: newScreenText.split('\n')) +./src/fenrirscreenreader/core/screenManager.py:225: windowList = text.split('\n') +./src/fenrirscreenreader/commands/onCursorChange/62000-spell_check.py:66: newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] +./src/fenrirscreenreader/commands/onCursorChange/60000-word_echo_type.py:39: newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] +./src/fenrirscreenreader/commands/onCursorChange/50000-present_char_if_cursor_change_horizontal.py:41: newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] +./src/fenrirscreenreader/commands/onCursorChange/61000-word_echo_navigation.py:37: newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] +./src/fenrirscreenreader/commands/commands/spell_check.py:47: newContent = self.env['screen']['newContentText'].split('\n')[cursorPos['y']] +./src/fenrirscreenreader/commands/commands/remove_word_from_spell_check.py:45: newContent = self.env['screen']['newContentText'].split('\n')[cursorPos['y']] +./src/fenrirscreenreader/commands/commands/add_word_to_spell_check.py:43: newContent = self.env['screen']['newContentText'].split('\n')[cursorPos['y']] +./src/fenrirscreenreader/commands/onScreenUpdate/60000-history.py:38: prevLine = self.env['screen']['oldContentText'].split('\n')[self.env['screen']['newCursor']['y']] +./src/fenrirscreenreader/commands/onScreenUpdate/60000-history.py:39: currLine = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] +./TODO v2.0:72: w.fill(i).split('\n')