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