diff --git a/config/keyboard/test.conf b/config/keyboard/test.conf index e48a41cb..953104af 100644 --- a/config/keyboard/test.conf +++ b/config/keyboard/test.conf @@ -8,8 +8,8 @@ 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 -#=present_first_line -#=present_last_line +KEY_FENRIR,KEY_KP1=review_line_first_char +KEY_FENRIR,KEY_KP3=review_line_last_char KEY_KP5=review_curr_word KEY_KP4=review_prev_word KEY_KP6=review_next_word @@ -35,7 +35,7 @@ KEY_KPPLUS=last_incoming KEY_FENRIR,KEY_F2=toggle_braille KEY_FENRIR,KEY_F3=toggle_sound 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_BACKSLASH=toggle_output key_FENRIR,KEY_KPENTER=toggle_auto_read diff --git a/src/fenrir/commands/commands/review_line_first_char.py b/src/fenrir/commands/commands/review_line_first_char.py new file mode 100644 index 00000000..6c173b11 --- /dev/null +++ b/src/fenrir/commands/commands/review_line_first_char.py @@ -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 diff --git a/src/fenrir/commands/commands/toggle_punctuation_level.py b/src/fenrir/commands/commands/toggle_punctuation_level.py index ab43a10b..b87789b8 100644 --- a/src/fenrir/commands/commands/toggle_punctuation_level.py +++ b/src/fenrir/commands/commands/toggle_punctuation_level.py @@ -17,7 +17,10 @@ class command(): return '' def run(self): - self.env['runtime']['punctuationManager'].cyclePunctuation() - self.env['runtime']['outputManager'].presentText(self.env['runtime']['settingsManager'].getSetting('general', 'punctuationLevel'), interrupt=True, ignorePunctuation=True) + if self.env['runtime']['punctuationManager'].cyclePunctuation(): + 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): pass diff --git a/src/fenrir/core/punctuationManager.py b/src/fenrir/core/punctuationManager.py index 2755b516..b7b2f686 100644 --- a/src/fenrir/core/punctuationManager.py +++ b/src/fenrir/core/punctuationManager.py @@ -102,9 +102,10 @@ class punctuationManager(): try: currIndex = punctList.index(self.env['runtime']['settingsManager'].getSetting('general', 'punctuationLevel').lower()) # curr punctuation except: - return + return False currIndex += 1 if currIndex >= len(punctList): currIndex = 0 currLevel = punctList[currIndex] - self.env['runtime']['settingsManager'].setSetting('general', currLevel.lower()) + self.env['runtime']['settingsManager'].setSetting('general', 'punctuationLevel', currLevel.lower()) + return True