add unbound flush_braille command

This commit is contained in:
chrys 2017-01-30 20:30:49 +01:00
parent fb9efec927
commit 6c63317e33
9 changed files with 40 additions and 11 deletions

View File

@ -34,6 +34,7 @@ KEY_FENRIR,KEY_KP2=curr_screen_after_cursor
#=cursor_read_to_end_of_line
#=cursor_column
#=cursor_lineno
#=flush_braille
KEY_FENRIR,KEY_CTRL,KEY_1=clear_bookmark_1
KEY_FENRIR,KEY_SHIFT,KEY_1=set_bookmark_1
KEY_FENRIR,KEY_1=bookmark_1

View File

@ -33,6 +33,7 @@ KEY_FENRIR,KEY_SHIFT,KEY_COMMA=curr_screen_after_cursor
#=cursor_read_to_end_of_line
#=cursor_column
#=cursor_lineno
#=flush_braille
KEY_FENRIR,KEY_CTRL,KEY_1=clear_bookmark_1
KEY_FENRIR,KEY_SHIFT,KEY_1=set_bookmark_1
KEY_FENRIR,KEY_1=bookmark_1

View File

@ -34,6 +34,7 @@ KEY_FENRIR,KEY_KP5=curr_screen
#=cursor_read_to_end_of_line
KEY_FENRIR,KEY_KP2=cursor_column
KEY_FENRIR,KEY_KP8=cursor_lineno
#=flush_braille
KEY_FENRIR,KEY_CTRL,KEY_1=clear_bookmark_1
KEY_FENRIR,KEY_SHIFT,KEY_1=set_bookmark_1
KEY_FENRIR,KEY_1=bookmark_1

View File

@ -67,8 +67,10 @@ enabled=False
driver=brlapiDriver
layout=en
# to what should the flush timeout relate to
# word = flush after seconds * word words
# static = flush after X secods
# word = flush after (number of words to display) * seconds
# char = flush after (number of chars to display) * seconds
# fix = flush after X seconds
# none = no automatic flush (manual via shortcut)
flushMode=word
# seconds to flush or
# -1 = no automatic flush (manual via shortcut)

View File

@ -68,8 +68,10 @@ enabled=False
driver=brlapiDriver
layout=en
# to what should the flush timeout relate to
# word = flush after seconds * word words
# static = flush after X secods
# word = flush after (number of words to display) * seconds
# char = flush after (number of chars to display) * seconds
# fix = flush after X seconds
# none = no automatic flush (manual via shortcut)
flushMode=word
# seconds to flush or
# -1 = no automatic flush (manual via shortcut)

View File

@ -67,8 +67,10 @@ enabled=False
driver=brlapiDriver
layout=en
# to what should the flush timeout relate to
# word = flush after seconds * word words
# static = flush after X secods
# word = flush after (number of words to display) * seconds
# char = flush after (number of chars to display) * seconds
# fix = flush after X seconds
# none = no automatic flush (manual via shortcut)
flushMode=word
# seconds to flush or
# -1 = no automatic flush (manual via shortcut)

View File

@ -25,8 +25,10 @@ enabled=False
driver=brlapiDriver
layout=en
# to what should the flush timeout relate to
# word = flush after seconds * word words
# static = flush after X secods
# word = flush after (number of words to display) * seconds
# char = flush after (number of chars to display) * seconds
# fix = flush after X seconds
# none = no automatic flush (manual via shortcut)
flushMode=word
# seconds to flush or
# -1 = no automatic flush (manual via shortcut)

View File

@ -107,7 +107,7 @@ class outputManager():
return
size = self.env['runtime']['brailleDriver'].getDeviceSize()
if flush:
self.env['output']['nextFlush'] = time.time() + 5.0
self.env['output']['nextFlush'] = time.time() + self.getFlushTime(text)
self.env['output']['messageText'] = text
self.env['runtime']['brailleDriver'].writeText('flush'+self.env['output']['messageText'] [self.env['output']['messageOffset']['x']: \
self.env['output']['messageOffset']['x']+size[0]])
@ -120,6 +120,7 @@ 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('notflush<>' + currLine +'<>'+currLine[cursor['x']:cursor['x'] + size[0]])
else:
self.env['runtime']['brailleDriver'].writeText('flush'+self.env['output']['messageText'] [self.env['output']['messageOffset']['x']: \
@ -128,8 +129,25 @@ class outputManager():
def interruptOutput(self):
self.env['runtime']['speechDriver'].cancel()
self.env['runtime']['debug'].writeDebugOut("Interrupt speech",debug.debugLevel.INFO)
def clearFlushTime(self):
self.setFlushTime(0.0)
def setFlushTime(self,newTime):
self.env['output']['nextFlush'] = newTime
def getFlushTime(self,text=''):
if self.env['runtime']['settingsManager'].getSettingAsFloat('braille', 'flushTimeout') < 0 or \
self.env['runtime']['settingsManager'].getSetting('braille', 'flushMode').upper() == 'NONE':
return 999999999999
if self.env['runtime']['settingsManager'].getSetting('braille', 'flushMode').upper() == 'FIX':
return self.env['runtime']['settingsManager'].getSettingAsFloat('braille', 'flushTimeout')
if self.env['runtime']['settingsManager'].getSetting('braille', 'flushMode').upper() == 'CHAR':
return self.env['runtime']['settingsManager'].getSettingAsFloat('braille', 'flushTimeout') * len(text)
if self.env['runtime']['settingsManager'].getSetting('braille', 'flushMode').upper() == 'WORD':
wordsList = text.split(' ')
return self.env['runtime']['settingsManager'].getSettingAsFloat('braille', 'flushTimeout') * len( list( filter(None, wordsList) ) )
def playSoundIcon(self, soundIcon = '', interrupt=True):
if soundIcon == '':
return False

View File

@ -31,7 +31,7 @@ settings = {
'enabled': False,
'driver':'brlapiDriver',
'layout': 'en',
'flushMode': 'word',
'flushMode': 'word', #NONE,FIX,CHAR,WORD
'flushTimeout': 3,
'fixCursorOnCell': -1,
},