major rework, performance boost and bigger accuracy
This commit is contained in:
parent
7f8a03ae6c
commit
6373b3d8b8
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
[sound]
|
[sound]
|
||||||
enabled=True
|
enabled=True
|
||||||
driver=sox
|
driver=sox
|
||||||
@ -6,17 +5,13 @@ theme=default
|
|||||||
|
|
||||||
[speech]
|
[speech]
|
||||||
enabled=True
|
enabled=True
|
||||||
#driver=espeak
|
driver=espeak
|
||||||
#language=en-us
|
rate=800
|
||||||
#voice=en-us
|
|
||||||
driver=speechd
|
|
||||||
#rate=800
|
|
||||||
rate=50
|
|
||||||
volume=100
|
|
||||||
pitch=50
|
pitch=50
|
||||||
module=espeak
|
module=espeak
|
||||||
voice=de
|
voice=en-us
|
||||||
language=de
|
language=en-us
|
||||||
|
volume=200
|
||||||
|
|
||||||
[braille]
|
[braille]
|
||||||
enabled=False
|
enabled=False
|
||||||
@ -28,9 +23,8 @@ driver=linux
|
|||||||
[keyboard]
|
[keyboard]
|
||||||
keyboardLayout=desktop
|
keyboardLayout=desktop
|
||||||
charEcho=False
|
charEcho=False
|
||||||
wordEcho=True
|
wordEcho=False
|
||||||
|
|
||||||
[general]
|
[general]
|
||||||
debugLevel=0
|
debugLevel=0
|
||||||
punctuationLevel=1
|
punctuationLevel=1
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ class command():
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
def run(self, environment):
|
def run(self, environment):
|
||||||
|
return environment
|
||||||
if environment['screenData']['newCursor'] == environment['screenData']['oldCursor'] and\
|
if environment['screenData']['newCursor'] == environment['screenData']['oldCursor'] and\
|
||||||
environment['screenData']['newDelta'] == environment['screenData']['oldDelta']:
|
environment['screenData']['newDelta'] == environment['screenData']['oldDelta']:
|
||||||
return environment
|
return environment
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
#!/bin/python
|
|
||||||
|
|
||||||
class command():
|
|
||||||
def __init__(self):
|
|
||||||
pass
|
|
||||||
def run(self, environment):
|
|
||||||
if environment['screenData']['newCursor']['x'] > environment['screenData']['oldCursor']['x']:
|
|
||||||
return environment
|
|
||||||
|
|
||||||
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
|
|
||||||
return environment
|
|
||||||
if environment['screenData']['newDelta'] == environment['screenData']['oldDelta']:
|
|
||||||
return environment
|
|
||||||
|
|
||||||
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newDelta'], interrupt=True)
|
|
||||||
|
|
||||||
return environment
|
|
||||||
def setCallback(self, callback):
|
|
||||||
pass
|
|
||||||
def shutdown(self):
|
|
||||||
pass
|
|
@ -4,6 +4,9 @@ class command():
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
def run(self, environment):
|
def run(self, environment):
|
||||||
|
|
||||||
|
if environment['screenData']['newDelta'] != environment['screenData']['oldDelta']:
|
||||||
|
return environment
|
||||||
if environment['screenData']['newCursor']['y'] != environment['screenData']['oldCursor']['y'] or\
|
if environment['screenData']['newCursor']['y'] != environment['screenData']['oldCursor']['y'] or\
|
||||||
environment['screenData']['newCursor']['x'] == environment['screenData']['oldCursor']['x']:
|
environment['screenData']['newCursor']['x'] == environment['screenData']['oldCursor']['x']:
|
||||||
return environment
|
return environment
|
||||||
@ -11,7 +14,7 @@ class command():
|
|||||||
pass
|
pass
|
||||||
#environment['runtime']['outputManager'].presentText(environment, "blank",True)
|
#environment['runtime']['outputManager'].presentText(environment, "blank",True)
|
||||||
else:
|
else:
|
||||||
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']][environment['screenData']['newCursor']['x']],True)
|
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']][environment['screenData']['newCursor']['x']],interrupt=True)
|
||||||
|
|
||||||
return environment
|
return environment
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
@ -4,6 +4,7 @@ class command():
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
def run(self, environment):
|
def run(self, environment):
|
||||||
|
|
||||||
if environment['screenData']['newDelta'] != environment['screenData']['oldDelta']:
|
if environment['screenData']['newDelta'] != environment['screenData']['oldDelta']:
|
||||||
return environment
|
return environment
|
||||||
if environment['screenData']['newCursor']['y'] == environment['screenData']['oldCursor']['y']:
|
if environment['screenData']['newCursor']['y'] == environment['screenData']['oldCursor']['y']:
|
@ -4,6 +4,7 @@ class command():
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
def run(self, environment):
|
def run(self, environment):
|
||||||
|
|
||||||
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'charEcho'):
|
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'charEcho'):
|
||||||
return environment
|
return environment
|
||||||
if environment['screenData']['newCursor']['x'] <= environment['screenData']['oldCursor']['x']:
|
if environment['screenData']['newCursor']['x'] <= environment['screenData']['oldCursor']['x']:
|
@ -5,7 +5,7 @@ class command():
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
def run(self, environment):
|
def run(self, environment):
|
||||||
|
return environment
|
||||||
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'wordEcho') and\
|
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'wordEcho') and\
|
||||||
environment['screenData']['newCursor']['x'] <= environment['screenData']['oldCursor']['x']:
|
environment['screenData']['newCursor']['x'] <= environment['screenData']['oldCursor']['x']:
|
||||||
return environment
|
return environment
|
||||||
@ -22,7 +22,7 @@ class command():
|
|||||||
if environment['screenData']['newCursor']['x'] > 0 and \
|
if environment['screenData']['newCursor']['x'] > 0 and \
|
||||||
newContent[environment['screenData']['newCursor']['x'] - 1] == ' ':
|
newContent[environment['screenData']['newCursor']['x'] - 1] == ' ':
|
||||||
environment['runtime']['outputManager'].presentText(environment, currWord, interrupt=True)
|
environment['runtime']['outputManager'].presentText(environment, currWord, interrupt=True)
|
||||||
|
print('word')
|
||||||
return environment
|
return environment
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
@ -4,16 +4,16 @@ class command():
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
def run(self, environment):
|
def run(self, environment):
|
||||||
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'keyboard', 'charEcho') and\
|
if environment['screenData']['newCursor']['x'] > environment['screenData']['oldCursor']['x']:
|
||||||
environment['screenData']['newCursor']['x'] - environment['screenData']['oldCursor']['x'] ==1:
|
|
||||||
return environment
|
return environment
|
||||||
|
|
||||||
ttyChanged = environment['screenData']['newTTY'] != environment['screenData']['oldTTY']
|
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
|
||||||
if environment['screenData']['newDelta'] == environment['screenData']['oldDelta'] and \
|
return environment
|
||||||
not ttyChanged:
|
if environment['screenData']['newDelta'] == environment['screenData']['oldDelta']:
|
||||||
return environment
|
return environment
|
||||||
|
|
||||||
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newDelta'], soundIconName='', interrupt=ttyChanged)
|
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newDelta'], interrupt=False)
|
||||||
|
|
||||||
return environment
|
return environment
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -31,13 +31,9 @@ class fenrir():
|
|||||||
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:
|
|
||||||
self.environment = self.environment['runtime']['commandManager'].executeTriggerCommands(self.environment, 'onInput')
|
self.environment = self.environment['runtime']['commandManager'].executeTriggerCommands(self.environment, 'onInput')
|
||||||
else:
|
|
||||||
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.environment['input']['currShortcut'] = {}
|
|
||||||
self.environment['input']['currShortcutString'] = ''
|
|
||||||
self.handleCommands()
|
self.handleCommands()
|
||||||
self.environment['runtime']['globalLock'].release()
|
self.environment['runtime']['globalLock'].release()
|
||||||
|
|
||||||
|
@ -64,19 +64,23 @@ class screen():
|
|||||||
# changes on the screen
|
# changes on the screen
|
||||||
if (environment['screenData']['oldContentText'] != environment['screenData']['newContentText']) and \
|
if (environment['screenData']['oldContentText'] != environment['screenData']['newContentText']) and \
|
||||||
(environment['screenData']['newContentText'] != '' ):
|
(environment['screenData']['newContentText'] != '' ):
|
||||||
# diff = difflib.ndiff(environment['screenData']['oldContentText'], environment['screenData']['newContentText'])
|
|
||||||
if environment['screenData']['oldContentText'] == '' and\
|
if environment['screenData']['oldContentText'] == '' and\
|
||||||
environment['screenData']['newContentText'] != '':
|
environment['screenData']['newContentText'] != '':
|
||||||
environment['screenData']['newDelta'] = environment['screenData']['newContentText']
|
environment['screenData']['newDelta'] = environment['screenData']['newContentText']
|
||||||
else:
|
else:
|
||||||
diffStart = 0
|
diffStart = 0
|
||||||
lastLine = len(environment['screenData']['newContentText']) - environment['screenData']['columns']
|
if environment['screenData']['oldCursor']['x'] != environment['screenData']['newCursor']['x'] and \
|
||||||
if environment['screenData']['newContentText'][:lastLine] == environment['screenData']['oldContentText'][:lastLine]:
|
environment['screenData']['oldCursor']['y'] == environment['screenData']['newCursor']['y'] and \
|
||||||
diffStart = lastLine + 1
|
environment['screenData']['newContentText'][:environment['screenData']['newCursor']['y']] == environment['screenData']['oldContentText'][:environment['screenData']['newCursor']['y']]:
|
||||||
|
diffStart = environment['screenData']['newCursor']['y'] * environment['screenData']['newCursor']['x'] + environment['screenData']['newCursor']['y']
|
||||||
|
diff = difflib.ndiff(environment['screenData']['oldContentText'][diffStart:],\
|
||||||
|
environment['screenData']['newContentText'][diffStart:])
|
||||||
|
else:
|
||||||
|
diff = difflib.ndiff( environment['screenData']['oldContentText'][diffStart:].splitlines(),\
|
||||||
|
environment['screenData']['newContentText'][diffStart:].splitlines())
|
||||||
|
|
||||||
diff = difflib.ndiff(re.sub('[ \t]+', ' ', environment['screenData']['oldContentText'][diffStart:]),\
|
diffList = list(diff)
|
||||||
re.sub('[ \t]+', ' ', environment['screenData']['newContentText'][diffStart:]))
|
environment['screenData']['newDelta'] = ''.join(x[2:] for x in diffList if x.startswith('+ '))
|
||||||
environment['screenData']['newDelta'] = ''.join(x[2:] for x in diff if x.startswith('+ '))
|
environment['screenData']['newNegativeDelta'] = ''.join(x[2:] for x in diffList if x.startswith('- '))
|
||||||
environment['screenData']['newNegativeDelta'] = ''.join(x[2:] for x in diff if x.startswith('- '))
|
|
||||||
|
|
||||||
return environment
|
return environment
|
||||||
|
Loading…
x
Reference in New Issue
Block a user