inital try for braille

This commit is contained in:
chrys
2016-10-08 03:22:56 +02:00
parent f996132043
commit fcf2a61dbc
8 changed files with 67 additions and 23 deletions

View File

@ -1,15 +0,0 @@
#!/bin/python
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from core import debug
class braille():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass

View File

@ -0,0 +1,53 @@
#!/bin/python
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from core import debug
class driver():
def __init__(self):
self._isInitialized = False
self.brl = None
def initialize(self, environment):
self.env = environment
try:
import brlapi
except Exception as e:
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
return
try:
self.connectDevice()
except Exception as e:
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)
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)
def connectDevice(self):
self.brl = brlapi.Connection()
self.brl.enterTtyModeWithPath()
def shutdown(self):
if not self._isInitialized:
return
self.brl.leaveTtyMode()

View File

@ -16,11 +16,13 @@ class outputManager():
self.env['runtime']['settingsManager'].getSetting('speech', 'driver'), 'speechDriver')
self.env['runtime']['settingsManager'].loadDriver(\
self.env['runtime']['settingsManager'].getSetting('sound', 'driver'), 'soundDriver')
self.env['runtime']['settingsManager'].loadDriver(\
self.env['runtime']['settingsManager'].getSetting('braille', 'driver'), 'brailleDriver')
def shutdown(self):
self.env['runtime']['settingsManager'].shutdownDriver('soundDriver')
self.env['runtime']['settingsManager'].shutdownDriver('speechDriver')
self.env['runtime']['settingsManager'].shutdownDriver('brailleDriver')
def presentText(self, text, interrupt=True, soundIcon = '', ignorePunctuation=False, announceCapital=False):
self.env['runtime']['debug'].writeDebugOut("presentText:\nsoundIcon:'"+soundIcon+"'\nText:\n" + text ,debug.debugLevel.INFO)
if self.playSoundIcon(soundIcon, interrupt):
@ -95,7 +97,7 @@ class outputManager():
return
if self.env['runtime']['brailleDriver'] == None:
return
print('braille:'+text)
self.env['runtime']['brailleDriver'].writeText(text)
def interruptOutput(self):
self.env['runtime']['speechDriver'].cancel()

View File

@ -29,6 +29,7 @@ settings = {
},
'braille':{
'enabled': False,
'driver':'brlapi',
'layout': 'en',
},
'screen':{