tweak char and line utils

This commit is contained in:
chrys 2016-12-22 23:08:16 +01:00
parent d8442c8f04
commit c8e23b8d78
3 changed files with 21 additions and 7 deletions

View File

@ -24,6 +24,8 @@ class outputManager():
self.env['runtime']['settingsManager'].shutdownDriver('brailleDriver')
def presentText(self, text, interrupt=True, soundIcon = '', ignorePunctuation=False, announceCapital=False):
if text == '':
return
self.env['runtime']['debug'].writeDebugOut("presentText:\nsoundIcon:'"+soundIcon+"'\nText:\n" + text ,debug.debugLevel.INFO)
if self.playSoundIcon(soundIcon, interrupt):
self.env['runtime']['debug'].writeDebugOut("soundIcon found" ,debug.debugLevel.INFO)

View File

@ -15,7 +15,7 @@ def getPrevChar(currX,currY, currText):
x = currX
y = currY
if x - 1 < 0:
if y - 1 > 0:
if y - 1 >= 0:
y -= 1
x = len(wrappedLines[y]) - 1
lineBreak = True
@ -24,6 +24,8 @@ def getPrevChar(currX,currY, currText):
endOfScreen = True
else:
x -= 1
currChar = ''
if not endOfScreen:
currChar = wrappedLines[y][x]
return x, y, currChar, endOfScreen, lineBreak
@ -44,6 +46,8 @@ def getUpChar(currX,currY, currText):
currY = 0
else:
endOfScreen = True
currChar = ''
if not endOfScreen:
currChar = wrappedLines[currY][currX]
return currX, currY, currChar, endOfScreen
@ -57,6 +61,8 @@ def getDownChar(currX,currY, currText):
currY = len(wrappedLines) -1
else:
endOfScreen = True
currChar = ''
if not endOfScreen:
currChar = wrappedLines[currY][currX]
return currX, currY, currChar, endOfScreen
@ -89,6 +95,8 @@ def getNextChar(currX,currY, currText):
endOfScreen = True
else:
x += 1
currChar = ''
if not endOfScreen:
currChar = wrappedLines[y][x]
return x, y, currChar, endOfScreen, lineBreak

View File

@ -19,6 +19,8 @@ def getPrevLine(currX,currY, currText):
else:
endOfScreen = True
x = 0
currLine = ''
if not endOfScreen:
currLine = wrappedLines[y]
return x, y, currLine, endOfScreen
@ -44,5 +46,7 @@ def getNextLine(currX,currY, currText):
else:
endOfScreen = True
x = 0
currLine = ''
if not endOfScreen:
currLine = wrappedLines[y]
return x, y, currLine, endOfScreen