do cleanups

This commit is contained in:
chrys 2016-10-08 11:45:17 +02:00
parent 556519187b
commit adc5384249

View File

@ -20,34 +20,42 @@ class driver():
return
try:
self.connectDevice()
self.connectDevice()
except Exception as e:
self.env['runtime']['debug'].writeDebugOut('BRAILLE.connectDevice '+str(e),debug.debugLevel.ERROR)
self.env['runtime']['debug'].writeDebugOut('BRAILLE.connectDevice '+str(e),debug.debugLevel.ERROR)
return
self._isInitialized = True
def flush(self):
if not self._isInitialized:
return
try:
self._brl.writeText('',0)
except Exception as e:
self.env['runtime']['debug'].writeDebugOut('BRAILLE.flush '+str(e),debug.debugLevel.ERROR)
self.env['runtime']['debug'].writeDebugOut('BRAILLE.flush '+str(e),debug.debugLevel.ERROR)
def writeText(self,text):
if not self._isInitialized:
return
try:
self._brl.writeText(text)
except Exception as e:
self.env['runtime']['debug'].writeDebugOut('BRAILLE.writeText '+str(e),debug.debugLevel.ERROR)
self.env['runtime']['debug'].writeDebugOut('BRAILLE.writeText '+str(e),debug.debugLevel.ERROR)
def connectDevice(self):
self._brl = brlapi.Connection()
self._brl.enterTtyModeWithPath()
def enterTTY(self):
if not self._isInitialized:
return
self._brl.enterTtyModeWithPath()
def leveTTY(self):
if not self._isInitialized:
return
self._brl.leaveTtyMode()
def shutdown(self):
if not self._isInitialized:
return
self._brl.leaveTtyMode()
self.leveTTY()