add quit_fenrir and curr_screen commands
This commit is contained in:
parent
7b503adabc
commit
ed27566474
@ -11,8 +11,10 @@
|
|||||||
1-KEY_KP1=prev_char
|
1-KEY_KP1=prev_char
|
||||||
1-KEY_KP3=next_char
|
1-KEY_KP3=next_char
|
||||||
1-KEY_KPDOT=exit_review
|
1-KEY_KPDOT=exit_review
|
||||||
|
#=curr_screen
|
||||||
1-KEY_KP0,1-KEY_F2=toggle_braille
|
1-KEY_KP0,1-KEY_F2=toggle_braille
|
||||||
1-KEY_KP0,1-KEY_F3=toggle_sound
|
1-KEY_KP0,1-KEY_F3=toggle_sound
|
||||||
1-KEY_KP0,1-KEY_F4=toggle_speech
|
1-KEY_KP0,1-KEY_F4=toggle_speech
|
||||||
#=toggle_output
|
#=toggle_output
|
||||||
#=toggle_autoRead
|
#=toggle_autoRead
|
||||||
|
#=quit_fenrir
|
||||||
|
@ -14,9 +14,9 @@ class command():
|
|||||||
char_utils.getCurrentChar(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText'])
|
char_utils.getCurrentChar(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText'])
|
||||||
|
|
||||||
if currChar.strip(" \t\n") == '':
|
if currChar.strip(" \t\n") == '':
|
||||||
environment['runtime']['outputManager'].presentText(environment, "blank")
|
environment['runtime']['outputManager'].presentText(environment, "blank" ,interrupt=True)
|
||||||
else:
|
else:
|
||||||
environment['runtime']['outputManager'].presentText(environment, currChar)
|
environment['runtime']['outputManager'].presentText(environment, currChar ,interrupt=True)
|
||||||
return environment
|
return environment
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -14,9 +14,9 @@ class command():
|
|||||||
line_utils.getCurrentLine(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText'])
|
line_utils.getCurrentLine(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText'])
|
||||||
|
|
||||||
if currLine.strip(" \t\n") == '':
|
if currLine.strip(" \t\n") == '':
|
||||||
environment['runtime']['outputManager'].presentText(environment, "blank")
|
environment['runtime']['outputManager'].presentText(environment, "blank", interrupt=True)
|
||||||
else:
|
else:
|
||||||
environment['runtime']['outputManager'].presentText(environment, currLine)
|
environment['runtime']['outputManager'].presentText(environment, currLine, interrupt=True)
|
||||||
return environment
|
return environment
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
12
src/fenrir-package/commands/commands/curr_screen.py
Normal file
12
src/fenrir-package/commands/commands/curr_screen.py
Normal file
@ -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
|
@ -14,9 +14,9 @@ class command():
|
|||||||
word_utils.getCurrentWord(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText'])
|
word_utils.getCurrentWord(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText'])
|
||||||
|
|
||||||
if currWord.strip(" \t\n") == '':
|
if currWord.strip(" \t\n") == '':
|
||||||
environment['runtime']['outputManager'].presentText(environment, "blank")
|
environment['runtime']['outputManager'].presentText(environment, "blank", interrupt=True)
|
||||||
else:
|
else:
|
||||||
environment['runtime']['outputManager'].presentText(environment, currWord)
|
environment['runtime']['outputManager'].presentText(environment, currWord, interrupt=True)
|
||||||
return environment
|
return environment
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -6,7 +6,7 @@ class command():
|
|||||||
def run(self, environment):
|
def run(self, environment):
|
||||||
environment['screenData']['oldCursorReview'] = {'x':-1,'y':-1}
|
environment['screenData']['oldCursorReview'] = {'x':-1,'y':-1}
|
||||||
environment['screenData']['newCursorReview'] = {'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
|
return environment
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -14,9 +14,9 @@ class command():
|
|||||||
char_utils.getNextChar(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText'])
|
char_utils.getNextChar(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText'])
|
||||||
|
|
||||||
if currChar.strip(" \t\n") == '':
|
if currChar.strip(" \t\n") == '':
|
||||||
environment['runtime']['outputManager'].presentText(environment, "blank")
|
environment['runtime']['outputManager'].presentText(environment, "blank", interrupt=True)
|
||||||
else:
|
else:
|
||||||
environment['runtime']['outputManager'].presentText(environment, currChar)
|
environment['runtime']['outputManager'].presentText(environment, currChar, interrupt=True)
|
||||||
return environment
|
return environment
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -14,9 +14,9 @@ class command():
|
|||||||
line_utils.getNextLine(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText'])
|
line_utils.getNextLine(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText'])
|
||||||
|
|
||||||
if currLine.strip(" \t\n") == '':
|
if currLine.strip(" \t\n") == '':
|
||||||
environment['runtime']['outputManager'].presentText(environment, "blank")
|
environment['runtime']['outputManager'].presentText(environment, "blank", interrupt=True)
|
||||||
else:
|
else:
|
||||||
environment['runtime']['outputManager'].presentText(environment, currLine)
|
environment['runtime']['outputManager'].presentText(environment, currLine, interrupt=True)
|
||||||
return environment
|
return environment
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -14,9 +14,9 @@ class command():
|
|||||||
word_utils.getNextWord(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText'])
|
word_utils.getNextWord(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText'])
|
||||||
|
|
||||||
if currWord.strip(" \t\n") == '':
|
if currWord.strip(" \t\n") == '':
|
||||||
environment['runtime']['outputManager'].presentText(environment, "blank")
|
environment['runtime']['outputManager'].presentText(environment, "blank", interrupt=True)
|
||||||
else:
|
else:
|
||||||
environment['runtime']['outputManager'].presentText(environment, currWord)
|
environment['runtime']['outputManager'].presentText(environment, currWord, interrupt=True)
|
||||||
return environment
|
return environment
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -14,9 +14,9 @@ class command():
|
|||||||
char_utils.getPrevChar(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText'])
|
char_utils.getPrevChar(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText'])
|
||||||
|
|
||||||
if currChar.strip(" \t\n") == '':
|
if currChar.strip(" \t\n") == '':
|
||||||
environment['runtime']['outputManager'].presentText(environment, "blank")
|
environment['runtime']['outputManager'].presentText(environment, "blank", interrupt=True)
|
||||||
else:
|
else:
|
||||||
environment['runtime']['outputManager'].presentText(environment, currChar)
|
environment['runtime']['outputManager'].presentText(environment, currChar, interrupt=True)
|
||||||
return environment
|
return environment
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -14,9 +14,9 @@ class command():
|
|||||||
line_utils.getPrevLine(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText'])
|
line_utils.getPrevLine(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText'])
|
||||||
|
|
||||||
if currLine.strip(" \t\n") == '':
|
if currLine.strip(" \t\n") == '':
|
||||||
environment['runtime']['outputManager'].presentText(environment, "blank")
|
environment['runtime']['outputManager'].presentText(environment, "blank", interrupt=True)
|
||||||
else:
|
else:
|
||||||
environment['runtime']['outputManager'].presentText(environment, currLine)
|
environment['runtime']['outputManager'].presentText(environment, currLine, interrupt=True)
|
||||||
return environment
|
return environment
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -14,9 +14,9 @@ class command():
|
|||||||
word_utils.getPrevWord(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText'])
|
word_utils.getPrevWord(environment['screenData']['newCursorReview']['x'], environment['screenData']['newCursorReview']['y'], environment['screenData']['newContentText'])
|
||||||
|
|
||||||
if currWord.strip(" \t\n") == '':
|
if currWord.strip(" \t\n") == '':
|
||||||
environment['runtime']['outputManager'].presentText(environment, "blank")
|
environment['runtime']['outputManager'].presentText(environment, "blank", interrupt=True)
|
||||||
else:
|
else:
|
||||||
environment['runtime']['outputManager'].presentText(environment, currWord)
|
environment['runtime']['outputManager'].presentText(environment, currWord, interrupt=True)
|
||||||
return environment
|
return environment
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
12
src/fenrir-package/commands/commands/quit_fenrir.py
Normal file
12
src/fenrir-package/commands/commands/quit_fenrir.py
Normal file
@ -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
|
@ -7,9 +7,9 @@ class command():
|
|||||||
|
|
||||||
environment = environment['runtime']['settingsManager'].setSetting(environment, 'speech', 'autoReadIncomming', str(not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'autoReadIncomming')))
|
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'):
|
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:
|
else:
|
||||||
environment['runtime']['outputManager'].presentText(environment, "autoread disabled",soundIconName='', interrupt=True)
|
environment['runtime']['outputManager'].presentText(environment, "autoread disabled", soundIconName='', interrupt=True)
|
||||||
return environment
|
return environment
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -6,10 +6,10 @@ class command():
|
|||||||
def run(self, environment):
|
def run(self, environment):
|
||||||
|
|
||||||
if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'braille', 'enabled'):
|
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')))
|
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'):
|
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
|
return environment
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -6,10 +6,10 @@ class command():
|
|||||||
def run(self, environment):
|
def run(self, environment):
|
||||||
|
|
||||||
if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'sound', 'enabled'):
|
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')))
|
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'):
|
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
|
return environment
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -6,10 +6,10 @@ class command():
|
|||||||
def run(self, environment):
|
def run(self, environment):
|
||||||
|
|
||||||
if environment['runtime']['settingsManager'].getSettingAsBool(environment, 'speech', 'enabled'):
|
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')))
|
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'):
|
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
|
return environment
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -9,6 +9,7 @@ iDevices = {dev.fd: dev for dev in iDevices if dev.fn in ['/dev/input/event18']}
|
|||||||
uDevices = {}
|
uDevices = {}
|
||||||
for fd in iDevices:
|
for fd in iDevices:
|
||||||
dev = iDevices[fd]
|
dev = iDevices[fd]
|
||||||
|
dev.capabilities()
|
||||||
uDevices[fd] = UInput()
|
uDevices[fd] = UInput()
|
||||||
dev.grab()
|
dev.grab()
|
||||||
|
|
||||||
|
@ -21,22 +21,22 @@ class fenrir():
|
|||||||
signal.signal(signal.SIGINT, self.captureSignal)
|
signal.signal(signal.SIGINT, self.captureSignal)
|
||||||
|
|
||||||
def proceed(self):
|
def proceed(self):
|
||||||
|
self.environment['runtime']['outputManager'].presentText(environment, "Start Fenrir", soundIcon= 'ScreenReaderOn', interrupt=True)
|
||||||
#self.threadonInput.start()
|
#self.threadonInput.start()
|
||||||
#while(self.environment['generalInformation']['running']):
|
while(self.environment['generalInformation']['running']):
|
||||||
self.onInput()
|
self.onInput()
|
||||||
self.shutdown()
|
self.shutdown()
|
||||||
|
|
||||||
def onInput(self):
|
def onInput(self):
|
||||||
while(self.environment['generalInformation']['running']):
|
self.environment, timeout = self.environment['runtime']['inputManager'].getKeyPressed(self.environment)
|
||||||
self.environment, timeout = self.environment['runtime']['inputManager'].getKeyPressed(self.environment)
|
self.environment = self.environment['runtime']['commandManager'].getCommandForShortcut(self.environment)
|
||||||
self.environment = self.environment['runtime']['commandManager'].getCommandForShortcut(self.environment)
|
self.environment = self.environment['runtime']['screenDriver'].analyzeScreen(self.environment, 'onInput')
|
||||||
self.environment = self.environment['runtime']['screenDriver'].analyzeScreen(self.environment, 'onInput')
|
if not timeout:
|
||||||
if not timeout:
|
self.environment = self.environment['runtime']['commandManager'].executeTriggerCommands(self.environment, 'onInput')
|
||||||
self.environment = self.environment['runtime']['commandManager'].executeTriggerCommands(self.environment, 'onInput')
|
self.environment = self.environment['runtime']['commandManager'].executeTriggerCommands(self.environment, 'onScreenChanged')
|
||||||
self.environment = self.environment['runtime']['commandManager'].executeTriggerCommands(self.environment, 'onScreenChanged')
|
if self.environment['commandInfo']['currCommand'] != '':
|
||||||
if self.environment['commandInfo']['currCommand'] != '':
|
self.handleCommands()
|
||||||
self.handleCommands()
|
self.environment['runtime']['globalLock'].release()
|
||||||
self.environment['runtime']['globalLock'].release()
|
|
||||||
|
|
||||||
def updateScreen(self):
|
def updateScreen(self):
|
||||||
return
|
return
|
||||||
@ -51,7 +51,8 @@ class fenrir():
|
|||||||
self.environment = self.environment['runtime']['commandManager'].executeCommand(self.environment, self.environment['commandInfo']['currCommand'], 'commands')
|
self.environment = self.environment['runtime']['commandManager'].executeCommand(self.environment, self.environment['commandInfo']['currCommand'], 'commands')
|
||||||
|
|
||||||
def shutdown(self):
|
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:
|
if self.environment['runtime']['speechDriver'] != None:
|
||||||
self.environment['runtime']['speechDriver'].shutdown()
|
self.environment['runtime']['speechDriver'].shutdown()
|
||||||
if self.environment['runtime']['debug'] != None:
|
if self.environment['runtime']['debug'] != None:
|
||||||
|
Loading…
Reference in New Issue
Block a user