fix make first plugin ready
This commit is contained in:
@ -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']
|
||||
|
Reference in New Issue
Block a user