add get first char in line, fix cycle punctuation
This commit is contained in:
parent
40b18c9c49
commit
1e3719ebff
@ -8,8 +8,8 @@ KEY_KP9=review_next_line
|
|||||||
#KEY_FENRIR,KEY_KP6=review_line_end
|
#KEY_FENRIR,KEY_KP6=review_line_end
|
||||||
#KEY_FENRIR,KEY_KP5=review_line_begin
|
#KEY_FENRIR,KEY_KP5=review_line_begin
|
||||||
#KEY_FENRIR,KEY_KP6=review_line_last_char
|
#KEY_FENRIR,KEY_KP6=review_line_last_char
|
||||||
#=present_first_line
|
KEY_FENRIR,KEY_KP1=review_line_first_char
|
||||||
#=present_last_line
|
KEY_FENRIR,KEY_KP3=review_line_last_char
|
||||||
KEY_KP5=review_curr_word
|
KEY_KP5=review_curr_word
|
||||||
KEY_KP4=review_prev_word
|
KEY_KP4=review_prev_word
|
||||||
KEY_KP6=review_next_word
|
KEY_KP6=review_next_word
|
||||||
@ -35,7 +35,7 @@ KEY_KPPLUS=last_incoming
|
|||||||
KEY_FENRIR,KEY_F2=toggle_braille
|
KEY_FENRIR,KEY_F2=toggle_braille
|
||||||
KEY_FENRIR,KEY_F3=toggle_sound
|
KEY_FENRIR,KEY_F3=toggle_sound
|
||||||
KEY_FENRIR,KEY_F4=toggle_speech
|
KEY_FENRIR,KEY_F4=toggle_speech
|
||||||
#=toggle_punctuation_level
|
KEY_FENRIR,KEY_F5=toggle_punctuation_level
|
||||||
KEY_FENRIR,KEY_RIGHTBRACE=toggle_auto_spell_check
|
KEY_FENRIR,KEY_RIGHTBRACE=toggle_auto_spell_check
|
||||||
KEY_FENRIR,KEY_BACKSLASH=toggle_output
|
KEY_FENRIR,KEY_BACKSLASH=toggle_output
|
||||||
key_FENRIR,KEY_KPENTER=toggle_auto_read
|
key_FENRIR,KEY_KPENTER=toggle_auto_read
|
||||||
|
37
src/fenrir/commands/commands/review_line_first_char.py
Normal file
37
src/fenrir/commands/commands/review_line_first_char.py
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#!/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Fenrir TTY screen reader
|
||||||
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
|
from core import debug
|
||||||
|
from utils import line_utils
|
||||||
|
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()
|
||||||
|
x, y, currLine = \
|
||||||
|
line_utils.getCurrentLine(cursorPos['x'], cursorPos['y'], self.env['screenData']['newContentText'])
|
||||||
|
|
||||||
|
self.env['runtime']['cursorManager'].setReviewCursorPosition((len(currLine) - len(currLine.lstrip()))
|
||||||
|
,cursorPos['y'])
|
||||||
|
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currChar = \
|
||||||
|
char_utils.getCurrentChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||||
|
if currChar.isspace():
|
||||||
|
self.env['runtime']['outputManager'].presentText("line is empty" ,interrupt=True)
|
||||||
|
else:
|
||||||
|
self.env['runtime']['outputManager'].presentText(currChar ,interrupt=True, ignorePunctuation=True, announceCapital=True)
|
||||||
|
self.env['runtime']['outputManager'].presentText("first char in line indent " + str(len(currLine) - len(currLine.lstrip())), interrupt=False)
|
||||||
|
|
||||||
|
def setCallback(self, callback):
|
||||||
|
pass
|
@ -17,7 +17,10 @@ class command():
|
|||||||
return ''
|
return ''
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.env['runtime']['punctuationManager'].cyclePunctuation()
|
if self.env['runtime']['punctuationManager'].cyclePunctuation():
|
||||||
self.env['runtime']['outputManager'].presentText(self.env['runtime']['settingsManager'].getSetting('general', 'punctuationLevel'), interrupt=True, ignorePunctuation=True)
|
self.env['runtime']['outputManager'].presentText(self.env['runtime']['settingsManager'].getSetting('general', 'punctuationLevel'), interrupt=True, ignorePunctuation=True)
|
||||||
|
else:
|
||||||
|
self.env['runtime']['outputManager'].presentText('No punctuation found.', interrupt=True, ignorePunctuation=True)
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -102,9 +102,10 @@ class punctuationManager():
|
|||||||
try:
|
try:
|
||||||
currIndex = punctList.index(self.env['runtime']['settingsManager'].getSetting('general', 'punctuationLevel').lower()) # curr punctuation
|
currIndex = punctList.index(self.env['runtime']['settingsManager'].getSetting('general', 'punctuationLevel').lower()) # curr punctuation
|
||||||
except:
|
except:
|
||||||
return
|
return False
|
||||||
currIndex += 1
|
currIndex += 1
|
||||||
if currIndex >= len(punctList):
|
if currIndex >= len(punctList):
|
||||||
currIndex = 0
|
currIndex = 0
|
||||||
currLevel = punctList[currIndex]
|
currLevel = punctList[currIndex]
|
||||||
self.env['runtime']['settingsManager'].setSetting('general', currLevel.lower())
|
self.env['runtime']['settingsManager'].setSetting('general', 'punctuationLevel', currLevel.lower())
|
||||||
|
return True
|
||||||
|
Loading…
Reference in New Issue
Block a user