improve Braile support

This commit is contained in:
chrys 2017-01-29 23:12:35 +01:00
parent df65611c5f
commit f13013f21f
2 changed files with 18 additions and 3 deletions

View File

@ -8,6 +8,7 @@ from core import debug
from core import settings from core import settings
from core import runtime from core import runtime
from core import screenData from core import screenData
from core import output
from core import generalInformation from core import generalInformation
from core import commands from core import commands
from core import inputEvent from core import inputEvent
@ -24,6 +25,7 @@ environment = {
'commandBuffer': commands.commandBuffer, 'commandBuffer': commands.commandBuffer,
'input': inputEvent.input, 'input': inputEvent.input,
'punctuation': punctuation.punctuation, 'punctuation': punctuation.punctuation,
'output': output.output,
'soundIcons': {}, 'soundIcons': {},
'bindings': {}, 'bindings': {},
} }

View File

@ -23,7 +23,7 @@ class outputManager():
self.env['runtime']['settingsManager'].shutdownDriver('speechDriver') self.env['runtime']['settingsManager'].shutdownDriver('speechDriver')
self.env['runtime']['settingsManager'].shutdownDriver('brailleDriver') 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, flush=False):
if text == '': if text == '':
return return
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)
@ -98,12 +98,25 @@ class outputManager():
self.env['runtime']['debug'].writeDebugOut("\"speak\" in outputManager.speakText ",debug.debugLevel.ERROR) self.env['runtime']['debug'].writeDebugOut("\"speak\" in outputManager.speakText ",debug.debugLevel.ERROR)
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR) self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
def brailleText(self, text, interrupt=True): def brailleText(self, text, flush=False):
if not self.env['runtime']['settingsManager'].getSettingAsBool('braille', 'enabled'): if not self.env['runtime']['settingsManager'].getSettingAsBool('braille', 'enabled'):
return return
if self.env['runtime']['brailleDriver'] == None: if self.env['runtime']['brailleDriver'] == None:
return return
self.env['runtime']['brailleDriver'].writeText(text[:35]) size = self.env['runtime']['brailleDriver'].getDeviceSize()
if flush:
self.env['output']['nextFlush'] = time.time() + 5.0
self.env['output']['messageText'] = text
self.env['runtime']['brailleDriver'].writeText(text[:size[0]])
else:
if self.env['output']['nextFlush'] < time.time():
if self.env['output']['messageText'] != '':
self.env['output']['messageText'] = ''
cursor = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
x, y, currLine = \
line_utils.getCurrentLine(cursor['x'], cursor['y'], self.env['screenData']['newContentText'])
self.env['runtime']['brailleDriver'].writeText(currLine[:size[0]])
def interruptOutput(self): def interruptOutput(self):
self.env['runtime']['speechDriver'].cancel() self.env['runtime']['speechDriver'].cancel()