some more tweaks

This commit is contained in:
chrys 2016-12-23 00:16:34 +01:00
parent c8e23b8d78
commit 4a7a36e6b8
5 changed files with 24 additions and 15 deletions

View File

@ -90,7 +90,7 @@ charEcho=False
# echo deleted chars # echo deleted chars
charDeleteEcho=True charDeleteEcho=True
# echo word after pressing space # echo word after pressing space
wordEcho=False wordEcho=True
# interrupt speech on any keypress # interrupt speech on any keypress
interruptOnKeyPress=False interruptOnKeyPress=False
# you can filter the keys on that the speech should interrupt (empty = all keys, otherwhise the given keys) # you can filter the keys on that the speech should interrupt (empty = all keys, otherwhise the given keys)

View File

@ -28,7 +28,12 @@ class command():
# big changes are no char (but the value is bigger than one maybe the differ needs longer than you can type, so a little strange random buffer for now) # big changes are no char (but the value is bigger than one maybe the differ needs longer than you can type, so a little strange random buffer for now)
if len(self.env['screenData']['newDelta']) > 3: if len(self.env['screenData']['newDelta']) > 3:
return return
self.env['runtime']['outputManager'].presentText(self.env['screenData']['newDelta'], interrupt=True, ignorePunctuation=True, announceCapital=True) # filter unneded space on word begin
currDelta = self.env['screenData']['newDelta']
if len(currDelta.strip()) != len(currDelta) and \
currDelta.strip() != '':
currDelta = currDelta.strip()
self.env['runtime']['outputManager'].presentText(currDelta, interrupt=True, ignorePunctuation=True, announceCapital=True)
def setCallback(self, callback): def setCallback(self, callback):
pass pass

View File

@ -38,16 +38,15 @@ class command():
newContent = self.env['screenData']['newContentText'].split('\n')[self.env['screenData']['newCursor']['y']] newContent = self.env['screenData']['newContentText'].split('\n')[self.env['screenData']['newCursor']['y']]
x, y, currWord, endOfScreen, lineBreak = \ x, y, currWord, endOfScreen, lineBreak = \
word_utils.getCurrentWord(self.env['screenData']['newCursor']['x'], 0, newContent) word_utils.getCurrentWord(self.env['screenData']['newCursor']['x'], 0, newContent)
# was this a typed word? # currently writing
if self.env['runtime']['screenManager'].isDelta(): if self.env['runtime']['screenManager'].isDelta():
# is there a delta bigger than keyecho? return
if len(self.env['screenData']['newDelta']) > 1:
return
if not(newContent[self.env['screenData']['oldCursor']['x']].isspace() and x != self.env['screenData']['oldCursor']['x']):
return
else: else:
# or just arrow arround? # at the end of a word
if not(newContent[self.env['screenData']['newCursor']['x']].isspace() and x != self.env['screenData']['newCursor']['x']): if not newContent[self.env['screenData']['newCursor']['x']].isspace():
return
if (x + len(currWord) != self.env['screenData']['newCursor']['x']) and \
(x + len(currWord) != self.env['screenData']['newCursor']['x']-1):
return return
if currWord != '': if currWord != '':

View File

@ -72,9 +72,11 @@ class command():
currWord = currWord.strip(string.whitespace + '!"#$%&()*+,-./:;<=>?@[\\]^_{|}~') currWord = currWord.strip(string.whitespace + '!"#$%&()*+,-./:;<=>?@[\\]^_{|}~')
else: else:
# or just arrow arround? # or just arrow arround?
if not(newContent[self.env['screenData']['newCursor']['x']].isspace() and x != self.env['screenData']['newCursor']['x']): if not newContent[self.env['screenData']['newCursor']['x']].isspace():
return return
if (x + len(currWord) != self.env['screenData']['newCursor']['x']) and \
(x + len(currWord) != self.env['screenData']['newCursor']['x']-1):
return
# ignore empty # ignore empty
if currWord.strip(string.whitespace) =='': if currWord.strip(string.whitespace) =='':
return return

View File

@ -38,8 +38,11 @@ class command():
# word begin produce a diff wiht len == 2 |a | others with 1 |a| # word begin produce a diff wiht len == 2 |a | others with 1 |a|
if len(self.env['screenData']['newNegativeDelta']) > 2: if len(self.env['screenData']['newNegativeDelta']) > 2:
return return
currNegativeDelta = self.env['screenData']['newNegativeDelta']
self.env['runtime']['outputManager'].presentText(self.env['screenData']['newNegativeDelta'], interrupt=True, ignorePunctuation=True, announceCapital=True) if len(currNegativeDelta.strip()) != len(currNegativeDelta) and \
currNegativeDelta.strip() != '':
currNegativeDelta = currNegativeDelta.strip()
self.env['runtime']['outputManager'].presentText(currNegativeDelta, interrupt=True, ignorePunctuation=True, announceCapital=True)
def setCallback(self, callback): def setCallback(self, callback):
pass pass