add review_up and review_donw commands
This commit is contained in:
parent
0d2c095b62
commit
1d7ba49e92
@ -18,6 +18,8 @@ KEY_KP2=review_curr_char
|
||||
KEY_KP1=review_prev_char
|
||||
KEY_KP3=review_next_char
|
||||
2,KEY_KP2=curr_char_phonetic
|
||||
#=review_up
|
||||
#=review_down
|
||||
KEY_KPDOT=cursor_position
|
||||
KEY_FENRIR,KEY_I=indent_curr_line
|
||||
KEY_FENRIR,KEY_KPDOT=exit_review
|
||||
|
@ -18,6 +18,8 @@ KEY_FENRIR,KEY_COMMA=review_curr_char
|
||||
KEY_FENRIR,KEY_M=review_prev_char
|
||||
KEY_FENRIR,KEY_DOT=review_next_char
|
||||
2,KEY_FENRIR,KEY_COMMA=curr_char_phonetic
|
||||
#=review_up
|
||||
#=review_down
|
||||
KEY_FENRIR,KEY_SLASH=exit_review
|
||||
KEY_FENRIR,KEY_SHIFT,KEY_DOT=cursor_position
|
||||
KEY_FENRIR,KEY_SHIFT,KEY_K=curr_screen
|
||||
|
@ -6,8 +6,8 @@ KEY_KP8=review_curr_line
|
||||
KEY_KP7=review_prev_line
|
||||
KEY_KP9=review_next_line
|
||||
#KEY_FENRIR,KEY_KP6=review_line_end
|
||||
KEY_FENRIR,KEY_KP5=review_line_begin
|
||||
KEY_FENRIR,KEY_KP6=review_line_last_char
|
||||
#KEY_FENRIR,KEY_KP5=review_line_begin
|
||||
#KEY_FENRIR,KEY_KP6=review_line_last_char
|
||||
#=present_first_line
|
||||
#=present_last_line
|
||||
KEY_KP5=review_curr_word
|
||||
@ -18,6 +18,8 @@ KEY_KP2=review_curr_char
|
||||
KEY_KP1=review_prev_char
|
||||
KEY_KP3=review_next_char
|
||||
2,KEY_KP2=curr_char_phonetic
|
||||
KEY_FENRIR,KEY_KP5=review_up
|
||||
KEY_FENRIR,KEY_KP6=review_down
|
||||
KEY_KPDOT=cursor_position
|
||||
KEY_FENRIR,KEY_I=indent_curr_line
|
||||
KEY_FENRIR,KEY_KPDOT=exit_review
|
||||
|
30
src/fenrir-package/commands/commands/review_down.py
Normal file
30
src/fenrir-package/commands/commands/review_down.py
Normal file
@ -0,0 +1,30 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from core import debug
|
||||
from utils import char_utils
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'set review cursor to end of current line and display the content'
|
||||
|
||||
def run(self):
|
||||
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], downChar = \
|
||||
char_utils.getDownChar(self.env['screenData']['newCursorReview']['x'],self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
if downChar.strip(" \t\n") == '':
|
||||
self.env['runtime']['outputManager'].presentText("line is empty" ,interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(downChar ,interrupt=True, ignorePunctuation=True, announceCapital=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
30
src/fenrir-package/commands/commands/review_up.py
Normal file
30
src/fenrir-package/commands/commands/review_up.py
Normal file
@ -0,0 +1,30 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from core import debug
|
||||
from utils import char_utils
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'set review cursor to end of current line and display the content'
|
||||
|
||||
def run(self):
|
||||
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], upChar = \
|
||||
char_utils.getUpChar(self.env['screenData']['newCursorReview']['x'],self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
if upChar.strip(" \t\n") == '':
|
||||
self.env['runtime']['outputManager'].presentText("line is empty" ,interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(upChar ,interrupt=True, ignorePunctuation=True, announceCapital=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
@ -28,6 +28,26 @@ def getCurrentChar(currX,currY, currText):
|
||||
currChar = wrappedLines[currY][currX]
|
||||
return currX, currY, currChar
|
||||
|
||||
def getUpChar(currX,currY, currText):
|
||||
if currText == '':
|
||||
return -1, -1, ''
|
||||
wrappedLines = currText.split('\n')
|
||||
currY -= 1
|
||||
if currY < 0:
|
||||
currY = 0
|
||||
currChar = wrappedLines[currY][currX]
|
||||
return currX, currY, currChar
|
||||
|
||||
def getDownChar(currX,currY, currText):
|
||||
if currText == '':
|
||||
return -1, -1, ''
|
||||
wrappedLines = currText.split('\n')
|
||||
currY += 1
|
||||
if currY >= len(wrappedLines):
|
||||
currY = len(wrappedLines) -1
|
||||
currChar = wrappedLines[currY][currX]
|
||||
return currX, currY, currChar
|
||||
|
||||
def getLastCharInLine(currY, currText):
|
||||
if currText == '':
|
||||
return -1, -1, ''
|
||||
|
Loading…
Reference in New Issue
Block a user