Merge branch 'bleed'
This commit is contained in:
commit
d01bd47833
@ -75,7 +75,6 @@ Braille Support:
|
|||||||
|
|
||||||
Driver (speech):
|
Driver (speech):
|
||||||
[S] talkey driver ( verry unresponsive for espeak in linux)
|
[S] talkey driver ( verry unresponsive for espeak in linux)
|
||||||
[S] emacspeak driver (breaks for a whole screen)
|
|
||||||
https://pypi.python.org/pypi/ptyprocess#downloads
|
https://pypi.python.org/pypi/ptyprocess#downloads
|
||||||
https://github.com/tbsaunde/yasr/blob/master/yasr/tts.c
|
https://github.com/tbsaunde/yasr/blob/master/yasr/tts.c
|
||||||
[] Dectalk SpeechDriver (Easy for contribution, device needed - i dont own one)
|
[] Dectalk SpeechDriver (Easy for contribution, device needed - i dont own one)
|
||||||
|
5
realese nots/1.9.4
Normal file
5
realese nots/1.9.4
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
- initial working emacspeak driver
|
||||||
|
- fixes for fenrir-ignore-screen/ fenrir-unignore-screen management tools
|
||||||
|
- settings and sections are now case sensitive (this makes it possible to make better validity checks.)
|
||||||
|
- validate datatype for settings you set with "-o" parameter or remotemanager "setting set"
|
||||||
|
- variouse speedups and bugfixes
|
@ -16,14 +16,14 @@ class fenrirManager():
|
|||||||
self.initialized = False
|
self.initialized = False
|
||||||
cliArgs = self.handleArgs()
|
cliArgs = self.handleArgs()
|
||||||
if not cliArgs:
|
if not cliArgs:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
self.environment = settingsManager.settingsManager().initFenrirConfig(cliArgs, self)
|
self.environment = settingsManager.settingsManager().initFenrirConfig(cliArgs, self)
|
||||||
if not self.environment:
|
if not self.environment:
|
||||||
raise RuntimeError('Cannot Initialize. Maybe the configfile is not available or not parseable')
|
raise RuntimeError('Cannot Initialize. Maybe the configfile is not available or not parseable')
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
raise
|
raise
|
||||||
self.environment['runtime']['outputManager'].presentText(_("Start Fenrir"), soundIcon='ScreenReaderOn', interrupt=True)
|
self.environment['runtime']['outputManager'].presentText(_("Start Fenrir"), soundIcon='ScreenReaderOn', interrupt=True)
|
||||||
signal.signal(signal.SIGINT, self.captureSignal)
|
signal.signal(signal.SIGINT, self.captureSignal)
|
||||||
signal.signal(signal.SIGTERM, self.captureSignal)
|
signal.signal(signal.SIGTERM, self.captureSignal)
|
||||||
self.initialized = True
|
self.initialized = True
|
||||||
@ -35,11 +35,11 @@ class fenrirManager():
|
|||||||
args = None
|
args = None
|
||||||
parser = argparse.ArgumentParser(description="Fenrir Help")
|
parser = argparse.ArgumentParser(description="Fenrir Help")
|
||||||
parser.add_argument('-s', '--setting', metavar='SETTING-FILE', default='/etc/fenrir/settings/settings.conf', help='Use a specified settingsfile')
|
parser.add_argument('-s', '--setting', metavar='SETTING-FILE', default='/etc/fenrir/settings/settings.conf', help='Use a specified settingsfile')
|
||||||
parser.add_argument('-o', '--options', metavar='SECTION#SETTING=VALUE;..', default='', help='Overwrite options in given settings file')
|
parser.add_argument('-o', '--options', metavar='SECTION#SETTING=VALUE;..', default='', help='Overwrite options in given settings file. Sections, settings and Values are cases sensitive')
|
||||||
parser.add_argument('-d', '--debug', action='store_true', help='Turns on Debugmode')
|
parser.add_argument('-d', '--debug', action='store_true', help='Turns on Debugmode')
|
||||||
parser.add_argument('-p', '--print', action='store_true', help='Print debug messages on screen')
|
parser.add_argument('-p', '--print', action='store_true', help='Print debug messages on screen')
|
||||||
parser.add_argument('-e', '--emulated-pty', action='store_true', help='Use PTY emulation and escape sequences for input')
|
parser.add_argument('-e', '--emulated-pty', action='store_true', help='Use PTY emulation and escape sequences for input')
|
||||||
parser.add_argument('-E', '--emulated-evdev', action='store_true', help='Use PTY emulation and evdev for input (single instance)')
|
parser.add_argument('-E', '--emulated-evdev', action='store_true', help='Use PTY emulation and evdev for input (single instance)')
|
||||||
try:
|
try:
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -52,38 +52,38 @@ class fenrirManager():
|
|||||||
self.shutdown()
|
self.shutdown()
|
||||||
def handleInput(self, event):
|
def handleInput(self, event):
|
||||||
#startTime = time.time()
|
#startTime = time.time()
|
||||||
self.environment['runtime']['debug'].writeDebugOut('DEBUG INPUT fenrirMan:' + str(event),debug.debugLevel.INFO)
|
self.environment['runtime']['debug'].writeDebugOut('DEBUG INPUT fenrirMan:' + str(event),debug.debugLevel.INFO)
|
||||||
if not event['Data']:
|
if not event['Data']:
|
||||||
event['Data'] = self.environment['runtime']['inputManager'].getInputEvent()
|
event['Data'] = self.environment['runtime']['inputManager'].getInputEvent()
|
||||||
if event['Data']:
|
if event['Data']:
|
||||||
event['Data']['EventName'] = self.environment['runtime']['inputManager'].convertEventName(event['Data']['EventName'])
|
event['Data']['EventName'] = self.environment['runtime']['inputManager'].convertEventName(event['Data']['EventName'])
|
||||||
self.environment['runtime']['inputManager'].handleInputEvent(event['Data'])
|
self.environment['runtime']['inputManager'].handleInputEvent(event['Data'])
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.environment['runtime']['inputManager'].noKeyPressed():
|
if self.environment['runtime']['inputManager'].noKeyPressed():
|
||||||
self.environment['runtime']['inputManager'].clearLastDeepInput()
|
self.environment['runtime']['inputManager'].clearLastDeepInput()
|
||||||
if self.environment['runtime']['screenManager'].isSuspendingScreen():
|
if self.environment['runtime']['screenManager'].isSuspendingScreen():
|
||||||
self.environment['runtime']['inputManager'].writeEventBuffer()
|
self.environment['runtime']['inputManager'].writeEventBuffer()
|
||||||
else:
|
else:
|
||||||
if self.environment['runtime']['helpManager'].isTutorialMode():
|
if self.environment['runtime']['helpManager'].isTutorialMode():
|
||||||
self.environment['runtime']['inputManager'].clearEventBuffer()
|
self.environment['runtime']['inputManager'].clearEventBuffer()
|
||||||
|
|
||||||
self.detectShortcutCommand()
|
self.detectShortcutCommand()
|
||||||
|
|
||||||
if self.modifierInput:
|
if self.modifierInput:
|
||||||
self.environment['runtime']['inputManager'].clearEventBuffer()
|
self.environment['runtime']['inputManager'].clearEventBuffer()
|
||||||
if self.singleKeyCommand:
|
if self.singleKeyCommand:
|
||||||
if self.environment['runtime']['inputManager'].noKeyPressed():
|
if self.environment['runtime']['inputManager'].noKeyPressed():
|
||||||
self.environment['runtime']['inputManager'].clearEventBuffer()
|
self.environment['runtime']['inputManager'].clearEventBuffer()
|
||||||
else:
|
else:
|
||||||
self.environment['runtime']['inputManager'].writeEventBuffer()
|
self.environment['runtime']['inputManager'].writeEventBuffer()
|
||||||
if self.environment['runtime']['inputManager'].noKeyPressed():
|
if self.environment['runtime']['inputManager'].noKeyPressed():
|
||||||
self.modifierInput = False
|
self.modifierInput = False
|
||||||
self.singleKeyCommand = False
|
self.singleKeyCommand = False
|
||||||
if self.environment['input']['keyForeward'] > 0:
|
if self.environment['input']['keyForeward'] > 0:
|
||||||
self.environment['input']['keyForeward'] -=1
|
self.environment['input']['keyForeward'] -=1
|
||||||
self.environment['runtime']['commandManager'].executeDefaultTrigger('onKeyInput')
|
self.environment['runtime']['commandManager'].executeDefaultTrigger('onKeyInput')
|
||||||
#print('handleInput:',time.time() - startTime)
|
#print('handleInput:',time.time() - startTime)
|
||||||
def handleByteInput(self, event):
|
def handleByteInput(self, event):
|
||||||
if not event['Data']:
|
if not event['Data']:
|
||||||
|
30
src/fenrirscreenreader/core/sayAllManager.py
Normal file
30
src/fenrirscreenreader/core/sayAllManager.py
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Fenrir TTY screen reader
|
||||||
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
|
from fenrirscreenreader.core import debug
|
||||||
|
|
||||||
|
class sayAllManager():
|
||||||
|
def __init__(self):
|
||||||
|
self.isActive = False
|
||||||
|
self.isActiveLock = None
|
||||||
|
def initialize(self, environment):
|
||||||
|
self.env = environment
|
||||||
|
def shutdown(self):
|
||||||
|
pass
|
||||||
|
def setIsActive(self, isActive):
|
||||||
|
pass
|
||||||
|
def start(self):
|
||||||
|
pass
|
||||||
|
def isSayAllActive(self):
|
||||||
|
pass
|
||||||
|
def sayAllWorker(self):
|
||||||
|
pass
|
||||||
|
def stop(self):
|
||||||
|
pass
|
||||||
|
def finish(self):
|
||||||
|
pass
|
||||||
|
def gotoNextPage(self):
|
||||||
|
pass
|
@ -28,6 +28,7 @@ from fenrirscreenreader.core import byteManager
|
|||||||
from fenrirscreenreader.core import attributeManager
|
from fenrirscreenreader.core import attributeManager
|
||||||
from fenrirscreenreader.core import barrierManager
|
from fenrirscreenreader.core import barrierManager
|
||||||
from fenrirscreenreader.core import remoteManager
|
from fenrirscreenreader.core import remoteManager
|
||||||
|
from fenrirscreenreader.core import sayAllManager
|
||||||
from fenrirscreenreader.core import environment
|
from fenrirscreenreader.core import environment
|
||||||
from fenrirscreenreader.core.settingsData import settingsData
|
from fenrirscreenreader.core.settingsData import settingsData
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core import debug
|
||||||
@ -50,7 +51,7 @@ class settingsManager():
|
|||||||
break
|
break
|
||||||
line = line.replace('\n','')
|
line = line.replace('\n','')
|
||||||
if line.replace(" ","") == '':
|
if line.replace(" ","") == '':
|
||||||
continue
|
continue
|
||||||
if line.replace(" ","").startswith("#"):
|
if line.replace(" ","").startswith("#"):
|
||||||
continue
|
continue
|
||||||
if line.count("=") != 1:
|
if line.count("=") != 1:
|
||||||
@ -103,7 +104,7 @@ class settingsManager():
|
|||||||
def getSetting(self, section, setting):
|
def getSetting(self, section, setting):
|
||||||
value = ''
|
value = ''
|
||||||
try:
|
try:
|
||||||
value = self.settingArgDict[section.lower()][setting.lower()]
|
value = self.settingArgDict[section][setting]
|
||||||
return value
|
return value
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
@ -116,7 +117,7 @@ class settingsManager():
|
|||||||
def getSettingAsInt(self, section, setting):
|
def getSettingAsInt(self, section, setting):
|
||||||
value = 0
|
value = 0
|
||||||
try:
|
try:
|
||||||
value = int(self.settingArgDict[section.lower()][setting.lower()])
|
value = int(self.settingArgDict[section][setting])
|
||||||
return value
|
return value
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
@ -129,7 +130,7 @@ class settingsManager():
|
|||||||
def getSettingAsFloat(self, section, setting):
|
def getSettingAsFloat(self, section, setting):
|
||||||
value = 0.0
|
value = 0.0
|
||||||
try:
|
try:
|
||||||
value = float(self.settingArgDict[section.lower()][setting.lower()])
|
value = float(self.settingArgDict[section][setting])
|
||||||
return value
|
return value
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
@ -142,10 +143,10 @@ class settingsManager():
|
|||||||
def getSettingAsBool(self, section, setting):
|
def getSettingAsBool(self, section, setting):
|
||||||
value = False
|
value = False
|
||||||
try:
|
try:
|
||||||
value = self.settingArgDict[section.lower()][setting.lower()].upper() in ['1','YES','JA','TRUE']
|
value = self.settingArgDict[section][setting].upper() in ['1','YES','JA','TRUE']
|
||||||
return value
|
return value
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
value = self.env['settings'].getboolean(section, setting)
|
value = self.env['settings'].getboolean(section, setting)
|
||||||
except:
|
except:
|
||||||
@ -154,8 +155,10 @@ class settingsManager():
|
|||||||
|
|
||||||
def loadDriver(self, driverName, driverType):
|
def loadDriver(self, driverName, driverType):
|
||||||
try:
|
try:
|
||||||
if self.env['runtime'][driverType] != None:
|
self.env['runtime'][driverType].shutdown(self.env)
|
||||||
self.env['runtime'][driverType].shutdown(self.env)
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
driver_mod = module_utils.importModule(driverName,
|
driver_mod = module_utils.importModule(driverName,
|
||||||
fenrirPath + "/" + driverType + '/' + driverName + '.py')
|
fenrirPath + "/" + driverType + '/' + driverName + '.py')
|
||||||
self.env['runtime'][driverType] = driver_mod.driver()
|
self.env['runtime'][driverType] = driver_mod.driver()
|
||||||
@ -170,10 +173,8 @@ class settingsManager():
|
|||||||
self.env['runtime'][driverType].initialize(self.env)
|
self.env['runtime'][driverType].initialize(self.env)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.env['runtime']['debug'].writeDebugOut('(fallback) Loading Driver ' + driverType + ' (dummyDriver) FAILED:'+ str(e), debug.debugLevel.ERROR)
|
self.env['runtime']['debug'].writeDebugOut('(fallback) Loading Driver ' + driverType + ' (dummyDriver) FAILED:'+ str(e), debug.debugLevel.ERROR)
|
||||||
|
|
||||||
def shutdownDriver(self, driverType):
|
def shutdownDriver(self, driverType):
|
||||||
if self.env['runtime'][driverType] == None:
|
|
||||||
return
|
|
||||||
try:
|
try:
|
||||||
self.env['runtime'][driverType].shutdown()
|
self.env['runtime'][driverType].shutdown()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -194,14 +195,35 @@ class settingsManager():
|
|||||||
self.env['input']['scriptKey'].append(key)
|
self.env['input']['scriptKey'].append(key)
|
||||||
def resetSettingArgDict(self):
|
def resetSettingArgDict(self):
|
||||||
self.settingArgDict = {}
|
self.settingArgDict = {}
|
||||||
def setOptionArgDict(self, section, option, value):
|
def setOptionArgDict(self, section, setting, value):
|
||||||
section = section.lower()
|
#section = section.lower()
|
||||||
option = option.lower()
|
#setting = setting.lower()
|
||||||
try:
|
try:
|
||||||
e = self.settingArgDict[section]
|
e = self.settingArgDict[section]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
self.settingArgDict[section] = {}
|
self.settingArgDict[section] = {}
|
||||||
self.settingArgDict[section][option] = str(value)
|
try:
|
||||||
|
t = self.settings[section][setting]
|
||||||
|
except:
|
||||||
|
print(section,setting, 'not found')
|
||||||
|
return
|
||||||
|
try:
|
||||||
|
if isinstance(self.settings[section][setting], str):
|
||||||
|
v = str(value)
|
||||||
|
elif isinstance(self.settings[section][setting], bool):
|
||||||
|
if not value in ['True','False']:
|
||||||
|
raise ValueError('could not convert string to bool: '+ value)
|
||||||
|
elif isinstance(self.settings[section][setting], int):
|
||||||
|
v = int(value)
|
||||||
|
elif isinstance(self.settings[section][setting], float):
|
||||||
|
v = float(value)
|
||||||
|
self.settingArgDict[section][setting] = str(value)
|
||||||
|
except Exception as e:
|
||||||
|
print('settingsManager:setOptionArgDict:Datatype missmatch: '+ section + '#' + setting + '=' + value + ' Error:' + str(e))
|
||||||
|
#self.env['runtime']['debug'].writeDebugOut('settingsManager:setOptionArgDict:Datatype missmatch: '+ section + '#' + setting + '=' + value + ' Error:' + str(e), debug.debugLevel.ERROR)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def parseSettingArgs(self, settingArgs):
|
def parseSettingArgs(self, settingArgs):
|
||||||
for optionElem in settingArgs.split(';'):
|
for optionElem in settingArgs.split(';'):
|
||||||
@ -245,20 +267,20 @@ class settingsManager():
|
|||||||
if cliArgs.options != '':
|
if cliArgs.options != '':
|
||||||
self.parseSettingArgs(cliArgs.options)
|
self.parseSettingArgs(cliArgs.options)
|
||||||
if cliArgs.debug:
|
if cliArgs.debug:
|
||||||
self.setOptionArgDict('general', 'debugLevel', 3)
|
self.setSetting('general', 'debugLevel', 3)
|
||||||
if cliArgs.print:
|
if cliArgs.print:
|
||||||
self.setOptionArgDict('general', 'debugLevel', 3)
|
self.setSetting('general', 'debugLevel', 3)
|
||||||
self.setOptionArgDict('general', 'debugMode', 'PRINT')
|
self.setSetting('general', 'debugMode', 'PRINT')
|
||||||
if cliArgs.emulated_pty:
|
if cliArgs.emulated_pty:
|
||||||
self.setOptionArgDict('screen', 'driver', 'ptyDriver')
|
self.setSetting('screen', 'driver', 'ptyDriver')
|
||||||
self.setOptionArgDict('keyboard', 'driver', 'ptyDriver')
|
self.setSetting('keyboard', 'driver', 'ptyDriver')
|
||||||
# TODO needs cleanup use dict
|
# TODO needs cleanup use dict
|
||||||
#self.setOptionArgDict('keyboard', 'keyboardLayout', 'pty')
|
#self.setOptionArgDict('keyboard', 'keyboardLayout', 'pty')
|
||||||
self.setSetting('keyboard', 'keyboardLayout', 'pty')
|
self.setSetting('keyboard', 'keyboardLayout', 'pty')
|
||||||
self.setOptionArgDict('general', 'debugFile', '/tmp/fenrir-pty.log')
|
self.setSetting('general', 'debugFile', '/tmp/fenrir-pty.log')
|
||||||
if cliArgs.emulated_evdev:
|
if cliArgs.emulated_evdev:
|
||||||
self.setOptionArgDict('screen', 'driver', 'ptyDriver')
|
self.setSetting('screen', 'driver', 'ptyDriver')
|
||||||
self.setOptionArgDict('keyboard', 'driver', 'evdevDriver')
|
self.setSetting('keyboard', 'driver', 'evdevDriver')
|
||||||
|
|
||||||
self.setFenrirKeys(self.getSetting('general','fenrirKeys'))
|
self.setFenrirKeys(self.getSetting('general','fenrirKeys'))
|
||||||
self.setScriptKeys(self.getSetting('general','scriptKeys'))
|
self.setScriptKeys(self.getSetting('general','scriptKeys'))
|
||||||
@ -267,9 +289,9 @@ class settingsManager():
|
|||||||
environment['runtime']['debug'].initialize(environment)
|
environment['runtime']['debug'].initialize(environment)
|
||||||
|
|
||||||
if not os.path.exists(self.getSetting('sound','theme') + '/soundicons.conf'):
|
if not os.path.exists(self.getSetting('sound','theme') + '/soundicons.conf'):
|
||||||
if os.path.exists(soundRoot + self.getSetting('sound','theme')):
|
if os.path.exists(soundRoot + self.getSetting('sound','theme')):
|
||||||
self.setSetting('sound', 'theme', soundRoot + self.getSetting('sound','theme'))
|
self.setSetting('sound', 'theme', soundRoot + self.getSetting('sound','theme'))
|
||||||
if os.path.exists(self.getSetting('sound','theme') + '/soundicons.conf'):
|
if os.path.exists(self.getSetting('sound','theme') + '/soundicons.conf'):
|
||||||
environment['runtime']['settingsManager'].loadSoundIcons(self.getSetting('sound','theme'))
|
environment['runtime']['settingsManager'].loadSoundIcons(self.getSetting('sound','theme'))
|
||||||
else:
|
else:
|
||||||
environment['runtime']['settingsManager'].loadSoundIcons(self.getSetting('sound','theme'))
|
environment['runtime']['settingsManager'].loadSoundIcons(self.getSetting('sound','theme'))
|
||||||
@ -348,23 +370,23 @@ class settingsManager():
|
|||||||
environment['runtime']['byteManager'].loadByteShortcuts(self.getSetting('keyboard','keyboardLayout'))
|
environment['runtime']['byteManager'].loadByteShortcuts(self.getSetting('keyboard','keyboardLayout'))
|
||||||
else:
|
else:
|
||||||
environment['runtime']['byteManager'].loadByteShortcuts(self.getSetting('keyboard','keyboardLayout'))
|
environment['runtime']['byteManager'].loadByteShortcuts(self.getSetting('keyboard','keyboardLayout'))
|
||||||
|
|
||||||
environment['runtime']['cursorManager'] = cursorManager.cursorManager()
|
environment['runtime']['cursorManager'] = cursorManager.cursorManager()
|
||||||
environment['runtime']['cursorManager'].initialize(environment)
|
environment['runtime']['cursorManager'].initialize(environment)
|
||||||
environment['runtime']['applicationManager'] = applicationManager.applicationManager()
|
environment['runtime']['applicationManager'] = applicationManager.applicationManager()
|
||||||
environment['runtime']['applicationManager'].initialize(environment)
|
environment['runtime']['applicationManager'].initialize(environment)
|
||||||
environment['runtime']['textManager'] = textManager.textManager()
|
environment['runtime']['textManager'] = textManager.textManager()
|
||||||
environment['runtime']['textManager'].initialize(environment)
|
environment['runtime']['textManager'].initialize(environment)
|
||||||
environment['runtime']['tableManager'] = tableManager.tableManager()
|
environment['runtime']['tableManager'] = tableManager.tableManager()
|
||||||
environment['runtime']['tableManager'].initialize(environment)
|
environment['runtime']['tableManager'].initialize(environment)
|
||||||
environment['runtime']['barrierManager'] = barrierManager.barrierManager()
|
environment['runtime']['barrierManager'] = barrierManager.barrierManager()
|
||||||
environment['runtime']['barrierManager'].initialize(environment)
|
environment['runtime']['barrierManager'].initialize(environment)
|
||||||
|
environment['runtime']['sayAllManager'] = sayAllManager.sayAllManager()
|
||||||
environment['runtime']['debug'].writeDebugOut('\/-------environment-------\/',debug.debugLevel.INFO, onAnyLevel=True)
|
environment['runtime']['sayAllManager'].initialize(environment)
|
||||||
|
environment['runtime']['debug'].writeDebugOut('\/-------environment-------\/',debug.debugLevel.INFO, onAnyLevel=True)
|
||||||
environment['runtime']['debug'].writeDebugOut(str(environment), debug.debugLevel.INFO, onAnyLevel=True)
|
environment['runtime']['debug'].writeDebugOut(str(environment), debug.debugLevel.INFO, onAnyLevel=True)
|
||||||
environment['runtime']['debug'].writeDebugOut('\/-------settings.conf-------\/', debug.debugLevel.INFO, onAnyLevel=True)
|
environment['runtime']['debug'].writeDebugOut('\/-------settings.conf-------\/', debug.debugLevel.INFO, onAnyLevel=True)
|
||||||
environment['runtime']['debug'].writeDebugOut(str(environment['settings']._sections) , debug.debugLevel.INFO, onAnyLevel=True)
|
environment['runtime']['debug'].writeDebugOut(str(environment['settings']._sections) , debug.debugLevel.INFO, onAnyLevel=True)
|
||||||
environment['runtime']['debug'].writeDebugOut('\/-------self.settingArgDict-------\/',debug.debugLevel.INFO, onAnyLevel=True)
|
environment['runtime']['debug'].writeDebugOut('\/-------self.settingArgDict-------\/',debug.debugLevel.INFO, onAnyLevel=True)
|
||||||
environment['runtime']['debug'].writeDebugOut(str( self.settingArgDict) ,debug.debugLevel.INFO, onAnyLevel=True)
|
environment['runtime']['debug'].writeDebugOut(str( self.settingArgDict) ,debug.debugLevel.INFO, onAnyLevel=True)
|
||||||
return environment
|
return environment
|
||||||
|
|
||||||
|
@ -5,11 +5,8 @@
|
|||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
# generic driver
|
# generic driver
|
||||||
|
|
||||||
from subprocess import Popen, PIPE
|
|
||||||
import pexpect
|
import pexpect
|
||||||
import ptyprocess
|
|
||||||
import shlex
|
import shlex
|
||||||
import sys
|
|
||||||
import time
|
import time
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core import debug
|
||||||
from fenrirscreenreader.core.speechDriver import speechDriver
|
from fenrirscreenreader.core.speechDriver import speechDriver
|
||||||
@ -20,13 +17,11 @@ class driver(speechDriver):
|
|||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
try:
|
try:
|
||||||
#self.server = ptyprocess.PtyProcessUnicode.spawn(['/usr/bin/tclsh', self.env['runtime']['settingsManager'].getSetting('speech', 'serverPath')])
|
|
||||||
self.server = pexpect.spawn('tclsh ' + self.env['runtime']['settingsManager'].getSetting('speech', 'serverPath'))
|
self.server = pexpect.spawn('tclsh ' + self.env['runtime']['settingsManager'].getSetting('speech', 'serverPath'))
|
||||||
self._isInitialized = True
|
self._isInitialized = True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.env['runtime']['debug'].writeDebugOut('speechDriver:initialize:' + str(e),debug.debugLevel.ERROR)
|
self.env['runtime']['debug'].writeDebugOut('speechDriver:initialize:' + str(e),debug.debugLevel.ERROR)
|
||||||
print(e)
|
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
if self.server:
|
if self.server:
|
||||||
try:
|
try:
|
||||||
@ -40,16 +35,15 @@ class driver(speechDriver):
|
|||||||
if not queueable:
|
if not queueable:
|
||||||
self.cancel()
|
self.cancel()
|
||||||
try:
|
try:
|
||||||
cleanText = shlex.split('tts_say "'+text.replace(',','')+'"')
|
cleanText = text
|
||||||
|
for c in '[]{}\\|_@#^*<>\"`~^':
|
||||||
|
cleanText.replace(c,'')
|
||||||
|
cleanText = shlex.split(cleanText)
|
||||||
for idx, word in enumerate(cleanText):
|
for idx, word in enumerate(cleanText):
|
||||||
cleanText[idx] = word
|
cleanText[idx] = word
|
||||||
cleanText = ' '.join(cleanText)
|
cleanText = ' '.join(cleanText)
|
||||||
#print(cleanText[0])
|
cleanText = 'tts_say \"' + cleanText +'\"'
|
||||||
#self.server.write('tts_say ' + '"' + cleanText[0] +'"\n')
|
|
||||||
#print(self.server.read(1000))
|
|
||||||
#self.server.sendline('tts_say ' + '"' + cleanText + '"')
|
|
||||||
self.server.sendline(cleanText)
|
self.server.sendline(cleanText)
|
||||||
print(cleanText)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.env['runtime']['debug'].writeDebugOut('speechDriver:speak:self.server.sendline():' + str(e),debug.debugLevel.ERROR)
|
self.env['runtime']['debug'].writeDebugOut('speechDriver:speak:self.server.sendline():' + str(e),debug.debugLevel.ERROR)
|
||||||
|
|
||||||
@ -57,10 +51,7 @@ class driver(speechDriver):
|
|||||||
if not self._isInitialized:
|
if not self._isInitialized:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
pass
|
self.server.sendline('stop')
|
||||||
#self.server.write('s\n')
|
|
||||||
#print(self.server.read(1000))
|
|
||||||
#self.server.sendline('stop')
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
self.env['runtime']['debug'].writeDebugOut('speechDriver:cancel:self.server.sendline():' + str(e),debug.debugLevel.ERROR)
|
self.env['runtime']['debug'].writeDebugOut('speechDriver:cancel:self.server.sendline():' + str(e),debug.debugLevel.ERROR)
|
||||||
@ -69,14 +60,11 @@ class driver(speechDriver):
|
|||||||
if not self._isInitialized:
|
if not self._isInitialized:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
pass
|
self.server.sendline('tts_set_speech_rate ' + str(int(rate * 400)))
|
||||||
#self.server.write('tts_set_speech_rate ' + str(int(rate * 400)) + '\n')
|
|
||||||
#self.server.sendline('tts_set_speech_rate ' + str(int(rate * 400)) + '')
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.env['runtime']['debug'].writeDebugOut('speechDriver:setRate:self.server.sendline():' + str(e),debug.debugLevel.ERROR)
|
self.env['runtime']['debug'].writeDebugOut('speechDriver:setRate:self.server.sendline():' + str(e),debug.debugLevel.ERROR)
|
||||||
|
|
||||||
def setLanguage(self, language):
|
def setLanguage(self, language):
|
||||||
if not self._isInitialized:
|
if not self._isInitialized:
|
||||||
return
|
return
|
||||||
#self.server.write('set_lang ' + language + '\n')
|
self.server.sendline('set_lang ' + language)
|
||||||
#self.server.sendline('set_lang ' + language + '')
|
|
||||||
|
Loading…
Reference in New Issue
Block a user