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

@ -57,14 +57,15 @@ module=espeak
voice=
# Select the language you want fenrir to use.
language=english-us
language=de
# Read new text as it happens?
autoReadIncoming=True
[braille]
#braille is not implemented yet
enabled=False
enabled=True
driver=brlapi
layout=en
[screen]
@ -82,7 +83,7 @@ device=AUTO
grabDevices=True
ignoreShortcuts=False
# the current shortcut layout located in /etc/fenrir/keyboard
keyboardLayout=desktop
keyboardLayout=test
# echo chars while typing.
charEcho=False
# echo deleted chars
@ -95,8 +96,8 @@ interruptOnKeyPress=False
doubleTapDelay=0.2
[general]
debugLevel=3
punctuationLevel=some
debugLevel=1
punctuationLevel=Some
numberOfClipboards=10
# define the current fenrir key
fenrirKeys=KEY_KP0,KEY_META

View File

@ -63,6 +63,7 @@ autoReadIncoming=True
[braille]
#braille is not implemented yet
enabled=False
driver=brlapi
layout=en
[screen]

View File

@ -22,6 +22,7 @@ autoReadIncoming=True
[braille]
enabled=False
driver=brlapi
layout=en
[screen]

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':{