add review announce linebreak and endofline

This commit is contained in:
chrys 2016-12-08 00:51:08 +01:00
parent e4b0327aca
commit 6023ca8800
24 changed files with 91 additions and 64 deletions

View File

@ -6,9 +6,10 @@
none:===:
some:===:.-$~+*-/\@
most:===:.,:-$~+*-/\@!#%^&*()[]}{<>;
all:===:!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~
all:===:!"#$%& \'()*+,-./:;<=>?@[\\]^_`{|}~
[punctDict]
:===:spacasdfe
&:===:and
':===:apostrophe
@:===:at

View File

@ -117,7 +117,7 @@ cursor=True
highlight=False
[review]
newLine=True
lineBreak=True
endOfScreen=True
[promote]

View File

@ -119,7 +119,7 @@ cursor=True
highlight=False
[review]
newLine=True
lineBreak=True
endOfScreen=True
[promote]

View File

@ -119,7 +119,7 @@ cursor=True
highlight=False
[review]
newLine=True
lineBreak=True
endOfScreen=True
[promote]

View File

@ -69,7 +69,7 @@ cursor=True
highlight=False
[review]
newLine=True
lineBreak=True
endOfScreen=True
[promote]

View File

@ -23,9 +23,6 @@ class command():
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("blank" ,interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(currChar ,interrupt=True, ignorePunctuation=True, announceCapital=True)
def setCallback(self, callback):

View File

@ -15,16 +15,15 @@ class command():
def shutdown(self):
pass
def getDescription(self):
return 'set review cursor to end of current line and display the content'
return 'set review cursor to char below the current char and present it.'
def run(self):
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], downChar, endOfScreen = \
char_utils.getDownChar(self.env['screenData']['newCursorReview']['x'],self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
if downChar.isspace():
self.env['runtime']['outputManager'].presentText("line is empty" ,interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(downChar ,interrupt=True, ignorePunctuation=True, announceCapital=True)
if endOfScreen:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText('end of screen' ,interrupt=False, soundIcon='EndOfScreen')
def setCallback(self, callback):
pass

View File

@ -23,9 +23,6 @@ class command():
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("space" ,interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(currChar ,interrupt=True, ignorePunctuation=True, announceCapital=True)
self.env['runtime']['outputManager'].presentText("end of line", interrupt=False)

View File

@ -23,9 +23,6 @@ class command():
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], lastChar = \
char_utils.getLastCharInLine(self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
if lastChar.isspace():
self.env['runtime']['outputManager'].presentText("line is empty" ,interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(lastChar ,interrupt=True, ignorePunctuation=True, announceCapital=True)
self.env['runtime']['outputManager'].presentText("last char in line", interrupt=False)

View File

@ -22,10 +22,12 @@ class command():
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], nextChar, endOfScreen, lineBreak = \
char_utils.getNextChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
if nextChar.isspace():
self.env['runtime']['outputManager'].presentText("space", interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(nextChar, interrupt=True, ignorePunctuation=True, announceCapital=True)
if endOfScreen:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText('end of screen' ,interrupt=False, soundIcon='EndOfScreen')
if lineBreak:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'):
self.env['runtime']['outputManager'].presentText('line break' ,interrupt=False, soundIcon='EndOfLine')
def setCallback(self, callback):
pass

View File

@ -23,11 +23,13 @@ class command():
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], nextChar, endOfScreen, lineBreak = \
char_utils.getNextChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
if nextChar.isspace():
self.env['runtime']['outputManager'].presentText("blank" ,interrupt=True)
else:
nextChar = char_utils.getPhonetic(nextChar)
self.env['runtime']['outputManager'].presentText(nextChar ,interrupt=True, announceCapital=True)
if endOfScreen:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText('end of screen' ,interrupt=False, soundIcon='EndOfScreen')
if lineBreak:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'):
self.env['runtime']['outputManager'].presentText('line break' ,interrupt=False, soundIcon='EndOfLine')
def setCallback(self, callback):
pass

View File

@ -29,6 +29,8 @@ class command():
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(nextLine, interrupt=True)
if endOfScreen:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText('end of screen' ,interrupt=False, soundIcon='EndOfScreen')
def setCallback(self, callback):
pass

View File

@ -29,6 +29,11 @@ class command():
self.env['runtime']['outputManager'].presentText("blank", interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(nextWord, interrupt=True)
if endOfScreen:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText('end of screen' ,interrupt=False, soundIcon='EndOfScreen')
if lineBreak:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'):
self.env['runtime']['outputManager'].presentText('line break' ,interrupt=False, soundIcon='EndOfLine')
def setCallback(self, callback):
pass

View File

@ -31,6 +31,11 @@ class command():
currChar = char_utils.getPhonetic(c)
self.env['runtime']['outputManager'].presentText(currChar, interrupt=firstSequence, announceCapital=True)
firstSequence = False
if endOfScreen:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText('end of screen' ,interrupt=False, soundIcon='EndOfScreen')
if lineBreak:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'):
self.env['runtime']['outputManager'].presentText('line break' ,interrupt=False, soundIcon='EndOfLine')
def setCallback(self, callback):
pass

View File

@ -25,10 +25,12 @@ class command():
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], prevChar, endOfScreen, lineBreak = \
char_utils.getPrevChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
if prevChar.isspace():
self.env['runtime']['outputManager'].presentText("space", interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(prevChar, interrupt=True, ignorePunctuation=True, announceCapital=True)
if endOfScreen:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText('end of screen' ,interrupt=False, soundIcon='EndOfScreen')
if lineBreak:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'):
self.env['runtime']['outputManager'].presentText('line break' ,interrupt=False, soundIcon='EndOfLine')
def setCallback(self, callback):
pass

View File

@ -23,11 +23,13 @@ class command():
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], prevChar, endOfScreen, lineBreak = \
char_utils.getPrevChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
if prevChar.isspace():
self.env['runtime']['outputManager'].presentText("blank" ,interrupt=True)
else:
prevChar = char_utils.getPhonetic(prevChar)
self.env['runtime']['outputManager'].presentText(prevChar ,interrupt=True, announceCapital=True)
if endOfScreen:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText('end of screen' ,interrupt=False, soundIcon='EndOfScreen')
if lineBreak:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'):
self.env['runtime']['outputManager'].presentText('line break' ,interrupt=False, soundIcon='EndOfLine')
def setCallback(self, callback):
pass

View File

@ -27,6 +27,9 @@ class command():
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(prevLine, interrupt=True)
if endOfScreen:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText('end of screen' ,interrupt=False, soundIcon='EndOfScreen')
def setCallback(self, callback):
pass

View File

@ -27,6 +27,11 @@ class command():
self.env['runtime']['outputManager'].presentText("blank", interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(prevWord, interrupt=True)
if endOfScreen:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText('end of screen' ,interrupt=False, soundIcon='EndOfScreen')
if lineBreak:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'):
self.env['runtime']['outputManager'].presentText('line break' ,interrupt=False, soundIcon='EndOfLine')
def setCallback(self, callback):
pass

View File

@ -31,6 +31,11 @@ class command():
currChar = char_utils.getPhonetic(c)
self.env['runtime']['outputManager'].presentText(currChar, interrupt=firstSequence, announceCapital=True)
firstSequence = False
if endOfScreen:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText('end of screen' ,interrupt=False, soundIcon='EndOfScreen')
if lineBreak:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'):
self.env['runtime']['outputManager'].presentText('line break' ,interrupt=False, soundIcon='EndOfLine')
def setCallback(self, callback):
pass

View File

@ -15,16 +15,18 @@ class command():
def shutdown(self):
pass
def getDescription(self):
return 'set review cursor to end of current line and display the content'
return 'set review cursor to the char in the line below and present it'
def run(self):
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], upChar, endOfScreen = \
char_utils.getUpChar(self.env['screenData']['newCursorReview']['x'],self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
if upChar.isspace():
self.env['runtime']['outputManager'].presentText("line is empty" ,interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(upChar ,interrupt=True, ignorePunctuation=True, announceCapital=True)
if endOfScreen:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText('end of screen' ,interrupt=False, soundIcon='EndOfScreen')
if lineBreak:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'):
self.env['runtime']['outputManager'].presentText('line break' ,interrupt=False, soundIcon='EndOfLine')
def setCallback(self, callback):
pass

View File

@ -28,7 +28,7 @@ class outputManager():
if self.playSoundIcon(soundIcon, interrupt):
self.env['runtime']['debug'].writeDebugOut("soundIcon found" ,debug.debugLevel.INFO)
return
if text.strip(string.whitespace) == '':
if (len(text) > 1) and (text.strip(string.whitespace) == ''):
return
toAnnounceCapital = announceCapital and text[0].isupper()
if toAnnounceCapital:

View File

@ -11,10 +11,11 @@ punctuation = {
'LEVELDICT':{
'none': '',
'some': '#-$~+*-/\\@',
'most': '.,:-$~+*-/\\@!#%^&*()[]}{<>;',
'all': string.punctuation + '§',
'most': '.,:-$~ +*-/\\@!#%^&*()[]}{<>;',
'all': string.punctuation + ' §',
},
'PUNCTDICT':{
' ':'space',
'&':'and',
"'":"apostrophe",
'@':'at',

View File

@ -12,7 +12,7 @@ class punctuationManager():
pass
def initialize(self, environment):
self.env = environment
self.allPunctNone = dict.fromkeys(map(ord, string.punctuation +"§"), ' ')
self.allPunctNone = dict.fromkeys(map(ord, string.punctuation +"§ "), ' ')
# replace with None:
# dot, comma, grave, apostrophe
#for char in [ord('`'),ord("'")]:
@ -62,7 +62,7 @@ class punctuationManager():
if not ignorePunctuation and self.env['runtime']['settingsManager'].getSetting('general', 'punctuationLevel').lower() in self.env['punctuation']['LEVELDICT']:
currPunctLevel = self.env['punctuation']['LEVELDICT'][self.env['runtime']['settingsManager'].getSetting('general', 'punctuationLevel').lower()]
else:
currPunctLevel = string.punctuation +'§'
currPunctLevel = string.punctuation +' §'
resultText = self.usePunctuationDict(resultText, self.env['punctuation']['PUNCTDICT'], currPunctLevel)
#resultText = self.removeUnused(resultText, currPunctLevel)
return resultText

View File

@ -60,7 +60,7 @@ settings = {
'highlight': False,
},
'review':{
'newLine': True,
'lineBreak': True,
'endOfScreen': True,
},
'promote':{