add horizontal and vertical announcements
This commit is contained in:
parent
e2668f1467
commit
0ff4002f16
@ -9,9 +9,9 @@ class command():
|
||||
environment['screenData']['newCursorReview'] = environment['screenData']['newCursor'].copy()
|
||||
|
||||
if environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursorReview']['y']].replace(" ","").replace("\n","").replace("\t","") == '':
|
||||
environment['runtime']['outputManager'].speakText(environment, "blank")
|
||||
environment['runtime']['outputManager'].presentText(environment, "blank")
|
||||
else:
|
||||
environment['runtime']['outputManager'].speakText(environment, environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursorReview']['y']])
|
||||
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursorReview']['y']])
|
||||
return environment
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -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'].speakText(environment, "leve review mode")
|
||||
environment['runtime']['outputManager'].presentText(environment, "leve review mode")
|
||||
return environment
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -11,9 +11,9 @@ class command():
|
||||
environment['screenData']['newCursorReview']['y'] = environment['screenData']['newCursorReview']['y'] + 1
|
||||
|
||||
if environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursorReview']['y']].replace(" ","").replace("\n","").replace("\t","") == '':
|
||||
environment['runtime']['outputManager'].speakText(environment, "blank")
|
||||
environment['runtime']['outputManager'].presentText(environment, "blank")
|
||||
else:
|
||||
environment['runtime']['outputManager'].speakText(environment, environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursorReview']['y']])
|
||||
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursorReview']['y']])
|
||||
return environment
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -10,9 +10,9 @@ class command():
|
||||
if environment['screenData']['newCursorReview']['y'] - 1 >= 0:
|
||||
environment['screenData']['newCursorReview']['y'] = environment['screenData']['newCursorReview']['y'] - 1
|
||||
if environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursorReview']['y']].replace(" ","").replace("\n","").replace("\t","") == '':
|
||||
environment['runtime']['outputManager'].speakText(environment, "blank")
|
||||
environment['runtime']['outputManager'].presentText(environment, "blank")
|
||||
else:
|
||||
environment['runtime']['outputManager'].speakText(environment, environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursorReview']['y']])
|
||||
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursorReview']['y']])
|
||||
return environment
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -10,7 +10,7 @@ class command():
|
||||
return environment
|
||||
if environment['screenData']['newDelta'] != environment['screenData']['oldDelta'] or \
|
||||
environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
|
||||
environment['runtime']['outputManager'].speakText(environment, environment['screenData']['newDelta'], Interrupt=False)
|
||||
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newDelta'], Interrupt=False)
|
||||
return environment
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -6,7 +6,7 @@ class command():
|
||||
def run(self, environment):
|
||||
if environment['screenData']['newDelta'] != environment['screenData']['oldDelta'] or \
|
||||
environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
|
||||
environment['runtime']['outputManager'].speakText(environment, environment['screenData']['newDelta'])
|
||||
environment['runtime']['outputManager'].presentText(environment, environment['screenData']['newDelta'])
|
||||
return environment
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -24,7 +24,7 @@ class outputManager():
|
||||
environment['runtime']['speechDriver'].speak(Text)
|
||||
|
||||
def brailleText(self, environment, Text):
|
||||
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'braile', 'enabled'):
|
||||
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'braille', 'enabled'):
|
||||
return
|
||||
print('braille')
|
||||
def interruptOutput(self, environment):
|
||||
|
@ -31,7 +31,7 @@ class fenrir():
|
||||
while(self.environment['generalInformation']['running']):
|
||||
self.environment = 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)
|
||||
self.environment = self.environment['runtime']['screenDriver'].analyzeScreen(self.environment, 'onInput')
|
||||
self.environment = self.environment['runtime']['commandManager'].executeTriggerCommands(self.environment, 'onInput')
|
||||
if self.environment['commandInfo']['currCommand'] != '':
|
||||
self.environment['input']['currShortcut'] = {}
|
||||
@ -41,7 +41,7 @@ class fenrir():
|
||||
|
||||
def updateScreen(self):
|
||||
self.environment['runtime']['globalLock'].acquire(True)
|
||||
self.environment = self.environment['runtime']['screenDriver'].analyzeScreen(self.environment)
|
||||
self.environment = self.environment['runtime']['screenDriver'].analyzeScreen(self.environment,'updateScreen')
|
||||
self.environment = self.environment['runtime']['commandManager'].executeTriggerCommands(self.environment, 'onScreenChanged')
|
||||
self.environment['runtime']['globalLock'].release()
|
||||
time.sleep(0.5)
|
||||
|
@ -12,7 +12,7 @@ class screen():
|
||||
self.vcsaDevicePath = device
|
||||
self.textWrapper = textwrap.TextWrapper()
|
||||
self.textWrapper.drop_whitespace = False
|
||||
def analyzeScreen(self, environment):
|
||||
def analyzeScreen(self, environment, trigger='updateScreen'):
|
||||
# set new "old" values
|
||||
environment['screenData']['oldContentBytes'] = environment['screenData']['newContentBytes']
|
||||
environment['screenData']['oldContentText'] = environment['screenData']['newContentText']
|
||||
@ -21,21 +21,27 @@ class screen():
|
||||
environment['screenData']['oldCursor']['y'] = environment['screenData']['newCursor']['y']
|
||||
environment['screenData']['oldTTY'] = environment['screenData']['newTTY']
|
||||
environment['screenData']['oldDelta'] = environment['screenData']['newDelta']
|
||||
|
||||
newTTY = environment['screenData']['newTTY']
|
||||
# read screen
|
||||
currTTY = open('/sys/devices/virtual/tty/tty0/active','r')
|
||||
environment['screenData']['newTTY'] = currTTY.read()[3:-1]
|
||||
newTTY = currTTY.read()[3:-1]
|
||||
currTTY.close()
|
||||
|
||||
newContentBytes = b''
|
||||
try:
|
||||
vcsa = open(self.vcsaDevicePath + environment['screenData']['newTTY'] ,'rb',0)
|
||||
environment['screenData']['newContentBytes'] = vcsa.read()
|
||||
vcsa = open(self.vcsaDevicePath + newTTY,'rb',0)
|
||||
newContentBytes = vcsa.read()
|
||||
vcsa.close()
|
||||
if len(environment['screenData']['newContentBytes']) < 5:
|
||||
if len(newContentBytes) < 5:
|
||||
return environment
|
||||
except:
|
||||
return environment
|
||||
|
||||
if trigger != 'onInput':
|
||||
if ((newContentBytes[2] != environment['screenData']['oldCursor']['x']) or\
|
||||
(newContentBytes[3] != environment['screenData']['oldCursor']['y'])) and\
|
||||
(newTTY == environment['screenData']['oldTTY']):
|
||||
return environment
|
||||
environment['screenData']['newTTY'] = newTTY
|
||||
environment['screenData']['newContentBytes'] = newContentBytes
|
||||
# get metadata like cursor or screensize
|
||||
environment['screenData']['lines'] = int( environment['screenData']['newContentBytes'][0])
|
||||
environment['screenData']['columns'] = int( environment['screenData']['newContentBytes'][1])
|
||||
|
Loading…
Reference in New Issue
Block a user