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

@ -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,13 +21,13 @@ 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']):
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')
@ -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: