diff --git a/config/keyboard/desktop.conf b/config/keyboard/desktop.conf index 2a67d71f..0be15d98 100644 --- a/config/keyboard/desktop.conf +++ b/config/keyboard/desktop.conf @@ -11,8 +11,10 @@ 1-KEY_KP1=prev_char 1-KEY_KP3=next_char 1-KEY_KPDOT=exit_review +#=curr_screen 1-KEY_KP0,1-KEY_F2=toggle_braille 1-KEY_KP0,1-KEY_F3=toggle_sound 1-KEY_KP0,1-KEY_F4=toggle_speech #=toggle_output #=toggle_autoRead +#=quit_fenrir diff --git a/config/settings/PromotedText b/config/settings/PromotedText.conf similarity index 100% rename from config/settings/PromotedText rename to config/settings/PromotedText.conf diff --git a/src/fenrir-package/commands/commands/curr_char.py b/src/fenrir-package/commands/commands/curr_char.py index d961f476..ed80935c 100644 --- a/src/fenrir-package/commands/commands/curr_char.py +++ b/src/fenrir-package/commands/commands/curr_char.py @@ -14,9 +14,9 @@ class command(): char_utils.getCurrentChar(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText']) if currChar.strip(" \t\n") == '': - environment['runtime']['outputManager'].presentText(environment, "blank") + environment['runtime']['outputManager'].presentText(environment, "blank" ,interrupt=True) else: - environment['runtime']['outputManager'].presentText(environment, currChar) + environment['runtime']['outputManager'].presentText(environment, currChar ,interrupt=True) return environment def setCallback(self, callback): pass diff --git a/src/fenrir-package/commands/commands/curr_line.py b/src/fenrir-package/commands/commands/curr_line.py index 63a47d72..7e7a4aec 100644 --- a/src/fenrir-package/commands/commands/curr_line.py +++ b/src/fenrir-package/commands/commands/curr_line.py @@ -14,9 +14,9 @@ class command(): line_utils.getCurrentLine(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText']) if currLine.strip(" \t\n") == '': - environment['runtime']['outputManager'].presentText(environment, "blank") + environment['runtime']['outputManager'].presentText(environment, "blank", interrupt=True) else: - environment['runtime']['outputManager'].presentText(environment, currLine) + environment['runtime']['outputManager'].presentText(environment, currLine, interrupt=True) return environment def setCallback(self, callback): pass diff --git a/src/fenrir-package/commands/commands/curr_screen.py b/src/fenrir-package/commands/commands/curr_screen.py new file mode 100644 index 00000000..cb841226 --- /dev/null +++ b/src/fenrir-package/commands/commands/curr_screen.py @@ -0,0 +1,12 @@ +#!/bin/python + +class command(): + def __init__(self): + pass + def run(self, environment): + environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newContentText'],interrupt=True) + return environment + def setCallback(self, callback): + pass + def shutdown(self): + pass diff --git a/src/fenrir-package/commands/commands/curr_word.py b/src/fenrir-package/commands/commands/curr_word.py index a25d5fbf..d2b5e5dc 100644 --- a/src/fenrir-package/commands/commands/curr_word.py +++ b/src/fenrir-package/commands/commands/curr_word.py @@ -14,9 +14,9 @@ class command(): word_utils.getCurrentWord(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText']) if currWord.strip(" \t\n") == '': - environment['runtime']['outputManager'].presentText(environment, "blank") + environment['runtime']['outputManager'].presentText(environment, "blank", interrupt=True) else: - environment['runtime']['outputManager'].presentText(environment, currWord) + environment['runtime']['outputManager'].presentText(environment, currWord, interrupt=True) return environment def setCallback(self, callback): pass diff --git a/src/fenrir-package/commands/commands/exit_review.py b/src/fenrir-package/commands/commands/exit_review.py index 453317d8..3fa97ff6 100644 --- a/src/fenrir-package/commands/commands/exit_review.py +++ b/src/fenrir-package/commands/commands/exit_review.py @@ -6,7 +6,7 @@ class command(): def run(self, environment): environment['screenData']['oldCursorReview'] = {'x':-1,'y':-1} environment['screenData']['newCursorReview'] = {'x':-1,'y':-1} - environment['runtime']['outputManager'].presentText(environment, "leve review mode") + environment['runtime']['outputManager'].presentText(environment, "leve review mode", interrupt=True) return environment def setCallback(self, callback): pass diff --git a/src/fenrir-package/commands/commands/next_char.py b/src/fenrir-package/commands/commands/next_char.py index 80f7947c..b0a6f298 100644 --- a/src/fenrir-package/commands/commands/next_char.py +++ b/src/fenrir-package/commands/commands/next_char.py @@ -14,9 +14,9 @@ class command(): char_utils.getNextChar(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText']) if currChar.strip(" \t\n") == '': - environment['runtime']['outputManager'].presentText(environment, "blank") + environment['runtime']['outputManager'].presentText(environment, "blank", interrupt=True) else: - environment['runtime']['outputManager'].presentText(environment, currChar) + environment['runtime']['outputManager'].presentText(environment, currChar, interrupt=True) return environment def setCallback(self, callback): pass diff --git a/src/fenrir-package/commands/commands/next_line.py b/src/fenrir-package/commands/commands/next_line.py index 80f98d85..bedcef99 100644 --- a/src/fenrir-package/commands/commands/next_line.py +++ b/src/fenrir-package/commands/commands/next_line.py @@ -14,9 +14,9 @@ class command(): line_utils.getNextLine(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText']) if currLine.strip(" \t\n") == '': - environment['runtime']['outputManager'].presentText(environment, "blank") + environment['runtime']['outputManager'].presentText(environment, "blank", interrupt=True) else: - environment['runtime']['outputManager'].presentText(environment, currLine) + environment['runtime']['outputManager'].presentText(environment, currLine, interrupt=True) return environment def setCallback(self, callback): pass diff --git a/src/fenrir-package/commands/commands/next_word.py b/src/fenrir-package/commands/commands/next_word.py index 65e5cadb..8405ffc3 100644 --- a/src/fenrir-package/commands/commands/next_word.py +++ b/src/fenrir-package/commands/commands/next_word.py @@ -14,9 +14,9 @@ class command(): word_utils.getNextWord(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText']) if currWord.strip(" \t\n") == '': - environment['runtime']['outputManager'].presentText(environment, "blank") + environment['runtime']['outputManager'].presentText(environment, "blank", interrupt=True) else: - environment['runtime']['outputManager'].presentText(environment, currWord) + environment['runtime']['outputManager'].presentText(environment, currWord, interrupt=True) return environment def setCallback(self, callback): pass diff --git a/src/fenrir-package/commands/commands/prev_char.py b/src/fenrir-package/commands/commands/prev_char.py index 8bd49d37..6abbb836 100644 --- a/src/fenrir-package/commands/commands/prev_char.py +++ b/src/fenrir-package/commands/commands/prev_char.py @@ -14,9 +14,9 @@ class command(): char_utils.getPrevChar(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText']) if currChar.strip(" \t\n") == '': - environment['runtime']['outputManager'].presentText(environment, "blank") + environment['runtime']['outputManager'].presentText(environment, "blank", interrupt=True) else: - environment['runtime']['outputManager'].presentText(environment, currChar) + environment['runtime']['outputManager'].presentText(environment, currChar, interrupt=True) return environment def setCallback(self, callback): pass diff --git a/src/fenrir-package/commands/commands/prev_line.py b/src/fenrir-package/commands/commands/prev_line.py index ad178fe2..d63589c9 100644 --- a/src/fenrir-package/commands/commands/prev_line.py +++ b/src/fenrir-package/commands/commands/prev_line.py @@ -14,9 +14,9 @@ class command(): line_utils.getPrevLine(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText']) if currLine.strip(" \t\n") == '': - environment['runtime']['outputManager'].presentText(environment, "blank") + environment['runtime']['outputManager'].presentText(environment, "blank", interrupt=True) else: - environment['runtime']['outputManager'].presentText(environment, currLine) + environment['runtime']['outputManager'].presentText(environment, currLine, interrupt=True) return environment def setCallback(self, callback): pass diff --git a/src/fenrir-package/commands/commands/prev_word.py b/src/fenrir-package/commands/commands/prev_word.py index e14983dc..a5b5f058 100644 --- a/src/fenrir-package/commands/commands/prev_word.py +++ b/src/fenrir-package/commands/commands/prev_word.py @@ -14,9 +14,9 @@ class command(): word_utils.getPrevWord(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText']) if currWord.strip(" \t\n") == '': - environment['runtime']['outputManager'].presentText(environment, "blank") + environment['runtime']['outputManager'].presentText(environment, "blank", interrupt=True) else: - environment['runtime']['outputManager'].presentText(environment, currWord) + environment['runtime']['outputManager'].presentText(environment, currWord, interrupt=True) return environment def setCallback(self, callback): pass diff --git a/src/fenrir-package/commands/commands/quit_fenrir.py b/src/fenrir-package/commands/commands/quit_fenrir.py new file mode 100644 index 00000000..4946c0ea --- /dev/null +++ b/src/fenrir-package/commands/commands/quit_fenrir.py @@ -0,0 +1,12 @@ +#!/bin/python + +class command(): + def __init__(self): + pass + def run(self, environment): + environment['generalInformation']['running'] = False + return environment + def setCallback(self, callback): + pass + def shutdown(self): + pass diff --git a/src/fenrir-package/commands/commands/toggle_autoRead.py b/src/fenrir-package/commands/commands/toggle_autoRead.py index 4c1611f0..f88ed08b 100644 --- a/src/fenrir-package/commands/commands/toggle_autoRead.py +++ b/src/fenrir-package/commands/commands/toggle_autoRead.py @@ -7,9 +7,9 @@ class command(): environment = environment['runtime']['settingsManager'].setSetting(environment, 'speech', 'autoReadIncomming', str(not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'autoReadIncomming'))) if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'autoReadIncomming'): - environment['runtime']['outputManager'].presentText(environment, "autoread enabled",soundIconName='', interrupt=True) + environment['runtime']['outputManager'].presentText(environment, "autoread enabled", soundIconName='', interrupt=True) else: - environment['runtime']['outputManager'].presentText(environment, "autoread disabled",soundIconName='', interrupt=True) + environment['runtime']['outputManager'].presentText(environment, "autoread disabled", soundIconName='', interrupt=True) return environment def setCallback(self, callback): pass diff --git a/src/fenrir-package/commands/commands/toggle_braille.py b/src/fenrir-package/commands/commands/toggle_braille.py index 48e63d74..846c2326 100644 --- a/src/fenrir-package/commands/commands/toggle_braille.py +++ b/src/fenrir-package/commands/commands/toggle_braille.py @@ -6,10 +6,10 @@ class command(): def run(self, environment): if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'braille', 'enabled'): - environment['runtime']['outputManager'].presentText(environment, "braille disabled",soundIconName='BrailleOff', interrupt=True) + environment['runtime']['outputManager'].presentText(environment, "braille disabled", soundIconName='BrailleOff', interrupt=True) environment = environment['runtime']['settingsManager'].setSetting(environment, 'braille', 'enabled', str(not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'braille', 'enabled'))) if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'braille', 'enabled'): - environment['runtime']['outputManager'].presentText(environment, "braille enabled",soundIconName='BrailleOn', interrupt=True) + environment['runtime']['outputManager'].presentText(environment, "braille enabled", soundIconName='BrailleOn', interrupt=True) return environment def setCallback(self, callback): pass diff --git a/src/fenrir-package/commands/commands/toggle_sound.py b/src/fenrir-package/commands/commands/toggle_sound.py index f0da2dc1..7f9c7dd3 100644 --- a/src/fenrir-package/commands/commands/toggle_sound.py +++ b/src/fenrir-package/commands/commands/toggle_sound.py @@ -6,10 +6,10 @@ class command(): def run(self, environment): if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'sound', 'enabled'): - environment['runtime']['outputManager'].presentText(environment, "sound disabled",soundIconName='SoundOff', interrupt=True) + environment['runtime']['outputManager'].presentText(environment, "sound disabled", soundIconName='SoundOff', interrupt=True) environment = environment['runtime']['settingsManager'].setSetting(environment, 'sound', 'enabled', str(not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'sound', 'enabled'))) if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'sound', 'enabled'): - environment['runtime']['outputManager'].presentText(environment, "sound enabled",soundIconName='SoundOn', interrupt=True) + environment['runtime']['outputManager'].presentText(environment, "sound enabled", soundIconName='SoundOn', interrupt=True) return environment def setCallback(self, callback): pass diff --git a/src/fenrir-package/commands/commands/toggle_speech.py b/src/fenrir-package/commands/commands/toggle_speech.py index d2740370..8f844d11 100644 --- a/src/fenrir-package/commands/commands/toggle_speech.py +++ b/src/fenrir-package/commands/commands/toggle_speech.py @@ -6,10 +6,10 @@ class command(): def run(self, environment): if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'enabled'): - environment['runtime']['outputManager'].presentText(environment, "speech disabled",soundIconName='SpeechOff', interrupt=True) + environment['runtime']['outputManager'].presentText(environment, "speech disabled", soundIconName='SpeechOff', interrupt=True) environment = environment['runtime']['settingsManager'].setSetting(environment, 'speech', 'enabled', str(not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'enabled'))) if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'enabled'): - environment['runtime']['outputManager'].presentText(environment, "speech enabled",soundIconName='SpeechOn', interrupt=True) + environment['runtime']['outputManager'].presentText(environment, "speech enabled", soundIconName='SpeechOn', interrupt=True) return environment def setCallback(self, callback): pass diff --git a/src/fenrir-package/consumeEvents.py b/src/fenrir-package/consumeEvents.py index 77339457..cbbf73d8 100755 --- a/src/fenrir-package/consumeEvents.py +++ b/src/fenrir-package/consumeEvents.py @@ -9,6 +9,7 @@ iDevices = {dev.fd: dev for dev in iDevices if dev.fn in ['/dev/input/event18']} uDevices = {} for fd in iDevices: dev = iDevices[fd] + dev.capabilities() uDevices[fd] = UInput() dev.grab() diff --git a/src/fenrir-package/fenrir.py b/src/fenrir-package/fenrir.py index 37a8415f..fe7120da 100755 --- a/src/fenrir-package/fenrir.py +++ b/src/fenrir-package/fenrir.py @@ -21,22 +21,22 @@ class fenrir(): signal.signal(signal.SIGINT, self.captureSignal) def proceed(self): + self.environment['runtime']['outputManager'].presentText(environment, "Start Fenrir", soundIcon= 'ScreenReaderOn', interrupt=True) #self.threadonInput.start() - #while(self.environment['generalInformation']['running']): - self.onInput() + while(self.environment['generalInformation']['running']): + self.onInput() self.shutdown() def onInput(self): - while(self.environment['generalInformation']['running']): - self.environment, timeout = self.environment['runtime']['inputManager'].getKeyPressed(self.environment) - self.environment = self.environment['runtime']['commandManager'].getCommandForShortcut(self.environment) - self.environment = self.environment['runtime']['screenDriver'].analyzeScreen(self.environment, 'onInput') - if not timeout: - self.environment = self.environment['runtime']['commandManager'].executeTriggerCommands(self.environment, 'onInput') - self.environment = self.environment['runtime']['commandManager'].executeTriggerCommands(self.environment, 'onScreenChanged') - if self.environment['commandInfo']['currCommand'] != '': - self.handleCommands() - self.environment['runtime']['globalLock'].release() + self.environment, timeout = self.environment['runtime']['inputManager'].getKeyPressed(self.environment) + self.environment = self.environment['runtime']['commandManager'].getCommandForShortcut(self.environment) + self.environment = self.environment['runtime']['screenDriver'].analyzeScreen(self.environment, 'onInput') + if not timeout: + self.environment = self.environment['runtime']['commandManager'].executeTriggerCommands(self.environment, 'onInput') + self.environment = self.environment['runtime']['commandManager'].executeTriggerCommands(self.environment, 'onScreenChanged') + if self.environment['commandInfo']['currCommand'] != '': + self.handleCommands() + self.environment['runtime']['globalLock'].release() def updateScreen(self): return @@ -51,7 +51,8 @@ class fenrir(): self.environment = self.environment['runtime']['commandManager'].executeCommand(self.environment, self.environment['commandInfo']['currCommand'], 'commands') def shutdown(self): - self.environment['generalInformation']['running'] = False + self.environment['runtime']['outputManager'].presentText(environment, "Quit Fenrir", soundIcon= 'ScreenReaderOff', interrupt=True) + time.sleep(1) if self.environment['runtime']['speechDriver'] != None: self.environment['runtime']['speechDriver'].shutdown() if self.environment['runtime']['debug'] != None: