merge bleed
This commit is contained in:
commit
1a55f4fe2e
@ -123,17 +123,18 @@ Cleanups:
|
|||||||
[X] curr item
|
[X] curr item
|
||||||
[X] first item
|
[X] first item
|
||||||
[X] last item
|
[X] last item
|
||||||
General:
|
General:
|
||||||
|
- [X] read ignorescreens from an file to be able to halt fenrir from outside
|
||||||
- commands
|
- commands
|
||||||
[X] place last spoken to clipboard (Easy for contribution)
|
[X] place last spoken to clipboard (Easy for contribution)
|
||||||
- Improvend Headline Seperator and Multible Char Support
|
- Improvend Headline Seperator and Multible Char Support
|
||||||
[X]read "13 #" insteed of ###################
|
[X]read "13 #" insteed of ###################
|
||||||
Braille Support:
|
Braille Support:
|
||||||
Driver:
|
Driver:
|
||||||
[Done] make generic speech driver default
|
[X] make generic speech driver default
|
||||||
[Done] pyttsx3 speech driver (slow -> pyttsx3 framework)
|
[X] pyttsx3 speech driver
|
||||||
- get information already in watchdogs insteed of mainloop (use eventloop to transport)
|
- get information already in watchdogs insteed of mainloop (use eventloop to transport)
|
||||||
[Done] InputDriver
|
[X] InputDriver
|
||||||
Settings:
|
Settings:
|
||||||
Application Profiles:
|
Application Profiles:
|
||||||
Translation:
|
Translation:
|
||||||
|
@ -122,6 +122,7 @@ driver=vcsaDriver
|
|||||||
encoding=auto
|
encoding=auto
|
||||||
screenUpdateDelay=0.05
|
screenUpdateDelay=0.05
|
||||||
suspendingScreen=
|
suspendingScreen=
|
||||||
|
suspendingScreenFile=/tmp/fenrirSuspend
|
||||||
autodetectSuspendingScreen=True
|
autodetectSuspendingScreen=True
|
||||||
|
|
||||||
[keyboard]
|
[keyboard]
|
||||||
|
@ -124,6 +124,7 @@ driver=vcsaDriver
|
|||||||
encoding=auto
|
encoding=auto
|
||||||
screenUpdateDelay=0.05
|
screenUpdateDelay=0.05
|
||||||
suspendingScreen=
|
suspendingScreen=
|
||||||
|
suspendingScreenFile=/tmp/fenrirSuspend
|
||||||
autodetectSuspendingScreen=True
|
autodetectSuspendingScreen=True
|
||||||
|
|
||||||
[keyboard]
|
[keyboard]
|
||||||
|
@ -125,6 +125,7 @@ driver=vcsaDriver
|
|||||||
encoding=auto
|
encoding=auto
|
||||||
screenUpdateDelay=0.05
|
screenUpdateDelay=0.05
|
||||||
suspendingScreen=
|
suspendingScreen=
|
||||||
|
suspendingScreenFile=/tmp/fenrirSuspend
|
||||||
autodetectSuspendingScreen=True
|
autodetectSuspendingScreen=True
|
||||||
|
|
||||||
[keyboard]
|
[keyboard]
|
||||||
|
@ -79,6 +79,7 @@ driver=vcsaDriver
|
|||||||
encoding=auto
|
encoding=auto
|
||||||
screenUpdateDelay=0.05
|
screenUpdateDelay=0.05
|
||||||
suspendingScreen=
|
suspendingScreen=
|
||||||
|
suspendingScreenFile=/tmp/fenrirSuspend
|
||||||
autodetectSuspendingScreen=True
|
autodetectSuspendingScreen=True
|
||||||
|
|
||||||
[keyboard]
|
[keyboard]
|
||||||
|
@ -124,6 +124,7 @@ driver=vcsaDriver
|
|||||||
encoding=auto
|
encoding=auto
|
||||||
screenUpdateDelay=0.05
|
screenUpdateDelay=0.05
|
||||||
suspendingScreen=
|
suspendingScreen=
|
||||||
|
suspendingScreenFile=/tmp/fenrirSuspend
|
||||||
autodetectSuspendingScreen=True
|
autodetectSuspendingScreen=True
|
||||||
|
|
||||||
[keyboard]
|
[keyboard]
|
||||||
|
@ -80,7 +80,6 @@ class fenrirManager():
|
|||||||
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']['screenManager'].update('onInput')
|
|
||||||
self.environment['runtime']['commandManager'].executeDefaultTrigger('onInput')
|
self.environment['runtime']['commandManager'].executeDefaultTrigger('onInput')
|
||||||
#print('handleInput:',time.time() - startTime)
|
#print('handleInput:',time.time() - startTime)
|
||||||
def handleExecuteCommand(self, event):
|
def handleExecuteCommand(self, event):
|
||||||
@ -93,8 +92,8 @@ class fenrirManager():
|
|||||||
self.environment['runtime']['commandManager'].executeCommand( command, 'help')
|
self.environment['runtime']['commandManager'].executeCommand( command, 'help')
|
||||||
return
|
return
|
||||||
self.environment['runtime']['commandManager'].executeCommand( command, 'commands')
|
self.environment['runtime']['commandManager'].executeCommand( command, 'commands')
|
||||||
def handleScreenChange(self, event):
|
def handleScreenChange(self, event):
|
||||||
self.environment['runtime']['screenManager'].update('onScreenChange')
|
self.environment['runtime']['screenManager'].hanldeScreenChange(event['Data'])
|
||||||
'''
|
'''
|
||||||
if self.environment['runtime']['applicationManager'].isApplicationChange():
|
if self.environment['runtime']['applicationManager'].isApplicationChange():
|
||||||
self.environment['runtime']['commandManager'].executeDefaultTrigger('onApplicationChange')
|
self.environment['runtime']['commandManager'].executeDefaultTrigger('onApplicationChange')
|
||||||
@ -103,10 +102,10 @@ class fenrirManager():
|
|||||||
self.environment['runtime']['applicationManager'].getCurrentApplication())
|
self.environment['runtime']['applicationManager'].getCurrentApplication())
|
||||||
'''
|
'''
|
||||||
self.environment['runtime']['commandManager'].executeDefaultTrigger('onScreenChanged')
|
self.environment['runtime']['commandManager'].executeDefaultTrigger('onScreenChanged')
|
||||||
self.environment['runtime']['screenManager'].update('onScreenChange')
|
self.environment['runtime']['screenDriver'].getCurrScreen()
|
||||||
def handleScreenUpdate(self, event):
|
def handleScreenUpdate(self, event):
|
||||||
#startTime = time.time()
|
#startTime = time.time()
|
||||||
self.environment['runtime']['screenManager'].update('onUpdate')
|
self.environment['runtime']['screenManager'].handleScreenUpdate(event['Data'])
|
||||||
'''
|
'''
|
||||||
if self.environment['runtime']['applicationManager'].isApplicationChange():
|
if self.environment['runtime']['applicationManager'].isApplicationChange():
|
||||||
self.environment['runtime']['commandManager'].executeDefaultTrigger('onApplicationChange')
|
self.environment['runtime']['commandManager'].executeDefaultTrigger('onApplicationChange')
|
||||||
@ -120,7 +119,7 @@ class fenrirManager():
|
|||||||
# has cursor changed?
|
# has cursor changed?
|
||||||
if self.environment['runtime']['cursorManager'].isCursorVerticalMove() or \
|
if self.environment['runtime']['cursorManager'].isCursorVerticalMove() or \
|
||||||
self.environment['runtime']['cursorManager'].isCursorHorizontalMove():
|
self.environment['runtime']['cursorManager'].isCursorHorizontalMove():
|
||||||
self.environment['runtime']['commandManager'].executeDefaultTrigger('onCursorChange')
|
self.environment['runtime']['commandManager'].executeDefaultTrigger('onCursorChange')
|
||||||
self.environment['runtime']['commandManager'].executeDefaultTrigger('onScreenUpdate')
|
self.environment['runtime']['commandManager'].executeDefaultTrigger('onScreenUpdate')
|
||||||
self.environment['runtime']['inputManager'].clearLastDeepInput()
|
self.environment['runtime']['inputManager'].clearLastDeepInput()
|
||||||
#print('handleScreenUpdate:',time.time() - startTime)
|
#print('handleScreenUpdate:',time.time() - startTime)
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from core import debug
|
from core import debug
|
||||||
import time
|
import time, os
|
||||||
|
|
||||||
class screenManager():
|
class screenManager():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -19,18 +19,18 @@ class screenManager():
|
|||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
self.env['runtime']['settingsManager'].shutdownDriver('screenDriver')
|
self.env['runtime']['settingsManager'].shutdownDriver('screenDriver')
|
||||||
|
def hanldeScreenChange(self, eventData):
|
||||||
def update(self, trigger='onUpdate'):
|
self.env['runtime']['screenDriver'].getCurrScreen()
|
||||||
self.env['runtime']['screenDriver'].getCurrScreen()
|
self.env['runtime']['screenDriver'].getSessionInformation()
|
||||||
|
|
||||||
if trigger == 'onScreenChange':
|
|
||||||
self.env['runtime']['screenDriver'].getSessionInformation()
|
|
||||||
|
|
||||||
self.env['screen']['oldApplication'] = self.env['screen']['newApplication']
|
|
||||||
if self.isScreenChange():
|
if self.isScreenChange():
|
||||||
self.changeBrailleScreen()
|
self.changeBrailleScreen()
|
||||||
if not self.isSuspendingScreen(self.env['screen']['newTTY']):
|
if not self.isSuspendingScreen(self.env['screen']['newTTY']):
|
||||||
self.env['runtime']['screenDriver'].update(trigger)
|
self.env['runtime']['screenDriver'].update(eventData, 'onScreenChange')
|
||||||
|
self.env['screen']['lastScreenUpdate'] = time.time()
|
||||||
|
def handleScreenUpdate(self, eventData):
|
||||||
|
self.env['screen']['oldApplication'] = self.env['screen']['newApplication']
|
||||||
|
if not self.isSuspendingScreen(self.env['screen']['newTTY']):
|
||||||
|
self.env['runtime']['screenDriver'].update(eventData, 'onScreenUpdate')
|
||||||
#if trigger == 'onUpdate' or self.isScreenChange() \
|
#if trigger == 'onUpdate' or self.isScreenChange() \
|
||||||
# or len(self.env['screen']['newDelta']) > 6:
|
# or len(self.env['screen']['newDelta']) > 6:
|
||||||
# self.env['runtime']['screenDriver'].getCurrApplication()
|
# self.env['runtime']['screenDriver'].getCurrApplication()
|
||||||
@ -60,6 +60,14 @@ class screenManager():
|
|||||||
if self.env['runtime']['settingsManager'].getSettingAsBool('screen', 'autodetectSuspendingScreen'):
|
if self.env['runtime']['settingsManager'].getSettingAsBool('screen', 'autodetectSuspendingScreen'):
|
||||||
ignoreScreens.extend(self.env['screen']['autoIgnoreScreens'])
|
ignoreScreens.extend(self.env['screen']['autoIgnoreScreens'])
|
||||||
self.env['runtime']['debug'].writeDebugOut('screenManager:isSuspendingScreen ' + str(ignoreScreens) + ' '+ str(self.env['screen']['newTTY']),debug.debugLevel.INFO)
|
self.env['runtime']['debug'].writeDebugOut('screenManager:isSuspendingScreen ' + str(ignoreScreens) + ' '+ str(self.env['screen']['newTTY']),debug.debugLevel.INFO)
|
||||||
|
try:
|
||||||
|
ignoreFileName = self.env['runtime']['settingsManager'].getSetting('screen', 'suspendingScreenFile')
|
||||||
|
if ignoreFileName != '':
|
||||||
|
if os.access(ignoreFileName, os.R_OK):
|
||||||
|
with open(ignoreFileName) as fp:
|
||||||
|
ignoreScreens.extend(fp.read().replace('\n','').split(','))
|
||||||
|
except:
|
||||||
|
pass
|
||||||
return (screen in ignoreScreens)
|
return (screen in ignoreScreens)
|
||||||
|
|
||||||
def isScreenChange(self):
|
def isScreenChange(self):
|
||||||
|
@ -51,6 +51,7 @@ settingsData = {
|
|||||||
'encoding': 'auto',
|
'encoding': 'auto',
|
||||||
'screenUpdateDelay': 0.1,
|
'screenUpdateDelay': 0.1,
|
||||||
'suspendingScreen': '',
|
'suspendingScreen': '',
|
||||||
|
'suspendingScreenFile': '/tmp/fenrirSuspend',
|
||||||
'autodetectSuspendingScreen': False,
|
'autodetectSuspendingScreen': False,
|
||||||
},
|
},
|
||||||
'general':{
|
'general':{
|
||||||
|
@ -116,6 +116,21 @@ class driver(screenDriver):
|
|||||||
#self.env['runtime']['debug'].writeDebugOut('getSessionInformation:' + str(self.env['screen']['autoIgnoreScreens']) + ' ' + str(self.env['general']) ,debug.debugLevel.INFO)
|
#self.env['runtime']['debug'].writeDebugOut('getSessionInformation:' + str(self.env['screen']['autoIgnoreScreens']) + ' ' + str(self.env['general']) ,debug.debugLevel.INFO)
|
||||||
|
|
||||||
def updateWatchdog(self,active , eventQueue):
|
def updateWatchdog(self,active , eventQueue):
|
||||||
|
screenData = {
|
||||||
|
'columns': 0,
|
||||||
|
'lines': 0,
|
||||||
|
'delta': '',
|
||||||
|
'negativeDelta': '',
|
||||||
|
'attribDelta': '',
|
||||||
|
'cursorAttrib':None,
|
||||||
|
'cursor':{'x':0,'y':0},
|
||||||
|
'Bytes': b'',
|
||||||
|
'Text': '',
|
||||||
|
'Attributes': None,
|
||||||
|
'Scren':'0',
|
||||||
|
'Application': '',
|
||||||
|
'screenUpdateTime': time.time(),
|
||||||
|
}
|
||||||
try:
|
try:
|
||||||
vcsa = {}
|
vcsa = {}
|
||||||
vcsaDevices = glob.glob('/dev/vcsa*')
|
vcsaDevices = glob.glob('/dev/vcsa*')
|
||||||
@ -148,12 +163,12 @@ class driver(screenDriver):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
oldScreen = currScreen
|
oldScreen = currScreen
|
||||||
eventQueue.put({"Type":fenrirEventType.ScreenChanged,"Data":''})
|
|
||||||
try:
|
try:
|
||||||
vcsa[currScreen].seek(0)
|
vcsa[currScreen].seek(0)
|
||||||
lastScreenContent = vcsa[currScreen].read()
|
lastScreenContent = vcsa[currScreen].read()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
eventQueue.put({"Type":fenrirEventType.ScreenChanged,"Data":lastScreenContent})
|
||||||
else:
|
else:
|
||||||
self.env['runtime']['debug'].writeDebugOut('ScreenUpdate',debug.debugLevel.INFO)
|
self.env['runtime']['debug'].writeDebugOut('ScreenUpdate',debug.debugLevel.INFO)
|
||||||
vcsa[currScreen].seek(0)
|
vcsa[currScreen].seek(0)
|
||||||
@ -164,10 +179,10 @@ class driver(screenDriver):
|
|||||||
screenContent = dirtyContent
|
screenContent = dirtyContent
|
||||||
if time.time() - timeout >= 0.4:
|
if time.time() - timeout >= 0.4:
|
||||||
break
|
break
|
||||||
time.sleep(0.008)
|
time.sleep(0.02)
|
||||||
vcsa[currScreen].seek(0)
|
vcsa[currScreen].seek(0)
|
||||||
dirtyContent = vcsa[currScreen].read()
|
dirtyContent = vcsa[currScreen].read()
|
||||||
eventQueue.put({"Type":fenrirEventType.ScreenUpdate,"Data":None})
|
eventQueue.put({"Type":fenrirEventType.ScreenUpdate,"Data":screenContent})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.env['runtime']['debug'].writeDebugOut('VCSA:updateWatchdog:' + str(e),debug.debugLevel.ERROR)
|
self.env['runtime']['debug'].writeDebugOut('VCSA:updateWatchdog:' + str(e),debug.debugLevel.ERROR)
|
||||||
|
|
||||||
@ -272,20 +287,8 @@ class driver(screenDriver):
|
|||||||
return _('Default')
|
return _('Default')
|
||||||
def getFenrirFontSize(self, attribute):
|
def getFenrirFontSize(self, attribute):
|
||||||
return _('Default')
|
return _('Default')
|
||||||
def update(self, trigger='onUpdate'):
|
def update(self, text, trigger='onUpdate'):
|
||||||
if trigger == 'onInput': # no need for an update on input for VCSA
|
newContentBytes = text
|
||||||
return
|
|
||||||
newContentBytes = b''
|
|
||||||
try:
|
|
||||||
# read screen
|
|
||||||
vcsa = open(self.vcsaDevicePath + self.env['screen']['newTTY'],'rb',0)
|
|
||||||
newContentBytes = vcsa.read()
|
|
||||||
vcsa.close()
|
|
||||||
if len(newContentBytes) < 5:
|
|
||||||
return
|
|
||||||
except Exception as e:
|
|
||||||
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
|
|
||||||
return
|
|
||||||
# set new "old" values
|
# set new "old" values
|
||||||
self.env['screen']['oldContentBytes'] = self.env['screen']['newContentBytes']
|
self.env['screen']['oldContentBytes'] = self.env['screen']['newContentBytes']
|
||||||
self.env['screen']['oldContentText'] = self.env['screen']['newContentText']
|
self.env['screen']['oldContentText'] = self.env['screen']['newContentText']
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
from core import debug
|
from core import debug
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import shlex
|
||||||
from core.soundDriver import soundDriver
|
from core.soundDriver import soundDriver
|
||||||
|
|
||||||
class driver(soundDriver):
|
class driver(soundDriver):
|
||||||
@ -30,19 +31,25 @@ class driver(soundDriver):
|
|||||||
return
|
return
|
||||||
if interrupt:
|
if interrupt:
|
||||||
self.cancel()
|
self.cancel()
|
||||||
popenFrequenceCommand = self.frequenceCommand.replace('fenrirVolume', str(self.volume + adjustVolume ))
|
popenFrequenceCommand = shlex.split(self.frequenceCommand)
|
||||||
popenFrequenceCommand = popenFrequenceCommand.replace('fenrirFreqDuration', str(duration))
|
for idx, word in enumerate(popenFrequenceCommand):
|
||||||
popenFrequenceCommand = popenFrequenceCommand.replace('fenrirFrequence', str(frequence))
|
word = word.replace('fenrirVolume', str(self.volume + adjustVolume ))
|
||||||
self.proc = subprocess.Popen(popenFrequenceCommand, shell=True)
|
word = word.replace('fenrirFreqDuration', str(duration))
|
||||||
|
word = word.replace('fenrirFrequence', str(frequence))
|
||||||
|
popenFrequenceCommand[idx] = word
|
||||||
|
self.proc = subprocess.Popen(popenFrequenceCommand, shell=False)
|
||||||
self.soundType = 'frequence'
|
self.soundType = 'frequence'
|
||||||
def playSoundFile(self, filePath, interrupt = True):
|
def playSoundFile(self, filePath, interrupt = True):
|
||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
return
|
return
|
||||||
if interrupt:
|
if interrupt:
|
||||||
self.cancel()
|
self.cancel()
|
||||||
popenSoundFileCommand = self.soundFileCommand.replace('fenrirVolume', str(self.volume ))
|
popenSoundFileCommand = shlex.split(self.soundFileCommand)
|
||||||
popenSoundFileCommand = popenSoundFileCommand.replace('fenrirSoundFile', filePath)
|
for idx, word in enumerate(popenSoundFileCommand):
|
||||||
self.proc = subprocess.Popen(popenSoundFileCommand, shell=True)
|
word = word.replace('fenrirVolume', str(self.volume ))
|
||||||
|
word = word.replace('fenrirSoundFile', str(filePath))
|
||||||
|
popenSoundFileCommand[idx] = word
|
||||||
|
self.proc = subprocess.Popen(popenSoundFileCommand, shell=False)
|
||||||
self.soundType = 'file'
|
self.soundType = 'file'
|
||||||
def cancel(self):
|
def cancel(self):
|
||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
|
26
tools/addScreenToIgnoreList.py
Executable file
26
tools/addScreenToIgnoreList.py
Executable file
@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/python
|
||||||
|
import os
|
||||||
|
|
||||||
|
def addScreenToIgnoreList(ignoreFileName = '/tmp/fenrirSuspend', screen = '1', useCurrentScreen = True):
|
||||||
|
if useCurrentScreen:
|
||||||
|
tty = open('/sys/devices/virtual/tty/tty0/active','r')
|
||||||
|
screen = str(tty.read()[3:-1])
|
||||||
|
ignoreScreens = []
|
||||||
|
ignoreScreensStr = ''
|
||||||
|
if ignoreFileName != '':
|
||||||
|
if os.access(ignoreFileName, os.R_OK):
|
||||||
|
with open(ignoreFileName, 'r') as fp:
|
||||||
|
try:
|
||||||
|
ignoreScreens = fp.read().split(',')#.replace('\n','').split(',')
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
if not screen in ignoreScreens:
|
||||||
|
ignoreScreens.extend(screen)
|
||||||
|
ignoreScreensStr = ','.join(ignoreScreens)
|
||||||
|
|
||||||
|
with open(ignoreFileName, 'w') as fp:
|
||||||
|
fp.write(ignoreScreensStr)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
addScreenToIgnoreList()
|
26
tools/removeScreenFromIgnoreList.py
Executable file
26
tools/removeScreenFromIgnoreList.py
Executable file
@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/python
|
||||||
|
import os
|
||||||
|
|
||||||
|
def removeScreenFromIgnoreList(ignoreFileName = '/tmp/fenrirSuspend', screen = '1', useCurrentScreen = True):
|
||||||
|
if useCurrentScreen:
|
||||||
|
tty = open('/sys/devices/virtual/tty/tty0/active','r')
|
||||||
|
screen = str(tty.read()[3:-1])
|
||||||
|
ignoreScreens = []
|
||||||
|
ignoreScreensStr = ''
|
||||||
|
if ignoreFileName != '':
|
||||||
|
if os.access(ignoreFileName, os.R_OK):
|
||||||
|
with open(ignoreFileName, 'r') as fp:
|
||||||
|
try:
|
||||||
|
ignoreScreens = fp.read().split(',')#.replace('\n','').split(',')
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
if screen in ignoreScreens:
|
||||||
|
ignoreScreens.remove(screen)
|
||||||
|
ignoreScreensStr = ','.join(ignoreScreens)
|
||||||
|
|
||||||
|
with open(ignoreFileName, 'w') as fp:
|
||||||
|
fp.write(ignoreScreensStr)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
removeScreenFromIgnoreList()
|
Loading…
x
Reference in New Issue
Block a user