add panning functionality; commands to move panning and reset to cursor; add the commands unbound
This commit is contained in:
parent
d88945ee01
commit
d440147340
@ -34,7 +34,10 @@ KEY_FENRIR,KEY_KP2=curr_screen_after_cursor
|
|||||||
#=cursor_read_to_end_of_line
|
#=cursor_read_to_end_of_line
|
||||||
#=cursor_column
|
#=cursor_column
|
||||||
#=cursor_lineno
|
#=cursor_lineno
|
||||||
#=flush_braille
|
#=braille_flush
|
||||||
|
#=braille_return_to_cursor
|
||||||
|
#=braille_pan_left
|
||||||
|
#=braille_pan_right
|
||||||
KEY_FENRIR,KEY_CTRL,KEY_1=clear_bookmark_1
|
KEY_FENRIR,KEY_CTRL,KEY_1=clear_bookmark_1
|
||||||
KEY_FENRIR,KEY_SHIFT,KEY_1=set_bookmark_1
|
KEY_FENRIR,KEY_SHIFT,KEY_1=set_bookmark_1
|
||||||
KEY_FENRIR,KEY_1=bookmark_1
|
KEY_FENRIR,KEY_1=bookmark_1
|
||||||
|
@ -33,7 +33,10 @@ KEY_FENRIR,KEY_SHIFT,KEY_COMMA=curr_screen_after_cursor
|
|||||||
#=cursor_read_to_end_of_line
|
#=cursor_read_to_end_of_line
|
||||||
#=cursor_column
|
#=cursor_column
|
||||||
#=cursor_lineno
|
#=cursor_lineno
|
||||||
#=flush_braille
|
#=braille_flush
|
||||||
|
#=braille_return_to_cursor
|
||||||
|
#=braille_pan_left
|
||||||
|
#=braille_pan_right
|
||||||
KEY_FENRIR,KEY_CTRL,KEY_1=clear_bookmark_1
|
KEY_FENRIR,KEY_CTRL,KEY_1=clear_bookmark_1
|
||||||
KEY_FENRIR,KEY_SHIFT,KEY_1=set_bookmark_1
|
KEY_FENRIR,KEY_SHIFT,KEY_1=set_bookmark_1
|
||||||
KEY_FENRIR,KEY_1=bookmark_1
|
KEY_FENRIR,KEY_1=bookmark_1
|
||||||
|
@ -34,7 +34,10 @@ KEY_FENRIR,KEY_KP5=curr_screen
|
|||||||
#=cursor_read_to_end_of_line
|
#=cursor_read_to_end_of_line
|
||||||
KEY_FENRIR,KEY_KP2=cursor_column
|
KEY_FENRIR,KEY_KP2=cursor_column
|
||||||
KEY_FENRIR,KEY_KP8=cursor_lineno
|
KEY_FENRIR,KEY_KP8=cursor_lineno
|
||||||
#=flush_braille
|
#=braille_flush
|
||||||
|
#=braille_return_to_cursor
|
||||||
|
#=braille_pan_left
|
||||||
|
#=braille_pan_right
|
||||||
KEY_FENRIR,KEY_CTRL,KEY_1=clear_bookmark_1
|
KEY_FENRIR,KEY_CTRL,KEY_1=clear_bookmark_1
|
||||||
KEY_FENRIR,KEY_SHIFT,KEY_1=set_bookmark_1
|
KEY_FENRIR,KEY_SHIFT,KEY_1=set_bookmark_1
|
||||||
KEY_FENRIR,KEY_1=bookmark_1
|
KEY_FENRIR,KEY_1=bookmark_1
|
||||||
|
21
src/fenrir/commands/commands/braille_pan_left.py
Normal file
21
src/fenrir/commands/commands/braille_pan_left.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Fenrir TTY screen reader
|
||||||
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
|
from core import debug
|
||||||
|
|
||||||
|
class command():
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
def initialize(self, environment):
|
||||||
|
self.env = environment
|
||||||
|
def shutdown(self):
|
||||||
|
pass
|
||||||
|
def getDescription(self):
|
||||||
|
return 'Move braille view to the left.'
|
||||||
|
def run(self):
|
||||||
|
panned = self.env['runtime']['outputManager'].setPanLeft()
|
||||||
|
def setCallback(self, callback):
|
||||||
|
pass
|
21
src/fenrir/commands/commands/braille_pan_right.py
Normal file
21
src/fenrir/commands/commands/braille_pan_right.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Fenrir TTY screen reader
|
||||||
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
|
from core import debug
|
||||||
|
|
||||||
|
class command():
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
def initialize(self, environment):
|
||||||
|
self.env = environment
|
||||||
|
def shutdown(self):
|
||||||
|
pass
|
||||||
|
def getDescription(self):
|
||||||
|
return 'Move braille view to the right.'
|
||||||
|
def run(self):
|
||||||
|
panned = self.env['runtime']['outputManager'].setPanRight()
|
||||||
|
def setCallback(self, callback):
|
||||||
|
pass
|
21
src/fenrir/commands/commands/braille_return_to_cursor.py
Normal file
21
src/fenrir/commands/commands/braille_return_to_cursor.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Fenrir TTY screen reader
|
||||||
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
|
from core import debug
|
||||||
|
|
||||||
|
class command():
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
def initialize(self, environment):
|
||||||
|
self.env = environment
|
||||||
|
def shutdown(self):
|
||||||
|
pass
|
||||||
|
def getDescription(self):
|
||||||
|
return 'Set the braille view back to cursor.'
|
||||||
|
def run(self):
|
||||||
|
self.env['runtime']['outputManager'].removePanning()
|
||||||
|
def setCallback(self, callback):
|
||||||
|
pass
|
@ -118,9 +118,9 @@ class outputManager():
|
|||||||
if self.env['output']['messageOffset'] != None:
|
if self.env['output']['messageOffset'] != None:
|
||||||
self.env['output']['messageOffset'] = None
|
self.env['output']['messageOffset'] = None
|
||||||
cursor = self.getBrailleCursor()
|
cursor = self.getBrailleCursor()
|
||||||
x, y, currLine = \
|
x, y, self.env['output']['brlText'] = \
|
||||||
line_utils.getCurrentLine(cursor['x'], cursor['y'], self.env['screenData']['newContentText'])
|
line_utils.getCurrentLine(cursor['x'], cursor['y'], self.env['screenData']['newContentText'])
|
||||||
displayText = self.getBrailleTextWithOffset(currLine, self.env['output']['cursorOffset'], cursor)
|
displayText = self.getBrailleTextWithOffset(self.env['screenData']['newContentText'], self.env['output']['cursorOffset'], cursor)
|
||||||
self.env['runtime']['brailleDriver'].writeText('notflush'+displayText)
|
self.env['runtime']['brailleDriver'].writeText('notflush'+displayText)
|
||||||
else:
|
else:
|
||||||
displayText = self.getBrailleTextWithOffset(self.env['output']['messageText'], self.env['output']['messageOffset'])
|
displayText = self.getBrailleTextWithOffset(self.env['output']['messageText'], self.env['output']['messageOffset'])
|
||||||
@ -136,13 +136,19 @@ class outputManager():
|
|||||||
return self.env['runtime']['cursorManager'].getReviewOrTextCursor()
|
return self.env['runtime']['cursorManager'].getReviewOrTextCursor()
|
||||||
|
|
||||||
def getFixCursorCell(self):
|
def getFixCursorCell(self):
|
||||||
if self.env['runtime']['settingsManager'].getSettingAsInt('braille', 'fixCursorOnCell') == -1:
|
size = self.env['runtime']['brailleDriver'].getDeviceSize()[0]
|
||||||
return self.env['runtime']['brailleDriver'].getDeviceSize()[0]
|
fixCell = self.env['runtime']['settingsManager'].getSettingAsInt('braille', 'fixCursorOnCell')
|
||||||
return self.env['runtime']['settingsManager'].getSettingAsInt('braille', 'fixCursorOnCell')
|
if fixCell <= -1:
|
||||||
def getActiveOffset(self):
|
return size[0]
|
||||||
|
if fixCell >= size[0]:
|
||||||
|
return size[0]
|
||||||
|
return fixCell
|
||||||
|
def getActiveOffsetAndText(self):
|
||||||
if self.env['output']['messageOffset']:
|
if self.env['output']['messageOffset']:
|
||||||
return self.env['output']['messageOffset']
|
return self.env['output']['messageOffset'], self.env['output']['messageText']
|
||||||
return self.env['output']['cursorOffset']
|
if not self.env['output']['cursorOffset']:
|
||||||
|
return self.getBrailleCursor(), self.env['screenData']['newContentText']
|
||||||
|
return self.env['output']['cursorOffset'], self.env['screenData']['newContentText']
|
||||||
def getHorizontalPanSize(self):
|
def getHorizontalPanSize(self):
|
||||||
size = self.env['runtime']['brailleDriver'].getDeviceSize()
|
size = self.env['runtime']['brailleDriver'].getDeviceSize()
|
||||||
if self.env['runtime']['settingsManager'].getSettingAsInt('braille', 'panSizeHorizontal') <= 0:
|
if self.env['runtime']['settingsManager'].getSettingAsInt('braille', 'panSizeHorizontal') <= 0:
|
||||||
@ -151,15 +157,37 @@ class outputManager():
|
|||||||
return size[0]
|
return size[0]
|
||||||
return self.env['runtime']['settingsManager'].getSettingAsInt('braille', 'panSizeHorizontal')
|
return self.env['runtime']['settingsManager'].getSettingAsInt('braille', 'panSizeHorizontal')
|
||||||
def getHorizontalPanLevel(self,offsetChange = 0):
|
def getHorizontalPanLevel(self,offsetChange = 0):
|
||||||
|
panned = True
|
||||||
panSize = self.getHorizontalPanSize()
|
panSize = self.getHorizontalPanSize()
|
||||||
offset = self.getActiveOffset()
|
offset, text = self.getActiveOffsetAndText()
|
||||||
if not offset:
|
currline = text.split('\n')[offset['y']]
|
||||||
offset = self.getBrailleCursor()
|
newOffsetStart = (int(offset['x'] / panSize) + offsetChange) * panSize
|
||||||
offsetStart = (int(offset['x'] / panSize) + offsetChange) * panSize
|
if newOffsetStart < 0:
|
||||||
def panLeft(self):
|
newOffsetStart = 0
|
||||||
return self.getHorizontalPanLevel(-1)
|
panned = False
|
||||||
def panRight(self):
|
if newOffsetStart >= len(text):
|
||||||
return self.getHorizontalPanLevel(1)
|
newOffsetStart = int((len(text) - panSize - 1) / panSize)
|
||||||
|
panned = False
|
||||||
|
return newOffsetStart, panned
|
||||||
|
def setPanLeft(self):
|
||||||
|
newPan, panned = self.getHorizontalPanLevel(-1)
|
||||||
|
if self.env['output']['messageOffset']:
|
||||||
|
self.env['output']['messageOffset'] = newPan.copy()
|
||||||
|
else:
|
||||||
|
self.env['output']['cursorOffset'] = newPan.copy()
|
||||||
|
return panned
|
||||||
|
def setPanRight(self):
|
||||||
|
newPan, panned = self.getHorizontalPanLevel(1)
|
||||||
|
if self.env['output']['messageOffset']:
|
||||||
|
self.env['output']['messageOffset'] = newPan.copy()
|
||||||
|
else:
|
||||||
|
self.env['output']['cursorOffset'] = newPan.copy()
|
||||||
|
return panned
|
||||||
|
def removePanning(self):
|
||||||
|
if self.env['output']['messageOffset']:
|
||||||
|
self.env['output']['messageOffset'] = None
|
||||||
|
else:
|
||||||
|
self.env['output']['cursorOffset'] = None
|
||||||
def getBrailleTextWithOffset(self, text, offset = None, cursor = None):
|
def getBrailleTextWithOffset(self, text, offset = None, cursor = None):
|
||||||
if text == '':
|
if text == '':
|
||||||
return ''
|
return ''
|
||||||
|
Loading…
Reference in New Issue
Block a user