first transport of text using the eventloop

This commit is contained in:
chrys 2018-03-12 21:29:34 +01:00
parent 56ea61f5fb
commit 66be5935cf
3 changed files with 35 additions and 33 deletions

View File

@ -80,7 +80,6 @@ class fenrirManager():
self.singleKeyCommand = False
if self.environment['input']['keyForeward'] > 0:
self.environment['input']['keyForeward'] -=1
self.environment['runtime']['screenManager'].update('onInput')
self.environment['runtime']['commandManager'].executeDefaultTrigger('onInput')
#print('handleInput:',time.time() - startTime)
def handleExecuteCommand(self, event):
@ -94,7 +93,7 @@ class fenrirManager():
return
self.environment['runtime']['commandManager'].executeCommand( command, 'commands')
def handleScreenChange(self, event):
self.environment['runtime']['screenManager'].update('onScreenChange')
self.environment['runtime']['screenManager'].hanldeScreenChange(event['Data'])
'''
if self.environment['runtime']['applicationManager'].isApplicationChange():
self.environment['runtime']['commandManager'].executeDefaultTrigger('onApplicationChange')
@ -103,10 +102,10 @@ class fenrirManager():
self.environment['runtime']['applicationManager'].getCurrentApplication())
'''
self.environment['runtime']['commandManager'].executeDefaultTrigger('onScreenChanged')
self.environment['runtime']['screenManager'].update('onScreenChange')
self.environment['runtime']['screenDriver'].getCurrScreen()
def handleScreenUpdate(self, event):
#startTime = time.time()
self.environment['runtime']['screenManager'].update('onUpdate')
self.environment['runtime']['screenManager'].handleScreenUpdate(event['Data'])
'''
if self.environment['runtime']['applicationManager'].isApplicationChange():
self.environment['runtime']['commandManager'].executeDefaultTrigger('onApplicationChange')

View File

@ -19,18 +19,18 @@ class screenManager():
def shutdown(self):
self.env['runtime']['settingsManager'].shutdownDriver('screenDriver')
def update(self, trigger='onUpdate'):
def hanldeScreenChange(self, eventData):
self.env['runtime']['screenDriver'].getCurrScreen()
if trigger == 'onScreenChange':
self.env['runtime']['screenDriver'].getSessionInformation()
self.env['screen']['oldApplication'] = self.env['screen']['newApplication']
self.env['runtime']['screenDriver'].getSessionInformation()
if self.isScreenChange():
self.changeBrailleScreen()
if not self.isSuspendingScreen(self.env['screen']['newTTY']):
self.env['runtime']['screenDriver'].update(trigger)
self.env['runtime']['screenDriver'].update(eventData, 'onScreenChange')
self.env['screen']['lastScreenUpdate'] = time.time()
def handleScreenUpdate(self, eventData):
self.env['screen']['oldApplication'] = self.env['screen']['newApplication']
if not self.isSuspendingScreen(self.env['screen']['newTTY']):
self.env['runtime']['screenDriver'].update(eventData, 'onScreenUpdate')
#if trigger == 'onUpdate' or self.isScreenChange() \
# or len(self.env['screen']['newDelta']) > 6:
# self.env['runtime']['screenDriver'].getCurrApplication()

View File

@ -116,6 +116,21 @@ class driver(screenDriver):
#self.env['runtime']['debug'].writeDebugOut('getSessionInformation:' + str(self.env['screen']['autoIgnoreScreens']) + ' ' + str(self.env['general']) ,debug.debugLevel.INFO)
def updateWatchdog(self,active , eventQueue):
screenData = {
'columns': 0,
'lines': 0,
'delta': '',
'negativeDelta': '',
'attribDelta': '',
'cursorAttrib':None,
'cursor':{'x':0,'y':0},
'Bytes': b'',
'Text': '',
'Attributes': None,
'Scren':'0',
'Application': '',
'screenUpdateTime': time.time(),
}
try:
vcsa = {}
vcsaDevices = glob.glob('/dev/vcsa*')
@ -148,12 +163,12 @@ class driver(screenDriver):
except:
pass
oldScreen = currScreen
eventQueue.put({"Type":fenrirEventType.ScreenChanged,"Data":''})
try:
vcsa[currScreen].seek(0)
lastScreenContent = vcsa[currScreen].read()
except:
pass
eventQueue.put({"Type":fenrirEventType.ScreenChanged,"Data":lastScreenContent})
else:
self.env['runtime']['debug'].writeDebugOut('ScreenUpdate',debug.debugLevel.INFO)
vcsa[currScreen].seek(0)
@ -167,7 +182,7 @@ class driver(screenDriver):
time.sleep(0.008)
vcsa[currScreen].seek(0)
dirtyContent = vcsa[currScreen].read()
eventQueue.put({"Type":fenrirEventType.ScreenUpdate,"Data":None})
eventQueue.put({"Type":fenrirEventType.ScreenUpdate,"Data":screenContent})
except Exception as e:
self.env['runtime']['debug'].writeDebugOut('VCSA:updateWatchdog:' + str(e),debug.debugLevel.ERROR)
@ -272,20 +287,8 @@ class driver(screenDriver):
return _('Default')
def getFenrirFontSize(self, attribute):
return _('Default')
def update(self, trigger='onUpdate'):
if trigger == 'onInput': # no need for an update on input for VCSA
return
newContentBytes = b''
try:
# read screen
vcsa = open(self.vcsaDevicePath + self.env['screen']['newTTY'],'rb',0)
newContentBytes = vcsa.read()
vcsa.close()
if len(newContentBytes) < 5:
return
except Exception as e:
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
return
def update(self, text, trigger='onUpdate'):
newContentBytes = text
# set new "old" values
self.env['screen']['oldContentBytes'] = self.env['screen']['newContentBytes']
self.env['screen']['oldContentText'] = self.env['screen']['newContentText']