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
|
@ -35,7 +35,7 @@ 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')
|
||||||
|
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
|
||||||
@ -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,7 +143,7 @@ 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
|
||||||
@ -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()
|
||||||
@ -172,8 +175,6 @@ class settingsManager():
|
|||||||
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'))
|
||||||
@ -359,7 +381,8 @@ class settingsManager():
|
|||||||
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']['sayAllManager'].initialize(environment)
|
||||||
environment['runtime']['debug'].writeDebugOut('\/-------environment-------\/',debug.debugLevel.INFO, onAnyLevel=True)
|
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)
|
||||||
@ -367,4 +390,3 @@ class settingsManager():
|
|||||||
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,12 +17,10 @@ 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:
|
||||||
@ -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