inital try for braille
This commit is contained in:
parent
f996132043
commit
fcf2a61dbc
@ -57,14 +57,15 @@ module=espeak
|
|||||||
voice=
|
voice=
|
||||||
|
|
||||||
# Select the language you want fenrir to use.
|
# Select the language you want fenrir to use.
|
||||||
language=english-us
|
language=de
|
||||||
|
|
||||||
# Read new text as it happens?
|
# Read new text as it happens?
|
||||||
autoReadIncoming=True
|
autoReadIncoming=True
|
||||||
|
|
||||||
[braille]
|
[braille]
|
||||||
#braille is not implemented yet
|
#braille is not implemented yet
|
||||||
enabled=False
|
enabled=True
|
||||||
|
driver=brlapi
|
||||||
layout=en
|
layout=en
|
||||||
|
|
||||||
[screen]
|
[screen]
|
||||||
@ -82,7 +83,7 @@ device=AUTO
|
|||||||
grabDevices=True
|
grabDevices=True
|
||||||
ignoreShortcuts=False
|
ignoreShortcuts=False
|
||||||
# the current shortcut layout located in /etc/fenrir/keyboard
|
# the current shortcut layout located in /etc/fenrir/keyboard
|
||||||
keyboardLayout=desktop
|
keyboardLayout=test
|
||||||
# echo chars while typing.
|
# echo chars while typing.
|
||||||
charEcho=False
|
charEcho=False
|
||||||
# echo deleted chars
|
# echo deleted chars
|
||||||
@ -95,8 +96,8 @@ interruptOnKeyPress=False
|
|||||||
doubleTapDelay=0.2
|
doubleTapDelay=0.2
|
||||||
|
|
||||||
[general]
|
[general]
|
||||||
debugLevel=3
|
debugLevel=1
|
||||||
punctuationLevel=some
|
punctuationLevel=Some
|
||||||
numberOfClipboards=10
|
numberOfClipboards=10
|
||||||
# define the current fenrir key
|
# define the current fenrir key
|
||||||
fenrirKeys=KEY_KP0,KEY_META
|
fenrirKeys=KEY_KP0,KEY_META
|
||||||
|
@ -63,6 +63,7 @@ autoReadIncoming=True
|
|||||||
[braille]
|
[braille]
|
||||||
#braille is not implemented yet
|
#braille is not implemented yet
|
||||||
enabled=False
|
enabled=False
|
||||||
|
driver=brlapi
|
||||||
layout=en
|
layout=en
|
||||||
|
|
||||||
[screen]
|
[screen]
|
||||||
|
@ -22,6 +22,7 @@ autoReadIncoming=True
|
|||||||
|
|
||||||
[braille]
|
[braille]
|
||||||
enabled=False
|
enabled=False
|
||||||
|
driver=brlapi
|
||||||
layout=en
|
layout=en
|
||||||
|
|
||||||
[screen]
|
[screen]
|
||||||
|
@ -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
|
|
53
src/fenrir/brailleDriver/brlapi.py
Normal file
53
src/fenrir/brailleDriver/brlapi.py
Normal 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()
|
||||||
|
|
@ -16,10 +16,12 @@ class outputManager():
|
|||||||
self.env['runtime']['settingsManager'].getSetting('speech', 'driver'), 'speechDriver')
|
self.env['runtime']['settingsManager'].getSetting('speech', 'driver'), 'speechDriver')
|
||||||
self.env['runtime']['settingsManager'].loadDriver(\
|
self.env['runtime']['settingsManager'].loadDriver(\
|
||||||
self.env['runtime']['settingsManager'].getSetting('sound', 'driver'), 'soundDriver')
|
self.env['runtime']['settingsManager'].getSetting('sound', 'driver'), 'soundDriver')
|
||||||
|
self.env['runtime']['settingsManager'].loadDriver(\
|
||||||
|
self.env['runtime']['settingsManager'].getSetting('braille', 'driver'), 'brailleDriver')
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
self.env['runtime']['settingsManager'].shutdownDriver('soundDriver')
|
self.env['runtime']['settingsManager'].shutdownDriver('soundDriver')
|
||||||
self.env['runtime']['settingsManager'].shutdownDriver('speechDriver')
|
self.env['runtime']['settingsManager'].shutdownDriver('speechDriver')
|
||||||
|
self.env['runtime']['settingsManager'].shutdownDriver('brailleDriver')
|
||||||
|
|
||||||
def presentText(self, text, interrupt=True, soundIcon = '', ignorePunctuation=False, announceCapital=False):
|
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)
|
self.env['runtime']['debug'].writeDebugOut("presentText:\nsoundIcon:'"+soundIcon+"'\nText:\n" + text ,debug.debugLevel.INFO)
|
||||||
@ -95,7 +97,7 @@ class outputManager():
|
|||||||
return
|
return
|
||||||
if self.env['runtime']['brailleDriver'] == None:
|
if self.env['runtime']['brailleDriver'] == None:
|
||||||
return
|
return
|
||||||
print('braille:'+text)
|
self.env['runtime']['brailleDriver'].writeText(text)
|
||||||
|
|
||||||
def interruptOutput(self):
|
def interruptOutput(self):
|
||||||
self.env['runtime']['speechDriver'].cancel()
|
self.env['runtime']['speechDriver'].cancel()
|
||||||
|
@ -29,6 +29,7 @@ settings = {
|
|||||||
},
|
},
|
||||||
'braille':{
|
'braille':{
|
||||||
'enabled': False,
|
'enabled': False,
|
||||||
|
'driver':'brlapi',
|
||||||
'layout': 'en',
|
'layout': 'en',
|
||||||
},
|
},
|
||||||
'screen':{
|
'screen':{
|
||||||
|
Loading…
Reference in New Issue
Block a user