add soundicon for BarrierMode

This commit is contained in:
chrys 2018-06-18 00:15:25 +02:00
parent 98660d17ac
commit c3f3aeb2e5
7 changed files with 14 additions and 31 deletions

View File

@ -13,6 +13,8 @@ ChangeTTY='ChangeTTY.wav'
StartOfLine='StartOfLine.wav' StartOfLine='StartOfLine.wav'
# Is the last position of the Line # Is the last position of the Line
EndOfLine='EndOfLine.wav' EndOfLine='EndOfLine.wav'
# barrier was detected
BarrierFound='barrier.wav'
# the Line is empty # the Line is empty
EmptyLine='EmptyLine.wav' EmptyLine='EmptyLine.wav'
# Is the first line on the screen. # Is the first line on the screen.

View File

@ -13,6 +13,8 @@ ChangeTTY=''
StartOfLine='' StartOfLine=''
# Is the last position of the Line # Is the last position of the Line
EndOfLine='' EndOfLine=''
# barrier was detected
BarrierFound=''
# the Line is empty # the Line is empty
EmptyLine='' EmptyLine=''
# Is the first line on the screen. # Is the first line on the screen.

View File

@ -48,7 +48,7 @@ class command():
# barrier # barrier
sayLine = currLine sayLine = currLine
if self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'barrier'): if self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'barrier'):
sayLine = self.env['runtime']['textManager'].getBarrierText(sayLine, self.env['screen']['newCursor']['x']) sayLine = self.env['runtime']['barrierManager'].handleLineBarrier(sayLine, self.env['screen']['newCursor']['x'])
# output # output
self.env['runtime']['outputManager'].presentText(sayLine, interrupt=doInterrupt, flush=False) self.env['runtime']['outputManager'].presentText(sayLine, interrupt=doInterrupt, flush=False)
self.lastIdent = currIdent self.lastIdent = currIdent

View File

@ -27,13 +27,12 @@ class command():
#if len(self.env['screen']['newDelta'].strip(' \n\t')) <= 1: #if len(self.env['screen']['newDelta'].strip(' \n\t')) <= 1:
xMove = abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']) xMove = abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x'])
yMove = abs(self.env['screen']['newCursor']['y'] - self.env['screen']['oldCursor']['y']) yMove = abs(self.env['screen']['newCursor']['y'] - self.env['screen']['oldCursor']['y'])
if (xMove >= 1) and xMove == len(self.env['screen']['newDelta']): if (xMove >= 1) and xMove == len(self.env['screen']['newDelta']):
# if len(self.env['screen']['newDelta'].strip(' \n\t0123456789')) <= 2: # if len(self.env['screen']['newDelta'].strip(' \n\t0123456789')) <= 2:
if not '\n' in self.env['screen']['newDelta']: if not '\n' in self.env['screen']['newDelta']:
return return
#if yMove == 1: #print(xMove, yMove, len(self.env['screen']['newDelta']), len(self.env['screen']['newNegativeDelta']))
# if len(self.env['screen']['newDelta'].strip(' \n\t0123456789')) <= 2:
# return
self.env['runtime']['outputManager'].presentText(self.env['screen']['newDelta'], interrupt=False, flush=False) self.env['runtime']['outputManager'].presentText(self.env['screen']['newDelta'], interrupt=False, flush=False)
def setCallback(self, callback): def setCallback(self, callback):

View File

@ -158,18 +158,16 @@ class screenManager():
newScreenText = self.env['screen']['newContentText'][cursorLineStartOffset:cursorLineEndOffset] newScreenText = self.env['screen']['newContentText'][cursorLineStartOffset:cursorLineEndOffset]
#newScreenText = re.sub(' +',' ',newScreenText) #newScreenText = re.sub(' +',' ',newScreenText)
diff = self.differ.compare(oldScreenText, newScreenText) diff = self.differ.compare(oldScreenText, newScreenText)
#diff = difflib.ndiff(oldScreenText, newScreenText)
diffList = list(diff) diffList = list(diff)
typing = True
tempNewDelta = ''.join(x[2:] for x in diffList if x[0] == '+') tempNewDelta = ''.join(x[2:] for x in diffList if x[0] == '+')
if tempNewDelta.strip() != '': if tempNewDelta.strip() != '':
if tempNewDelta != ''.join(newScreenText[self.env['screen']['oldCursor']['x']:self.env['screen']['newCursor']['x']].rstrip()): if tempNewDelta != ''.join(newScreenText[self.env['screen']['oldCursor']['x']:self.env['screen']['newCursor']['x']].rstrip()):
diffList = ['+ ' + self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']]] diffList = ['+ ' + self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] +'\n']
typing = True typing = False
else: else:
diff = self.differ.compare(oldScreenText.split('\n'),\ diff = self.differ.compare(oldScreenText.split('\n'),\
newScreenText.split('\n')) newScreenText.split('\n'))
#diff = difflib.ndiff( oldScreenText.split('\n'),\
# newScreenText.split('\n'))
diffList = list(diff) diffList = list(diff)
if not typing: if not typing:

View File

@ -25,6 +25,7 @@ from fenrirscreenreader.core import textManager
from fenrirscreenreader.core import tableManager from fenrirscreenreader.core import tableManager
from fenrirscreenreader.core import byteManager from fenrirscreenreader.core import byteManager
from fenrirscreenreader.core import attributeManager from fenrirscreenreader.core import attributeManager
from fenrirscreenreader.core import barrierManager
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
@ -327,6 +328,8 @@ class settingsManager():
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'].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)

View File

@ -15,27 +15,6 @@ class textManager():
self.env = environment self.env = environment
def shutdown(self): def shutdown(self):
pass pass
def hasBarrier(self, start, end):
# check for corners here
return True
def getBarrierText(self, line, xCursor):
offset = xCursor
# is the cursor at the begin or end of an entry:
if line[:offset + 1].count('') > line[offset + 1:].count(''):
offset = xCursor - 1
start = line[:offset + 1].rfind('') + 1
end = line[offset + 1:].find('')
if start == end:
return line
if start == -1:
return line
if end == -1:
return line
else:
end += offset + 1
if not self.hasBarrier(start, end):
return line
return line[start:end]
def replaceHeadLines(self, text): def replaceHeadLines(self, text):
# fast len check for bigger typing echo # fast len check for bigger typing echo