diff --git a/config/settings/settings.conf b/config/settings/settings.conf index 65c83fd0..13b249be 100644 --- a/config/settings/settings.conf +++ b/config/settings/settings.conf @@ -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 diff --git a/config/settings/settings.conf.orig b/config/settings/settings.conf.orig index c30c15a9..14873be5 100644 --- a/config/settings/settings.conf.orig +++ b/config/settings/settings.conf.orig @@ -63,6 +63,7 @@ autoReadIncoming=True [braille] #braille is not implemented yet enabled=False +driver=brlapi layout=en [screen] diff --git a/config/settings/settings.conf.storm b/config/settings/settings.conf.storm index 757d3a86..4ee95f1e 100644 --- a/config/settings/settings.conf.storm +++ b/config/settings/settings.conf.storm @@ -22,6 +22,7 @@ autoReadIncoming=True [braille] enabled=False +driver=brlapi layout=en [screen] diff --git a/src/fenrir/braille/braille.py b/src/fenrir/braille/braille.py deleted file mode 100644 index aff4f599..00000000 --- a/src/fenrir/braille/braille.py +++ /dev/null @@ -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 diff --git a/src/fenrir/braille/__init__.py b/src/fenrir/brailleDriver/__init__.py similarity index 100% rename from src/fenrir/braille/__init__.py rename to src/fenrir/brailleDriver/__init__.py diff --git a/src/fenrir/brailleDriver/brlapi.py b/src/fenrir/brailleDriver/brlapi.py new file mode 100644 index 00000000..140b5044 --- /dev/null +++ b/src/fenrir/brailleDriver/brlapi.py @@ -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() + diff --git a/src/fenrir/core/outputManager.py b/src/fenrir/core/outputManager.py index d9544005..764d545e 100644 --- a/src/fenrir/core/outputManager.py +++ b/src/fenrir/core/outputManager.py @@ -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() diff --git a/src/fenrir/core/settings.py b/src/fenrir/core/settings.py index 7e97843f..a4fcbb12 100644 --- a/src/fenrir/core/settings.py +++ b/src/fenrir/core/settings.py @@ -29,6 +29,7 @@ settings = { }, 'braille':{ 'enabled': False, + 'driver':'brlapi', 'layout': 'en', }, 'screen':{