add quit_fenrir and curr_screen commands

This commit is contained in:
chrys 2016-08-10 14:32:13 +02:00
parent 7b503adabc
commit ed27566474
20 changed files with 68 additions and 40 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View 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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View 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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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()

View File

@ -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: