From df65611c5f463ba67477b4808c6db299307d8d41 Mon Sep 17 00:00:00 2001 From: chrys Date: Sun, 29 Jan 2017 22:39:54 +0100 Subject: [PATCH] add getDisplaySize to brlapii braile driver --- src/fenrir/brailleDriver/brlapiDriver.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/fenrir/brailleDriver/brlapiDriver.py b/src/fenrir/brailleDriver/brlapiDriver.py index 22d88368..3cd4089c 100644 --- a/src/fenrir/brailleDriver/brlapiDriver.py +++ b/src/fenrir/brailleDriver/brlapiDriver.py @@ -10,24 +10,24 @@ class driver(): def __init__(self): self._isInitialized = False self._brl = None - + self._deviceSize = 0 def initialize(self, environment): self.env = environment try: import brlapi + self._brl = brlapi.Connection() + self._deviceSize = self._brl.displaySize except Exception as e: print(e) self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR) return - - try: - self._brl = brlapi.Connection() - except Exception as e: - print(e) - self.env['runtime']['debug'].writeDebugOut('BRAILLE.connectDevice '+str(e),debug.debugLevel.ERROR) - return self._isInitialized = True + def getDeviceSize(self): + if not self._isInitialized: + return (0,0) + return self._deviceSize + def flush(self): if not self._isInitialized: return