From 426fecf60faf76de680a59e39572d1c9eeaf5f3f Mon Sep 17 00:00:00 2001 From: chrys Date: Fri, 11 May 2018 23:34:13 +0200 Subject: [PATCH] catch some driver calls --- src/fenrirscreenreader/core/screenManager.py | 18 ++++++++++-------- src/fenrirscreenreader/core/settingsManager.py | 5 ++++- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/fenrirscreenreader/core/screenManager.py b/src/fenrirscreenreader/core/screenManager.py index 426e086c..9b6fd7fa 100644 --- a/src/fenrirscreenreader/core/screenManager.py +++ b/src/fenrirscreenreader/core/screenManager.py @@ -158,13 +158,16 @@ class screenManager(): return '' if attributeFormatString == '': return '' - attributeFormatString = attributeFormatString.replace('fenrirBGColor', self.env['runtime']['screenDriver'].getFenrirBGColor(attribute)) - attributeFormatString = attributeFormatString.replace('fenrirFGColor', self.env['runtime']['screenDriver'].getFenrirFGColor(attribute)) - attributeFormatString = attributeFormatString.replace('fenrirUnderline', self.env['runtime']['screenDriver'].getFenrirUnderline(attribute)) - attributeFormatString = attributeFormatString.replace('fenrirBold', self.env['runtime']['screenDriver'].getFenrirBold(attribute)) - attributeFormatString = attributeFormatString.replace('fenrirBlink', self.env['runtime']['screenDriver'].getFenrirBlink(attribute)) - attributeFormatString = attributeFormatString.replace('fenrirFontSize', self.env['runtime']['screenDriver'].getFenrirFontSize(attribute)) - attributeFormatString = attributeFormatString.replace('fenrirFont', self.env['runtime']['screenDriver'].getFenrirFont(attribute)) + try: + attributeFormatString = attributeFormatString.replace('fenrirBGColor', self.env['runtime']['screenDriver'].getFenrirBGColor(attribute)) + attributeFormatString = attributeFormatString.replace('fenrirFGColor', self.env['runtime']['screenDriver'].getFenrirFGColor(attribute)) + attributeFormatString = attributeFormatString.replace('fenrirUnderline', self.env['runtime']['screenDriver'].getFenrirUnderline(attribute)) + attributeFormatString = attributeFormatString.replace('fenrirBold', self.env['runtime']['screenDriver'].getFenrirBold(attribute)) + attributeFormatString = attributeFormatString.replace('fenrirBlink', self.env['runtime']['screenDriver'].getFenrirBlink(attribute)) + attributeFormatString = attributeFormatString.replace('fenrirFontSize', self.env['runtime']['screenDriver'].getFenrirFontSize(attribute)) + attributeFormatString = attributeFormatString.replace('fenrirFont', self.env['runtime']['screenDriver'].getFenrirFont(attribute)) + except Exception as e: + pass return attributeFormatString def isSuspendingScreen(self, screen = None): if screen == None: @@ -212,7 +215,6 @@ class screenManager(): try: self.env['runtime']['screenDriver'].injectTextToScreen(text, screen) except Exception as e: - print(e) self.env['runtime']['debug'].writeDebugOut('screenManager:injectTextToScreen ' + str(e),debug.debugLevel.ERROR) def changeBrailleScreen(self): diff --git a/src/fenrirscreenreader/core/settingsManager.py b/src/fenrirscreenreader/core/settingsManager.py index abc2f4ef..444e1947 100644 --- a/src/fenrirscreenreader/core/settingsManager.py +++ b/src/fenrirscreenreader/core/settingsManager.py @@ -153,7 +153,10 @@ class settingsManager(): def shutdownDriver(self, driverType): if self.env['runtime'][driverType] == None: return - self.env['runtime'][driverType].shutdown() + try: + self.env['runtime'][driverType].shutdown() + except Exception as e: + pass del self.env['runtime'][driverType] def setFenrirKeys(self, keys):