From d4402d13cff19a41d458d645cf952791b7d63bda Mon Sep 17 00:00:00 2001 From: chrys Date: Tue, 18 Oct 2016 15:17:20 +0200 Subject: [PATCH] add pause after line --- config/settings/settings.conf | 1 + config/settings/settings.conf.storm | 1 + src/fenrir/commands/onScreenUpdate/70000-incoming.py | 2 +- src/fenrir/core/outputManager.py | 2 ++ src/fenrir/core/settings.py | 1 + src/fenrir/screenDriver/linux.py | 10 ++++++++-- 6 files changed, 14 insertions(+), 3 deletions(-) diff --git a/config/settings/settings.conf b/config/settings/settings.conf index 5a8a6f4b..288e9932 100644 --- a/config/settings/settings.conf +++ b/config/settings/settings.conf @@ -100,6 +100,7 @@ debugLevel=0 punctuationProfile=default punctuationLevel=some respectPunctuationPause=True +newLinePause=True numberOfClipboards=10 emoticons=True # define the current fenrir key diff --git a/config/settings/settings.conf.storm b/config/settings/settings.conf.storm index f166faa7..7fad3797 100644 --- a/config/settings/settings.conf.storm +++ b/config/settings/settings.conf.storm @@ -51,6 +51,7 @@ debugLevel=0 punctuationProfile=default punctuationLevel=some respectPunctuationPause=True +newLinePause=True numberOfClipboards=10 emoticons=True fenrirKeys=KEY_KP0 diff --git a/src/fenrir/commands/onScreenUpdate/70000-incoming.py b/src/fenrir/commands/onScreenUpdate/70000-incoming.py index 114e9b14..189b2c43 100644 --- a/src/fenrir/commands/onScreenUpdate/70000-incoming.py +++ b/src/fenrir/commands/onScreenUpdate/70000-incoming.py @@ -27,7 +27,7 @@ class command(): if abs(self.env['screenData']['newCursor']['x'] - self.env['screenData']['oldCursor']['x']) >= 1: if len(self.env['screenData']['newDelta']) <= 2: return - + self.env['runtime']['outputManager'].presentText(self.env['screenData']['newDelta'], interrupt=False) def setCallback(self, callback): diff --git a/src/fenrir/core/outputManager.py b/src/fenrir/core/outputManager.py index 016563fc..6b4c5088 100644 --- a/src/fenrir/core/outputManager.py +++ b/src/fenrir/core/outputManager.py @@ -88,6 +88,8 @@ class outputManager(): try: text = self.env['runtime']['punctuationManager'].proceedPunctuation(text,ignorePunctuation) + text = text.replace('\n',' , ') + self.env['runtime']['speechDriver'].speak(text) self.env['runtime']['debug'].writeDebugOut("Speak: "+ text,debug.debugLevel.INFO) except Exception as e: diff --git a/src/fenrir/core/settings.py b/src/fenrir/core/settings.py index 7a8906cc..146f9a5e 100644 --- a/src/fenrir/core/settings.py +++ b/src/fenrir/core/settings.py @@ -44,6 +44,7 @@ settings = { 'punctuationProfile':'default', 'punctuationLevel': 'some', 'respectPunctuationPause':True, + 'newLinePause':True, 'numberOfClipboards': 10, 'emoticons': True, 'fenrirKeys': ['KEY_KP0','KEY_META'], diff --git a/src/fenrir/screenDriver/linux.py b/src/fenrir/screenDriver/linux.py index 36b3a386..654aae72 100644 --- a/src/fenrir/screenDriver/linux.py +++ b/src/fenrir/screenDriver/linux.py @@ -116,6 +116,7 @@ class driver(): # changes on the screen oldScreenText = re.sub(' +',' ',self.env['runtime']['screenManager'].getWindowAreaInText(self.env['screenData']['oldContentText'])) newScreenText = re.sub(' +',' ',self.env['runtime']['screenManager'].getWindowAreaInText(self.env['screenData']['newContentText'])) + typing = False if (self.env['screenData']['oldContentText'] != self.env['screenData']['newContentText']) and \ (self.env['screenData']['newContentText'] != '' ): if oldScreenText == '' and\ @@ -132,12 +133,17 @@ class driver(): oldScreenText = re.sub(' +',' ',oldScreenText) newScreenText = self.env['screenData']['newContentText'][cursorLineStart:cursorLineEnd] newScreenText = re.sub(' +',' ',newScreenText) - diff = difflib.ndiff(oldScreenText, newScreenText) + diff = difflib.ndiff(oldScreenText, newScreenText) + typing = True else: diff = difflib.ndiff( oldScreenText.split('\n'),\ newScreenText.split('\n')) diffList = list(diff) - self.env['screenData']['newDelta'] = ''.join(x[2:] for x in diffList if x[0] == '+') + if self.env['runtime']['settingsManager'].getSetting('general', 'newLinePause') and not typing: + self.env['screenData']['newDelta'] = '\n'.join(x[2:] for x in diffList if x[0] == '+') + else: + self.env['screenData']['newDelta'] = ''.join(x[2:] for x in diffList if x[0] == '+') self.env['screenData']['newNegativeDelta'] = ''.join(x[2:] for x in diffList if x[0] == '-') +