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
# -1 = no automatic flush (manual via shortcut)
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
# 0 = first cell on device
# -1 = last cell on device

View File

@ -76,6 +76,10 @@ flushMode=word
# seconds to flush or
# -1 = no automatic flush (manual via shortcut)
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
# 0 = first cell on device
# -1 = last cell on device

View File

@ -75,6 +75,10 @@ flushMode=word
# seconds to flush or
# -1 = no automatic flush (manual via shortcut)
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
# 0 = first cell on device
# -1 = last cell on device

View File

@ -33,6 +33,10 @@ flushMode=word
# seconds to flush or
# -1 = no automatic flush (manual via shortcut)
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
# 0 = first cell on device
# -1 = last cell on device

View File

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

View File

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