diff --git a/src/fenrir/core/outputManager.py b/src/fenrir/core/outputManager.py index adf35832..fc108b94 100644 --- a/src/fenrir/core/outputManager.py +++ b/src/fenrir/core/outputManager.py @@ -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) diff --git a/src/fenrir/utils/char_utils.py b/src/fenrir/utils/char_utils.py index 0d029631..1dc9d266 100644 --- a/src/fenrir/utils/char_utils.py +++ b/src/fenrir/utils/char_utils.py @@ -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): diff --git a/src/fenrir/utils/line_utils.py b/src/fenrir/utils/line_utils.py index d7f49ac0..7e6340f0 100644 --- a/src/fenrir/utils/line_utils.py +++ b/src/fenrir/utils/line_utils.py @@ -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