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,7 +24,9 @@ def getPrevChar(currX,currY, currText):
endOfScreen = True
else:
x -= 1
currChar = wrappedLines[y][x]
currChar = ''
if not endOfScreen:
currChar = wrappedLines[y][x]
return x, y, currChar, endOfScreen, lineBreak
def getCurrentChar(currX,currY, currText):
@ -44,7 +46,9 @@ def getUpChar(currX,currY, currText):
currY = 0
else:
endOfScreen = True
currChar = wrappedLines[currY][currX]
currChar = ''
if not endOfScreen:
currChar = wrappedLines[currY][currX]
return currX, currY, currChar, endOfScreen
def getDownChar(currX,currY, currText):
@ -57,7 +61,9 @@ def getDownChar(currX,currY, currText):
currY = len(wrappedLines) -1
else:
endOfScreen = True
currChar = wrappedLines[currY][currX]
currChar = ''
if not endOfScreen:
currChar = wrappedLines[currY][currX]
return currX, currY, currChar, endOfScreen
def getLastCharInLine(currY, currText):
@ -89,7 +95,9 @@ def getNextChar(currX,currY, currText):
endOfScreen = True
else:
x += 1
currChar = wrappedLines[y][x]
currChar = ''
if not endOfScreen:
currChar = wrappedLines[y][x]
return x, y, currChar, endOfScreen, lineBreak
def getPhonetic(currChar):

View File

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