complete VCSU support

This commit is contained in:
Chrys 2019-08-21 22:56:02 +02:00
parent 4a70a0442e
commit 8423dbe4ab
3 changed files with 44 additions and 40 deletions

View File

@ -23,6 +23,7 @@ from struct import unpack_from, unpack, pack
from fenrirscreenreader.core import debug
from fenrirscreenreader.core.eventData import fenrirEventType
from fenrirscreenreader.core.screenDriver import screenDriver
from fenrirscreenreader.utils import screen_utils
class driver(screenDriver):
def __init__(self):
@ -142,8 +143,12 @@ class driver(screenDriver):
lastScreenContent = vcsa[currScreen].read()
except:
pass
vcsuContent = None
if useVCSU:
vcsu[currScreen].seek(0)
vcsuContent = vcsu[currScreen].read()
eventQueue.put({"Type":fenrirEventType.ScreenChanged,
"Data":self.createScreenEventData(currScreen,lastScreenContent)
"Data":self.createScreenEventData(currScreen, lastScreenContent, vcsuContent)
})
else:
self.env['runtime']['debug'].writeDebugOut('ScreenUpdate',debug.debugLevel.INFO)
@ -160,6 +165,7 @@ class driver(screenDriver):
vcsa[currScreen].seek(0)
dirtyContent = vcsa[currScreen].read()
if useVCSU:
vcsu[currScreen].seek(0)
vcsuContent = vcsu[currScreen].read()
eventQueue.put({"Type":fenrirEventType.ScreenUpdate,
"Data":self.createScreenEventData(currScreen, screenContent, vcsuContent)
@ -168,7 +174,6 @@ class driver(screenDriver):
self.env['runtime']['debug'].writeDebugOut('VCSA:updateWatchdog:' + str(e),debug.debugLevel.ERROR)
time.sleep(0.2)
def createScreenEventData(self, screen, vcsaContent, vcsuContent = None):
eventData = {
'bytes': vcsaContent,
@ -184,8 +189,8 @@ class driver(screenDriver):
}
eventData['text'], eventData['attributes'] =\
self.autoDecodeVCSA(vcsaContent[4:], eventData['lines'], eventData['columns'])
#if vcsuContent != None:
# eventData['text'] = vcsuContent.decode('UTF-32')
if vcsuContent != None:
eventData['text'] = screen_utils.insertNewlines(vcsuContent.decode('UTF-32', 'replace'), eventData['columns'])
return eventData.copy()
def updateCharMap(self, screen):
self.charmap = {}
@ -312,4 +317,3 @@ class driver(screenDriver):
return
except Exception as e:
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)