diff --git a/src/fenrir-package/commands/curr_line.py b/src/fenrir-package/commands/curr_line.py index ff8bcefb..009b4f5f 100644 --- a/src/fenrir-package/commands/curr_line.py +++ b/src/fenrir-package/commands/curr_line.py @@ -5,7 +5,7 @@ class command(): pass def run(self, environment): pass - def setCallback(self, callback) + def setCallback(self, callback): pass def shutdown(self): pass diff --git a/src/fenrir-package/core/environment.py b/src/fenrir-package/core/environment.py index b63dda05..b51e21df 100644 --- a/src/fenrir-package/core/environment.py +++ b/src/fenrir-package/core/environment.py @@ -8,11 +8,11 @@ from core import screenData from core import generalInformation environment = { -'screenData' = screenData.screenData, -'runtime' = runtime.runtime, -'generalInformation' = generalInformation.generalInformation, -'settings' = settings.settings, -'bindings' = bindings.bindings, -'soundIcons' = soundIcons.soundIcons, -'autospeak' = ['speak_delta'] +'screenData': screenData.screenData, +'runtime': runtime.runtime, +'generalInformation': generalInformation.generalInformation, +'settings': settings.settings, +'bindings': bindings.bindings, +'soundIcons': soundIcons.soundIcons, +'autospeak': ['speak_delta'] } diff --git a/src/fenrir-package/fenrir.py b/src/fenrir-package/fenrir.py index 9825a6de..f66237ef 100755 --- a/src/fenrir-package/fenrir.py +++ b/src/fenrir-package/fenrir.py @@ -39,7 +39,7 @@ class fenrir(): self.threadHandleInput.start() self.threadCommandQueue.start() while(self.environment['generalInformation']['running']): - time.sleep(2) + time.sleep(0.2) self.shutdown() def handleInput(self): diff --git a/src/fenrir-package/screen/linux.py b/src/fenrir-package/screen/linux.py index 6a33a94e..bd3623bf 100644 --- a/src/fenrir-package/screen/linux.py +++ b/src/fenrir-package/screen/linux.py @@ -12,7 +12,7 @@ class screenManager(): def analyzeScreen(self, environment): # read screen currTTY = open('/sys/devices/virtual/tty/tty0/active','r') - runtime['newTTY'] = currTTY.read()[3:-1] + environment['screenData']['newTTY'] = currTTY.read()[3:-1] currTTY.close() try: @@ -44,7 +44,7 @@ class screenManager(): if environment['screenData']['oldContentBytes'] != environment['screenData']['newContentBytes']: if ((len(environment['screenData']['delta']) < 4) or environment['screenData']['oldTTY'] != environment['screenData']['newTTY']): environment['runtime']['speechDriver'].cancel() - diff = difflib.ndiff(runtime['oldContentText'], environment['screenData']['newContentText']) + diff = difflib.ndiff(environment['screenData']['oldContentText'], environment['screenData']['newContentText']) environment['screenData']['delta'] = ''.join(x[2:] for x in diff if x.startswith('+ ')) environment['runtime']['speechDriver'].speak(environment['screenData']['delta']) diff --git a/src/fenrir-package/speech/espeak.py b/src/fenrir-package/speech/espeak.py index 472d6eb5..2990f214 100644 --- a/src/fenrir-package/speech/espeak.py +++ b/src/fenrir-package/speech/espeak.py @@ -27,7 +27,7 @@ class speech(): self._es.cancel() return True - def setCallback(self, callback) + def setCallback(self, callback): pass def clear_buffer(self): diff --git a/src/fenrir-package/speech/speechd.py b/src/fenrir-package/speech/speechd.py index 9e8417a6..b04ae748 100644 --- a/src/fenrir-package/speech/speechd.py +++ b/src/fenrir-package/speech/speechd.py @@ -27,7 +27,7 @@ class speech(): self._sd.cancel() return True - def setCallback(self, callback) + def setCallback(self, callback): pass def clear_buffer(self): @@ -71,7 +71,10 @@ class speech(): except: return False - def shutdown(self): + if not self._isInitialized: + return False + self._isInitialized = False self.cancel() self._sd.close() + return True diff --git a/src/fenrir-package/utils/debug.py b/src/fenrir-package/utils/debug.py index 88b767d1..3c10202a 100644 --- a/src/fenrir-package/utils/debug.py +++ b/src/fenrir-package/utils/debug.py @@ -1,7 +1,8 @@ #!/usr/bin/python - # Debugger module for the Fenrir screen reader. +from enum import Enum + class debugLevel(Enum): DEACTIVE = 0 ERROR = 1 @@ -31,9 +32,9 @@ class debug(): else: if not self._fileOpened: self.openDebugFile() - self.writeLog(environment, text, level): + self.writeLog(environment, text, level) - def writeLog(self, environment, text, level: + def writeLog(self, environment, text, level = debugLevel.DEACTIVE): if envirionment['settings']['debugLevel'] < level: return False if not self._fileOpened: @@ -54,7 +55,7 @@ class debug(): def setDebugFile(self, fileName): self.closeDebugFile() if self._fileOpened: - self.openDebugFile(self, fileName): + self.openDebugFile(self, fileName)