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