enter/ leve braille screen correctly

This commit is contained in:
chrys 2016-10-08 12:15:38 +02:00
parent adc5384249
commit fa45cdf5da
2 changed files with 22 additions and 10 deletions

View File

@ -45,12 +45,12 @@ class driver():
def connectDevice(self): def connectDevice(self):
self._brl = brlapi.Connection() self._brl = brlapi.Connection()
def enterTTY(self): def enterScreen(self, screen):
if not self._isInitialized: if not self._isInitialized:
return return
self._brl.enterTtyModeWithPath() self._brl.enterTtyMode(screen)
def leveTTY(self): def leveScreen(self):
if not self._isInitialized: if not self._isInitialized:
return return
self._brl.leaveTtyMode() self._brl.leaveTtyMode()
@ -58,4 +58,4 @@ class driver():
def shutdown(self): def shutdown(self):
if not self._isInitialized: if not self._isInitialized:
return return
self.leveTTY() self.leveScreen()

View File

@ -24,16 +24,21 @@ class screenManager():
def update(self, trigger='onUpdate'): def update(self, trigger='onUpdate'):
self.env['runtime']['screenDriver'].getCurrScreen() self.env['runtime']['screenDriver'].getCurrScreen()
self.env['screenData']['oldApplication'] = self.env['screenData']['newApplication'] self.env['screenData']['oldApplication'] = self.env['screenData']['newApplication']
if not self.isSuspendingScreen(): if self.isScreenChange():
self.changeBrailleScreen()
if not self.isSuspendingScreen(self.env['screenData']['newTTY']):
self.env['runtime']['screenDriver'].update(trigger) self.env['runtime']['screenDriver'].update(trigger)
if trigger == 'onUpdate' or self.isScreenChange() or len(self.env['screenData']['newDelta']) > 6: if trigger == 'onUpdate' or self.isScreenChange() \
or len(self.env['screenData']['newDelta']) > 6:
self.env['runtime']['screenDriver'].getCurrApplication() self.env['runtime']['screenDriver'].getCurrApplication()
self.env['screenData']['lastScreenUpdate'] = time.time() self.env['screenData']['lastScreenUpdate'] = time.time()
def isSuspendingScreen(self): def isSuspendingScreen(self, screen = None):
return ((self.env['screenData']['newTTY'] in \ if screen == None:
screen = self.env['screenData']['newTTY']
return ((screen in \
self.env['runtime']['settingsManager'].getSetting('screen', 'suspendingScreen').split(',')) or self.env['runtime']['settingsManager'].getSetting('screen', 'suspendingScreen').split(',')) or
(self.env['screenData']['newTTY'] in self.autoIgnoreScreens)) (screen in self.autoIgnoreScreens))
def isScreenChange(self): def isScreenChange(self):
return self.env['screenData']['newTTY'] != self.env['screenData']['oldTTY'] return self.env['screenData']['newTTY'] != self.env['screenData']['oldTTY']
@ -48,4 +53,11 @@ class screenManager():
for line in windowList: for line in windowList:
windowText += line[self.env['commandBuffer']['windowArea'][currApp]['1']['x']:self.env['commandBuffer']['windowArea'][currApp]['2']['x'] + 1] + '\n' windowText += line[self.env['commandBuffer']['windowArea'][currApp]['1']['x']:self.env['commandBuffer']['windowArea'][currApp]['2']['x'] + 1] + '\n'
return windowText return windowText
def changeBrailleScreen(self):
if not self.env['runtime']['brailleDriver']:
return
if not self.isSuspendingScreen(self.env['screenData']['oldTTY']):
self.env['runtime']['brailleDriver'].leveScreen()
if not self.isSuspendingScreen():
self.env['runtime']['brailleDriver'].enterScreen(self.env['screenData']['newTTY'])