add page mode. make fixCell/page mode configurable

This commit is contained in:
chrys 2017-02-02 19:31:47 +01:00
parent 87a9672c03
commit e9332caa93
6 changed files with 39 additions and 14 deletions

View File

@ -75,6 +75,10 @@ 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
# how should the cursor be focused?
# page = if cursor cross the border move to next page and start at beginn
# fixCell = ajust the cursor on an special cell where it is always placed. the display scroll here more smooth.
cursorFocusMode=page
# define the cell on the Braille device where fenrir should scroll and keep the cursor # define the cell on the Braille device where fenrir should scroll and keep the cursor
# 0 = first cell on device # 0 = first cell on device
# -1 = last cell on device # -1 = last cell on device

View File

@ -76,6 +76,10 @@ 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
# how should the cursor be focused?
# page = if cursor cross the border move to next page and start at beginn
# fixCell = ajust the cursor on an special cell where it is always placed. the display scroll here more smooth.
cursorFocusMode=page
# define the cell on the Braille device where fenrir should scroll and keep the cursor # define the cell on the Braille device where fenrir should scroll and keep the cursor
# 0 = first cell on device # 0 = first cell on device
# -1 = last cell on device # -1 = last cell on device

View File

@ -75,6 +75,10 @@ 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
# how should the cursor be focused?
# page = if cursor cross the border move to next page and start at beginn
# fixCell = ajust the cursor on an special cell where it is always placed. the display scroll here more smooth.
cursorFocusMode=page
# define the cell on the Braille device where fenrir should scroll and keep the cursor # define the cell on the Braille device where fenrir should scroll and keep the cursor
# 0 = first cell on device # 0 = first cell on device
# -1 = last cell on device # -1 = last cell on device

View File

@ -33,6 +33,10 @@ 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
# how should the cursor be focused?
# page = if cursor cross the border move to next page and start at beginn
# fixCell = ajust the cursor on an special cell where it is always placed. the display scroll here more smooth.
cursorFocusMode=page
# define the cell on the Braille device where fenrir should scroll and keep the cursor # define the cell on the Braille device where fenrir should scroll and keep the cursor
# 0 = first cell on device # 0 = first cell on device
# -1 = last cell on device # -1 = last cell on device

View File

@ -127,13 +127,15 @@ class outputManager():
self.env['runtime']['brailleDriver'].writeText('flush'+displayText) self.env['runtime']['brailleDriver'].writeText('flush'+displayText)
def getBrailleCursor(self): def getBrailleCursor(self):
if self.env['runtime']['settingsManager'].getSetting('focus', 'cursorFollowMode') == 'review': if self.env['runtime']['settingsManager'].getSetting('braille', 'cursorFollowMode').upper() == 'REVIEW':
return self.env['runtime']['cursorManager'].getReviewOrTextCursor() return self.env['runtime']['cursorManager'].getReviewOrTextCursor()
self.env['runtime']['settingsManager'].getSetting('focus', 'cursorFollowMode') == 'manual': if self.env['runtime']['settingsManager'].getSetting('braille', 'cursorFollowMode').upper() == 'MANUAL':
pass return self.env['runtime']['cursorManager'].getReviewOrTextCursor()
self.env['runtime']['settingsManager'].getSetting('focus', 'cursorFollowMode') == 'last': if self.env['runtime']['settingsManager'].getSetting('braille', 'cursorFollowMode').upper() == 'LAST':
pass return self.env['runtime']['cursorManager'].getReviewOrTextCursor()
def getCursorCell(self): return self.env['runtime']['cursorManager'].getReviewOrTextCursor()
def getFixCursorCell(self):
if self.env['runtime']['settingsManager'].getSettingAsInt('braille', 'fixCursorOnCell') == -1: if self.env['runtime']['settingsManager'].getSettingAsInt('braille', 'fixCursorOnCell') == -1:
return self.env['runtime']['brailleDriver'].getDeviceSize()[0] return self.env['runtime']['brailleDriver'].getDeviceSize()[0]
return self.env['runtime']['settingsManager'].getSettingAsInt('braille', 'fixCursorOnCell') return self.env['runtime']['settingsManager'].getSettingAsInt('braille', 'fixCursorOnCell')
@ -142,17 +144,23 @@ class outputManager():
if text == '': if text == '':
return '' return ''
size = self.env['runtime']['brailleDriver'].getDeviceSize() size = self.env['runtime']['brailleDriver'].getDeviceSize()
cursorCell = self.getCursorCell()
offsetText = text offsetText = text
if cursor and not offset: if cursor and not offset:
offsetStart = cursor['x'] if self.env['runtime']['settingsManager'].getSetting('braille', 'cursorFollowMode').upper() == 'FIXCELL':
if offsetStart < size[0]: #fix cell
if offsetStart <= cursorCell: cursorCell = self.getFixCursorCell()
return offsetText[0: size[0]] offsetStart = cursor['x']
if offsetStart < size[0]:
if offsetStart <= cursorCell:
return offsetText[0: size[0]]
offsetStart -= cursorCell offsetStart -= cursorCell
if offsetStart >= len(offsetText): if offsetStart >= len(offsetText):
offsetStart = len(offsetText) - 1 offsetStart = len(offsetText) - 1
else:
# page and fallback
offsetStart = int(cursor / size[0]) * size[0]
else: else:
if not offset: if not offset:
offset = {'x':0,'y':0} offset = {'x':0,'y':0}

View File

@ -33,6 +33,7 @@ settings = {
'layout': 'en', 'layout': 'en',
'flushMode': 'word', #NONE,FIX,CHAR,WORD 'flushMode': 'word', #NONE,FIX,CHAR,WORD
'flushTimeout': 3, 'flushTimeout': 3,
'cursorFocusMode':'page', # page,fixCell
'fixCursorOnCell': -1, 'fixCursorOnCell': -1,
'cursorFollowMode': 'review', # none, review, last, text 'cursorFollowMode': 'review', # none, review, last, text
'panSize': 0 # 0 display size 'panSize': 0 # 0 display size