complete VCSU support
This commit is contained in:
parent
4a70a0442e
commit
8423dbe4ab
@ -23,6 +23,7 @@ from struct import unpack_from, unpack, pack
|
|||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core import debug
|
||||||
from fenrirscreenreader.core.eventData import fenrirEventType
|
from fenrirscreenreader.core.eventData import fenrirEventType
|
||||||
from fenrirscreenreader.core.screenDriver import screenDriver
|
from fenrirscreenreader.core.screenDriver import screenDriver
|
||||||
|
from fenrirscreenreader.utils import screen_utils
|
||||||
|
|
||||||
class driver(screenDriver):
|
class driver(screenDriver):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -128,11 +129,11 @@ class driver(screenDriver):
|
|||||||
currScreen = str(tty.read()[3:-1])
|
currScreen = str(tty.read()[3:-1])
|
||||||
if currScreen != oldScreen:
|
if currScreen != oldScreen:
|
||||||
try:
|
try:
|
||||||
watchdog.unregister(vcsa[ oldScreen ])
|
watchdog.unregister(vcsa[oldScreen])
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
watchdog.register(vcsa[ currScreen ], select.POLLPRI | select.POLLERR)
|
watchdog.register(vcsa[currScreen], select.POLLPRI | select.POLLERR)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
self.updateCharMap(currScreen)
|
self.updateCharMap(currScreen)
|
||||||
@ -142,8 +143,12 @@ class driver(screenDriver):
|
|||||||
lastScreenContent = vcsa[currScreen].read()
|
lastScreenContent = vcsa[currScreen].read()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
vcsuContent = None
|
||||||
|
if useVCSU:
|
||||||
|
vcsu[currScreen].seek(0)
|
||||||
|
vcsuContent = vcsu[currScreen].read()
|
||||||
eventQueue.put({"Type":fenrirEventType.ScreenChanged,
|
eventQueue.put({"Type":fenrirEventType.ScreenChanged,
|
||||||
"Data":self.createScreenEventData(currScreen,lastScreenContent)
|
"Data":self.createScreenEventData(currScreen, lastScreenContent, vcsuContent)
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
self.env['runtime']['debug'].writeDebugOut('ScreenUpdate',debug.debugLevel.INFO)
|
self.env['runtime']['debug'].writeDebugOut('ScreenUpdate',debug.debugLevel.INFO)
|
||||||
@ -160,6 +165,7 @@ class driver(screenDriver):
|
|||||||
vcsa[currScreen].seek(0)
|
vcsa[currScreen].seek(0)
|
||||||
dirtyContent = vcsa[currScreen].read()
|
dirtyContent = vcsa[currScreen].read()
|
||||||
if useVCSU:
|
if useVCSU:
|
||||||
|
vcsu[currScreen].seek(0)
|
||||||
vcsuContent = vcsu[currScreen].read()
|
vcsuContent = vcsu[currScreen].read()
|
||||||
eventQueue.put({"Type":fenrirEventType.ScreenUpdate,
|
eventQueue.put({"Type":fenrirEventType.ScreenUpdate,
|
||||||
"Data":self.createScreenEventData(currScreen, screenContent, vcsuContent)
|
"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)
|
self.env['runtime']['debug'].writeDebugOut('VCSA:updateWatchdog:' + str(e),debug.debugLevel.ERROR)
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
|
|
||||||
|
|
||||||
def createScreenEventData(self, screen, vcsaContent, vcsuContent = None):
|
def createScreenEventData(self, screen, vcsaContent, vcsuContent = None):
|
||||||
eventData = {
|
eventData = {
|
||||||
'bytes': vcsaContent,
|
'bytes': vcsaContent,
|
||||||
@ -184,8 +189,8 @@ class driver(screenDriver):
|
|||||||
}
|
}
|
||||||
eventData['text'], eventData['attributes'] =\
|
eventData['text'], eventData['attributes'] =\
|
||||||
self.autoDecodeVCSA(vcsaContent[4:], eventData['lines'], eventData['columns'])
|
self.autoDecodeVCSA(vcsaContent[4:], eventData['lines'], eventData['columns'])
|
||||||
#if vcsuContent != None:
|
if vcsuContent != None:
|
||||||
# eventData['text'] = vcsuContent.decode('UTF-32')
|
eventData['text'] = screen_utils.insertNewlines(vcsuContent.decode('UTF-32', 'replace'), eventData['columns'])
|
||||||
return eventData.copy()
|
return eventData.copy()
|
||||||
def updateCharMap(self, screen):
|
def updateCharMap(self, screen):
|
||||||
self.charmap = {}
|
self.charmap = {}
|
||||||
@ -312,4 +317,3 @@ class driver(screenDriver):
|
|||||||
return
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
|
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user