finalize cleanup in API
This commit is contained in:
@@ -41,7 +41,7 @@ class command():
|
||||
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
|
||||
# get the word
|
||||
newContent = self.env['screenData']['newContentText'].split('\n')[cursorPos['y']]
|
||||
x, y, currWord = word_utils.getCurrentWord(cursorPos['x'], 0, newContent)
|
||||
x, y, currWord, endOfScreen, lineBreak = word_utils.getCurrentWord(cursorPos['x'], 0, newContent)
|
||||
currWord = currWord.strip(string.whitespace + '!"#$%&\()*+,-./:;<=§>?@[\\]^_{|}~')
|
||||
|
||||
if currWord != '':
|
||||
|
@@ -43,7 +43,7 @@ class command():
|
||||
|
||||
# get the word
|
||||
newContent = self.env['screenData']['newContentText'].split('\n')[cursorPos['y']]
|
||||
x, y, currWord = word_utils.getCurrentWord(cursorPos['x'], 0, newContent)
|
||||
x, y, currWord, endOfScreen, lineBreak = word_utils.getCurrentWord(cursorPos['x'], 0, newContent)
|
||||
currWord = currWord.strip(string.whitespace + '!"#$%&\()*+,-./:;<=§>?@[\\]^_{|}~')
|
||||
if not currWord.isspace():
|
||||
if self.spellChecker.is_removed(currWord):
|
||||
|
@@ -20,7 +20,7 @@ class command():
|
||||
def run(self):
|
||||
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
|
||||
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currWord = \
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currWord, endOfScreen, lineBreak = \
|
||||
word_utils.getCurrentWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currWord.isspace():
|
||||
|
@@ -20,7 +20,7 @@ class command():
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currWord = \
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currWord, endOfScreen, lineBreak = \
|
||||
word_utils.getCurrentWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currWord.isspace():
|
||||
|
@@ -19,7 +19,7 @@ class command():
|
||||
|
||||
def run(self):
|
||||
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], downChar = \
|
||||
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)
|
||||
|
@@ -22,16 +22,15 @@ class command():
|
||||
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'])
|
||||
if currLine.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("line is empty" ,interrupt=True)
|
||||
return
|
||||
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)
|
||||
|
||||
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
|
||||
|
@@ -19,13 +19,13 @@ class command():
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currChar = \
|
||||
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 currChar.isspace():
|
||||
if nextChar.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(nextChar, interrupt=True, ignorePunctuation=True, announceCapital=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@@ -20,7 +20,7 @@ class command():
|
||||
def run(self):
|
||||
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
|
||||
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], nextChar = \
|
||||
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():
|
||||
|
@@ -22,13 +22,13 @@ class command():
|
||||
if not self.env['screenData']['newCursorReview']:
|
||||
self.env['screenData']['newCursorReview'] = self.env['screenData']['newCursor'].copy()
|
||||
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currLine = \
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], nextLine, endOfScreen = \
|
||||
line_utils.getNextLine(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currLine.isspace():
|
||||
if nextLine.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(currLine, interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(nextLine, interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@@ -22,13 +22,13 @@ class command():
|
||||
if self.env['screenData']['newCursorReview'] == None:
|
||||
self.env['screenData']['newCursorReview'] = self.env['screenData']['newCursor'].copy()
|
||||
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currWord = \
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], nextWord, endOfScreen, lineBreak = \
|
||||
word_utils.getNextWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currWord.isspace():
|
||||
if nextWord.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank", interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(currWord, interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(nextWord, interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@@ -20,7 +20,7 @@ class command():
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], nextWord = \
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], nextWord, endOfScreen, lineBreak = \
|
||||
word_utils.getNextWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if nextWord.isspace():
|
||||
|
@@ -22,13 +22,13 @@ class command():
|
||||
if not self.env['screenData']['newCursorReview']:
|
||||
self.env['screenData']['newCursorReview'] = self.env['screenData']['newCursor'].copy()
|
||||
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currChar = \
|
||||
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 currChar.isspace():
|
||||
if prevChar.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(prevChar, interrupt=True, ignorePunctuation=True, announceCapital=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@@ -20,14 +20,14 @@ class command():
|
||||
def run(self):
|
||||
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
|
||||
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], nextChar = \
|
||||
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 nextChar.isspace():
|
||||
if prevChar.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)
|
||||
prevChar = char_utils.getPhonetic(prevChar)
|
||||
self.env['runtime']['outputManager'].presentText(prevChar ,interrupt=True, announceCapital=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@@ -20,13 +20,13 @@ class command():
|
||||
def run(self):
|
||||
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
|
||||
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currLine = \
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], prevLine, endOfScreen = \
|
||||
line_utils.getPrevLine(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currLine.isspace():
|
||||
if prevLine.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(currLine, interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(prevLine, interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@@ -20,13 +20,13 @@ class command():
|
||||
def run(self):
|
||||
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
|
||||
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currWord = \
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], prevWord, endOfScreen, lineBreak = \
|
||||
word_utils.getPrevWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if currWord.isspace():
|
||||
if prevWord.isspace():
|
||||
self.env['runtime']['outputManager'].presentText("blank", interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(currWord, interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText(prevWord, interrupt=True)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@@ -20,7 +20,7 @@ class command():
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], prevWord = \
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], prevWord, endOfScreen, lineBreak = \
|
||||
word_utils.getPrevWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText'])
|
||||
|
||||
if prevWord.isspace():
|
||||
|
@@ -19,7 +19,7 @@ class command():
|
||||
|
||||
def run(self):
|
||||
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
|
||||
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], upChar = \
|
||||
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)
|
||||
|
@@ -42,7 +42,7 @@ class command():
|
||||
|
||||
# get the word
|
||||
newContent = self.env['screenData']['newContentText'].split('\n')[cursorPos['y']]
|
||||
x, y, currWord = word_utils.getCurrentWord(cursorPos['x'], 0, newContent)
|
||||
x, y, currWord, endOfScreen, lineBreak = word_utils.getCurrentWord(cursorPos['x'], 0, newContent)
|
||||
|
||||
if not currWord.isspace():
|
||||
if not self.spellChecker.check(currWord):
|
||||
|
@@ -23,7 +23,7 @@ class command():
|
||||
if self.env['screenData']['newCursor']['x'] <= self.env['screenData']['oldCursor']['x']:
|
||||
return
|
||||
# is there any change?
|
||||
if not self.environment['runtime']['screenManager'].isDelta():
|
||||
if not self.env['runtime']['screenManager'].isDelta():
|
||||
return
|
||||
# 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:
|
||||
|
@@ -36,7 +36,8 @@ class command():
|
||||
return
|
||||
# get the word
|
||||
newContent = self.env['screenData']['newContentText'].split('\n')[self.env['screenData']['newCursor']['y']]
|
||||
x, y, currWord = word_utils.getCurrentWord(self.env['screenData']['newCursor']['x'], 0, newContent)
|
||||
x, y, currWord, endOfScreen, lineBreak = \
|
||||
word_utils.getCurrentWord(self.env['screenData']['newCursor']['x'], 0, newContent)
|
||||
# was this a typed word?
|
||||
if self.env['runtime']['screenManager'].isDelta():
|
||||
# is there a delta bigger than keyecho?
|
||||
|
@@ -63,7 +63,7 @@ class command():
|
||||
|
||||
# get the word (just for speedup only look at current line
|
||||
newContent = self.env['screenData']['newContentText'].split('\n')[self.env['screenData']['newCursor']['y']]
|
||||
x, y, currWord, endOfScreen, lineBreak = word_utils.getCurrentWord(self.env['screenData']['newCursor']['x'], 0, newContent)
|
||||
x, y, currWord, endOfScreen, lineBreak = word_utils.getCurrentWord(self.env['screenData']['newCursor']['x'], 0, newContent)
|
||||
# was this a typed word?
|
||||
if self.env['screenData']['newDelta'] != '':
|
||||
if not(newContent[self.env['screenData']['oldCursor']['x']] in string.whitespace + '!"#$%&()*+,-./:;<=>?@[\\]^_{|}~' and x != self.env['screenData']['oldCursor']['x']):
|
||||
|
@@ -26,10 +26,10 @@ class command():
|
||||
|
||||
# More than just a deletion happend
|
||||
|
||||
if self.environment['runtime']['screenManager'].isDelta():
|
||||
if self.env['runtime']['screenManager'].isDelta():
|
||||
return
|
||||
# no deletion
|
||||
if not self.environment['runtime']['screenManager'].isNegativeDelta():
|
||||
if not self.env['runtime']['screenManager'].isNegativeDelta():
|
||||
return
|
||||
if self.env['runtime']['inputManager'].noKeyPressed():
|
||||
return
|
||||
|
Reference in New Issue
Block a user