merge bleed
This commit is contained in:
commit
1a55f4fe2e
@ -124,16 +124,17 @@ Cleanups:
|
||||
[X] first item
|
||||
[X] last item
|
||||
General:
|
||||
- [X] read ignorescreens from an file to be able to halt fenrir from outside
|
||||
- commands
|
||||
[X] place last spoken to clipboard (Easy for contribution)
|
||||
- Improvend Headline Seperator and Multible Char Support
|
||||
[X]read "13 #" insteed of ###################
|
||||
Braille Support:
|
||||
Driver:
|
||||
[Done] make generic speech driver default
|
||||
[Done] pyttsx3 speech driver (slow -> pyttsx3 framework)
|
||||
[X] make generic speech driver default
|
||||
[X] pyttsx3 speech driver
|
||||
- get information already in watchdogs insteed of mainloop (use eventloop to transport)
|
||||
[Done] InputDriver
|
||||
[X] InputDriver
|
||||
Settings:
|
||||
Application Profiles:
|
||||
Translation:
|
||||
|
@ -122,6 +122,7 @@ driver=vcsaDriver
|
||||
encoding=auto
|
||||
screenUpdateDelay=0.05
|
||||
suspendingScreen=
|
||||
suspendingScreenFile=/tmp/fenrirSuspend
|
||||
autodetectSuspendingScreen=True
|
||||
|
||||
[keyboard]
|
||||
|
@ -124,6 +124,7 @@ driver=vcsaDriver
|
||||
encoding=auto
|
||||
screenUpdateDelay=0.05
|
||||
suspendingScreen=
|
||||
suspendingScreenFile=/tmp/fenrirSuspend
|
||||
autodetectSuspendingScreen=True
|
||||
|
||||
[keyboard]
|
||||
|
@ -125,6 +125,7 @@ driver=vcsaDriver
|
||||
encoding=auto
|
||||
screenUpdateDelay=0.05
|
||||
suspendingScreen=
|
||||
suspendingScreenFile=/tmp/fenrirSuspend
|
||||
autodetectSuspendingScreen=True
|
||||
|
||||
[keyboard]
|
||||
|
@ -79,6 +79,7 @@ driver=vcsaDriver
|
||||
encoding=auto
|
||||
screenUpdateDelay=0.05
|
||||
suspendingScreen=
|
||||
suspendingScreenFile=/tmp/fenrirSuspend
|
||||
autodetectSuspendingScreen=True
|
||||
|
||||
[keyboard]
|
||||
|
@ -124,6 +124,7 @@ driver=vcsaDriver
|
||||
encoding=auto
|
||||
screenUpdateDelay=0.05
|
||||
suspendingScreen=
|
||||
suspendingScreenFile=/tmp/fenrirSuspend
|
||||
autodetectSuspendingScreen=True
|
||||
|
||||
[keyboard]
|
||||
|
@ -80,7 +80,6 @@ class fenrirManager():
|
||||
self.singleKeyCommand = False
|
||||
if self.environment['input']['keyForeward'] > 0:
|
||||
self.environment['input']['keyForeward'] -=1
|
||||
self.environment['runtime']['screenManager'].update('onInput')
|
||||
self.environment['runtime']['commandManager'].executeDefaultTrigger('onInput')
|
||||
#print('handleInput:',time.time() - startTime)
|
||||
def handleExecuteCommand(self, event):
|
||||
@ -94,7 +93,7 @@ class fenrirManager():
|
||||
return
|
||||
self.environment['runtime']['commandManager'].executeCommand( command, 'commands')
|
||||
def handleScreenChange(self, event):
|
||||
self.environment['runtime']['screenManager'].update('onScreenChange')
|
||||
self.environment['runtime']['screenManager'].hanldeScreenChange(event['Data'])
|
||||
'''
|
||||
if self.environment['runtime']['applicationManager'].isApplicationChange():
|
||||
self.environment['runtime']['commandManager'].executeDefaultTrigger('onApplicationChange')
|
||||
@ -103,10 +102,10 @@ class fenrirManager():
|
||||
self.environment['runtime']['applicationManager'].getCurrentApplication())
|
||||
'''
|
||||
self.environment['runtime']['commandManager'].executeDefaultTrigger('onScreenChanged')
|
||||
self.environment['runtime']['screenManager'].update('onScreenChange')
|
||||
self.environment['runtime']['screenDriver'].getCurrScreen()
|
||||
def handleScreenUpdate(self, event):
|
||||
#startTime = time.time()
|
||||
self.environment['runtime']['screenManager'].update('onUpdate')
|
||||
self.environment['runtime']['screenManager'].handleScreenUpdate(event['Data'])
|
||||
'''
|
||||
if self.environment['runtime']['applicationManager'].isApplicationChange():
|
||||
self.environment['runtime']['commandManager'].executeDefaultTrigger('onApplicationChange')
|
||||
|
@ -5,7 +5,7 @@
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from core import debug
|
||||
import time
|
||||
import time, os
|
||||
|
||||
class screenManager():
|
||||
def __init__(self):
|
||||
@ -19,18 +19,18 @@ class screenManager():
|
||||
|
||||
def shutdown(self):
|
||||
self.env['runtime']['settingsManager'].shutdownDriver('screenDriver')
|
||||
|
||||
def update(self, trigger='onUpdate'):
|
||||
def hanldeScreenChange(self, eventData):
|
||||
self.env['runtime']['screenDriver'].getCurrScreen()
|
||||
|
||||
if trigger == 'onScreenChange':
|
||||
self.env['runtime']['screenDriver'].getSessionInformation()
|
||||
|
||||
self.env['screen']['oldApplication'] = self.env['screen']['newApplication']
|
||||
if self.isScreenChange():
|
||||
self.changeBrailleScreen()
|
||||
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() \
|
||||
# or len(self.env['screen']['newDelta']) > 6:
|
||||
# self.env['runtime']['screenDriver'].getCurrApplication()
|
||||
@ -60,6 +60,14 @@ class screenManager():
|
||||
if self.env['runtime']['settingsManager'].getSettingAsBool('screen', 'autodetectSuspendingScreen'):
|
||||
ignoreScreens.extend(self.env['screen']['autoIgnoreScreens'])
|
||||
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)
|
||||
|
||||
def isScreenChange(self):
|
||||
|
@ -51,6 +51,7 @@ settingsData = {
|
||||
'encoding': 'auto',
|
||||
'screenUpdateDelay': 0.1,
|
||||
'suspendingScreen': '',
|
||||
'suspendingScreenFile': '/tmp/fenrirSuspend',
|
||||
'autodetectSuspendingScreen': False,
|
||||
},
|
||||
'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)
|
||||
|
||||
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:
|
||||
vcsa = {}
|
||||
vcsaDevices = glob.glob('/dev/vcsa*')
|
||||
@ -148,12 +163,12 @@ class driver(screenDriver):
|
||||
except:
|
||||
pass
|
||||
oldScreen = currScreen
|
||||
eventQueue.put({"Type":fenrirEventType.ScreenChanged,"Data":''})
|
||||
try:
|
||||
vcsa[currScreen].seek(0)
|
||||
lastScreenContent = vcsa[currScreen].read()
|
||||
except:
|
||||
pass
|
||||
eventQueue.put({"Type":fenrirEventType.ScreenChanged,"Data":lastScreenContent})
|
||||
else:
|
||||
self.env['runtime']['debug'].writeDebugOut('ScreenUpdate',debug.debugLevel.INFO)
|
||||
vcsa[currScreen].seek(0)
|
||||
@ -164,10 +179,10 @@ class driver(screenDriver):
|
||||
screenContent = dirtyContent
|
||||
if time.time() - timeout >= 0.4:
|
||||
break
|
||||
time.sleep(0.008)
|
||||
time.sleep(0.02)
|
||||
vcsa[currScreen].seek(0)
|
||||
dirtyContent = vcsa[currScreen].read()
|
||||
eventQueue.put({"Type":fenrirEventType.ScreenUpdate,"Data":None})
|
||||
eventQueue.put({"Type":fenrirEventType.ScreenUpdate,"Data":screenContent})
|
||||
except Exception as e:
|
||||
self.env['runtime']['debug'].writeDebugOut('VCSA:updateWatchdog:' + str(e),debug.debugLevel.ERROR)
|
||||
|
||||
@ -272,20 +287,8 @@ class driver(screenDriver):
|
||||
return _('Default')
|
||||
def getFenrirFontSize(self, attribute):
|
||||
return _('Default')
|
||||
def update(self, trigger='onUpdate'):
|
||||
if trigger == 'onInput': # no need for an update on input for VCSA
|
||||
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
|
||||
def update(self, text, trigger='onUpdate'):
|
||||
newContentBytes = text
|
||||
# set new "old" values
|
||||
self.env['screen']['oldContentBytes'] = self.env['screen']['newContentBytes']
|
||||
self.env['screen']['oldContentText'] = self.env['screen']['newContentText']
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
from core import debug
|
||||
import subprocess
|
||||
import shlex
|
||||
from core.soundDriver import soundDriver
|
||||
|
||||
class driver(soundDriver):
|
||||
@ -30,19 +31,25 @@ class driver(soundDriver):
|
||||
return
|
||||
if interrupt:
|
||||
self.cancel()
|
||||
popenFrequenceCommand = self.frequenceCommand.replace('fenrirVolume', str(self.volume + adjustVolume ))
|
||||
popenFrequenceCommand = popenFrequenceCommand.replace('fenrirFreqDuration', str(duration))
|
||||
popenFrequenceCommand = popenFrequenceCommand.replace('fenrirFrequence', str(frequence))
|
||||
self.proc = subprocess.Popen(popenFrequenceCommand, shell=True)
|
||||
popenFrequenceCommand = shlex.split(self.frequenceCommand)
|
||||
for idx, word in enumerate(popenFrequenceCommand):
|
||||
word = word.replace('fenrirVolume', str(self.volume + adjustVolume ))
|
||||
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'
|
||||
def playSoundFile(self, filePath, interrupt = True):
|
||||
if not self._initialized:
|
||||
return
|
||||
if interrupt:
|
||||
self.cancel()
|
||||
popenSoundFileCommand = self.soundFileCommand.replace('fenrirVolume', str(self.volume ))
|
||||
popenSoundFileCommand = popenSoundFileCommand.replace('fenrirSoundFile', filePath)
|
||||
self.proc = subprocess.Popen(popenSoundFileCommand, shell=True)
|
||||
popenSoundFileCommand = shlex.split(self.soundFileCommand)
|
||||
for idx, word in enumerate(popenSoundFileCommand):
|
||||
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'
|
||||
def cancel(self):
|
||||
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…
Reference in New Issue
Block a user