From fe885c3e3184c232a5372b8d16bd8d1706970330 Mon Sep 17 00:00:00 2001 From: chrys Date: Mon, 30 Jan 2017 19:55:48 +0100 Subject: [PATCH] add scrollOnCell --- config/settings/espeak.settings.conf | 5 +++++ config/settings/settings.conf | 5 +++++ config/settings/settings.conf.chrys | 5 +++++ config/settings/settings.conf.storm | 5 +++++ src/fenrir/core/outputManager.py | 14 ++++++++------ src/fenrir/core/settings.py | 1 + src/fenrir/fenrir.py | 2 +- 7 files changed, 30 insertions(+), 7 deletions(-) diff --git a/config/settings/espeak.settings.conf b/config/settings/espeak.settings.conf index 6f361965..e9db78d2 100644 --- a/config/settings/espeak.settings.conf +++ b/config/settings/espeak.settings.conf @@ -73,6 +73,11 @@ flushMode=word # seconds to flush or # -1 = no automatic flush (manual via shortcut) flushTimeout=3 +# define the cell on the Braille device where fenrir should scroll +# 0 = first cell on device +# -1 = last cell on device +# >0 = fix cell number +scrollOnCell=-1 [screen] driver=vcsaDriver diff --git a/config/settings/settings.conf b/config/settings/settings.conf index d34bac38..8b41aa2b 100644 --- a/config/settings/settings.conf +++ b/config/settings/settings.conf @@ -74,6 +74,11 @@ flushMode=word # seconds to flush or # -1 = no automatic flush (manual via shortcut) flushTimeout=3 +# define the cell on the Braille device where fenrir should scroll +# 0 = first cell on device +# -1 = last cell on device +# >0 = fix cell number +scrollOnCell=-1 [screen] driver=vcsaDriver diff --git a/config/settings/settings.conf.chrys b/config/settings/settings.conf.chrys index 8d145dc0..cf002b9f 100644 --- a/config/settings/settings.conf.chrys +++ b/config/settings/settings.conf.chrys @@ -73,6 +73,11 @@ flushMode=word # seconds to flush or # -1 = no automatic flush (manual via shortcut) flushTimeout=3 +# define the cell on the Braille device where fenrir should scroll +# 0 = first cell on device +# -1 = last cell on device +# >0 = fix cell number +scrollOnCell=-1 [screen] driver=vcsaDriver diff --git a/config/settings/settings.conf.storm b/config/settings/settings.conf.storm index 6286c50a..7550c2b7 100644 --- a/config/settings/settings.conf.storm +++ b/config/settings/settings.conf.storm @@ -31,6 +31,11 @@ flushMode=word # seconds to flush or # -1 = no automatic flush (manual via shortcut) flushTimeout=3 +# define the cell on the Braille device where fenrir should scroll +# 0 = first cell on device +# -1 = last cell on device +# >0 = fix cell number +scrollOnCell=-1 [screen] driver=vcsaDriver diff --git a/src/fenrir/core/outputManager.py b/src/fenrir/core/outputManager.py index 3f58b01c..ebfe4fa5 100644 --- a/src/fenrir/core/outputManager.py +++ b/src/fenrir/core/outputManager.py @@ -5,7 +5,8 @@ # By Chrys, Storm Dragon, and contributers. from core import debug -import string +from utils import line_utils +import string, time class outputManager(): def __init__(self): @@ -38,7 +39,8 @@ class outputManager(): toAnnounceCapital = False self.speakText(text, interrupt, ignorePunctuation,toAnnounceCapital) - self.brailleText(text, interrupt) + if flush: + self.brailleText(text, flush) def speakText(self, text, interrupt=True, ignorePunctuation=False, announceCapital=False): if not self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'enabled'): @@ -98,7 +100,7 @@ class outputManager(): self.env['runtime']['debug'].writeDebugOut("\"speak\" in outputManager.speakText ",debug.debugLevel.ERROR) self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR) - def brailleText(self, text, flush=False): + def brailleText(self, text='', flush=False): if not self.env['runtime']['settingsManager'].getSettingAsBool('braille', 'enabled'): return if self.env['runtime']['brailleDriver'] == None: @@ -107,7 +109,7 @@ class outputManager(): if flush: self.env['output']['nextFlush'] = time.time() + 5.0 self.env['output']['messageText'] = text - self.env['runtime']['brailleDriver'].writeText(self.env['output']['messageText'] [self.env['output']['messageOffset']['x']: \ + self.env['runtime']['brailleDriver'].writeText('flush'+self.env['output']['messageText'] [self.env['output']['messageOffset']['x']: \ self.env['output']['messageOffset']['x']+size[0]]) else: if self.env['output']['nextFlush'] < time.time(): @@ -118,9 +120,9 @@ class outputManager(): cursor = self.env['runtime']['cursorManager'].getReviewOrTextCursor() x, y, currLine = \ line_utils.getCurrentLine(cursor['x'], cursor['y'], self.env['screenData']['newContentText']) - self.env['runtime']['brailleDriver'].writeText(currLine[cursor['x']:cursor['x'] + size[0]]) + self.env['runtime']['brailleDriver'].writeText('notflush<>' + currLine +'<>'+currLine[cursor['x']:cursor['x'] + size[0]]) else: - self.env['runtime']['brailleDriver'].writeText(self.env['output']['messageText'] [self.env['output']['messageOffset']['x']: \ + self.env['runtime']['brailleDriver'].writeText('flush'+self.env['output']['messageText'] [self.env['output']['messageOffset']['x']: \ self.env['output']['messageOffset']['x']+size[0]]) def interruptOutput(self): diff --git a/src/fenrir/core/settings.py b/src/fenrir/core/settings.py index 432a12b2..84e73f05 100644 --- a/src/fenrir/core/settings.py +++ b/src/fenrir/core/settings.py @@ -33,6 +33,7 @@ settings = { 'layout': 'en', 'flushMode': 'word', 'flushTimeout': 3, + 'scrollOnCell': -1, }, 'screen':{ 'driver': 'vcsaDriver', diff --git a/src/fenrir/fenrir.py b/src/fenrir/fenrir.py index 00f4498d..5e237416 100644 --- a/src/fenrir/fenrir.py +++ b/src/fenrir/fenrir.py @@ -64,7 +64,7 @@ class fenrir(): self.environment['runtime']['commandManager'].executeDefaultTrigger('onScreenChanged') else: self.environment['runtime']['commandManager'].executeDefaultTrigger('onScreenUpdate') - + self.environment['runtime']['outputManager'].brailleText() self.handleCommands() #print(time.time()-startTime)