add scrollOnCell

This commit is contained in:
chrys 2017-01-30 19:55:48 +01:00
parent 04459e8eb7
commit fe885c3e31
7 changed files with 30 additions and 7 deletions

View File

@ -73,6 +73,11 @@ flushMode=word
# seconds to flush or # seconds to flush or
# -1 = no automatic flush (manual via shortcut) # -1 = no automatic flush (manual via shortcut)
flushTimeout=3 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] [screen]
driver=vcsaDriver driver=vcsaDriver

View File

@ -74,6 +74,11 @@ flushMode=word
# seconds to flush or # seconds to flush or
# -1 = no automatic flush (manual via shortcut) # -1 = no automatic flush (manual via shortcut)
flushTimeout=3 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] [screen]
driver=vcsaDriver driver=vcsaDriver

View File

@ -73,6 +73,11 @@ flushMode=word
# seconds to flush or # seconds to flush or
# -1 = no automatic flush (manual via shortcut) # -1 = no automatic flush (manual via shortcut)
flushTimeout=3 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] [screen]
driver=vcsaDriver driver=vcsaDriver

View File

@ -31,6 +31,11 @@ flushMode=word
# seconds to flush or # seconds to flush or
# -1 = no automatic flush (manual via shortcut) # -1 = no automatic flush (manual via shortcut)
flushTimeout=3 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] [screen]
driver=vcsaDriver driver=vcsaDriver

View File

@ -5,7 +5,8 @@
# By Chrys, Storm Dragon, and contributers. # By Chrys, Storm Dragon, and contributers.
from core import debug from core import debug
import string from utils import line_utils
import string, time
class outputManager(): class outputManager():
def __init__(self): def __init__(self):
@ -38,7 +39,8 @@ class outputManager():
toAnnounceCapital = False toAnnounceCapital = False
self.speakText(text, interrupt, ignorePunctuation,toAnnounceCapital) 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): def speakText(self, text, interrupt=True, ignorePunctuation=False, announceCapital=False):
if not self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'enabled'): 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("\"speak\" in outputManager.speakText ",debug.debugLevel.ERROR)
self.env['runtime']['debug'].writeDebugOut(str(e),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'): if not self.env['runtime']['settingsManager'].getSettingAsBool('braille', 'enabled'):
return return
if self.env['runtime']['brailleDriver'] == None: if self.env['runtime']['brailleDriver'] == None:
@ -107,7 +109,7 @@ class outputManager():
if flush: if flush:
self.env['output']['nextFlush'] = time.time() + 5.0 self.env['output']['nextFlush'] = time.time() + 5.0
self.env['output']['messageText'] = text 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]]) self.env['output']['messageOffset']['x']+size[0]])
else: else:
if self.env['output']['nextFlush'] < time.time(): if self.env['output']['nextFlush'] < time.time():
@ -118,9 +120,9 @@ class outputManager():
cursor = self.env['runtime']['cursorManager'].getReviewOrTextCursor() cursor = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
x, y, currLine = \ x, y, currLine = \
line_utils.getCurrentLine(cursor['x'], cursor['y'], self.env['screenData']['newContentText']) 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: 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]]) self.env['output']['messageOffset']['x']+size[0]])
def interruptOutput(self): def interruptOutput(self):

View File

@ -33,6 +33,7 @@ settings = {
'layout': 'en', 'layout': 'en',
'flushMode': 'word', 'flushMode': 'word',
'flushTimeout': 3, 'flushTimeout': 3,
'scrollOnCell': -1,
}, },
'screen':{ 'screen':{
'driver': 'vcsaDriver', 'driver': 'vcsaDriver',

View File

@ -64,7 +64,7 @@ class fenrir():
self.environment['runtime']['commandManager'].executeDefaultTrigger('onScreenChanged') self.environment['runtime']['commandManager'].executeDefaultTrigger('onScreenChanged')
else: else:
self.environment['runtime']['commandManager'].executeDefaultTrigger('onScreenUpdate') self.environment['runtime']['commandManager'].executeDefaultTrigger('onScreenUpdate')
self.environment['runtime']['outputManager'].brailleText()
self.handleCommands() self.handleCommands()
#print(time.time()-startTime) #print(time.time()-startTime)