diff --git a/src/fenrir/brailleDriver/brlapi.py b/src/fenrir/brailleDriver/brlapi.py index 0bbc7f2d..387b88cf 100644 --- a/src/fenrir/brailleDriver/brlapi.py +++ b/src/fenrir/brailleDriver/brlapi.py @@ -45,12 +45,12 @@ class driver(): def connectDevice(self): self._brl = brlapi.Connection() - def enterTTY(self): + def enterScreen(self, screen): if not self._isInitialized: return - self._brl.enterTtyModeWithPath() + self._brl.enterTtyMode(screen) - def leveTTY(self): + def leveScreen(self): if not self._isInitialized: return self._brl.leaveTtyMode() @@ -58,4 +58,4 @@ class driver(): def shutdown(self): if not self._isInitialized: return - self.leveTTY() + self.leveScreen() diff --git a/src/fenrir/core/screenManager.py b/src/fenrir/core/screenManager.py index 406f5ec4..7ee7cc76 100644 --- a/src/fenrir/core/screenManager.py +++ b/src/fenrir/core/screenManager.py @@ -24,16 +24,21 @@ class screenManager(): def update(self, trigger='onUpdate'): self.env['runtime']['screenDriver'].getCurrScreen() 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) - 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['screenData']['lastScreenUpdate'] = time.time() - def isSuspendingScreen(self): - return ((self.env['screenData']['newTTY'] in \ + def isSuspendingScreen(self, screen = None): + if screen == None: + screen = self.env['screenData']['newTTY'] + return ((screen in \ self.env['runtime']['settingsManager'].getSetting('screen', 'suspendingScreen').split(',')) or - (self.env['screenData']['newTTY'] in self.autoIgnoreScreens)) + (screen in self.autoIgnoreScreens)) def isScreenChange(self): return self.env['screenData']['newTTY'] != self.env['screenData']['oldTTY'] @@ -48,4 +53,11 @@ class screenManager(): for line in windowList: windowText += line[self.env['commandBuffer']['windowArea'][currApp]['1']['x']:self.env['commandBuffer']['windowArea'][currApp]['2']['x'] + 1] + '\n' 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'])