fix make first plugin ready
This commit is contained in:
parent
7a737c7797
commit
7c0c1b4bf1
@ -5,9 +5,14 @@ class command():
|
||||
pass
|
||||
def run(self, environment):
|
||||
print('fire')
|
||||
#print(environment['screenData']['newContentText'])i
|
||||
print(environment['screenData']['newCursor']['x'])
|
||||
environment['runtime']['speechDriver'].speak(environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['x']-1])
|
||||
#print(environment)
|
||||
environment['runtime']['speechDriver'].cancel()
|
||||
if environment['screenData']['newContentText'].replace(" ","") == '':
|
||||
environment['runtime']['speechDriver'].speak("empty screen")
|
||||
else:
|
||||
print(environment['screenData']['newCursor'])
|
||||
print(environment['screenData']['newContentText'].split('\n'))
|
||||
environment['runtime']['speechDriver'].speak(environment['screenData']['newContentText'].split('\n')[environment['screenData']['newCursor']['y']])
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
def shutdown(self):
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
@ -58,8 +59,7 @@ class fenrir():
|
||||
while(self.environment['generalInformation']['running']):
|
||||
self.environment = self.environment['runtime']['commandManager'].getCommandForShortcut(self.environment)
|
||||
#self.environment['input']['currShortcut'] = {}
|
||||
#self.environment['input']['currShortcutString'] = ''
|
||||
if self.environment['input']['currShortcutString'] != '':
|
||||
if self.environment['commandInfo']['currCommand'] != '':
|
||||
self.environment = self.environment['runtime']['commandManager'].executeCommand(self.environment)
|
||||
time.sleep(0.5)
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import difflib
|
||||
import textwrap
|
||||
import time
|
||||
import re
|
||||
|
||||
#import fenrir.utils.debug
|
||||
class screenManager():
|
||||
@ -29,10 +31,12 @@ class screenManager():
|
||||
environment['screenData']['newCursor']['y'] = int( environment['screenData']['newContentBytes'][3])
|
||||
|
||||
# analyze content
|
||||
environment['screenData']['newContentText'] = str(environment['screenData']['newContentBytes'][4:][::2].decode('cp1252').encode('utf-8'))[2:]
|
||||
environment['screenData']['newContentText'] = str(environment['screenData']['newContentBytes'][4:][::2].decode('WINDOWS-1250'))
|
||||
#environment['screenData']['newContentText'] = str(environment['screenData']['newContentBytes'][4:][::2].decode('cp1252')).encode('utf-8')[2:]
|
||||
environment['screenData']['newContentAttrib'] = environment['screenData']['newContentBytes'][5:][::2]
|
||||
environment['screenData']['newContentText'] = '\n'.join(textwrap.wrap(environment['screenData']['newContentText'], environment['screenData']['columns']))[:-2]
|
||||
|
||||
#environment['screenData']['newContentText'] = '\n'.join(textwrap.wrap(environment['screenData']['newContentText'], environment['screenData']['columns']))[:-2]
|
||||
environment['screenData']['newContentText'] = re.sub("(.{"+ str(environment['screenData']['columns'])+"})", "\\1\n", str(environment['screenData']['newContentText']), 0, re.DOTALL)
|
||||
|
||||
if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']:
|
||||
environment['screenData']['oldContentBytes'] = b''
|
||||
environment['screenData']['oldContentAttrib'] = b''
|
||||
@ -47,7 +51,6 @@ class screenManager():
|
||||
diff = difflib.ndiff(environment['screenData']['oldContentText'], environment['screenData']['newContentText'])
|
||||
environment['screenData']['delta'] = ''.join(x[2:] for x in diff if x.startswith('+ '))
|
||||
environment['runtime']['speechDriver'].speak(environment['screenData']['delta'])
|
||||
|
||||
# set new "old" values
|
||||
environment['screenData']['oldContentBytes'] = environment['screenData']['newContentBytes']
|
||||
environment['screenData']['oldContentText'] = environment['screenData']['newContentText']
|
||||
|
Loading…
Reference in New Issue
Block a user