add pause after line

This commit is contained in:
chrys 2016-10-18 15:17:20 +02:00
parent f42eafd816
commit d4402d13cf
6 changed files with 14 additions and 3 deletions

View File

@ -100,6 +100,7 @@ debugLevel=0
punctuationProfile=default punctuationProfile=default
punctuationLevel=some punctuationLevel=some
respectPunctuationPause=True respectPunctuationPause=True
newLinePause=True
numberOfClipboards=10 numberOfClipboards=10
emoticons=True emoticons=True
# define the current fenrir key # define the current fenrir key

View File

@ -51,6 +51,7 @@ debugLevel=0
punctuationProfile=default punctuationProfile=default
punctuationLevel=some punctuationLevel=some
respectPunctuationPause=True respectPunctuationPause=True
newLinePause=True
numberOfClipboards=10 numberOfClipboards=10
emoticons=True emoticons=True
fenrirKeys=KEY_KP0 fenrirKeys=KEY_KP0

View File

@ -27,7 +27,7 @@ class command():
if abs(self.env['screenData']['newCursor']['x'] - self.env['screenData']['oldCursor']['x']) >= 1: if abs(self.env['screenData']['newCursor']['x'] - self.env['screenData']['oldCursor']['x']) >= 1:
if len(self.env['screenData']['newDelta']) <= 2: if len(self.env['screenData']['newDelta']) <= 2:
return return
self.env['runtime']['outputManager'].presentText(self.env['screenData']['newDelta'], interrupt=False) self.env['runtime']['outputManager'].presentText(self.env['screenData']['newDelta'], interrupt=False)
def setCallback(self, callback): def setCallback(self, callback):

View File

@ -88,6 +88,8 @@ class outputManager():
try: try:
text = self.env['runtime']['punctuationManager'].proceedPunctuation(text,ignorePunctuation) text = self.env['runtime']['punctuationManager'].proceedPunctuation(text,ignorePunctuation)
text = text.replace('\n',' , ')
self.env['runtime']['speechDriver'].speak(text) self.env['runtime']['speechDriver'].speak(text)
self.env['runtime']['debug'].writeDebugOut("Speak: "+ text,debug.debugLevel.INFO) self.env['runtime']['debug'].writeDebugOut("Speak: "+ text,debug.debugLevel.INFO)
except Exception as e: except Exception as e:

View File

@ -44,6 +44,7 @@ settings = {
'punctuationProfile':'default', 'punctuationProfile':'default',
'punctuationLevel': 'some', 'punctuationLevel': 'some',
'respectPunctuationPause':True, 'respectPunctuationPause':True,
'newLinePause':True,
'numberOfClipboards': 10, 'numberOfClipboards': 10,
'emoticons': True, 'emoticons': True,
'fenrirKeys': ['KEY_KP0','KEY_META'], 'fenrirKeys': ['KEY_KP0','KEY_META'],

View File

@ -116,6 +116,7 @@ class driver():
# changes on the screen # changes on the screen
oldScreenText = re.sub(' +',' ',self.env['runtime']['screenManager'].getWindowAreaInText(self.env['screenData']['oldContentText'])) oldScreenText = re.sub(' +',' ',self.env['runtime']['screenManager'].getWindowAreaInText(self.env['screenData']['oldContentText']))
newScreenText = re.sub(' +',' ',self.env['runtime']['screenManager'].getWindowAreaInText(self.env['screenData']['newContentText'])) newScreenText = re.sub(' +',' ',self.env['runtime']['screenManager'].getWindowAreaInText(self.env['screenData']['newContentText']))
typing = False
if (self.env['screenData']['oldContentText'] != self.env['screenData']['newContentText']) and \ if (self.env['screenData']['oldContentText'] != self.env['screenData']['newContentText']) and \
(self.env['screenData']['newContentText'] != '' ): (self.env['screenData']['newContentText'] != '' ):
if oldScreenText == '' and\ if oldScreenText == '' and\
@ -132,12 +133,17 @@ class driver():
oldScreenText = re.sub(' +',' ',oldScreenText) oldScreenText = re.sub(' +',' ',oldScreenText)
newScreenText = self.env['screenData']['newContentText'][cursorLineStart:cursorLineEnd] newScreenText = self.env['screenData']['newContentText'][cursorLineStart:cursorLineEnd]
newScreenText = re.sub(' +',' ',newScreenText) newScreenText = re.sub(' +',' ',newScreenText)
diff = difflib.ndiff(oldScreenText, newScreenText) diff = difflib.ndiff(oldScreenText, newScreenText)
typing = True
else: else:
diff = difflib.ndiff( oldScreenText.split('\n'),\ diff = difflib.ndiff( oldScreenText.split('\n'),\
newScreenText.split('\n')) newScreenText.split('\n'))
diffList = list(diff) diffList = list(diff)
self.env['screenData']['newDelta'] = ''.join(x[2:] for x in diffList if x[0] == '+') if self.env['runtime']['settingsManager'].getSetting('general', 'newLinePause') and not typing:
self.env['screenData']['newDelta'] = '\n'.join(x[2:] for x in diffList if x[0] == '+')
else:
self.env['screenData']['newDelta'] = ''.join(x[2:] for x in diffList if x[0] == '+')
self.env['screenData']['newNegativeDelta'] = ''.join(x[2:] for x in diffList if x[0] == '-') self.env['screenData']['newNegativeDelta'] = ''.join(x[2:] for x in diffList if x[0] == '-')