Merge pull request #12 from chrys87/event

Merge Event to Master
This commit is contained in:
chrys87 2017-05-10 13:51:25 +02:00 committed by GitHub
commit 917327724d
90 changed files with 512 additions and 358 deletions

12
play zone/argp.py Executable file
View File

@ -0,0 +1,12 @@
#!/bin/python3
import argparse
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('-o', '--options', metavar='SECTION:SETTING=VALUE,..', default='', help='Overwrite options in given settings file')
args = parser.parse_args()
parser.print_help()
print(args.setting)

View File

@ -1,24 +0,0 @@
#!/bin/python3
import sys, os
import pty
mode = 'wb'
shell = '/bin/bash'
if 'SHELL' in os.environ:
shell = os.environ['SHELL']
filename = '/home/chrys/mytypescript.txt'
script = open(filename, mode)
def read(fd):
data = os.read(fd, 1024)
script.write(data)
return data
def write(fd):
data = os.read(fd, 1024)
return data
pty.spawn(shell, read, write)

34
play zone/pyterm.py Executable file
View File

@ -0,0 +1,34 @@
#!/bin/python3
import sys, os
import pty
import pyte
class FenrirTermStream(pyte.Stream):
def __init__(self):
super().__init__()
def attach(self, screen):
super().attach(screen)
def feed(self, text):
super().feed(text)
class FenrirTermEmu():
def __init__(self):
self.shell = '/bin/bash'
if 'SHELL' in os.environ:
self.shell = os.environ['SHELL']
self.screen = pyte.Screen(80,24)
self.stream = FenrirTermStream()
self.stream.attach(self.screen)
def outputCallback(self, fd):
data = os.read(fd, 1024)
self.stream.feed(data.decode('UTF8'))
# alles
print(self.screen.display)
# input
print(data.decode('UTF8'))
return data
def inputCallback(self, fd):
data = os.read(fd, 1024)
return data
def startEmulator(self):
pty.spawn(self.shell, self.outputCallback, self.inputCallback)

View File

@ -40,7 +40,7 @@ class command():
return return
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
# get the word # get the word
newContent = self.env['screenData']['newContentText'].split('\n')[cursorPos['y']] newContent = self.env['screen']['newContentText'].split('\n')[cursorPos['y']]
x, y, currWord, endOfScreen, lineBreak = word_utils.getCurrentWord(cursorPos['x'], 0, newContent) x, y, currWord, endOfScreen, lineBreak = word_utils.getCurrentWord(cursorPos['x'], 0, newContent)
currWord = currWord.strip(string.whitespace + '!"#$%&\()*+,-./:;<=§>?@[\\]^_{|}~') currWord = currWord.strip(string.whitespace + '!"#$%&\()*+,-./:;<=§>?@[\\]^_{|}~')

View File

@ -35,10 +35,10 @@ class command():
startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy() startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy()
if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']: if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']:
endMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'].copy() endMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'].copy()
marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screenData']['newContentText']) marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screen']['newContentText'])
else: else:
x, y, marked = \ x, y, marked = \
line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screenData']['newContentText']) line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screen']['newContentText'])
if marked.isspace(): if marked.isspace():
self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True) self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True)
else: else:

View File

@ -35,10 +35,10 @@ class command():
startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy() startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy()
if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']: if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']:
endMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'].copy() endMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'].copy()
marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screenData']['newContentText']) marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screen']['newContentText'])
else: else:
x, y, marked = \ x, y, marked = \
line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screenData']['newContentText']) line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screen']['newContentText'])
if marked.isspace(): if marked.isspace():
self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True) self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True)
else: else:

View File

@ -35,10 +35,10 @@ class command():
startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy() startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy()
if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']: if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']:
endMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'].copy() endMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'].copy()
marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screenData']['newContentText']) marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screen']['newContentText'])
else: else:
x, y, marked = \ x, y, marked = \
line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screenData']['newContentText']) line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screen']['newContentText'])
if marked.isspace(): if marked.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True) self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True)
else: else:

View File

@ -35,10 +35,10 @@ class command():
startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy() startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy()
if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']: if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']:
endMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'].copy() endMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'].copy()
marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screenData']['newContentText']) marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screen']['newContentText'])
else: else:
x, y, marked = \ x, y, marked = \
line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screenData']['newContentText']) line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screen']['newContentText'])
if marked.isspace(): if marked.isspace():
self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True) self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True)
else: else:

View File

@ -35,10 +35,10 @@ class command():
startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy() startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy()
if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']: if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']:
endMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'].copy() endMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'].copy()
marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screenData']['newContentText']) marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screen']['newContentText'])
else: else:
x, y, marked = \ x, y, marked = \
line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screenData']['newContentText']) line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screen']['newContentText'])
if marked.isspace(): if marked.isspace():
self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True) self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True)
else: else:

View File

@ -35,10 +35,10 @@ class command():
startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy() startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy()
if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']: if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']:
endMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'].copy() endMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'].copy()
marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screenData']['newContentText']) marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screen']['newContentText'])
else: else:
x, y, marked = \ x, y, marked = \
line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screenData']['newContentText']) line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screen']['newContentText'])
if marked.isspace(): if marked.isspace():
self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True) self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True)
else: else:

View File

@ -35,10 +35,10 @@ class command():
startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy() startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy()
if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']: if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']:
endMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'].copy() endMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'].copy()
marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screenData']['newContentText']) marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screen']['newContentText'])
else: else:
x, y, marked = \ x, y, marked = \
line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screenData']['newContentText']) line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screen']['newContentText'])
if marked.isspace(): if marked.isspace():
self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True) self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True)
else: else:

View File

@ -35,10 +35,10 @@ class command():
startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy() startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy()
if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']: if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']:
endMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'].copy() endMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'].copy()
marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screenData']['newContentText']) marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screen']['newContentText'])
else: else:
x, y, marked = \ x, y, marked = \
line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screenData']['newContentText']) line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screen']['newContentText'])
if marked.isspace(): if marked.isspace():
self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True) self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True)
else: else:

View File

@ -35,10 +35,10 @@ class command():
startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy() startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy()
if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']: if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']:
endMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'].copy() endMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'].copy()
marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screenData']['newContentText']) marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screen']['newContentText'])
else: else:
x, y, marked = \ x, y, marked = \
line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screenData']['newContentText']) line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screen']['newContentText'])
if marked.isspace(): if marked.isspace():
self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True) self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True)
else: else:

View File

@ -35,10 +35,10 @@ class command():
startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy() startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy()
if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']: if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']:
endMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'].copy() endMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'].copy()
marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screenData']['newContentText']) marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screen']['newContentText'])
else: else:
x, y, marked = \ x, y, marked = \
line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screenData']['newContentText']) line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screen']['newContentText'])
if marked.isspace(): if marked.isspace():
self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True) self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True)
else: else:

View File

@ -28,7 +28,7 @@ class command():
startMark = self.env['commandBuffer']['Marks']['1'].copy() startMark = self.env['commandBuffer']['Marks']['1'].copy()
endMark = self.env['commandBuffer']['Marks']['2'].copy() endMark = self.env['commandBuffer']['Marks']['2'].copy()
marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screenData']['newContentText']) marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screen']['newContentText'])
self.env['commandBuffer']['clipboard'] = [marked] + self.env['commandBuffer']['clipboard'][:self.env['runtime']['settingsManager'].getSettingAsInt('general', 'numberOfClipboards') -1] self.env['commandBuffer']['clipboard'] = [marked] + self.env['commandBuffer']['clipboard'][:self.env['runtime']['settingsManager'].getSettingAsInt('general', 'numberOfClipboards') -1]
self.env['commandBuffer']['currClipboard'] = 0 self.env['commandBuffer']['currClipboard'] = 0

View File

@ -17,10 +17,10 @@ class command():
return _('reads the contents of the current screen') return _('reads the contents of the current screen')
def run(self): def run(self):
if self.env['screenData']['newContentText'].isspace(): if self.env['screen']['newContentText'].isspace():
self.env['runtime']['outputManager'].presentText(_("screen is empty"), soundIcon='EmptyLine', interrupt=True) self.env['runtime']['outputManager'].presentText(_("screen is empty"), soundIcon='EmptyLine', interrupt=True)
else: else:
self.env['runtime']['outputManager'].presentText(self.env['screenData']['newContentText'],interrupt=True) self.env['runtime']['outputManager'].presentText(self.env['screen']['newContentText'],interrupt=True)
def setCallback(self, callback): def setCallback(self, callback):
pass pass

View File

@ -21,7 +21,7 @@ class command():
# Prefer review cursor over text cursor # Prefer review cursor over text cursor
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
textAfterCursor = mark_utils.getTextAfterMark(cursorPos, self.env['screenData']['newContentText']) textAfterCursor = mark_utils.getTextAfterMark(cursorPos, self.env['screen']['newContentText'])
if textAfterCursor.isspace(): if textAfterCursor.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True) self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True)

View File

@ -19,12 +19,12 @@ class command():
def run(self): def run(self):
# Prefer review cursor over text cursor # Prefer review cursor over text cursor
if self.env['screenData']['newCursorReview']: if self.env['screen']['newCursorReview']:
cursorPos = self.env['screenData']['newCursorReview'].copy() cursorPos = self.env['screen']['newCursorReview'].copy()
else: else:
cursorPos = self.env['screenData']['newCursor'].copy() cursorPos = self.env['screen']['newCursor'].copy()
textBeforeCursor = mark_utils.getTextBeforeMark(cursorPos, self.env['screenData']['newContentText']) textBeforeCursor = mark_utils.getTextBeforeMark(cursorPos, self.env['screen']['newContentText'])
if textBeforeCursor.isspace(): if textBeforeCursor.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True) self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True)

View File

@ -21,7 +21,7 @@ class command():
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
x, y, currLine = \ x, y, currLine = \
line_utils.getCurrentLine(cursorPos['x'], cursorPos['y'], self.env['screenData']['newContentText']) line_utils.getCurrentLine(cursorPos['x'], cursorPos['y'], self.env['screen']['newContentText'])
if currLine.isspace(): if currLine.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True) self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True)

View File

@ -46,7 +46,7 @@ class command():
print('4') print('4')
return return
print('doit') print('doit')
p = Popen('su -c "echo -n \"' + self.env['commandBuffer']['clipboard'][currClipboard] +'\" | xclip -d :0 -selection c' + self.env['generalInformation']['currUser'] , stdout=PIPE, stderr=PIPE, shell=True) p = Popen('su -c "echo -n \"' + self.env['commandBuffer']['clipboard'][currClipboard] +'\" | xclip -d :0 -selection c' + self.env['general']['currUser'] , stdout=PIPE, stderr=PIPE, shell=True)
stdout, stderr = p.communicate() stdout, stderr = p.communicate()
self.env['runtime']['outputManager'].interruptOutput() self.env['runtime']['outputManager'].interruptOutput()
screenEncoding = self.env['runtime']['settingsManager'].getSetting('screen', 'encoding') screenEncoding = self.env['runtime']['settingsManager'].getSetting('screen', 'encoding')

View File

@ -20,12 +20,12 @@ class command():
def run(self): def run(self):
# Prefer review cursor over text cursor # Prefer review cursor over text cursor
if self.env['screenData']['newCursorReview']: if self.env['screen']['newCursorReview']:
cursorPos = self.env['screenData']['newCursorReview'].copy() cursorPos = self.env['screen']['newCursorReview'].copy()
else: else:
cursorPos = self.env['screenData']['newCursor'].copy() cursorPos = self.env['screen']['newCursor'].copy()
x, y, currLine = \ x, y, currLine = \
line_utils.getCurrentLine(cursorPos['x'], cursorPos['y'], self.env['screenData']['newContentText']) line_utils.getCurrentLine(cursorPos['x'], cursorPos['y'], self.env['screen']['newContentText'])
if currLine.isspace(): if currLine.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True) self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True)

View File

@ -17,7 +17,7 @@ class command():
return _('displays the last received text') return _('displays the last received text')
def run(self): def run(self):
self.env['runtime']['outputManager'].presentText(self.env['screenData']['newDelta'], interrupt=True) self.env['runtime']['outputManager'].presentText(self.env['screen']['newDelta'], interrupt=True)
def setCallback(self, callback): def setCallback(self, callback):
pass pass

View File

@ -27,7 +27,7 @@ class command():
startMark = self.env['commandBuffer']['Marks']['1'].copy() startMark = self.env['commandBuffer']['Marks']['1'].copy()
endMark = self.env['commandBuffer']['Marks']['2'].copy() endMark = self.env['commandBuffer']['Marks']['2'].copy()
marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screenData']['newContentText']) marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screen']['newContentText'])
if marked.isspace(): if marked.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True) self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True)

View File

@ -19,7 +19,7 @@ class command():
def run(self): def run(self):
x, y, firstLine = \ x, y, firstLine = \
line_utils.getCurrentLine(0, 0, self.env['screenData']['newContentText']) line_utils.getCurrentLine(0, 0, self.env['screen']['newContentText'])
if firstLine.isspace(): if firstLine.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True) self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True)

View File

@ -19,7 +19,7 @@ class command():
def run(self): def run(self):
x, y, lastLine = \ x, y, lastLine = \
line_utils.getCurrentLine(0, self.env['screenData']['lines'] -1, self.env['screenData']['newContentText']) line_utils.getCurrentLine(0, self.env['screen']['lines'] -1, self.env['screen']['newContentText'])
if lastLine.isspace(): if lastLine.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True) self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True)

View File

@ -17,7 +17,7 @@ class command():
return _('exits Fenrir') return _('exits Fenrir')
def run(self): def run(self):
self.env['generalInformation']['running'] = False self.env['general']['running'] = False
def setCallback(self, callback): def setCallback(self, callback):
pass pass

View File

@ -42,7 +42,7 @@ class command():
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
# get the word # get the word
newContent = self.env['screenData']['newContentText'].split('\n')[cursorPos['y']] newContent = self.env['screen']['newContentText'].split('\n')[cursorPos['y']]
x, y, currWord, endOfScreen, lineBreak = word_utils.getCurrentWord(cursorPos['x'], 0, newContent) x, y, currWord, endOfScreen, lineBreak = word_utils.getCurrentWord(cursorPos['x'], 0, newContent)
currWord = currWord.strip(string.whitespace + '!"#$%&\()*+,-./:;<=§>?@[\\]^_{|}~') currWord = currWord.strip(string.whitespace + '!"#$%&\()*+,-./:;<=§>?@[\\]^_{|}~')
if not currWord.isspace(): if not currWord.isspace():

View File

@ -17,7 +17,7 @@ class command():
return _('move review to bottom of screen') return _('move review to bottom of screen')
def run(self): def run(self):
self.env['screenData']['newCursorReview'] = { 'x': 0, 'y':self.env['screenData']['lines'] -1} self.env['screen']['newCursorReview'] = { 'x': 0, 'y':self.env['screen']['lines'] -1}
self.env['runtime']['outputManager'].presentText(_("Bottom"), interrupt=True, flush=False) self.env['runtime']['outputManager'].presentText(_("Bottom"), interrupt=True, flush=False)
def setCallback(self, callback): def setCallback(self, callback):

View File

@ -20,8 +20,8 @@ class command():
def run(self): def run(self):
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currChar = \ self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currChar = \
char_utils.getCurrentChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) char_utils.getCurrentChar(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
self.env['runtime']['outputManager'].presentText(currChar ,interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) self.env['runtime']['outputManager'].presentText(currChar ,interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False)

View File

@ -20,8 +20,8 @@ class command():
def run(self): def run(self):
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currChar = \ self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currChar = \
char_utils.getCurrentChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) char_utils.getCurrentChar(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
if currChar.isspace(): if currChar.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False) self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False)

View File

@ -20,8 +20,8 @@ class command():
def run(self): def run(self):
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currLine = \ self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currLine = \
line_utils.getCurrentLine(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) line_utils.getCurrentLine(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
if currLine.isspace(): if currLine.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False) self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False)

View File

@ -20,8 +20,8 @@ class command():
def run(self): def run(self):
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currWord, endOfScreen, lineBreak = \ self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currWord, endOfScreen, lineBreak = \
word_utils.getCurrentWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) word_utils.getCurrentWord(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
if currWord.isspace(): if currWord.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False) self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False)

View File

@ -20,8 +20,8 @@ class command():
def run(self): def run(self):
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currWord, endOfScreen, lineBreak = \ self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currWord, endOfScreen, lineBreak = \
word_utils.getCurrentWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) word_utils.getCurrentWord(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
if currWord.isspace(): if currWord.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False) self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False)

View File

@ -19,8 +19,8 @@ class command():
def run(self): def run(self):
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], downChar, endOfScreen = \ self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], downChar, endOfScreen = \
char_utils.getDownChar(self.env['screenData']['newCursorReview']['x'],self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) char_utils.getDownChar(self.env['screen']['newCursorReview']['x'],self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
self.env['runtime']['outputManager'].presentText(downChar ,interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) self.env['runtime']['outputManager'].presentText(downChar ,interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False)
if endOfScreen: if endOfScreen:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'):

View File

@ -20,8 +20,8 @@ class command():
def run(self): def run(self):
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
self.env['runtime']['cursorManager'].setReviewCursorPosition(0 ,cursorPos['y']) self.env['runtime']['cursorManager'].setReviewCursorPosition(0 ,cursorPos['y'])
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currChar = \ self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currChar = \
char_utils.getCurrentChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) char_utils.getCurrentChar(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
if currChar.isspace(): if currChar.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False) self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False)

View File

@ -19,9 +19,9 @@ class command():
def run(self): def run(self):
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
self.env['runtime']['cursorManager'].setReviewCursorPosition(self.env['screenData']['columns']-1 ,cursorPos['y']) self.env['runtime']['cursorManager'].setReviewCursorPosition(self.env['screen']['columns']-1 ,cursorPos['y'])
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currChar = \ self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currChar = \
char_utils.getCurrentChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) char_utils.getCurrentChar(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
self.env['runtime']['outputManager'].presentText(currChar ,interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) self.env['runtime']['outputManager'].presentText(currChar ,interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False)
self.env['runtime']['outputManager'].presentText(_("end of line"), interrupt=False) self.env['runtime']['outputManager'].presentText(_("end of line"), interrupt=False)

View File

@ -21,13 +21,13 @@ class command():
def run(self): def run(self):
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
x, y, currLine = \ x, y, currLine = \
line_utils.getCurrentLine(cursorPos['x'], cursorPos['y'], self.env['screenData']['newContentText']) line_utils.getCurrentLine(cursorPos['x'], cursorPos['y'], self.env['screen']['newContentText'])
if currLine.isspace(): if currLine.isspace():
self.env['runtime']['outputManager'].presentText(_("line is empty"), interrupt=True) self.env['runtime']['outputManager'].presentText(_("line is empty"), interrupt=True)
return return
self.env['runtime']['cursorManager'].setReviewCursorPosition((len(currLine) - len(currLine.lstrip())), cursorPos['y']) self.env['runtime']['cursorManager'].setReviewCursorPosition((len(currLine) - len(currLine.lstrip())), cursorPos['y'])
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currChar = \ self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currChar = \
char_utils.getCurrentChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) char_utils.getCurrentChar(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
self.env['runtime']['outputManager'].presentText(currChar ,interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) self.env['runtime']['outputManager'].presentText(currChar ,interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False)
self.env['runtime']['outputManager'].presentText(_("first char in line indent {0}").format(str(len(currLine) - len(currLine.lstrip()))), interrupt=False) self.env['runtime']['outputManager'].presentText(_("first char in line indent {0}").format(str(len(currLine) - len(currLine.lstrip()))), interrupt=False)

View File

@ -19,9 +19,9 @@ class command():
def run(self): def run(self):
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
self.env['runtime']['cursorManager'].setReviewCursorPosition(self.env['screenData']['columns']-1 ,cursorPos['y']) self.env['runtime']['cursorManager'].setReviewCursorPosition(self.env['screen']['columns']-1 ,cursorPos['y'])
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], lastChar = \ self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], lastChar = \
char_utils.getLastCharInLine(self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) char_utils.getLastCharInLine(self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
self.env['runtime']['outputManager'].presentText(lastChar ,interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) self.env['runtime']['outputManager'].presentText(lastChar ,interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False)
self.env['runtime']['outputManager'].presentText(_("last char in line"), interrupt=False) self.env['runtime']['outputManager'].presentText(_("last char in line"), interrupt=False)

View File

@ -19,8 +19,8 @@ class command():
def run(self): def run(self):
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], nextChar, endOfScreen, lineBreak = \ self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], nextChar, endOfScreen, lineBreak = \
char_utils.getNextChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) char_utils.getNextChar(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
self.env['runtime']['outputManager'].presentText(nextChar, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) self.env['runtime']['outputManager'].presentText(nextChar, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False)
if endOfScreen: if endOfScreen:

View File

@ -20,8 +20,8 @@ class command():
def run(self): def run(self):
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], nextChar, endOfScreen, lineBreak = \ self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], nextChar, endOfScreen, lineBreak = \
char_utils.getNextChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) char_utils.getNextChar(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
nextChar = char_utils.getPhonetic(nextChar) nextChar = char_utils.getPhonetic(nextChar)
self.env['runtime']['outputManager'].presentText(nextChar ,interrupt=True, announceCapital=True, flush=False) self.env['runtime']['outputManager'].presentText(nextChar ,interrupt=True, announceCapital=True, flush=False)

View File

@ -18,12 +18,12 @@ class command():
return _('moves review to the next line and presents it') return _('moves review to the next line and presents it')
def run(self): def run(self):
self.env['screenData']['oldCursorReview'] = self.env['screenData']['newCursorReview'] self.env['screen']['oldCursorReview'] = self.env['screen']['newCursorReview']
if not self.env['screenData']['newCursorReview']: if not self.env['screen']['newCursorReview']:
self.env['screenData']['newCursorReview'] = self.env['screenData']['newCursor'].copy() self.env['screen']['newCursorReview'] = self.env['screen']['newCursor'].copy()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], nextLine, endOfScreen = \ self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], nextLine, endOfScreen = \
line_utils.getNextLine(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) line_utils.getNextLine(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
if nextLine.isspace(): if nextLine.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False) self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False)

View File

@ -18,12 +18,12 @@ class command():
return _('moves review to the next word and presents it') return _('moves review to the next word and presents it')
def run(self): def run(self):
self.env['screenData']['oldCursorReview'] = self.env['screenData']['newCursorReview'] self.env['screen']['oldCursorReview'] = self.env['screen']['newCursorReview']
if self.env['screenData']['newCursorReview'] == None: if self.env['screen']['newCursorReview'] == None:
self.env['screenData']['newCursorReview'] = self.env['screenData']['newCursor'].copy() self.env['screen']['newCursorReview'] = self.env['screen']['newCursor'].copy()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], nextWord, endOfScreen, lineBreak = \ self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], nextWord, endOfScreen, lineBreak = \
word_utils.getNextWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) word_utils.getNextWord(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
if nextWord.isspace(): if nextWord.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False) self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False)

View File

@ -20,8 +20,8 @@ class command():
def run(self): def run(self):
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], nextWord, endOfScreen, lineBreak = \ self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], nextWord, endOfScreen, lineBreak = \
word_utils.getNextWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) word_utils.getNextWord(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
if nextWord.isspace(): if nextWord.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False) self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False)

View File

@ -18,12 +18,12 @@ class command():
return _('moves review to the previous character and presents it') return _('moves review to the previous character and presents it')
def run(self): def run(self):
self.env['screenData']['oldCursorReview'] = self.env['screenData']['newCursorReview'] self.env['screen']['oldCursorReview'] = self.env['screen']['newCursorReview']
if not self.env['screenData']['newCursorReview']: if not self.env['screen']['newCursorReview']:
self.env['screenData']['newCursorReview'] = self.env['screenData']['newCursor'].copy() self.env['screen']['newCursorReview'] = self.env['screen']['newCursor'].copy()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], prevChar, endOfScreen, lineBreak = \ self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], prevChar, endOfScreen, lineBreak = \
char_utils.getPrevChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) char_utils.getPrevChar(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
self.env['runtime']['outputManager'].presentText(prevChar, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) self.env['runtime']['outputManager'].presentText(prevChar, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False)
if endOfScreen: if endOfScreen:

View File

@ -20,8 +20,8 @@ class command():
def run(self): def run(self):
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], prevChar, endOfScreen, lineBreak = \ self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], prevChar, endOfScreen, lineBreak = \
char_utils.getPrevChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) char_utils.getPrevChar(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
prevChar = char_utils.getPhonetic(prevChar) prevChar = char_utils.getPhonetic(prevChar)
self.env['runtime']['outputManager'].presentText(prevChar ,interrupt=True, announceCapital=True, flush=False) self.env['runtime']['outputManager'].presentText(prevChar ,interrupt=True, announceCapital=True, flush=False)

View File

@ -20,8 +20,8 @@ class command():
def run(self): def run(self):
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], prevLine, endOfScreen = \ self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], prevLine, endOfScreen = \
line_utils.getPrevLine(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) line_utils.getPrevLine(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
if prevLine.isspace(): if prevLine.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False) self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False)

View File

@ -20,8 +20,8 @@ class command():
def run(self): def run(self):
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], prevWord, endOfScreen, lineBreak = \ self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], prevWord, endOfScreen, lineBreak = \
word_utils.getPrevWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) word_utils.getPrevWord(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
if prevWord.isspace(): if prevWord.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False) self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False)

View File

@ -20,8 +20,8 @@ class command():
def run(self): def run(self):
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], prevWord, endOfScreen, lineBreak = \ self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], prevWord, endOfScreen, lineBreak = \
word_utils.getPrevWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) word_utils.getPrevWord(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
if prevWord.isspace(): if prevWord.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False) self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False)

View File

@ -18,7 +18,7 @@ class command():
return _('move review to top of screen') return _('move review to top of screen')
def run(self): def run(self):
self.env['screenData']['newCursorReview'] = {'x':0,'y':0} self.env['screen']['newCursorReview'] = {'x':0,'y':0}
self.env['runtime']['outputManager'].presentText(_("Top"), interrupt=True, flush=False) self.env['runtime']['outputManager'].presentText(_("Top"), interrupt=True, flush=False)
def setCallback(self, callback): def setCallback(self, callback):

View File

@ -19,8 +19,8 @@ class command():
def run(self): def run(self):
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], upChar, endOfScreen = \ self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], upChar, endOfScreen = \
char_utils.getUpChar(self.env['screenData']['newCursorReview']['x'],self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) char_utils.getUpChar(self.env['screen']['newCursorReview']['x'],self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
self.env['runtime']['outputManager'].presentText(upChar ,interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) self.env['runtime']['outputManager'].presentText(upChar ,interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False)
if endOfScreen: if endOfScreen:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'):

View File

@ -44,7 +44,7 @@ class command():
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
# get the word # get the word
newContent = self.env['screenData']['newContentText'].split('\n')[cursorPos['y']] newContent = self.env['screen']['newContentText'].split('\n')[cursorPos['y']]
x, y, currWord, endOfScreen, lineBreak = word_utils.getCurrentWord(cursorPos['x'], 0, newContent) x, y, currWord, endOfScreen, lineBreak = word_utils.getCurrentWord(cursorPos['x'], 0, newContent)
if not currWord.isspace(): if not currWord.isspace():

View File

@ -14,13 +14,13 @@ class command():
def shutdown(self): def shutdown(self):
pass pass
def getDescription(self): def getDescription(self):
self.env['generalInformation']['tutorialMode'] = False self.env['general']['tutorialMode'] = False
return _('You are leaving the tutorial mode. Press that shortcut again to enter the tutorial mode again.') return _('You are leaving the tutorial mode. Press that shortcut again to enter the tutorial mode again.')
def run(self): def run(self):
text = _('you entered the tutorial mode. In that mode the commands are not executed. but you get a description of what the shortcut does. To leave the tutorial mode, press that shortcut again.') text = _('you entered the tutorial mode. In that mode the commands are not executed. but you get a description of what the shortcut does. To leave the tutorial mode, press that shortcut again.')
self.env['runtime']['outputManager'].presentText(text, interrupt=True) self.env['runtime']['outputManager'].presentText(text, interrupt=True)
self.env['generalInformation']['tutorialMode'] = True self.env['general']['tutorialMode'] = True
def setCallback(self, callback): def setCallback(self, callback):
pass pass

View File

@ -1,25 +1,25 @@
#!/bin/python #!/bi[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]/py[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]ho[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]
# -*- coding: utf-8 -*- # -*- [['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]odi[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]g: u[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]f-8 -*-
# Fenrir TTY screen reader # F[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]i[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']] TTY [['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']] [['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]d[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]
# By Chrys, Storm Dragon, and contributers. # By Ch[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]y[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']], S[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]o[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]m [['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]go[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']], [['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]d [['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]o[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]ibu[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']].
from core import debug f[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]om [['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]o[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']] impo[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']] d[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]bug
class command(): [['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]l[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']] [['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]omm[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]d():
def __init__(self): d[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]f __i[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]i[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]__([['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]lf):
pass p[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]
def initialize(self, environment): d[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]f i[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]i[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]i[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]liz[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]([['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]lf, [['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]vi[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]o[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]m[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]):
self.env = environment [['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]lf.[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]v = [['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]vi[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]o[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]m[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]
def shutdown(self): d[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]f [['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]hu[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]dow[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]([['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]lf):
pass p[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]
def getDescription(self): d[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]f g[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]ip[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]io[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]([['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]lf):
return 'No description found' [['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]u[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']] [['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]No d[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]ip[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]io[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']] fou[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]d[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]
def run(self): d[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]f [['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]u[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]([['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]lf):
#print('new ', self.env['screenData']['newApplication']) #p[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]i[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]([['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]w [['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']], [['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]lf.[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]v[[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]][[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]wAppli[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]io[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]])
#print('old ', self.env['screenData']['oldApplication']) #p[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]i[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]([['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]old [['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']], [['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]lf.[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]v[[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]][[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]oldAppli[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]io[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]])
#print('-----------') #p[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]i[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]([['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]-----------[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']])
pass p[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]
def setCallback(self, callback): d[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]f [['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]C[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]llb[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]k([['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]lf, [['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]llb[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]k):
pass p[['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']][['screen']['screen']['screen']['screen']['screen']['screen']['screen']['screen']]

View File

@ -35,7 +35,7 @@ class command():
# is it a horizontal change? # is it a horizontal change?
if not self.env['runtime']['cursorManager'].isCursorHorizontalMove(): if not self.env['runtime']['cursorManager'].isCursorHorizontalMove():
return return
x, y, currChar = char_utils.getCurrentChar(self.env['screenData']['newCursor']['x'], self.env['screenData']['newCursor']['y'], self.env['screenData']['newContentText']) x, y, currChar = char_utils.getCurrentChar(self.env['screen']['newCursor']['x'], self.env['screen']['newCursor']['y'], self.env['screen']['newContentText'])
if not currChar.isspace(): if not currChar.isspace():
self.env['runtime']['outputManager'].presentText(currChar, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) self.env['runtime']['outputManager'].presentText(currChar, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False)
def setCallback(self, callback): def setCallback(self, callback):

View File

@ -20,16 +20,16 @@ class command():
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'charEcho'): if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'charEcho'):
return return
# detect deletion or chilling # detect deletion or chilling
if self.env['screenData']['newCursor']['x'] <= self.env['screenData']['oldCursor']['x']: if self.env['screen']['newCursor']['x'] <= self.env['screen']['oldCursor']['x']:
return return
# is there any change? # is there any change?
if not self.env['runtime']['screenManager'].isDelta(): if not self.env['runtime']['screenManager'].isDelta():
return return
# big changes are no char (but the value is bigger than one maybe the differ needs longer than you can type, so a little strange random buffer for now) # big changes are no char (but the value is bigger than one maybe the differ needs longer than you can type, so a little strange random buffer for now)
if len(self.env['screenData']['newDelta']) > 3: if len(self.env['screen']['newDelta']) > 3:
return return
# filter unneded space on word begin # filter unneded space on word begin
currDelta = self.env['screenData']['newDelta'] currDelta = self.env['screen']['newDelta']
if len(currDelta.strip()) != len(currDelta) and \ if len(currDelta.strip()) != len(currDelta) and \
currDelta.strip() != '': currDelta.strip() != '':
currDelta = currDelta.strip() currDelta = currDelta.strip()

View File

@ -26,14 +26,14 @@ class command():
return return
# this leads to problems in vim -> status line change -> no announcement, so we do check the lengh as hack # this leads to problems in vim -> status line change -> no announcement, so we do check the lengh as hack
if self.env['runtime']['screenManager'].isDelta(): if self.env['runtime']['screenManager'].isDelta():
if len(self.env['screenData']['newDelta']) > 4: if len(self.env['screen']['newDelta']) > 4:
return return
# is a vertical change? # is a vertical change?
if not self.env['runtime']['cursorManager'].isCursorVerticalMove(): if not self.env['runtime']['cursorManager'].isCursorVerticalMove():
return return
x, y, currLine = line_utils.getCurrentLine(self.env['screenData']['newCursor']['x'], self.env['screenData']['newCursor']['y'], self.env['screenData']['newContentText']) x, y, currLine = line_utils.getCurrentLine(self.env['screen']['newCursor']['x'], self.env['screen']['newCursor']['y'], self.env['screen']['newContentText'])
if currLine.isspace(): if currLine.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False) self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False)

View File

@ -18,7 +18,7 @@ class command():
def run(self): def run(self):
if not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'highlight'): if not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'highlight'):
return return
self.env['runtime']['outputManager'].presentText(self.env['screenData']['newAttribDelta'], soundIcon='', interrupt=True, flush=False) self.env['runtime']['outputManager'].presentText(self.env['screen']['newAttribDelta'], soundIcon='', interrupt=True, flush=False)
def setCallback(self, callback): def setCallback(self, callback):
pass pass

View File

@ -20,7 +20,7 @@ class command():
def run(self): def run(self):
# first place could not be the end of a word # first place could not be the end of a word
if self.env['screenData']['newCursor']['x'] == 0: if self.env['screen']['newCursor']['x'] == 0:
return return
# is it enabled? # is it enabled?
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'wordEcho'): if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'wordEcho'):
@ -35,18 +35,18 @@ class command():
if self.env['runtime']['cursorManager'].isCursorVerticalMove(): if self.env['runtime']['cursorManager'].isCursorVerticalMove():
return return
# get the word # get the word
newContent = self.env['screenData']['newContentText'].split('\n')[self.env['screenData']['newCursor']['y']] newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']]
x, y, currWord, endOfScreen, lineBreak = \ x, y, currWord, endOfScreen, lineBreak = \
word_utils.getCurrentWord(self.env['screenData']['newCursor']['x'], 0, newContent) word_utils.getCurrentWord(self.env['screen']['newCursor']['x'], 0, newContent)
# currently writing # currently writing
if self.env['runtime']['screenManager'].isDelta(): if self.env['runtime']['screenManager'].isDelta():
return return
else: else:
# at the end of a word # at the end of a word
if not newContent[self.env['screenData']['newCursor']['x']].isspace(): if not newContent[self.env['screen']['newCursor']['x']].isspace():
return return
if (x + len(currWord) != self.env['screenData']['newCursor']['x']) and \ if (x + len(currWord) != self.env['screen']['newCursor']['x']) and \
(x + len(currWord) != self.env['screenData']['newCursor']['x']-1): (x + len(currWord) != self.env['screen']['newCursor']['x']-1):
return return
if currWord != '': if currWord != '':

View File

@ -55,35 +55,35 @@ class command():
if self.env['runtime']['cursorManager'].isCursorVerticalMove(): if self.env['runtime']['cursorManager'].isCursorVerticalMove():
return return
# more than a keyecho? # more than a keyecho?
if len(self.env['screenData']['newDelta']) > 1: if len(self.env['screen']['newDelta']) > 1:
return return
# deletion # deletion
if self.env['runtime']['screenManager'].isNegativeDelta(): if self.env['runtime']['screenManager'].isNegativeDelta():
return return
# first place could not be the end of a word # first place could not be the end of a word
if self.env['screenData']['newCursor']['x'] == 0: if self.env['screen']['newCursor']['x'] == 0:
return return
# get the word (just for speedup only look at current line # get the word (just for speedup only look at current line
newContent = self.env['screenData']['newContentText'].split('\n')[self.env['screenData']['newCursor']['y']] newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']]
x, y, currWord, endOfScreen, lineBreak = word_utils.getCurrentWord(self.env['screenData']['newCursor']['x'], 0, newContent) x, y, currWord, endOfScreen, lineBreak = word_utils.getCurrentWord(self.env['screen']['newCursor']['x'], 0, newContent)
# was this a typed word? # was this a typed word?
if self.env['runtime']['screenManager'].isDelta(): if self.env['runtime']['screenManager'].isDelta():
if not(newContent[self.env['screenData']['oldCursor']['x']] in string.whitespace + '!"#$%&()*+,-./:;<=>?@[\\]^_{|}~' and x != self.env['screenData']['oldCursor']['x']): if not(newContent[self.env['screen']['oldCursor']['x']] in string.whitespace + '!"#$%&()*+,-./:;<=>?@[\\]^_{|}~' and x != self.env['screen']['oldCursor']['x']):
return return
else: else:
currWord = currWord.strip(string.whitespace + '!"#$%&()*+,-./:;<=>?@[\\]^_{|}~') currWord = currWord.strip(string.whitespace + '!"#$%&()*+,-./:;<=>?@[\\]^_{|}~')
else: else:
# or just arrow arround? # or just arrow arround?
if not newContent[self.env['screenData']['newCursor']['x']].isspace(): if not newContent[self.env['screen']['newCursor']['x']].isspace():
return return
if (x + len(currWord) != self.env['screenData']['newCursor']['x']) and \ if (x + len(currWord) != self.env['screen']['newCursor']['x']) and \
(x + len(currWord) != self.env['screenData']['newCursor']['x']-1): (x + len(currWord) != self.env['screen']['newCursor']['x']-1):
return return
# just on end of word # just on end of word
if self.env['screenData']['newCursor']['x'] > 0: if self.env['screen']['newCursor']['x'] > 0:
if not newContent[self.env['screenData']['oldCursor']['x'] - 1].lower() in string.ascii_lowercase: if not newContent[self.env['screen']['oldCursor']['x'] - 1].lower() in string.ascii_lowercase:
return return
# ignore bash buildins # ignore bash buildins

View File

@ -21,7 +21,7 @@ class command():
return return
# detect typing or chilling # detect typing or chilling
if self.env['screenData']['newCursor']['x'] >= self.env['screenData']['oldCursor']['x']: if self.env['screen']['newCursor']['x'] >= self.env['screen']['oldCursor']['x']:
return return
# More than just a deletion happend # More than just a deletion happend
@ -36,9 +36,9 @@ class command():
# too much for a single backspace... # too much for a single backspace...
# word begin produce a diff wiht len == 2 |a | others with 1 |a| # word begin produce a diff wiht len == 2 |a | others with 1 |a|
if len(self.env['screenData']['newNegativeDelta']) > 2: if len(self.env['screen']['newNegativeDelta']) > 2:
return return
currNegativeDelta = self.env['screenData']['newNegativeDelta'] currNegativeDelta = self.env['screen']['newNegativeDelta']
if len(currNegativeDelta.strip()) != len(currNegativeDelta) and \ if len(currNegativeDelta.strip()) != len(currNegativeDelta) and \
currNegativeDelta.strip() != '': currNegativeDelta.strip() != '':
currNegativeDelta = currNegativeDelta.strip() currNegativeDelta = currNegativeDelta.strip()

View File

@ -19,7 +19,7 @@ class command():
def run(self): def run(self):
if self.env['runtime']['inputManager'].noKeyPressed(): if self.env['runtime']['inputManager'].noKeyPressed():
return return
if self.env['screenData']['newAttribDelta'] != '': if self.env['screen']['newAttribDelta'] != '':
return return
if self.env['runtime']['screenManager'].isScreenChange(): if self.env['runtime']['screenManager'].isScreenChange():
return return
@ -29,8 +29,8 @@ class command():
return return
if not self.env['input']['currInput'][0] in ['KEY_UP','KEY_DOWN']: if not self.env['input']['currInput'][0] in ['KEY_UP','KEY_DOWN']:
return return
prevLine = self.env['screenData']['oldContentText'].split('\n')[self.env['screenData']['newCursor']['y']] prevLine = self.env['screen']['oldContentText'].split('\n')[self.env['screen']['newCursor']['y']]
currLine = self.env['screenData']['newContentText'].split('\n')[self.env['screenData']['newCursor']['y']] currLine = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']]
if not currLine.isspace(): if not currLine.isspace():
currPrompt = currLine.find('$') currPrompt = currLine.find('$')
rootPrompt = currLine.find('#') rootPrompt = currLine.find('#')

View File

@ -17,8 +17,8 @@ class command():
return 'No Description found' return 'No Description found'
def run(self): def run(self):
self.env['runtime']['outputManager'].presentText(_("screen {0}").format(self.env['screenData']['newTTY']),soundIcon='ChangeTTY', interrupt=True, flush=False) self.env['runtime']['outputManager'].presentText(_("screen {0}").format(self.env['screen']['newTTY']),soundIcon='ChangeTTY', interrupt=True, flush=False)
self.env['runtime']['outputManager'].presentText(self.env['screenData']['newContentText'], interrupt=False, flush=False) self.env['runtime']['outputManager'].presentText(self.env['screen']['newContentText'], interrupt=False, flush=False)
def setCallback(self, callback): def setCallback(self, callback):
pass pass

View File

@ -26,15 +26,15 @@ class command():
# its a cursor movement (experimental) - maybe also check current shortcut string? # its a cursor movement (experimental) - maybe also check current shortcut string?
#if not '$' in self.env['screenData']['newDelta'] and #if not '$' in self.env['screen']['newDelta'] and
# not '#' in self.env['screenData']['newDelta']: # not '#' in self.env['screen']['newDelta']:
if abs(self.env['screenData']['newCursor']['x'] - self.env['screenData']['oldCursor']['x']) >= 1: if abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']) >= 1:
if len(self.env['screenData']['newDelta'].strip(' \n\t0123456789')) <= 2: if len(self.env['screen']['newDelta'].strip(' \n\t0123456789')) <= 2:
return return
if abs(self.env['screenData']['newCursor']['y'] - self.env['screenData']['oldCursor']['y']) == 1: if abs(self.env['screen']['newCursor']['y'] - self.env['screen']['oldCursor']['y']) == 1:
if len(self.env['screenData']['newDelta'].strip(' \n\t0123456789')) <= 2: if len(self.env['screen']['newDelta'].strip(' \n\t0123456789')) <= 2:
return return
self.env['runtime']['outputManager'].presentText(self.env['screenData']['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):
pass pass

View File

@ -22,14 +22,14 @@ class command():
return return
if self.env['runtime']['settingsManager'].getSetting('promote', 'list').strip(" \t\n") == '': if self.env['runtime']['settingsManager'].getSetting('promote', 'list').strip(" \t\n") == '':
return return
if self.env['screenData']['newDelta'] == '': if self.env['screen']['newDelta'] == '':
return return
if int(time.time() - self.env['input']['lastInputTime']) < self.env['runtime']['settingsManager'].getSettingAsInt('promote', 'inactiveTimeoutSec'): if int(time.time() - self.env['input']['lastInputTime']) < self.env['runtime']['settingsManager'].getSettingAsInt('promote', 'inactiveTimeoutSec'):
return return
if len(self.env['runtime']['settingsManager'].getSetting('promote', 'list')) == 0: if len(self.env['runtime']['settingsManager'].getSetting('promote', 'list')) == 0:
return return
for promote in self.env['runtime']['settingsManager'].getSetting('promote', 'list').split(','): for promote in self.env['runtime']['settingsManager'].getSetting('promote', 'list').split(','):
if promote in self.env['screenData']['newDelta']: if promote in self.env['screen']['newDelta']:
self.env['runtime']['outputManager'].playSoundIcon('PromotedText') self.env['runtime']['outputManager'].playSoundIcon('PromotedText')
self.env['input']['lastInputTime'] = time.time() self.env['input']['lastInputTime'] = time.time()
return return

View File

@ -24,12 +24,12 @@ class command():
# return # return
# its a cursor movement (experimental) - maybe also check current shortcut string? # its a cursor movement (experimental) - maybe also check current shortcut string?
if abs(self.env['screenData']['newCursor']['x'] - self.env['screenData']['oldCursor']['x']) >= 1: if abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']) >= 1:
if len(self.env['screenData']['newDelta'].strip(' \n\t')) <= 2: if len(self.env['screen']['newDelta'].strip(' \n\t')) <= 2:
return return
#if abs(self.env['screenData']['newCursor']['y'] - self.env['screenData']['oldCursor']['y']) = 1: #if abs(self.env['screen']['newCursor']['y'] - self.env['screen']['oldCursor']['y']) = 1:
# return # return
self.env['runtime']['outputManager'].presentText(self.env['screenData']['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):
pass pass

View File

@ -19,14 +19,14 @@ class command():
return return
print('--------------') print('--------------')
print('default') print('default')
print('load new',self.env['screenData']['newApplication']) print('load new',self.env['screen']['newApplication'])
print('--------------') print('--------------')
def unload(self): def unload(self):
return return
print('--------------') print('--------------')
print('default') print('default')
print('unload old',self.env['screenData']['oldApplication']) print('unload old',self.env['screen']['oldApplication'])
print('--------------') print('--------------')
def setCallback(self, callback): def setCallback(self, callback):

View File

@ -18,13 +18,13 @@ class command():
def load(self): def load(self):
print('--------------') print('--------------')
print('agetty') print('agetty')
print('load new',self.env['screenData']['newApplication']) print('load new',self.env['screen']['newApplication'])
print('--------------') print('--------------')
def unload(self): def unload(self):
print('--------------') print('--------------')
print('agetty') print('agetty')
print('unload old',self.env['screenData']['oldApplication']) print('unload old',self.env['screen']['oldApplication'])
print('--------------') print('--------------')
def setCallback(self, callback): def setCallback(self, callback):

View File

@ -18,13 +18,13 @@ class command():
def load(self): def load(self):
print('--------------') print('--------------')
print('bash') print('bash')
print('load new',self.env['screenData']['newApplication']) print('load new',self.env['screen']['newApplication'])
print('--------------') print('--------------')
def unload(self): def unload(self):
print('--------------') print('--------------')
print('bash') print('bash')
print('unload old',self.env['screenData']['oldApplication']) print('unload old',self.env['screen']['oldApplication'])
print('--------------') print('--------------')
def setCallback(self, callback): def setCallback(self, callback):

View File

@ -18,13 +18,13 @@ class command():
def load(self): def load(self):
print('--------------') print('--------------')
print('vim') print('vim')
print('load new',self.env['screenData']['newApplication']) print('load new',self.env['screen']['newApplication'])
print('--------------') print('--------------')
def unload(self): def unload(self):
print('--------------') print('--------------')
print('vim') print('vim')
print('unload old',self.env['screenData']['oldApplication']) print('unload old',self.env['screen']['oldApplication'])
print('--------------') print('--------------')
def setCallback(self, callback): def setCallback(self, callback):

View File

@ -14,18 +14,18 @@ class applicationManager():
def shutdown(self): def shutdown(self):
pass pass
def getCurrentApplication(self): def getCurrentApplication(self):
currApp = self.env['screenData']['newApplication'].upper() currApp = self.env['screen']['newApplication'].upper()
if not currApp: if not currApp:
currApp == 'DEFAULT' currApp == 'DEFAULT'
if currApp == '': if currApp == '':
currApp == 'DEFAULT' currApp == 'DEFAULT'
return currApp return currApp
def getPrevApplication(self): def getPrevApplication(self):
prevApp = self.env['screenData']['oldApplication'].upper() prevApp = self.env['screen']['oldApplication'].upper()
if not prevApp: if not prevApp:
prevApp == 'DEFAULT' prevApp == 'DEFAULT'
if prevApp == '': if prevApp == '':
prevApp == 'DEFAULT' prevApp == 'DEFAULT'
return prevApp return prevApp
def isApplicationChange(self): def isApplicationChange(self):
return self.env['screenData']['oldApplication'] != self.env['screenData']['newApplication'] return self.env['screen']['oldApplication'] != self.env['screen']['newApplication']

View File

@ -15,7 +15,7 @@ class commandManager():
def initialize(self, environment): def initialize(self, environment):
self.env = environment self.env = environment
# commands # commands
for commandFolder in self.env['generalInformation']['commandFolderList']: for commandFolder in self.env['general']['commandFolderList']:
self.env['runtime']['commandManager'].loadCommands(commandFolder, self.env['runtime']['commandManager'].loadCommands(commandFolder,
self.env['runtime']['settingsManager'].getSetting('general', 'commandPath')) self.env['runtime']['settingsManager'].getSetting('general', 'commandPath'))
self.env['runtime']['commandManager'].loadCommands(commandFolder) self.env['runtime']['commandManager'].loadCommands(commandFolder)
@ -24,7 +24,7 @@ class commandManager():
self.env['runtime']['commandManager'].loadScriptCommands() self.env['runtime']['commandManager'].loadScriptCommands()
def shutdown(self): def shutdown(self):
for commandFolder in self.env['generalInformation']['commandFolderList']: for commandFolder in self.env['general']['commandFolderList']:
self.env['runtime']['commandManager'].shutdownCommands(commandFolder) self.env['runtime']['commandManager'].shutdownCommands(commandFolder)
def loadCommands(self, section='commands',commandPath=''): def loadCommands(self, section='commands',commandPath=''):
@ -180,7 +180,7 @@ class commandManager():
return return
if self.commandExists(command, section): if self.commandExists(command, section):
try: try:
if self.env['generalInformation']['tutorialMode']: if self.env['general']['tutorialMode']:
self.env['runtime']['debug'].writeDebugOut("Tutorial for command:" + section + "." + command ,debug.debugLevel.INFO) self.env['runtime']['debug'].writeDebugOut("Tutorial for command:" + section + "." + command ,debug.debugLevel.INFO)
description = self.env['commands'][section][command].getDescription() description = self.env['commands'][section][command].getDescription()
self.env['runtime']['outputManager'].presentText(description, interrupt=True) self.env['runtime']['outputManager'].presentText(description, interrupt=True)

View File

@ -26,10 +26,10 @@ class cursorManager():
self.env['commandBuffer']['Marks']['2'] != None self.env['commandBuffer']['Marks']['2'] != None
def setMark(self): def setMark(self):
currCursor = None currCursor = None
if self.env['screenData']['newCursorReview']: if self.env['screen']['newCursorReview']:
currCursor = self.env['screenData']['newCursorReview'].copy() currCursor = self.env['screen']['newCursorReview'].copy()
else: else:
currCursor = self.env['screenData']['newCursor'].copy() currCursor = self.env['screen']['newCursor'].copy()
if not self.env['commandBuffer']['Marks']['1']: if not self.env['commandBuffer']['Marks']['1']:
self.env['commandBuffer']['Marks']['1'] = currCursor.copy() self.env['commandBuffer']['Marks']['1'] = currCursor.copy()
return 1 return 1
@ -38,43 +38,43 @@ class cursorManager():
return 2 return 2
return 0 return 0
def getReviewOrTextCursor(self): def getReviewOrTextCursor(self):
if self.env['screenData']['newCursorReview']: if self.env['screen']['newCursorReview']:
return self.env['screenData']['newCursorReview'].copy() return self.env['screen']['newCursorReview'].copy()
else: else:
return self.env['screenData']['newCursor'].copy() return self.env['screen']['newCursor'].copy()
def clearReviewCursor(self): def clearReviewCursor(self):
if not self.isReviewMode(): if not self.isReviewMode():
return return
self.env['screenData']['oldCursorReview'] = None self.env['screen']['oldCursorReview'] = None
self.env['screenData']['newCursorReview'] = None self.env['screen']['newCursorReview'] = None
def isCursorHorizontalMove(self): def isCursorHorizontalMove(self):
return self.env['screenData']['newCursor']['x'] != self.env['screenData']['oldCursor']['x'] return self.env['screen']['newCursor']['x'] != self.env['screen']['oldCursor']['x']
def isCursorVerticalMove(self): def isCursorVerticalMove(self):
return self.env['screenData']['newCursor']['y'] != self.env['screenData']['oldCursor']['y'] return self.env['screen']['newCursor']['y'] != self.env['screen']['oldCursor']['y']
def isReviewMode(self): def isReviewMode(self):
return self.env['screenData']['newCursorReview'] != None return self.env['screen']['newCursorReview'] != None
def enterReviewModeCurrTextCursor(self, overwrite=False): def enterReviewModeCurrTextCursor(self, overwrite=False):
if self.isReviewMode() and not overwrite: if self.isReviewMode() and not overwrite:
return return
self.env['screenData']['oldCursorReview'] = self.env['screenData']['newCursorReview'] self.env['screen']['oldCursorReview'] = self.env['screen']['newCursorReview']
if not self.env['screenData']['newCursorReview']: if not self.env['screen']['newCursorReview']:
self.env['screenData']['newCursorReview'] = self.env['screenData']['newCursor'].copy() self.env['screen']['newCursorReview'] = self.env['screen']['newCursor'].copy()
if self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'highlight') and \ if self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'highlight') and \
self.env['screenData']['newCursorAttrib'] != None: self.env['screen']['newCursorAttrib'] != None:
if self.env['screenData']['newCursorAttrib']['x'] != 0 and \ if self.env['screen']['newCursorAttrib']['x'] != 0 and \
self.env['screenData']['newCursorAttrib']['y'] != 0: self.env['screen']['newCursorAttrib']['y'] != 0:
self.env['screenData']['newCursorReview'] = self.env['screenData']['newCursorAttrib'].copy() self.env['screen']['newCursorReview'] = self.env['screen']['newCursorAttrib'].copy()
def setReviewCursorPosition(self, x, y): def setReviewCursorPosition(self, x, y):
if not self.isReviewMode(): if not self.isReviewMode():
self.enterReviewModeCurrTextCursor() self.enterReviewModeCurrTextCursor()
self.env['screenData']['oldCursorReview'] = self.env['screenData']['newCursorReview'] self.env['screen']['oldCursorReview'] = self.env['screen']['newCursorReview']
self.env['screenData']['newCursorReview']['x'] = x self.env['screen']['newCursorReview']['x'] = x
self.env['screenData']['newCursorReview']['y'] = y self.env['screen']['newCursorReview']['y'] = y
def isApplicationWindowSet(self): def isApplicationWindowSet(self):
try: try:

View File

@ -5,27 +5,27 @@
# By Chrys, Storm Dragon, and contributers. # By Chrys, Storm Dragon, and contributers.
from core import debug from core import debug
from core import settings from core.settingsData import settingsData
from core import runtime from core.runtimeData import runtimeData
from core import screenData from core.screenData import screenData
from core import output from core.outputData import outputData
from core import generalInformation from core.generalData import generalData
from core import commands from core import commandData
from core import inputEvent from core.inputData import inputData
from core import punctuation from core.punctuationData import punctuationData
environment = { environment = {
'screenData': screenData.screenData, 'screen': screenData,
'runtime': runtime.runtime, 'runtime': runtimeData,
'generalInformation': generalInformation.generalInformation, 'general': generalData,
'settings': settings.settings, 'settings': settingsData,
'commands': commands.commands, 'commands': commandData.commands,
'commandsIgnore': commands.commandsIgnore, 'commandsIgnore': commandData.commandsIgnore,
'commandInfo': commands.commandInfo, 'commandInfo': commandData.commandInfo,
'commandBuffer': commands.commandBuffer, 'commandBuffer': commandData.commandBuffer,
'input': inputEvent.input, 'input': inputData,
'punctuation': punctuation.punctuation, 'punctuation': punctuationData,
'output': output.output, 'output': outputData,
'soundIcons': {}, 'soundIcons': {},
'bindings': {}, 'bindings': {},
} }

View File

@ -0,0 +1,125 @@
#!/bin/python
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
#from core import debug
from queue import Empty
import time
from enum import Enum
from multiprocessing import Process, Queue
from multiprocessing.sharedctypes import Value
from ctypes import c_bool
class fenrirEventType(Enum):
Ignore = 0
StopMainLoop = 1
ScreenUpdate = 2
KeyboardInput = 3
BrailleInput = 4
PlugInputDevice = 5
BrailleFlush = 6
ScreenChanged = 7
def __int__(self):
return self.value
def __str__(self):
return self.name
class eventManager():
def __init__(self):
self._mainLoopRunning = Value(c_bool, True)
self._eventProcesses = []
self._eventQueue = Queue() # multiprocessing.Queue()
self.cleanEventQueue()
def initialize(self, environment):
self.env = environment
def shutdown(self):
self.terminateAllProcesses()
self.cleanEventQueue()
def terminateAllProcesses(self):
for proc in self._eventProcesses:
try:
proc.terminate()
except Exception as e:
print(e)
def proceedEventLoop(self):
event = self._eventQueue.get()
self.eventDispatcher(event)
def eventDispatcher(self, event):
if not event:
return
if event['Type'] == fenrirEventType.Ignore:
return
elif event['Type'] == fenrirEventType.StopMainLoop:
self._mainLoopRunning.value = 0
return
elif event['Type'] == fenrirEventType.ScreenUpdate:
print('do an update')
pass
elif event['Type'] == fenrirEventType.KeyboardInput:
pass
elif event['Type'] == fenrirEventType.BrailleInput:
pass
elif event['Type'] == fenrirEventType.PlugInputDevice:
pass
elif event['Type'] == fenrirEventType.BrailleFlush:
pass
elif event['Type'] == fenrirEventType.ScreenChanged:
pass
def startMainEventLoop(self):
self._mainLoopRunning.value = True
while(self._mainLoopRunning.value):
self.proceedEventLoop()
def stopMainEventLoop(self, Force = False):
if Force:
self._mainLoopRunning.value = False
self._eventQueue.put({"Type":fenrirEventType.StopMainLoop,"Data":None})
def addEventThread(self, event, function):
self._mainLoopRunning.value = True
t = Process(target=self.eventWorkerThread, args=(event, function))
self._eventProcesses.append(t)
t.start()
def cleanEventQueue(self):
if self._eventQueue.empty():
return
try:
while True:
self._eventQueue.get_nowait()
except Empty:
pass
def putToEventQueue(self,event, data):
if not isinstance(event, fenrirEventType):
return False
self._eventQueue.put({"Type":event,"Data":data})
return True
def eventWorkerThread(self, event, function):
if not isinstance(event, fenrirEventType):
return
if not callable(function):
return
while self._mainLoopRunning.value:
Data = None
try:
Data = function()
except Exception as e:
print(e)
self.putToEventQueue(event, Data)
'''
def p():
time.sleep(0.02)
return("p")
i = 1
e = eventManager()
e.addEventThread(fenrirEventType.ScreenUpdate,p)
e.addEventThread(fenrirEventType.BrailleInput,p)
e.addEventThread(fenrirEventType.PlugInputDevice,p)
e.addEventThread(fenrirEventType.ScreenChanged,p)
time.sleep(1.5)
e.addEventThread(fenrirEventType.StopMainLoop,e.stopMainEventLoop)
s = time.time()
e.startMainEventLoop()
print(time.time() - s )
'''

View File

@ -46,7 +46,7 @@ class fenrirManager():
def proceed(self): def proceed(self):
if not self.initialized: if not self.initialized:
return return
while(self.environment['generalInformation']['running']): while(self.environment['general']['running']):
try: try:
self.handleProcess() self.handleProcess()
except Exception as e: except Exception as e:
@ -61,13 +61,13 @@ class fenrirManager():
self.environment['runtime']['inputManager'].updateInputDevices() self.environment['runtime']['inputManager'].updateInputDevices()
if eventReceived: if eventReceived:
self.prepareCommand() self.prepareCommand()
if not (self.wasCommand or self.environment['generalInformation']['tutorialMode']) or self.environment['runtime']['screenManager'].isSuspendingScreen(): if not (self.wasCommand or self.environment['general']['tutorialMode']) or self.environment['runtime']['screenManager'].isSuspendingScreen():
self.environment['runtime']['inputManager'].writeEventBuffer() self.environment['runtime']['inputManager'].writeEventBuffer()
if self.environment['runtime']['inputManager'].noKeyPressed(): if self.environment['runtime']['inputManager'].noKeyPressed():
if self.wasCommand: if self.wasCommand:
self.wasCommand = False self.wasCommand = False
self.environment['runtime']['inputManager'].clearEventBuffer() self.environment['runtime']['inputManager'].clearEventBuffer()
if self.environment['generalInformation']['tutorialMode']: if self.environment['general']['tutorialMode']:
self.environment['runtime']['inputManager'].clearEventBuffer() self.environment['runtime']['inputManager'].clearEventBuffer()
if self.environment['input']['keyForeward'] > 0: if self.environment['input']['keyForeward'] > 0:
self.environment['input']['keyForeward'] -=1 self.environment['input']['keyForeward'] -=1
@ -112,14 +112,14 @@ class fenrirManager():
self.environment['runtime']['commandManager'].executeCommand( self.environment['commandInfo']['currCommand'], 'commands') self.environment['runtime']['commandManager'].executeCommand( self.environment['commandInfo']['currCommand'], 'commands')
def shutdownRequest(self): def shutdownRequest(self):
self.environment['generalInformation']['running'] = False self.environment['general']['running'] = False
def captureSignal(self, siginit, frame): def captureSignal(self, siginit, frame):
self.shutdownRequest() self.shutdownRequest()
def shutdown(self): def shutdown(self):
self.environment['runtime']['outputManager'].presentText(_("Quit Fenrir"), soundIcon='ScreenReaderOff', interrupt=True) self.environment['runtime']['outputManager'].presentText(_("Quit Fenrir"), soundIcon='ScreenReaderOff', interrupt=True)
for currManager in self.environment['generalInformation']['managerList']: for currManager in self.environment['general']['managerList']:
if self.environment['runtime'][currManager]: if self.environment['runtime'][currManager]:
self.environment['runtime'][currManager].shutdown() self.environment['runtime'][currManager].shutdown()
del self.environment['runtime'][currManager] del self.environment['runtime'][currManager]

View File

@ -6,13 +6,13 @@
from core import debug from core import debug
generalInformation = { generalData = {
'running': True, 'running': True,
'args': None, 'args': None,
'tutorialMode': False, 'tutorialMode': False,
'currUser':'', 'currUser':'',
'prevUser':'', 'prevUser':'',
'managerList':['punctuationManager','cursorManager','applicationManager','commandManager' 'managerList':['eventManager','punctuationManager','cursorManager','applicationManager','commandManager'
,'screenManager','inputManager','outputManager','debug'], ,'screenManager','inputManager','outputManager','debug'],
'commandFolderList':['commands','onInput','onScreenUpdate','onScreenChanged' 'commandFolderList':['commands','onInput','onScreenUpdate','onScreenChanged'
,'onApplicationChange','onSwitchApplicationProfile',], ,'onApplicationChange','onSwitchApplicationProfile',],

File diff suppressed because one or more lines are too long

View File

@ -6,7 +6,6 @@
import time import time
from core import debug from core import debug
from core import inputEvent
class inputManager(): class inputManager():
def __init__(self): def __init__(self):

View File

@ -7,7 +7,7 @@
import time import time
from core import debug from core import debug
output = { outputData = {
'nextFlush': time.time(), 'nextFlush': time.time(),
'messageText': '', 'messageText': '',
'messageOffset': None, 'messageOffset': None,

View File

@ -119,8 +119,8 @@ class outputManager():
self.env['output']['messageOffset'] = None self.env['output']['messageOffset'] = None
cursor = self.getBrailleCursor() cursor = self.getBrailleCursor()
x, y, self.env['output']['brlText'] = \ x, y, self.env['output']['brlText'] = \
line_utils.getCurrentLine(cursor['x'], cursor['y'], self.env['screenData']['newContentText']) line_utils.getCurrentLine(cursor['x'], cursor['y'], self.env['screen']['newContentText'])
displayText = self.getBrailleTextWithOffset(self.env['screenData']['newContentText'], self.env['output']['cursorOffset'], cursor) displayText = self.getBrailleTextWithOffset(self.env['screen']['newContentText'], self.env['output']['cursorOffset'], cursor)
self.env['runtime']['brailleDriver'].writeText('notflush'+displayText) self.env['runtime']['brailleDriver'].writeText('notflush'+displayText)
else: else:
displayText = self.getBrailleTextWithOffset(self.env['output']['messageText'], self.env['output']['messageOffset']) displayText = self.getBrailleTextWithOffset(self.env['output']['messageText'], self.env['output']['messageOffset'])
@ -147,8 +147,8 @@ class outputManager():
if self.env['output']['messageOffset']: if self.env['output']['messageOffset']:
return self.env['output']['messageOffset'], self.env['output']['messageText'] return self.env['output']['messageOffset'], self.env['output']['messageText']
if not self.env['output']['cursorOffset']: if not self.env['output']['cursorOffset']:
return self.getBrailleCursor(), self.env['screenData']['newContentText'] return self.getBrailleCursor(), self.env['screen']['newContentText']
return self.env['output']['cursorOffset'], self.env['screenData']['newContentText'] return self.env['output']['cursorOffset'], self.env['screen']['newContentText']
def getHorizontalPanSize(self): def getHorizontalPanSize(self):
size = self.env['runtime']['brailleDriver'].getDeviceSize() size = self.env['runtime']['brailleDriver'].getDeviceSize()
if self.env['runtime']['settingsManager'].getSettingAsInt('braille', 'panSizeHorizontal') <= 0: if self.env['runtime']['settingsManager'].getSettingAsInt('braille', 'panSizeHorizontal') <= 0:

View File

@ -7,7 +7,7 @@
from core import debug from core import debug
import string import string
punctuation = { punctuationData = {
'LEVELDICT':{ 'LEVELDICT':{
'none': '', 'none': '',
'some': '#-$~+*-/\\@', 'some': '#-$~+*-/\\@',

View File

@ -6,7 +6,7 @@
from core import debug from core import debug
runtime = { runtimeData = {
'speechDriver': None, 'speechDriver': None,
'screenDriver': None, 'screenDriver': None,
'soundDriver': None, 'soundDriver': None,

View File

@ -23,35 +23,35 @@ class screenManager():
def update(self, trigger='onUpdate'): def update(self, trigger='onUpdate'):
self.env['runtime']['screenDriver'].getCurrScreen() self.env['runtime']['screenDriver'].getCurrScreen()
self.env['runtime']['screenDriver'].getSessionInformation() self.env['runtime']['screenDriver'].getSessionInformation()
self.env['screenData']['oldApplication'] = self.env['screenData']['newApplication'] self.env['screen']['oldApplication'] = self.env['screen']['newApplication']
if self.isScreenChange(): if self.isScreenChange():
self.changeBrailleScreen() self.changeBrailleScreen()
if not self.isSuspendingScreen(self.env['screenData']['newTTY']): if not self.isSuspendingScreen(self.env['screen']['newTTY']):
self.env['runtime']['screenDriver'].update(trigger) self.env['runtime']['screenDriver'].update(trigger)
if trigger == 'onUpdate' or self.isScreenChange() \ if trigger == 'onUpdate' or self.isScreenChange() \
or len(self.env['screenData']['newDelta']) > 6: or len(self.env['screen']['newDelta']) > 6:
self.env['runtime']['screenDriver'].getCurrApplication() self.env['runtime']['screenDriver'].getCurrApplication()
self.env['screenData']['lastScreenUpdate'] = time.time() self.env['screen']['lastScreenUpdate'] = time.time()
def isSuspendingScreen(self, screen = None): def isSuspendingScreen(self, screen = None):
if screen == None: if screen == None:
screen = self.env['screenData']['newTTY'] screen = self.env['screen']['newTTY']
ignoreScreens = [] ignoreScreens = []
fixIgnoreScreens = self.env['runtime']['settingsManager'].getSetting('screen', 'suspendingScreen') fixIgnoreScreens = self.env['runtime']['settingsManager'].getSetting('screen', 'suspendingScreen')
if fixIgnoreScreens != '': if fixIgnoreScreens != '':
ignoreScreens.extend(fixIgnoreScreens.split(',')) ignoreScreens.extend(fixIgnoreScreens.split(','))
if self.env['runtime']['settingsManager'].getSettingAsBool('screen', 'autodetectSuspendingScreen'): if self.env['runtime']['settingsManager'].getSettingAsBool('screen', 'autodetectSuspendingScreen'):
ignoreScreens.extend(self.env['screenData']['autoIgnoreScreens']) ignoreScreens.extend(self.env['screen']['autoIgnoreScreens'])
return (screen in ignoreScreens) return (screen in ignoreScreens)
def isScreenChange(self): def isScreenChange(self):
if not self.env['screenData']['oldTTY']: if not self.env['screen']['oldTTY']:
return False return False
return self.env['screenData']['newTTY'] != self.env['screenData']['oldTTY'] return self.env['screen']['newTTY'] != self.env['screen']['oldTTY']
def isDelta(self): def isDelta(self):
return self.env['screenData']['newDelta'] != '' return self.env['screen']['newDelta'] != ''
def isNegativeDelta(self): def isNegativeDelta(self):
return self.env['screenData']['newNegativeDelta'] != '' return self.env['screen']['newNegativeDelta'] != ''
def getWindowAreaInText(self, text): def getWindowAreaInText(self, text):
if not self.env['runtime']['cursorManager'].isApplicationWindowSet(): if not self.env['runtime']['cursorManager'].isApplicationWindowSet():
return text return text
@ -74,14 +74,14 @@ class screenManager():
return return
if not self.env['runtime']['brailleDriver']: if not self.env['runtime']['brailleDriver']:
return return
if self.env['screenData']['oldTTY']: if self.env['screen']['oldTTY']:
if not self.isSuspendingScreen(self.env['screenData']['oldTTY']): if not self.isSuspendingScreen(self.env['screen']['oldTTY']):
try: try:
self.env['runtime']['brailleDriver'].leveScreen() self.env['runtime']['brailleDriver'].leveScreen()
except Exception as e: except Exception as e:
self.env['runtime']['debug'].writeDebugOut('screenManager:changeBrailleScreen:leveScreen ' + str(e),debug.debugLevel.ERROR) self.env['runtime']['debug'].writeDebugOut('screenManager:changeBrailleScreen:leveScreen ' + str(e),debug.debugLevel.ERROR)
if not self.isSuspendingScreen(): if not self.isSuspendingScreen():
try: try:
self.env['runtime']['brailleDriver'].enterScreen(self.env['screenData']['newTTY']) self.env['runtime']['brailleDriver'].enterScreen(self.env['screen']['newTTY'])
except Exception as e: except Exception as e:
self.env['runtime']['debug'].writeDebugOut('screenManager:changeBrailleScreen:enterScreen ' + str(e),debug.debugLevel.ERROR) self.env['runtime']['debug'].writeDebugOut('screenManager:changeBrailleScreen:enterScreen ' + str(e),debug.debugLevel.ERROR)

View File

@ -6,7 +6,7 @@
from core import debug from core import debug
settings = { settingsData = {
'sound': { 'sound': {
'enabled': True, 'enabled': True,
'driver': 'genericDriver', 'driver': 'genericDriver',

View File

@ -7,6 +7,7 @@
import os import os
import __main__ import __main__
from configparser import ConfigParser from configparser import ConfigParser
from core import eventManager
from core import inputManager from core import inputManager
from core import outputManager from core import outputManager
from core import commandManager from core import commandManager
@ -15,14 +16,14 @@ from core import punctuationManager
from core import cursorManager from core import cursorManager
from core import applicationManager from core import applicationManager
from core import environment from core import environment
from core import inputEvent from core import inputData
from core.settings import settings from core.settingsData import settingsData
from core import debug from core import debug
from utils import module_utils from utils import module_utils
class settingsManager(): class settingsManager():
def __init__(self): def __init__(self):
self.settings = settings self.settings = settingsData
self.settingArgDict = {} self.settingArgDict = {}
def initialize(self, environment): def initialize(self, environment):
self.env = environment self.env = environment
@ -100,7 +101,7 @@ class settingsManager():
self.env['runtime']['debug'].writeDebugOut("SoundIcon: " + soundIcon + '.' + soundIconFile, debug.debugLevel.INFO, onAnyLevel=True) self.env['runtime']['debug'].writeDebugOut("SoundIcon: " + soundIcon + '.' + soundIconFile, debug.debugLevel.INFO, onAnyLevel=True)
siConfig.close() siConfig.close()
def isValidKey(self, key): def isValidKey(self, key):
return key in inputEvent.keyNames return key in inputData.keyNames
def loadDicts(self, dictConfigPath=os.path.dirname(os.path.realpath(__main__.__file__)) + '/../../config/punctuation/default.conf'): def loadDicts(self, dictConfigPath=os.path.dirname(os.path.realpath(__main__.__file__)) + '/../../config/punctuation/default.conf'):
dictConfig = open(dictConfigPath,"r") dictConfig = open(dictConfigPath,"r")
@ -203,10 +204,10 @@ class settingsManager():
os.path.dirname(os.path.realpath(__main__.__file__)) + "/" + driverType + '/' + driverName + '.py') os.path.dirname(os.path.realpath(__main__.__file__)) + "/" + driverType + '/' + driverName + '.py')
self.env['runtime'][driverType] = driver_mod.driver() self.env['runtime'][driverType] = driver_mod.driver()
self.env['runtime'][driverType].initialize(self.env) self.env['runtime'][driverType].initialize(self.env)
self.env['runtime']['debug'].writeDebugOut('Loading Driver ' + driverType +" OK",debug.debugLevel.INFO, onAnyLevel=True) self.env['runtime']['debug'].writeDebugOut('Loading Driver ' + driverType + ' (' + driverName +") OK",debug.debugLevel.INFO, onAnyLevel=True)
except Exception as e: except Exception as e:
self.env['runtime'][driverType] = None self.env['runtime'][driverType] = None
self.env['runtime']['debug'].writeDebugOut("Loading " + driverType + " Driver : "+ str(e), debug.debugLevel.ERROR) self.env['runtime']['debug'].writeDebugOut('Loading Driver ' + driverType + ' (' + driverName +") FAILED:"+ str(e), debug.debugLevel.ERROR)
def shutdownDriver(self, driverType): def shutdownDriver(self, driverType):
if self.env['runtime'][driverType] == None: if self.env['runtime'][driverType] == None:
return return
@ -303,6 +304,8 @@ class settingsManager():
else: else:
environment['runtime']['settingsManager'].loadDicts(self.getSetting('general','punctuationProfile')) environment['runtime']['settingsManager'].loadDicts(self.getSetting('general','punctuationProfile'))
environment['runtime']['eventManager'] = eventManager.eventManager()
environment['runtime']['eventManager'].initialize(environment)
environment['runtime']['inputManager'] = inputManager.inputManager() environment['runtime']['inputManager'] = inputManager.inputManager()
environment['runtime']['inputManager'].initialize(environment) environment['runtime']['inputManager'].initialize(environment)
environment['runtime']['outputManager'] = outputManager.outputManager() environment['runtime']['outputManager'] = outputManager.outputManager()

View File

@ -15,7 +15,7 @@ except Exception as e:
import time import time
from select import select from select import select
from core import inputEvent from core import inputData
from core import debug from core import debug
class driver(): class driver():
@ -151,7 +151,7 @@ class driver():
return None return None
if not event: if not event:
return None return None
mEvent = inputEvent.inputEvent mEvent = inputData.inputEvent
try: try:
mEvent['EventName'] = evdev.ecodes.keys[event.code] mEvent['EventName'] = evdev.ecodes.keys[event.code]
mEvent['EventValue'] = event.code mEvent['EventValue'] = event.code

View File

@ -23,15 +23,15 @@ class driver():
def shutdown(self): def shutdown(self):
pass pass
def getCurrScreen(self): def getCurrScreen(self):
self.env['screenData']['oldTTY'] = self.env['screenData']['newTTY'] self.env['screen']['oldTTY'] = self.env['screen']['newTTY']
try: try:
currScreenFile = open('/sys/devices/virtual/tty/tty0/active','r') currScreenFile = open('/sys/devices/virtual/tty/tty0/active','r')
self.env['screenData']['newTTY'] = str(currScreenFile.read()[3:-1]) self.env['screen']['newTTY'] = str(currScreenFile.read()[3:-1])
currScreenFile.close() currScreenFile.close()
except Exception as e: except Exception as e:
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR) self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
def injectTextToScreen(self, text, screen = None): def injectTextToScreen(self, text, screen = None):
useScreen = "/dev/tty" + self.env['screenData']['newTTY'] useScreen = "/dev/tty" + self.env['screen']['newTTY']
if screen != None: if screen != None:
useScreen = screen useScreen = screen
with open(useScreen, 'w') as fd: with open(useScreen, 'w') as fd:
@ -41,7 +41,7 @@ class driver():
def getCurrApplication(self): def getCurrApplication(self):
apps = [] apps = []
try: try:
currScreen = self.env['screenData']['newTTY'] currScreen = self.env['screen']['newTTY']
apps = subprocess.Popen('ps -t tty' + currScreen + ' -o comm,tty,stat', shell=True, stdout=subprocess.PIPE).stdout.read().decode()[:-1].split('\n') apps = subprocess.Popen('ps -t tty' + currScreen + ' -o comm,tty,stat', shell=True, stdout=subprocess.PIPE).stdout.read().decode()[:-1].split('\n')
except Exception as e: except Exception as e:
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR) self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
@ -58,8 +58,8 @@ class driver():
not "SH" == i[0] and \ not "SH" == i[0] and \
not "PS" == i[0]: not "PS" == i[0]:
if "TTY"+currScreen in i[1]: if "TTY"+currScreen in i[1]:
if self.env['screenData']['newApplication'] != i[0]: if self.env['screen']['newApplication'] != i[0]:
self.env['screenData']['newApplication'] = i[0] self.env['screen']['newApplication'] = i[0]
return return
except Exception as e: except Exception as e:
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR) self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
@ -71,9 +71,8 @@ class driver():
obj = bus.get_object('org.freedesktop.login1', '/org/freedesktop/login1') obj = bus.get_object('org.freedesktop.login1', '/org/freedesktop/login1')
inf = dbus.Interface(obj, 'org.freedesktop.login1.Manager') inf = dbus.Interface(obj, 'org.freedesktop.login1.Manager')
self.ListSessions = inf.get_dbus_method('ListSessions') self.ListSessions = inf.get_dbus_method('ListSessions')
sessions = self.ListSessions() sessions = self.ListSessions()
self.env['screenData']['autoIgnoreScreens'] = [] self.env['screen']['autoIgnoreScreens'] = []
for session in sessions: for session in sessions:
obj = bus.get_object('org.freedesktop.login1', session[4]) obj = bus.get_object('org.freedesktop.login1', session[4])
inf = dbus.Interface(obj, 'org.freedesktop.DBus.Properties') inf = dbus.Interface(obj, 'org.freedesktop.DBus.Properties')
@ -86,19 +85,20 @@ class driver():
self.env['runtime']['debug'].writeDebugOut('No TTY found for session:' + session[4],debug.debugLevel.ERROR) self.env['runtime']['debug'].writeDebugOut('No TTY found for session:' + session[4],debug.debugLevel.ERROR)
return return
if sessionType.upper() == 'X11': if sessionType.upper() == 'X11':
self.env['screenData']['autoIgnoreScreens'].append(screen) self.env['screen']['autoIgnoreScreens'].append(screen)
if screen == self.env['screenData']['newTTY'] : if screen == self.env['screen']['newTTY'] :
if self.env['generalInformation']['currUser'] != session[2]: if self.env['general']['currUser'] != session[2]:
self.env['generalInformation']['prevUser'] = self.env['generalInformation']['currUser'] self.env['general']['prevUser'] = self.env['general']['currUser']
self.env['generalInformation']['currUser'] = session[2] self.env['general']['currUser'] = session[2]
except Exception as e: except Exception as e:
self.env['runtime']['debug'].writeDebugOut('getSessionInformation: Maybe no LoginD:' + str(e),debug.debugLevel.ERROR) self.env['runtime']['debug'].writeDebugOut('getSessionInformation: Maybe no LoginD:' + str(e),debug.debugLevel.ERROR)
self.env['screenData']['autoIgnoreScreens'] = [] self.env['screen']['autoIgnoreScreens'] = []
def update(self, trigger='onUpdate'): def update(self, trigger='onUpdate'):
newContentBytes = b'' newContentBytes = b''
try: try:
# read screen # read screen
vcsa = open(self.vcsaDevicePath + self.env['screenData']['newTTY'],'rb',0) vcsa = open(self.vcsaDevicePath + self.env['screen']['newTTY'],'rb',0)
newContentBytes = vcsa.read() newContentBytes = vcsa.read()
vcsa.close() vcsa.close()
if len(newContentBytes) < 5: if len(newContentBytes) < 5:
@ -108,62 +108,62 @@ class driver():
return return
screenEncoding = self.env['runtime']['settingsManager'].getSetting('screen', 'encoding') screenEncoding = self.env['runtime']['settingsManager'].getSetting('screen', 'encoding')
# set new "old" values # set new "old" values
self.env['screenData']['oldContentBytes'] = self.env['screenData']['newContentBytes'] self.env['screen']['oldContentBytes'] = self.env['screen']['newContentBytes']
self.env['screenData']['oldContentText'] = self.env['screenData']['newContentText'] self.env['screen']['oldContentText'] = self.env['screen']['newContentText']
self.env['screenData']['oldContentAttrib'] = self.env['screenData']['newContentAttrib'] self.env['screen']['oldContentAttrib'] = self.env['screen']['newContentAttrib']
self.env['screenData']['oldCursor'] = self.env['screenData']['newCursor'].copy() self.env['screen']['oldCursor'] = self.env['screen']['newCursor'].copy()
if self.env['screenData']['newCursorAttrib']: if self.env['screen']['newCursorAttrib']:
self.env['screenData']['oldCursorAttrib'] = self.env['screenData']['newCursorAttrib'].copy() self.env['screen']['oldCursorAttrib'] = self.env['screen']['newCursorAttrib'].copy()
self.env['screenData']['oldDelta'] = self.env['screenData']['newDelta'] self.env['screen']['oldDelta'] = self.env['screen']['newDelta']
self.env['screenData']['oldAttribDelta'] = self.env['screenData']['newAttribDelta'] self.env['screen']['oldAttribDelta'] = self.env['screen']['newAttribDelta']
self.env['screenData']['oldNegativeDelta'] = self.env['screenData']['newNegativeDelta'] self.env['screen']['oldNegativeDelta'] = self.env['screen']['newNegativeDelta']
self.env['screenData']['newContentBytes'] = newContentBytes self.env['screen']['newContentBytes'] = newContentBytes
# get metadata like cursor or screensize # get metadata like cursor or screensize
self.env['screenData']['lines'] = int( self.env['screenData']['newContentBytes'][0]) self.env['screen']['lines'] = int( self.env['screen']['newContentBytes'][0])
self.env['screenData']['columns'] = int( self.env['screenData']['newContentBytes'][1]) self.env['screen']['columns'] = int( self.env['screen']['newContentBytes'][1])
self.env['screenData']['newCursor']['x'] = int( self.env['screenData']['newContentBytes'][2]) self.env['screen']['newCursor']['x'] = int( self.env['screen']['newContentBytes'][2])
self.env['screenData']['newCursor']['y'] = int( self.env['screenData']['newContentBytes'][3]) self.env['screen']['newCursor']['y'] = int( self.env['screen']['newContentBytes'][3])
# analyze content # analyze content
self.env['screenData']['newContentText'] = self.env['screenData']['newContentBytes'][4:][::2].decode(screenEncoding, "replace").encode('utf-8').decode('utf-8') self.env['screen']['newContentText'] = self.env['screen']['newContentBytes'][4:][::2].decode(screenEncoding, "replace").encode('utf-8').decode('utf-8')
self.env['screenData']['newContentText'] = screen_utils.removeNonprintable(self.env['screenData']['newContentText']) self.env['screen']['newContentText'] = screen_utils.removeNonprintable(self.env['screen']['newContentText'])
self.env['screenData']['newContentAttrib'] = self.env['screenData']['newContentBytes'][5:][::2] self.env['screen']['newContentAttrib'] = self.env['screen']['newContentBytes'][5:][::2]
self.env['screenData']['newContentText'] = screen_utils.insertNewlines(self.env['screenData']['newContentText'], self.env['screenData']['columns']) self.env['screen']['newContentText'] = screen_utils.insertNewlines(self.env['screen']['newContentText'], self.env['screen']['columns'])
if self.env['screenData']['newTTY'] != self.env['screenData']['oldTTY']: if self.env['screen']['newTTY'] != self.env['screen']['oldTTY']:
self.env['screenData']['oldContentBytes'] = b'' self.env['screen']['oldContentBytes'] = b''
self.env['screenData']['oldContentAttrib'] = b'' self.env['screen']['oldContentAttrib'] = b''
self.env['screenData']['oldContentText'] = '' self.env['screen']['oldContentText'] = ''
self.env['screenData']['oldCursor']['x'] = 0 self.env['screen']['oldCursor']['x'] = 0
self.env['screenData']['oldCursor']['y'] = 0 self.env['screen']['oldCursor']['y'] = 0
self.env['screenData']['oldDelta'] = '' self.env['screen']['oldDelta'] = ''
self.env['screenData']['oldAttribDelta'] = '' self.env['screen']['oldAttribDelta'] = ''
self.env['screenData']['oldCursorAttrib'] = None self.env['screen']['oldCursorAttrib'] = None
self.env['screenData']['newCursorAttrib'] = None self.env['screen']['newCursorAttrib'] = None
self.env['screenData']['oldNegativeDelta'] = '' self.env['screen']['oldNegativeDelta'] = ''
# initialize current deltas # initialize current deltas
self.env['screenData']['newNegativeDelta'] = '' self.env['screen']['newNegativeDelta'] = ''
self.env['screenData']['newDelta'] = '' self.env['screen']['newDelta'] = ''
self.env['screenData']['newAttribDelta'] = '' self.env['screen']['newAttribDelta'] = ''
# 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['screen']['oldContentText']))
newScreenText = re.sub(' +',' ',self.env['runtime']['screenManager'].getWindowAreaInText(self.env['screenData']['newContentText'])) newScreenText = re.sub(' +',' ',self.env['runtime']['screenManager'].getWindowAreaInText(self.env['screen']['newContentText']))
typing = False typing = False
if (self.env['screenData']['oldContentText'] != self.env['screenData']['newContentText']) and \ if (self.env['screen']['oldContentText'] != self.env['screen']['newContentText']) and \
(self.env['screenData']['newContentText'] != '' ): (self.env['screen']['newContentText'] != '' ):
if oldScreenText == '' and\ if oldScreenText == '' and\
newScreenText != '': newScreenText != '':
self.env['screenData']['newDelta'] = newScreenText self.env['screen']['newDelta'] = newScreenText
else: else:
cursorLineStart = self.env['screenData']['newCursor']['y'] * self.env['screenData']['columns'] + self.env['screenData']['newCursor']['y'] cursorLineStart = self.env['screen']['newCursor']['y'] * self.env['screen']['columns'] + self.env['screen']['newCursor']['y']
cursorLineEnd = cursorLineStart + self.env['screenData']['columns'] cursorLineEnd = cursorLineStart + self.env['screen']['columns']
if self.env['screenData']['oldCursor']['x'] != self.env['screenData']['newCursor']['x'] and \ if self.env['screen']['oldCursor']['x'] != self.env['screen']['newCursor']['x'] and \
self.env['screenData']['oldCursor']['y'] == self.env['screenData']['newCursor']['y'] and \ self.env['screen']['oldCursor']['y'] == self.env['screen']['newCursor']['y'] and \
self.env['screenData']['newContentText'][:cursorLineStart] == self.env['screenData']['oldContentText'][:cursorLineStart]: self.env['screen']['newContentText'][:cursorLineStart] == self.env['screen']['oldContentText'][:cursorLineStart]:
oldScreenText = self.env['screenData']['oldContentText'][cursorLineStart:cursorLineEnd] oldScreenText = self.env['screen']['oldContentText'][cursorLineStart:cursorLineEnd]
oldScreenText = re.sub(' +',' ',oldScreenText) oldScreenText = re.sub(' +',' ',oldScreenText)
newScreenText = self.env['screenData']['newContentText'][cursorLineStart:cursorLineEnd] newScreenText = self.env['screen']['newContentText'][cursorLineStart:cursorLineEnd]
newScreenText = re.sub(' +',' ',newScreenText) newScreenText = re.sub(' +',' ',newScreenText)
diff = difflib.ndiff(oldScreenText, newScreenText) diff = difflib.ndiff(oldScreenText, newScreenText)
typing = True typing = True
@ -174,13 +174,13 @@ class driver():
diffList = list(diff) diffList = list(diff)
if self.env['runtime']['settingsManager'].getSetting('general', 'newLinePause') and not typing: 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] == '+') self.env['screen']['newDelta'] = '\n'.join(x[2:] for x in diffList if x[0] == '+')
else: else:
self.env['screenData']['newDelta'] = ''.join(x[2:] for x in diffList if x[0] == '+') self.env['screen']['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['screen']['newNegativeDelta'] = ''.join(x[2:] for x in diffList if x[0] == '-')
# track highlighted # track highlighted
if self.env['screenData']['oldContentAttrib'] != self.env['screenData']['newContentAttrib']: if self.env['screen']['oldContentAttrib'] != self.env['screen']['newContentAttrib']:
if self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'highlight'): if self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'highlight'):
self.env['screenData']['newAttribDelta'], self.env['screenData']['newCursorAttrib'] = screen_utils.trackHighlights(self.env['screenData']['oldContentAttrib'], self.env['screenData']['newContentAttrib'], self.env['screenData']['newContentText'], self.env['screenData']['columns']) self.env['screen']['newAttribDelta'], self.env['screen']['newCursorAttrib'] = screen_utils.trackHighlights(self.env['screen']['oldContentAttrib'], self.env['screen']['newContentAttrib'], self.env['screen']['newContentText'], self.env['screen']['columns'])

View File

@ -43,7 +43,8 @@ class driver():
if self.speechCommand == '': if self.speechCommand == '':
self.speechCommand = 'espeak -a fenrirVolume -s fenrirRate -p fenrirPitch -v fenrirVoice "fenrirText"' self.speechCommand = 'espeak -a fenrirVolume -s fenrirRate -p fenrirPitch -v fenrirVoice "fenrirText"'
if False: #for debugging overwrite here if False: #for debugging overwrite here
self.speechCommand = 'spd-say --wait -r 100 -i 100 "fenrirText"' #self.speechCommand = 'spd-say --wait -r 100 -i 100 "fenrirText"'
self.speechCommand = 'flite -t "fenrirText"'
self._isInitialized = True self._isInitialized = True
if self._isInitialized: if self._isInitialized:
@ -78,9 +79,12 @@ class driver():
if self.proc: if self.proc:
try: try:
self.proc.terminate() self.proc.terminate()
except: except Exception as e:
self.env['runtime']['debug'].writeDebugOut('speechDriver:Cancel:self.proc.terminate():' + str(e),debug.debugLevel.WARNING)
try:
self.proc.kill() self.proc.kill()
finally: except Exception as e:
self.env['runtime']['debug'].writeDebugOut('speechDriver:Cancel:self.proc.kill():' + str(e),debug.debugLevel.WARNING)
self.proc = None self.proc = None
self.lock.release() self.lock.release()
def setCallback(self, callback): def setCallback(self, callback):

View File

@ -21,7 +21,7 @@ class driver():
self._punct = speechd.PunctuationMode() self._punct = speechd.PunctuationMode()
self._isInitialized = True self._isInitialized = True
except Exception as e: except Exception as e:
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR) self.env['runtime']['debug'].writeDebugOut('speechDriver initialize:' + str(e),debug.debugLevel.ERROR)
self._initialized = False self._initialized = False
def shutdown(self): def shutdown(self):
@ -46,6 +46,7 @@ class driver():
self._sd.set_punctuation(self._punct.NONE) self._sd.set_punctuation(self._punct.NONE)
self._sd.speak(text) self._sd.speak(text)
except Exception as e: except Exception as e:
self.env['runtime']['debug'].writeDebugOut('speechDriver speak:' + str(e),debug.debugLevel.ERROR)
self._isInitialized = False self._isInitialized = False
def cancel(self): def cancel(self):
@ -54,6 +55,7 @@ class driver():
try: try:
self._sd.cancel() self._sd.cancel()
except Exception as e: except Exception as e:
self.env['runtime']['debug'].writeDebugOut('speechDriver cancel:' + str(e),debug.debugLevel.ERROR)
self._isInitialized = False self._isInitialized = False
def setCallback(self, callback): def setCallback(self, callback):
@ -70,7 +72,7 @@ class driver():
if voice != '': if voice != '':
self._sd.set_voice(voice) self._sd.set_voice(voice)
except Exception as e: except Exception as e:
self._isInitialized = False self.env['runtime']['debug'].writeDebugOut('speechDriver setVoice:' + str(e),debug.debugLevel.ERROR)
def setPitch(self, pitch): def setPitch(self, pitch):
if not self._isInitialized: if not self._isInitialized:
@ -78,7 +80,7 @@ class driver():
try: try:
self._sd.set_pitch(int(-100 + pitch * 200)) self._sd.set_pitch(int(-100 + pitch * 200))
except Exception as e: except Exception as e:
self._isInitialized = False self.env['runtime']['debug'].writeDebugOut('speechDriver setPitch:' + str(e),debug.debugLevel.ERROR)
def setRate(self, rate): def setRate(self, rate):
if not self._isInitialized: if not self._isInitialized:
@ -86,7 +88,7 @@ class driver():
try: try:
self._sd.set_rate(int(-100 + rate * 200)) self._sd.set_rate(int(-100 + rate * 200))
except Exception as e: except Exception as e:
self._isInitialized = False self.env['runtime']['debug'].writeDebugOut('speechDriver setRate:' + str(e),debug.debugLevel.ERROR)
def setModule(self, module): def setModule(self, module):
if not self._isInitialized: if not self._isInitialized:
@ -94,7 +96,7 @@ class driver():
try: try:
self._sd.set_output_module(module) self._sd.set_output_module(module)
except Exception as e: except Exception as e:
self._isInitialized = False self.env['runtime']['debug'].writeDebugOut('speechDriver setModule:' + str(e),debug.debugLevel.ERROR)
def setLanguage(self, language): def setLanguage(self, language):
if not self._isInitialized: if not self._isInitialized:
@ -107,4 +109,4 @@ class driver():
try: try:
self._sd.set_volume(int(-100 + volume * 200)) self._sd.set_volume(int(-100 + volume * 200))
except Exception as e: except Exception as e:
self._isInitialized = False self.env['runtime']['debug'].writeDebugOut('speechDriver setVolume:' + str(e),debug.debugLevel.ERROR)