diff --git a/play zone/argp.py b/play zone/argp.py new file mode 100755 index 00000000..f97130d1 --- /dev/null +++ b/play zone/argp.py @@ -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) diff --git a/play zone/pya.py b/play zone/pya.py deleted file mode 100755 index f72d85e6..00000000 --- a/play zone/pya.py +++ /dev/null @@ -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) - diff --git a/play zone/pyterm.py b/play zone/pyterm.py new file mode 100755 index 00000000..7be1844a --- /dev/null +++ b/play zone/pyterm.py @@ -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) diff --git a/src/fenrir/commands/commands/add_word_to_spell_check.py b/src/fenrir/commands/commands/add_word_to_spell_check.py index 1dd04982..2eb5c579 100644 --- a/src/fenrir/commands/commands/add_word_to_spell_check.py +++ b/src/fenrir/commands/commands/add_word_to_spell_check.py @@ -40,7 +40,7 @@ class command(): return cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() # 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) currWord = currWord.strip(string.whitespace + '!"#$%&\()*+,-./:;<=§>?@[\\]^_{|}~') diff --git a/src/fenrir/commands/commands/bookmark_1.py b/src/fenrir/commands/commands/bookmark_1.py index 4ddae198..28923622 100644 --- a/src/fenrir/commands/commands/bookmark_1.py +++ b/src/fenrir/commands/commands/bookmark_1.py @@ -35,10 +35,10 @@ class command(): startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy() if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']: 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: 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(): self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True) else: diff --git a/src/fenrir/commands/commands/bookmark_10.py b/src/fenrir/commands/commands/bookmark_10.py index 6dec1f6a..d85dcf27 100644 --- a/src/fenrir/commands/commands/bookmark_10.py +++ b/src/fenrir/commands/commands/bookmark_10.py @@ -35,10 +35,10 @@ class command(): startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy() if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']: 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: 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(): self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True) else: diff --git a/src/fenrir/commands/commands/bookmark_2.py b/src/fenrir/commands/commands/bookmark_2.py index 86135a17..e25c59c2 100644 --- a/src/fenrir/commands/commands/bookmark_2.py +++ b/src/fenrir/commands/commands/bookmark_2.py @@ -35,10 +35,10 @@ class command(): startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy() if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']: 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: 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(): self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True) else: diff --git a/src/fenrir/commands/commands/bookmark_3.py b/src/fenrir/commands/commands/bookmark_3.py index 6c520f73..490e49b7 100644 --- a/src/fenrir/commands/commands/bookmark_3.py +++ b/src/fenrir/commands/commands/bookmark_3.py @@ -35,10 +35,10 @@ class command(): startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy() if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']: 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: 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(): self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True) else: diff --git a/src/fenrir/commands/commands/bookmark_4.py b/src/fenrir/commands/commands/bookmark_4.py index 0bbb53d5..09543ea6 100644 --- a/src/fenrir/commands/commands/bookmark_4.py +++ b/src/fenrir/commands/commands/bookmark_4.py @@ -35,10 +35,10 @@ class command(): startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy() if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']: 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: 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(): self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True) else: diff --git a/src/fenrir/commands/commands/bookmark_5.py b/src/fenrir/commands/commands/bookmark_5.py index 10c6fd2c..4df87ac9 100644 --- a/src/fenrir/commands/commands/bookmark_5.py +++ b/src/fenrir/commands/commands/bookmark_5.py @@ -35,10 +35,10 @@ class command(): startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy() if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']: 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: 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(): self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True) else: diff --git a/src/fenrir/commands/commands/bookmark_6.py b/src/fenrir/commands/commands/bookmark_6.py index defdd9be..0073e40a 100644 --- a/src/fenrir/commands/commands/bookmark_6.py +++ b/src/fenrir/commands/commands/bookmark_6.py @@ -35,10 +35,10 @@ class command(): startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy() if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']: 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: 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(): self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True) else: diff --git a/src/fenrir/commands/commands/bookmark_7.py b/src/fenrir/commands/commands/bookmark_7.py index 8a6baf49..8275698d 100644 --- a/src/fenrir/commands/commands/bookmark_7.py +++ b/src/fenrir/commands/commands/bookmark_7.py @@ -35,10 +35,10 @@ class command(): startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy() if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']: 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: 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(): self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True) else: diff --git a/src/fenrir/commands/commands/bookmark_8.py b/src/fenrir/commands/commands/bookmark_8.py index e4be37d3..6a5f2e42 100644 --- a/src/fenrir/commands/commands/bookmark_8.py +++ b/src/fenrir/commands/commands/bookmark_8.py @@ -35,10 +35,10 @@ class command(): startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy() if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']: 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: 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(): self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True) else: diff --git a/src/fenrir/commands/commands/bookmark_9.py b/src/fenrir/commands/commands/bookmark_9.py index f0afeb64..a86fcd1c 100644 --- a/src/fenrir/commands/commands/bookmark_9.py +++ b/src/fenrir/commands/commands/bookmark_9.py @@ -35,10 +35,10 @@ class command(): startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy() if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']: 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: 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(): self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True) else: diff --git a/src/fenrir/commands/commands/copy_marked_to_clipboard.py b/src/fenrir/commands/commands/copy_marked_to_clipboard.py index 687fa097..2a06bbf2 100644 --- a/src/fenrir/commands/commands/copy_marked_to_clipboard.py +++ b/src/fenrir/commands/commands/copy_marked_to_clipboard.py @@ -28,7 +28,7 @@ class command(): startMark = self.env['commandBuffer']['Marks']['1'].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']['currClipboard'] = 0 diff --git a/src/fenrir/commands/commands/curr_screen.py b/src/fenrir/commands/commands/curr_screen.py index 01d8723d..2de39736 100644 --- a/src/fenrir/commands/commands/curr_screen.py +++ b/src/fenrir/commands/commands/curr_screen.py @@ -17,10 +17,10 @@ class command(): return _('reads the contents of the current screen') 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) 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): pass diff --git a/src/fenrir/commands/commands/curr_screen_after_cursor.py b/src/fenrir/commands/commands/curr_screen_after_cursor.py index c009b9b0..1e059cc9 100644 --- a/src/fenrir/commands/commands/curr_screen_after_cursor.py +++ b/src/fenrir/commands/commands/curr_screen_after_cursor.py @@ -21,7 +21,7 @@ class command(): # Prefer review cursor over text cursor 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(): self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True) diff --git a/src/fenrir/commands/commands/curr_screen_before_cursor.py b/src/fenrir/commands/commands/curr_screen_before_cursor.py index 1e211ed0..8fd0a851 100644 --- a/src/fenrir/commands/commands/curr_screen_before_cursor.py +++ b/src/fenrir/commands/commands/curr_screen_before_cursor.py @@ -19,12 +19,12 @@ class command(): def run(self): # Prefer review cursor over text cursor - if self.env['screenData']['newCursorReview']: - cursorPos = self.env['screenData']['newCursorReview'].copy() + if self.env['screen']['newCursorReview']: + cursorPos = self.env['screen']['newCursorReview'].copy() 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(): self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True) diff --git a/src/fenrir/commands/commands/cursor_read_to_end_of_line.py b/src/fenrir/commands/commands/cursor_read_to_end_of_line.py index a8c69d32..93e8a8a0 100644 --- a/src/fenrir/commands/commands/cursor_read_to_end_of_line.py +++ b/src/fenrir/commands/commands/cursor_read_to_end_of_line.py @@ -21,7 +21,7 @@ class command(): cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() 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(): self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True) diff --git a/src/fenrir/commands/commands/export_clipboard_to_x.py b/src/fenrir/commands/commands/export_clipboard_to_x.py index 4e81906c..0497199f 100644 --- a/src/fenrir/commands/commands/export_clipboard_to_x.py +++ b/src/fenrir/commands/commands/export_clipboard_to_x.py @@ -46,7 +46,7 @@ class command(): print('4') return 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() self.env['runtime']['outputManager'].interruptOutput() screenEncoding = self.env['runtime']['settingsManager'].getSetting('screen', 'encoding') diff --git a/src/fenrir/commands/commands/indent_curr_line.py b/src/fenrir/commands/commands/indent_curr_line.py index 948b30cd..09907691 100644 --- a/src/fenrir/commands/commands/indent_curr_line.py +++ b/src/fenrir/commands/commands/indent_curr_line.py @@ -20,12 +20,12 @@ class command(): def run(self): # Prefer review cursor over text cursor - if self.env['screenData']['newCursorReview']: - cursorPos = self.env['screenData']['newCursorReview'].copy() + if self.env['screen']['newCursorReview']: + cursorPos = self.env['screen']['newCursorReview'].copy() else: - cursorPos = self.env['screenData']['newCursor'].copy() + cursorPos = self.env['screen']['newCursor'].copy() 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(): self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True) diff --git a/src/fenrir/commands/commands/last_incoming.py b/src/fenrir/commands/commands/last_incoming.py index 4c2e2a7c..effb7f37 100644 --- a/src/fenrir/commands/commands/last_incoming.py +++ b/src/fenrir/commands/commands/last_incoming.py @@ -17,7 +17,7 @@ class command(): return _('displays the last received text') 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): pass diff --git a/src/fenrir/commands/commands/marked_text.py b/src/fenrir/commands/commands/marked_text.py index 205757b6..9341382a 100644 --- a/src/fenrir/commands/commands/marked_text.py +++ b/src/fenrir/commands/commands/marked_text.py @@ -27,7 +27,7 @@ class command(): startMark = self.env['commandBuffer']['Marks']['1'].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(): self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True) diff --git a/src/fenrir/commands/commands/present_first_line.py b/src/fenrir/commands/commands/present_first_line.py index 385f199f..9d54e879 100644 --- a/src/fenrir/commands/commands/present_first_line.py +++ b/src/fenrir/commands/commands/present_first_line.py @@ -19,7 +19,7 @@ class command(): def run(self): x, y, firstLine = \ - line_utils.getCurrentLine(0, 0, self.env['screenData']['newContentText']) + line_utils.getCurrentLine(0, 0, self.env['screen']['newContentText']) if firstLine.isspace(): self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True) diff --git a/src/fenrir/commands/commands/present_last_line.py b/src/fenrir/commands/commands/present_last_line.py index ec83a2af..25316f4c 100644 --- a/src/fenrir/commands/commands/present_last_line.py +++ b/src/fenrir/commands/commands/present_last_line.py @@ -19,7 +19,7 @@ class command(): def run(self): 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(): self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True) diff --git a/src/fenrir/commands/commands/quit_fenrir.py b/src/fenrir/commands/commands/quit_fenrir.py index f79060aa..2ac67484 100644 --- a/src/fenrir/commands/commands/quit_fenrir.py +++ b/src/fenrir/commands/commands/quit_fenrir.py @@ -17,7 +17,7 @@ class command(): return _('exits Fenrir') def run(self): - self.env['generalInformation']['running'] = False + self.env['general']['running'] = False def setCallback(self, callback): pass diff --git a/src/fenrir/commands/commands/remove_word_from_spell_check.py b/src/fenrir/commands/commands/remove_word_from_spell_check.py index 0b860bf9..f212ee27 100644 --- a/src/fenrir/commands/commands/remove_word_from_spell_check.py +++ b/src/fenrir/commands/commands/remove_word_from_spell_check.py @@ -42,7 +42,7 @@ class command(): cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() # 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) currWord = currWord.strip(string.whitespace + '!"#$%&\()*+,-./:;<=§>?@[\\]^_{|}~') if not currWord.isspace(): diff --git a/src/fenrir/commands/commands/review_bottom.py b/src/fenrir/commands/commands/review_bottom.py index 98925c2d..07a431f4 100644 --- a/src/fenrir/commands/commands/review_bottom.py +++ b/src/fenrir/commands/commands/review_bottom.py @@ -17,7 +17,7 @@ class command(): return _('move review to bottom of screen') 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) def setCallback(self, callback): diff --git a/src/fenrir/commands/commands/review_curr_char.py b/src/fenrir/commands/commands/review_curr_char.py index 5c9d08f6..6784ba5f 100644 --- a/src/fenrir/commands/commands/review_curr_char.py +++ b/src/fenrir/commands/commands/review_curr_char.py @@ -20,8 +20,8 @@ class command(): def run(self): self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() - self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currChar = \ - char_utils.getCurrentChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) + self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currChar = \ + 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) diff --git a/src/fenrir/commands/commands/review_curr_char_phonetic.py b/src/fenrir/commands/commands/review_curr_char_phonetic.py index 66947cb4..061eec43 100644 --- a/src/fenrir/commands/commands/review_curr_char_phonetic.py +++ b/src/fenrir/commands/commands/review_curr_char_phonetic.py @@ -20,8 +20,8 @@ class command(): def run(self): self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() - self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currChar = \ - char_utils.getCurrentChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) + self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currChar = \ + char_utils.getCurrentChar(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText']) if currChar.isspace(): self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False) diff --git a/src/fenrir/commands/commands/review_curr_line.py b/src/fenrir/commands/commands/review_curr_line.py index fae007a7..af1de983 100644 --- a/src/fenrir/commands/commands/review_curr_line.py +++ b/src/fenrir/commands/commands/review_curr_line.py @@ -20,8 +20,8 @@ class command(): def run(self): self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() - self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currLine = \ - line_utils.getCurrentLine(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) + self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currLine = \ + line_utils.getCurrentLine(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText']) if currLine.isspace(): self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False) diff --git a/src/fenrir/commands/commands/review_curr_word.py b/src/fenrir/commands/commands/review_curr_word.py index c7367861..4436cd03 100644 --- a/src/fenrir/commands/commands/review_curr_word.py +++ b/src/fenrir/commands/commands/review_curr_word.py @@ -20,8 +20,8 @@ class command(): def run(self): self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() - self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currWord, endOfScreen, lineBreak = \ - word_utils.getCurrentWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) + self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currWord, endOfScreen, lineBreak = \ + word_utils.getCurrentWord(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText']) if currWord.isspace(): self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False) diff --git a/src/fenrir/commands/commands/review_curr_word_phonetic.py b/src/fenrir/commands/commands/review_curr_word_phonetic.py index 705a8faa..c58568cb 100644 --- a/src/fenrir/commands/commands/review_curr_word_phonetic.py +++ b/src/fenrir/commands/commands/review_curr_word_phonetic.py @@ -20,8 +20,8 @@ class command(): def run(self): self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() - self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currWord, endOfScreen, lineBreak = \ - word_utils.getCurrentWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) + self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currWord, endOfScreen, lineBreak = \ + word_utils.getCurrentWord(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText']) if currWord.isspace(): self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False) diff --git a/src/fenrir/commands/commands/review_down.py b/src/fenrir/commands/commands/review_down.py index 2d27ce6d..2428083e 100644 --- a/src/fenrir/commands/commands/review_down.py +++ b/src/fenrir/commands/commands/review_down.py @@ -19,8 +19,8 @@ class command(): def run(self): cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() - self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], downChar, endOfScreen = \ - char_utils.getDownChar(self.env['screenData']['newCursorReview']['x'],self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) + self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], downChar, endOfScreen = \ + 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) if endOfScreen: if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): diff --git a/src/fenrir/commands/commands/review_line_begin.py b/src/fenrir/commands/commands/review_line_begin.py index f0fd6bd6..c788a5ca 100644 --- a/src/fenrir/commands/commands/review_line_begin.py +++ b/src/fenrir/commands/commands/review_line_begin.py @@ -20,8 +20,8 @@ class command(): def run(self): cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() self.env['runtime']['cursorManager'].setReviewCursorPosition(0 ,cursorPos['y']) - self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currChar = \ - char_utils.getCurrentChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) + self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currChar = \ + char_utils.getCurrentChar(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText']) if currChar.isspace(): self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False) diff --git a/src/fenrir/commands/commands/review_line_end.py b/src/fenrir/commands/commands/review_line_end.py index 5cf14833..1af5b558 100644 --- a/src/fenrir/commands/commands/review_line_end.py +++ b/src/fenrir/commands/commands/review_line_end.py @@ -19,9 +19,9 @@ class command(): def run(self): cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() - self.env['runtime']['cursorManager'].setReviewCursorPosition(self.env['screenData']['columns']-1 ,cursorPos['y']) - self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currChar = \ - char_utils.getCurrentChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) + self.env['runtime']['cursorManager'].setReviewCursorPosition(self.env['screen']['columns']-1 ,cursorPos['y']) + self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currChar = \ + 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(_("end of line"), interrupt=False) diff --git a/src/fenrir/commands/commands/review_line_first_char.py b/src/fenrir/commands/commands/review_line_first_char.py index 79f8d45f..82f687a8 100644 --- a/src/fenrir/commands/commands/review_line_first_char.py +++ b/src/fenrir/commands/commands/review_line_first_char.py @@ -21,13 +21,13 @@ class command(): def run(self): cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() 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(): self.env['runtime']['outputManager'].presentText(_("line is empty"), interrupt=True) return self.env['runtime']['cursorManager'].setReviewCursorPosition((len(currLine) - len(currLine.lstrip())), cursorPos['y']) - self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], currChar = \ - char_utils.getCurrentChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) + self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currChar = \ + 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(_("first char in line indent {0}").format(str(len(currLine) - len(currLine.lstrip()))), interrupt=False) diff --git a/src/fenrir/commands/commands/review_line_last_char.py b/src/fenrir/commands/commands/review_line_last_char.py index bf3f7acb..f30265ee 100644 --- a/src/fenrir/commands/commands/review_line_last_char.py +++ b/src/fenrir/commands/commands/review_line_last_char.py @@ -19,9 +19,9 @@ class command(): def run(self): cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() - self.env['runtime']['cursorManager'].setReviewCursorPosition(self.env['screenData']['columns']-1 ,cursorPos['y']) - self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], lastChar = \ - char_utils.getLastCharInLine(self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) + self.env['runtime']['cursorManager'].setReviewCursorPosition(self.env['screen']['columns']-1 ,cursorPos['y']) + self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], lastChar = \ + 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(_("last char in line"), interrupt=False) diff --git a/src/fenrir/commands/commands/review_next_char.py b/src/fenrir/commands/commands/review_next_char.py index 856cac36..e3c0a2ee 100644 --- a/src/fenrir/commands/commands/review_next_char.py +++ b/src/fenrir/commands/commands/review_next_char.py @@ -19,8 +19,8 @@ class command(): def run(self): self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() - self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], nextChar, endOfScreen, lineBreak = \ - char_utils.getNextChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) + self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], nextChar, endOfScreen, lineBreak = \ + 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) if endOfScreen: diff --git a/src/fenrir/commands/commands/review_next_char_phonetic.py b/src/fenrir/commands/commands/review_next_char_phonetic.py index 6c989fec..f4ae4aa3 100644 --- a/src/fenrir/commands/commands/review_next_char_phonetic.py +++ b/src/fenrir/commands/commands/review_next_char_phonetic.py @@ -20,8 +20,8 @@ class command(): def run(self): self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() - self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], nextChar, endOfScreen, lineBreak = \ - char_utils.getNextChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) + self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], nextChar, endOfScreen, lineBreak = \ + char_utils.getNextChar(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText']) nextChar = char_utils.getPhonetic(nextChar) self.env['runtime']['outputManager'].presentText(nextChar ,interrupt=True, announceCapital=True, flush=False) diff --git a/src/fenrir/commands/commands/review_next_line.py b/src/fenrir/commands/commands/review_next_line.py index ca2902ed..a41550c1 100644 --- a/src/fenrir/commands/commands/review_next_line.py +++ b/src/fenrir/commands/commands/review_next_line.py @@ -18,12 +18,12 @@ class command(): return _('moves review to the next line and presents it') def run(self): - self.env['screenData']['oldCursorReview'] = self.env['screenData']['newCursorReview'] - if not self.env['screenData']['newCursorReview']: - self.env['screenData']['newCursorReview'] = self.env['screenData']['newCursor'].copy() + self.env['screen']['oldCursorReview'] = self.env['screen']['newCursorReview'] + if not self.env['screen']['newCursorReview']: + self.env['screen']['newCursorReview'] = self.env['screen']['newCursor'].copy() - self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], nextLine, endOfScreen = \ - line_utils.getNextLine(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) + self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], nextLine, endOfScreen = \ + line_utils.getNextLine(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText']) if nextLine.isspace(): self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False) diff --git a/src/fenrir/commands/commands/review_next_word.py b/src/fenrir/commands/commands/review_next_word.py index 4e149c9f..c05ca59a 100644 --- a/src/fenrir/commands/commands/review_next_word.py +++ b/src/fenrir/commands/commands/review_next_word.py @@ -18,12 +18,12 @@ class command(): return _('moves review to the next word and presents it') def run(self): - self.env['screenData']['oldCursorReview'] = self.env['screenData']['newCursorReview'] - if self.env['screenData']['newCursorReview'] == None: - self.env['screenData']['newCursorReview'] = self.env['screenData']['newCursor'].copy() + self.env['screen']['oldCursorReview'] = self.env['screen']['newCursorReview'] + if self.env['screen']['newCursorReview'] == None: + self.env['screen']['newCursorReview'] = self.env['screen']['newCursor'].copy() - self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], nextWord, endOfScreen, lineBreak = \ - word_utils.getNextWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) + self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], nextWord, endOfScreen, lineBreak = \ + word_utils.getNextWord(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText']) if nextWord.isspace(): self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False) diff --git a/src/fenrir/commands/commands/review_next_word_phonetic.py b/src/fenrir/commands/commands/review_next_word_phonetic.py index aa12e557..f0e9f90e 100644 --- a/src/fenrir/commands/commands/review_next_word_phonetic.py +++ b/src/fenrir/commands/commands/review_next_word_phonetic.py @@ -20,8 +20,8 @@ class command(): def run(self): self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() - self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], nextWord, endOfScreen, lineBreak = \ - word_utils.getNextWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) + self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], nextWord, endOfScreen, lineBreak = \ + word_utils.getNextWord(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText']) if nextWord.isspace(): self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False) diff --git a/src/fenrir/commands/commands/review_prev_char.py b/src/fenrir/commands/commands/review_prev_char.py index aec891d9..444eb32a 100644 --- a/src/fenrir/commands/commands/review_prev_char.py +++ b/src/fenrir/commands/commands/review_prev_char.py @@ -18,12 +18,12 @@ class command(): return _('moves review to the previous character and presents it') def run(self): - self.env['screenData']['oldCursorReview'] = self.env['screenData']['newCursorReview'] - if not self.env['screenData']['newCursorReview']: - self.env['screenData']['newCursorReview'] = self.env['screenData']['newCursor'].copy() + self.env['screen']['oldCursorReview'] = self.env['screen']['newCursorReview'] + if not self.env['screen']['newCursorReview']: + self.env['screen']['newCursorReview'] = self.env['screen']['newCursor'].copy() - self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], prevChar, endOfScreen, lineBreak = \ - char_utils.getPrevChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) + self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], prevChar, endOfScreen, lineBreak = \ + 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) if endOfScreen: diff --git a/src/fenrir/commands/commands/review_prev_char_phonetic.py b/src/fenrir/commands/commands/review_prev_char_phonetic.py index 4c977932..e66e0883 100644 --- a/src/fenrir/commands/commands/review_prev_char_phonetic.py +++ b/src/fenrir/commands/commands/review_prev_char_phonetic.py @@ -20,8 +20,8 @@ class command(): def run(self): self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() - self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], prevChar, endOfScreen, lineBreak = \ - char_utils.getPrevChar(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) + self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], prevChar, endOfScreen, lineBreak = \ + char_utils.getPrevChar(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText']) prevChar = char_utils.getPhonetic(prevChar) self.env['runtime']['outputManager'].presentText(prevChar ,interrupt=True, announceCapital=True, flush=False) diff --git a/src/fenrir/commands/commands/review_prev_line.py b/src/fenrir/commands/commands/review_prev_line.py index 8905cab7..c3601955 100644 --- a/src/fenrir/commands/commands/review_prev_line.py +++ b/src/fenrir/commands/commands/review_prev_line.py @@ -20,8 +20,8 @@ class command(): def run(self): self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() - self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], prevLine, endOfScreen = \ - line_utils.getPrevLine(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) + self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], prevLine, endOfScreen = \ + line_utils.getPrevLine(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText']) if prevLine.isspace(): self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False) diff --git a/src/fenrir/commands/commands/review_prev_word.py b/src/fenrir/commands/commands/review_prev_word.py index 3d2920ff..b36f3038 100644 --- a/src/fenrir/commands/commands/review_prev_word.py +++ b/src/fenrir/commands/commands/review_prev_word.py @@ -20,8 +20,8 @@ class command(): def run(self): self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() - self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], prevWord, endOfScreen, lineBreak = \ - word_utils.getPrevWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) + self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], prevWord, endOfScreen, lineBreak = \ + word_utils.getPrevWord(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText']) if prevWord.isspace(): self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False) diff --git a/src/fenrir/commands/commands/review_prev_word_phonetic.py b/src/fenrir/commands/commands/review_prev_word_phonetic.py index df22fc3a..eeddfd3e 100644 --- a/src/fenrir/commands/commands/review_prev_word_phonetic.py +++ b/src/fenrir/commands/commands/review_prev_word_phonetic.py @@ -20,8 +20,8 @@ class command(): def run(self): self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() - self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], prevWord, endOfScreen, lineBreak = \ - word_utils.getPrevWord(self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) + self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], prevWord, endOfScreen, lineBreak = \ + word_utils.getPrevWord(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText']) if prevWord.isspace(): self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False) diff --git a/src/fenrir/commands/commands/review_top.py b/src/fenrir/commands/commands/review_top.py index 9831e797..aaaed438 100644 --- a/src/fenrir/commands/commands/review_top.py +++ b/src/fenrir/commands/commands/review_top.py @@ -18,7 +18,7 @@ class command(): return _('move review to top of screen') 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) def setCallback(self, callback): diff --git a/src/fenrir/commands/commands/review_up.py b/src/fenrir/commands/commands/review_up.py index b92c0b37..1867e878 100644 --- a/src/fenrir/commands/commands/review_up.py +++ b/src/fenrir/commands/commands/review_up.py @@ -19,8 +19,8 @@ class command(): def run(self): cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() - self.env['screenData']['newCursorReview']['x'], self.env['screenData']['newCursorReview']['y'], upChar, endOfScreen = \ - char_utils.getUpChar(self.env['screenData']['newCursorReview']['x'],self.env['screenData']['newCursorReview']['y'], self.env['screenData']['newContentText']) + self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], upChar, endOfScreen = \ + 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) if endOfScreen: if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): diff --git a/src/fenrir/commands/commands/spell_check.py b/src/fenrir/commands/commands/spell_check.py index f6410569..c251ca02 100644 --- a/src/fenrir/commands/commands/spell_check.py +++ b/src/fenrir/commands/commands/spell_check.py @@ -44,7 +44,7 @@ class command(): cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() # 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) if not currWord.isspace(): diff --git a/src/fenrir/commands/commands/toggle_tutorial_mode.py b/src/fenrir/commands/commands/toggle_tutorial_mode.py index d54122f9..0fab4dfa 100644 --- a/src/fenrir/commands/commands/toggle_tutorial_mode.py +++ b/src/fenrir/commands/commands/toggle_tutorial_mode.py @@ -14,13 +14,13 @@ class command(): def shutdown(self): pass 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.') 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.') self.env['runtime']['outputManager'].presentText(text, interrupt=True) - self.env['generalInformation']['tutorialMode'] = True + self.env['general']['tutorialMode'] = True def setCallback(self, callback): pass diff --git a/src/fenrir/commands/onApplicationChange/inactive/test.py b/src/fenrir/commands/onApplicationChange/inactive/test.py index ca4d74b6..f17d8160 100644 --- a/src/fenrir/commands/onApplicationChange/inactive/test.py +++ b/src/fenrir/commands/onApplicationChange/inactive/test.py @@ -1,25 +1,25 @@ -#!/bin/python -# -*- coding: utf-8 -*- +#!/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']] +# -*- [['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 -# By Chrys, Storm Dragon, and contributers. +# 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 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(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No description found' - def run(self): - #print('new ', self.env['screenData']['newApplication']) - #print('old ', self.env['screenData']['oldApplication']) - #print('-----------') - pass +[['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(): + 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): + 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']] + 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']]): + [['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']] + 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): + 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']] + 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): + [['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']] + 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): + #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']]]) + #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']]]) + #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']]) + 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): - pass + 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): + 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']] diff --git a/src/fenrir/commands/onInput/45000-present_char_if_cursor_change_horizontal.py b/src/fenrir/commands/onInput/45000-present_char_if_cursor_change_horizontal.py index 7fd753e4..08deef10 100644 --- a/src/fenrir/commands/onInput/45000-present_char_if_cursor_change_horizontal.py +++ b/src/fenrir/commands/onInput/45000-present_char_if_cursor_change_horizontal.py @@ -35,7 +35,7 @@ class command(): # is it a horizontal change? if not self.env['runtime']['cursorManager'].isCursorHorizontalMove(): 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(): self.env['runtime']['outputManager'].presentText(currChar, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) def setCallback(self, callback): diff --git a/src/fenrir/commands/onInput/50000-char_echo.py b/src/fenrir/commands/onInput/50000-char_echo.py index cb42eda9..832263b2 100644 --- a/src/fenrir/commands/onInput/50000-char_echo.py +++ b/src/fenrir/commands/onInput/50000-char_echo.py @@ -20,16 +20,16 @@ class command(): if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'charEcho'): return # 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 # is there any change? if not self.env['runtime']['screenManager'].isDelta(): 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) - if len(self.env['screenData']['newDelta']) > 3: + if len(self.env['screen']['newDelta']) > 3: return # filter unneded space on word begin - currDelta = self.env['screenData']['newDelta'] + currDelta = self.env['screen']['newDelta'] if len(currDelta.strip()) != len(currDelta) and \ currDelta.strip() != '': currDelta = currDelta.strip() diff --git a/src/fenrir/commands/onInput/55000-present_line_if_cursor_change_vertical.py b/src/fenrir/commands/onInput/55000-present_line_if_cursor_change_vertical.py index 583d0897..905b7daf 100644 --- a/src/fenrir/commands/onInput/55000-present_line_if_cursor_change_vertical.py +++ b/src/fenrir/commands/onInput/55000-present_line_if_cursor_change_vertical.py @@ -26,14 +26,14 @@ class command(): return # 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 len(self.env['screenData']['newDelta']) > 4: + if len(self.env['screen']['newDelta']) > 4: return # is a vertical change? if not self.env['runtime']['cursorManager'].isCursorVerticalMove(): 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(): self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False) diff --git a/src/fenrir/commands/onInput/56000-highlight_tracking.py b/src/fenrir/commands/onInput/56000-highlight_tracking.py index 8797fe1d..419966f8 100644 --- a/src/fenrir/commands/onInput/56000-highlight_tracking.py +++ b/src/fenrir/commands/onInput/56000-highlight_tracking.py @@ -18,7 +18,7 @@ class command(): def run(self): if not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'highlight'): 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): pass diff --git a/src/fenrir/commands/onInput/60000-word_echo.py b/src/fenrir/commands/onInput/60000-word_echo.py index fd5391af..b0fab071 100644 --- a/src/fenrir/commands/onInput/60000-word_echo.py +++ b/src/fenrir/commands/onInput/60000-word_echo.py @@ -20,7 +20,7 @@ class command(): def run(self): # 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 # is it enabled? if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'wordEcho'): @@ -35,18 +35,18 @@ class command(): if self.env['runtime']['cursorManager'].isCursorVerticalMove(): return # 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 = \ - word_utils.getCurrentWord(self.env['screenData']['newCursor']['x'], 0, newContent) + word_utils.getCurrentWord(self.env['screen']['newCursor']['x'], 0, newContent) # currently writing if self.env['runtime']['screenManager'].isDelta(): return else: # 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 - if (x + len(currWord) != self.env['screenData']['newCursor']['x']) and \ - (x + len(currWord) != self.env['screenData']['newCursor']['x']-1): + if (x + len(currWord) != self.env['screen']['newCursor']['x']) and \ + (x + len(currWord) != self.env['screen']['newCursor']['x']-1): return if currWord != '': diff --git a/src/fenrir/commands/onInput/62000-spell_check.py b/src/fenrir/commands/onInput/62000-spell_check.py index 0b912a88..0a73cffd 100644 --- a/src/fenrir/commands/onInput/62000-spell_check.py +++ b/src/fenrir/commands/onInput/62000-spell_check.py @@ -55,35 +55,35 @@ class command(): if self.env['runtime']['cursorManager'].isCursorVerticalMove(): return # more than a keyecho? - if len(self.env['screenData']['newDelta']) > 1: + if len(self.env['screen']['newDelta']) > 1: return # deletion if self.env['runtime']['screenManager'].isNegativeDelta(): return # 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 # get the word (just for speedup only look at current line - newContent = self.env['screenData']['newContentText'].split('\n')[self.env['screenData']['newCursor']['y']] - x, y, currWord, endOfScreen, lineBreak = word_utils.getCurrentWord(self.env['screenData']['newCursor']['x'], 0, newContent) + newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] + x, y, currWord, endOfScreen, lineBreak = word_utils.getCurrentWord(self.env['screen']['newCursor']['x'], 0, newContent) # was this a typed word? 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 else: currWord = currWord.strip(string.whitespace + '!"#$%&()*+,-./:;<=>?@[\\]^_{|}~') else: # or just arrow arround? - if not newContent[self.env['screenData']['newCursor']['x']].isspace(): + if not newContent[self.env['screen']['newCursor']['x']].isspace(): return - if (x + len(currWord) != self.env['screenData']['newCursor']['x']) and \ - (x + len(currWord) != self.env['screenData']['newCursor']['x']-1): + if (x + len(currWord) != self.env['screen']['newCursor']['x']) and \ + (x + len(currWord) != self.env['screen']['newCursor']['x']-1): return # just on end of word - if self.env['screenData']['newCursor']['x'] > 0: - if not newContent[self.env['screenData']['oldCursor']['x'] - 1].lower() in string.ascii_lowercase: + if self.env['screen']['newCursor']['x'] > 0: + if not newContent[self.env['screen']['oldCursor']['x'] - 1].lower() in string.ascii_lowercase: return # ignore bash buildins diff --git a/src/fenrir/commands/onInput/65000-char_delete_echo.py b/src/fenrir/commands/onInput/65000-char_delete_echo.py index 66b87b9f..d64262e0 100644 --- a/src/fenrir/commands/onInput/65000-char_delete_echo.py +++ b/src/fenrir/commands/onInput/65000-char_delete_echo.py @@ -21,7 +21,7 @@ class command(): return # 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 # More than just a deletion happend @@ -36,9 +36,9 @@ class command(): # too much for a single backspace... # 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 - currNegativeDelta = self.env['screenData']['newNegativeDelta'] + currNegativeDelta = self.env['screen']['newNegativeDelta'] if len(currNegativeDelta.strip()) != len(currNegativeDelta) and \ currNegativeDelta.strip() != '': currNegativeDelta = currNegativeDelta.strip() diff --git a/src/fenrir/commands/onInput/72000-history.py b/src/fenrir/commands/onInput/72000-history.py index 99b3849b..7cde4a06 100644 --- a/src/fenrir/commands/onInput/72000-history.py +++ b/src/fenrir/commands/onInput/72000-history.py @@ -19,7 +19,7 @@ class command(): def run(self): if self.env['runtime']['inputManager'].noKeyPressed(): return - if self.env['screenData']['newAttribDelta'] != '': + if self.env['screen']['newAttribDelta'] != '': return if self.env['runtime']['screenManager'].isScreenChange(): return @@ -29,8 +29,8 @@ class command(): return if not self.env['input']['currInput'][0] in ['KEY_UP','KEY_DOWN']: return - prevLine = self.env['screenData']['oldContentText'].split('\n')[self.env['screenData']['newCursor']['y']] - currLine = self.env['screenData']['newContentText'].split('\n')[self.env['screenData']['newCursor']['y']] + prevLine = self.env['screen']['oldContentText'].split('\n')[self.env['screen']['newCursor']['y']] + currLine = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] if not currLine.isspace(): currPrompt = currLine.find('$') rootPrompt = currLine.find('#') diff --git a/src/fenrir/commands/onScreenChanged/80000-screen_change_announcement.py b/src/fenrir/commands/onScreenChanged/80000-screen_change_announcement.py index 6fc9a395..b59b8631 100644 --- a/src/fenrir/commands/onScreenChanged/80000-screen_change_announcement.py +++ b/src/fenrir/commands/onScreenChanged/80000-screen_change_announcement.py @@ -17,8 +17,8 @@ class command(): return 'No Description found' 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(self.env['screenData']['newContentText'], interrupt=False, 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['screen']['newContentText'], interrupt=False, flush=False) def setCallback(self, callback): pass diff --git a/src/fenrir/commands/onScreenUpdate/70000-incoming.py b/src/fenrir/commands/onScreenUpdate/70000-incoming.py index 36d868c9..d8601913 100644 --- a/src/fenrir/commands/onScreenUpdate/70000-incoming.py +++ b/src/fenrir/commands/onScreenUpdate/70000-incoming.py @@ -26,15 +26,15 @@ class command(): # its a cursor movement (experimental) - maybe also check current shortcut string? - #if not '$' in self.env['screenData']['newDelta'] and - # not '#' in self.env['screenData']['newDelta']: - if abs(self.env['screenData']['newCursor']['x'] - self.env['screenData']['oldCursor']['x']) >= 1: - if len(self.env['screenData']['newDelta'].strip(' \n\t0123456789')) <= 2: + #if not '$' in self.env['screen']['newDelta'] and + # not '#' in self.env['screen']['newDelta']: + if abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']) >= 1: + if len(self.env['screen']['newDelta'].strip(' \n\t0123456789')) <= 2: return - if abs(self.env['screenData']['newCursor']['y'] - self.env['screenData']['oldCursor']['y']) == 1: - if len(self.env['screenData']['newDelta'].strip(' \n\t0123456789')) <= 2: + if abs(self.env['screen']['newCursor']['y'] - self.env['screen']['oldCursor']['y']) == 1: + if len(self.env['screen']['newDelta'].strip(' \n\t0123456789')) <= 2: 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): pass diff --git a/src/fenrir/commands/onScreenUpdate/75000-incoming_promote.py b/src/fenrir/commands/onScreenUpdate/75000-incoming_promote.py index 3ec3f43b..a39b0688 100644 --- a/src/fenrir/commands/onScreenUpdate/75000-incoming_promote.py +++ b/src/fenrir/commands/onScreenUpdate/75000-incoming_promote.py @@ -22,14 +22,14 @@ class command(): return if self.env['runtime']['settingsManager'].getSetting('promote', 'list').strip(" \t\n") == '': return - if self.env['screenData']['newDelta'] == '': + if self.env['screen']['newDelta'] == '': return if int(time.time() - self.env['input']['lastInputTime']) < self.env['runtime']['settingsManager'].getSettingAsInt('promote', 'inactiveTimeoutSec'): return if len(self.env['runtime']['settingsManager'].getSetting('promote', 'list')) == 0: return 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['input']['lastInputTime'] = time.time() return diff --git a/src/fenrir/commands/onScreenUpdate/deactive/70000-incoming.py b/src/fenrir/commands/onScreenUpdate/deactive/70000-incoming.py index fe96b5c4..1b3ebae0 100644 --- a/src/fenrir/commands/onScreenUpdate/deactive/70000-incoming.py +++ b/src/fenrir/commands/onScreenUpdate/deactive/70000-incoming.py @@ -24,12 +24,12 @@ class command(): # return # 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 len(self.env['screenData']['newDelta'].strip(' \n\t')) <= 2: + if abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']) >= 1: + if len(self.env['screen']['newDelta'].strip(' \n\t')) <= 2: 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 - 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): pass diff --git a/src/fenrir/commands/onSwitchApplicationProfile/default.py b/src/fenrir/commands/onSwitchApplicationProfile/default.py index 130de5f6..04558ae3 100644 --- a/src/fenrir/commands/onSwitchApplicationProfile/default.py +++ b/src/fenrir/commands/onSwitchApplicationProfile/default.py @@ -19,14 +19,14 @@ class command(): return print('--------------') print('default') - print('load new',self.env['screenData']['newApplication']) + print('load new',self.env['screen']['newApplication']) print('--------------') def unload(self): return print('--------------') print('default') - print('unload old',self.env['screenData']['oldApplication']) + print('unload old',self.env['screen']['oldApplication']) print('--------------') def setCallback(self, callback): diff --git a/src/fenrir/commands/onSwitchApplicationProfile/inactive/agetty.py b/src/fenrir/commands/onSwitchApplicationProfile/inactive/agetty.py index dbd5250d..1fb59c8d 100644 --- a/src/fenrir/commands/onSwitchApplicationProfile/inactive/agetty.py +++ b/src/fenrir/commands/onSwitchApplicationProfile/inactive/agetty.py @@ -18,13 +18,13 @@ class command(): def load(self): print('--------------') print('agetty') - print('load new',self.env['screenData']['newApplication']) + print('load new',self.env['screen']['newApplication']) print('--------------') def unload(self): print('--------------') print('agetty') - print('unload old',self.env['screenData']['oldApplication']) + print('unload old',self.env['screen']['oldApplication']) print('--------------') def setCallback(self, callback): diff --git a/src/fenrir/commands/onSwitchApplicationProfile/inactive/bash.py b/src/fenrir/commands/onSwitchApplicationProfile/inactive/bash.py index d82b6e9d..7a5d7540 100644 --- a/src/fenrir/commands/onSwitchApplicationProfile/inactive/bash.py +++ b/src/fenrir/commands/onSwitchApplicationProfile/inactive/bash.py @@ -18,13 +18,13 @@ class command(): def load(self): print('--------------') print('bash') - print('load new',self.env['screenData']['newApplication']) + print('load new',self.env['screen']['newApplication']) print('--------------') def unload(self): print('--------------') print('bash') - print('unload old',self.env['screenData']['oldApplication']) + print('unload old',self.env['screen']['oldApplication']) print('--------------') def setCallback(self, callback): diff --git a/src/fenrir/commands/onSwitchApplicationProfile/inactive/vim.py b/src/fenrir/commands/onSwitchApplicationProfile/inactive/vim.py index 74ae0c40..78f02af9 100644 --- a/src/fenrir/commands/onSwitchApplicationProfile/inactive/vim.py +++ b/src/fenrir/commands/onSwitchApplicationProfile/inactive/vim.py @@ -18,13 +18,13 @@ class command(): def load(self): print('--------------') print('vim') - print('load new',self.env['screenData']['newApplication']) + print('load new',self.env['screen']['newApplication']) print('--------------') def unload(self): print('--------------') print('vim') - print('unload old',self.env['screenData']['oldApplication']) + print('unload old',self.env['screen']['oldApplication']) print('--------------') def setCallback(self, callback): diff --git a/src/fenrir/core/applicationManager.py b/src/fenrir/core/applicationManager.py index 8f127b88..202e6e35 100644 --- a/src/fenrir/core/applicationManager.py +++ b/src/fenrir/core/applicationManager.py @@ -14,18 +14,18 @@ class applicationManager(): def shutdown(self): pass def getCurrentApplication(self): - currApp = self.env['screenData']['newApplication'].upper() + currApp = self.env['screen']['newApplication'].upper() if not currApp: currApp == 'DEFAULT' if currApp == '': currApp == 'DEFAULT' return currApp def getPrevApplication(self): - prevApp = self.env['screenData']['oldApplication'].upper() + prevApp = self.env['screen']['oldApplication'].upper() if not prevApp: prevApp == 'DEFAULT' if prevApp == '': prevApp == 'DEFAULT' return prevApp def isApplicationChange(self): - return self.env['screenData']['oldApplication'] != self.env['screenData']['newApplication'] + return self.env['screen']['oldApplication'] != self.env['screen']['newApplication'] diff --git a/src/fenrir/core/commands.py b/src/fenrir/core/commandData.py similarity index 100% rename from src/fenrir/core/commands.py rename to src/fenrir/core/commandData.py diff --git a/src/fenrir/core/commandManager.py b/src/fenrir/core/commandManager.py index d813a6c2..631eabdf 100644 --- a/src/fenrir/core/commandManager.py +++ b/src/fenrir/core/commandManager.py @@ -15,7 +15,7 @@ class commandManager(): def initialize(self, environment): self.env = environment # commands - for commandFolder in self.env['generalInformation']['commandFolderList']: + for commandFolder in self.env['general']['commandFolderList']: self.env['runtime']['commandManager'].loadCommands(commandFolder, self.env['runtime']['settingsManager'].getSetting('general', 'commandPath')) self.env['runtime']['commandManager'].loadCommands(commandFolder) @@ -24,7 +24,7 @@ class commandManager(): self.env['runtime']['commandManager'].loadScriptCommands() def shutdown(self): - for commandFolder in self.env['generalInformation']['commandFolderList']: + for commandFolder in self.env['general']['commandFolderList']: self.env['runtime']['commandManager'].shutdownCommands(commandFolder) def loadCommands(self, section='commands',commandPath=''): @@ -180,7 +180,7 @@ class commandManager(): return if self.commandExists(command, section): try: - if self.env['generalInformation']['tutorialMode']: + if self.env['general']['tutorialMode']: self.env['runtime']['debug'].writeDebugOut("Tutorial for command:" + section + "." + command ,debug.debugLevel.INFO) description = self.env['commands'][section][command].getDescription() self.env['runtime']['outputManager'].presentText(description, interrupt=True) diff --git a/src/fenrir/core/cursorManager.py b/src/fenrir/core/cursorManager.py index 4995a167..2a3191e1 100644 --- a/src/fenrir/core/cursorManager.py +++ b/src/fenrir/core/cursorManager.py @@ -26,10 +26,10 @@ class cursorManager(): self.env['commandBuffer']['Marks']['2'] != None def setMark(self): currCursor = None - if self.env['screenData']['newCursorReview']: - currCursor = self.env['screenData']['newCursorReview'].copy() + if self.env['screen']['newCursorReview']: + currCursor = self.env['screen']['newCursorReview'].copy() else: - currCursor = self.env['screenData']['newCursor'].copy() + currCursor = self.env['screen']['newCursor'].copy() if not self.env['commandBuffer']['Marks']['1']: self.env['commandBuffer']['Marks']['1'] = currCursor.copy() return 1 @@ -38,43 +38,43 @@ class cursorManager(): return 2 return 0 def getReviewOrTextCursor(self): - if self.env['screenData']['newCursorReview']: - return self.env['screenData']['newCursorReview'].copy() + if self.env['screen']['newCursorReview']: + return self.env['screen']['newCursorReview'].copy() else: - return self.env['screenData']['newCursor'].copy() + return self.env['screen']['newCursor'].copy() def clearReviewCursor(self): if not self.isReviewMode(): return - self.env['screenData']['oldCursorReview'] = None - self.env['screenData']['newCursorReview'] = None + self.env['screen']['oldCursorReview'] = None + self.env['screen']['newCursorReview'] = None 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): - 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): - return self.env['screenData']['newCursorReview'] != None + return self.env['screen']['newCursorReview'] != None def enterReviewModeCurrTextCursor(self, overwrite=False): if self.isReviewMode() and not overwrite: return - self.env['screenData']['oldCursorReview'] = self.env['screenData']['newCursorReview'] - if not self.env['screenData']['newCursorReview']: - self.env['screenData']['newCursorReview'] = self.env['screenData']['newCursor'].copy() + self.env['screen']['oldCursorReview'] = self.env['screen']['newCursorReview'] + if not self.env['screen']['newCursorReview']: + self.env['screen']['newCursorReview'] = self.env['screen']['newCursor'].copy() if self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'highlight') and \ - self.env['screenData']['newCursorAttrib'] != None: - if self.env['screenData']['newCursorAttrib']['x'] != 0 and \ - self.env['screenData']['newCursorAttrib']['y'] != 0: - self.env['screenData']['newCursorReview'] = self.env['screenData']['newCursorAttrib'].copy() + self.env['screen']['newCursorAttrib'] != None: + if self.env['screen']['newCursorAttrib']['x'] != 0 and \ + self.env['screen']['newCursorAttrib']['y'] != 0: + self.env['screen']['newCursorReview'] = self.env['screen']['newCursorAttrib'].copy() def setReviewCursorPosition(self, x, y): if not self.isReviewMode(): self.enterReviewModeCurrTextCursor() - self.env['screenData']['oldCursorReview'] = self.env['screenData']['newCursorReview'] - self.env['screenData']['newCursorReview']['x'] = x - self.env['screenData']['newCursorReview']['y'] = y + self.env['screen']['oldCursorReview'] = self.env['screen']['newCursorReview'] + self.env['screen']['newCursorReview']['x'] = x + self.env['screen']['newCursorReview']['y'] = y def isApplicationWindowSet(self): try: diff --git a/src/fenrir/core/environment.py b/src/fenrir/core/environment.py index 410c8e99..0dde4f99 100644 --- a/src/fenrir/core/environment.py +++ b/src/fenrir/core/environment.py @@ -5,27 +5,27 @@ # By Chrys, Storm Dragon, and contributers. from core import debug -from core import settings -from core import runtime -from core import screenData -from core import output -from core import generalInformation -from core import commands -from core import inputEvent -from core import punctuation +from core.settingsData import settingsData +from core.runtimeData import runtimeData +from core.screenData import screenData +from core.outputData import outputData +from core.generalData import generalData +from core import commandData +from core.inputData import inputData +from core.punctuationData import punctuationData environment = { -'screenData': screenData.screenData, -'runtime': runtime.runtime, -'generalInformation': generalInformation.generalInformation, -'settings': settings.settings, -'commands': commands.commands, -'commandsIgnore': commands.commandsIgnore, -'commandInfo': commands.commandInfo, -'commandBuffer': commands.commandBuffer, -'input': inputEvent.input, -'punctuation': punctuation.punctuation, -'output': output.output, +'screen': screenData, +'runtime': runtimeData, +'general': generalData, +'settings': settingsData, +'commands': commandData.commands, +'commandsIgnore': commandData.commandsIgnore, +'commandInfo': commandData.commandInfo, +'commandBuffer': commandData.commandBuffer, +'input': inputData, +'punctuation': punctuationData, +'output': outputData, 'soundIcons': {}, 'bindings': {}, } diff --git a/src/fenrir/core/eventManager.py b/src/fenrir/core/eventManager.py new file mode 100644 index 00000000..e81407cb --- /dev/null +++ b/src/fenrir/core/eventManager.py @@ -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 ) +''' diff --git a/src/fenrir/core/fenrirManager.py b/src/fenrir/core/fenrirManager.py index 4ce78846..d70aa1ae 100644 --- a/src/fenrir/core/fenrirManager.py +++ b/src/fenrir/core/fenrirManager.py @@ -46,7 +46,7 @@ class fenrirManager(): def proceed(self): if not self.initialized: return - while(self.environment['generalInformation']['running']): + while(self.environment['general']['running']): try: self.handleProcess() except Exception as e: @@ -61,13 +61,13 @@ class fenrirManager(): self.environment['runtime']['inputManager'].updateInputDevices() if eventReceived: 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() if self.environment['runtime']['inputManager'].noKeyPressed(): if self.wasCommand: self.wasCommand = False self.environment['runtime']['inputManager'].clearEventBuffer() - if self.environment['generalInformation']['tutorialMode']: + if self.environment['general']['tutorialMode']: self.environment['runtime']['inputManager'].clearEventBuffer() if self.environment['input']['keyForeward'] > 0: self.environment['input']['keyForeward'] -=1 @@ -112,14 +112,14 @@ class fenrirManager(): self.environment['runtime']['commandManager'].executeCommand( self.environment['commandInfo']['currCommand'], 'commands') def shutdownRequest(self): - self.environment['generalInformation']['running'] = False + self.environment['general']['running'] = False def captureSignal(self, siginit, frame): self.shutdownRequest() def shutdown(self): 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]: self.environment['runtime'][currManager].shutdown() del self.environment['runtime'][currManager] diff --git a/src/fenrir/core/generalInformation.py b/src/fenrir/core/generalData.py similarity index 77% rename from src/fenrir/core/generalInformation.py rename to src/fenrir/core/generalData.py index 7086a39d..6e4d666b 100644 --- a/src/fenrir/core/generalInformation.py +++ b/src/fenrir/core/generalData.py @@ -6,13 +6,13 @@ from core import debug -generalInformation = { +generalData = { 'running': True, 'args': None, 'tutorialMode': False, 'currUser':'', 'prevUser':'', -'managerList':['punctuationManager','cursorManager','applicationManager','commandManager' +'managerList':['eventManager','punctuationManager','cursorManager','applicationManager','commandManager' ,'screenManager','inputManager','outputManager','debug'], 'commandFolderList':['commands','onInput','onScreenUpdate','onScreenChanged' ,'onApplicationChange','onSwitchApplicationProfile',], diff --git a/src/fenrir/core/inputEvent.py b/src/fenrir/core/inputData.py similarity index 99% rename from src/fenrir/core/inputEvent.py rename to src/fenrir/core/inputData.py index c01b48f8..6b2fdf95 100644 --- a/src/fenrir/core/inputEvent.py +++ b/src/fenrir/core/inputData.py @@ -7,7 +7,7 @@ from core import debug import time -input = { +inputData = { 'currInput': [], 'prevDeepestInput': [], 'eventBuffer': [], @@ -32,6 +32,5 @@ inputEvent = { 'EventState': 0, } - keyNames = ['KEY_RESERVED', 'KEY_ESC', 'KEY_1', 'KEY_2', 'KEY_3', 'KEY_4', 'KEY_5', 'KEY_6', 'KEY_7', 'KEY_8', 'KEY_9', 'KEY_0', 'KEY_MINUS', 'KEY_EQUAL', 'KEY_BACKSPACE', 'KEY_TAB', 'KEY_Q', 'KEY_W', 'KEY_E', 'KEY_R', 'KEY_T', 'KEY_Y', 'KEY_U', 'KEY_I', 'KEY_O', 'KEY_P', 'KEY_LEFTBRACE', 'KEY_RIGHTBRACE', 'KEY_ENTER', 'KEY_LEFTCTRL', 'KEY_A', 'KEY_S', 'KEY_D', 'KEY_F', 'KEY_G', 'KEY_H', 'KEY_J', 'KEY_K', 'KEY_L', 'KEY_SEMICOLON', 'KEY_APOSTROPHE', 'KEY_GRAVE', 'KEY_LEFTSHIFT', 'KEY_BACKSLASH', 'KEY_Z', 'KEY_X', 'KEY_C', 'KEY_V', 'KEY_B', 'KEY_N', 'KEY_M', 'KEY_COMMA', 'KEY_DOT', 'KEY_SLASH', 'KEY_RIGHTSHIFT', 'KEY_KPASTERISK', 'KEY_LEFTALT', 'KEY_SPACE', 'KEY_CAPSLOCK', 'KEY_F1', 'KEY_F2', 'KEY_F3', 'KEY_F4', 'KEY_F5', 'KEY_F6', 'KEY_F7', 'KEY_F8', 'KEY_F9', 'KEY_F10', 'KEY_NUMLOCK', 'KEY_SCROLLLOCK', 'KEY_KP7', 'KEY_KP8', 'KEY_KP9', 'KEY_KPMINUS', 'KEY_KP4', 'KEY_KP5', 'KEY_KP6', 'KEY_KPPLUS', 'KEY_KP1', 'KEY_KP2', 'KEY_KP3', 'KEY_KP0', 'KEY_KPDOT', 'KEY_ZENKAKUHANKAKU', 'KEY_102ND', 'KEY_F11', 'KEY_F12', 'KEY_RO', 'KEY_KATAKANA', 'KEY_HIRAGANA', 'KEY_HENKAN', 'KEY_KATAKANAHIRAGANA', 'KEY_MUHENKAN', 'KEY_KPJPCOMMA', 'KEY_KPENTER', 'KEY_RIGHTCTRL', 'KEY_KPSLASH', 'KEY_SYSRQ', 'KEY_RIGHTALT', 'KEY_LINEFEED', 'KEY_HOME', 'KEY_UP', 'KEY_PAGEUP', 'KEY_LEFT', 'KEY_RIGHT', 'KEY_END', 'KEY_DOWN', 'KEY_PAGEDOWN', 'KEY_INSERT', 'KEY_DELETE', 'KEY_MACRO', 'KEY_MIN_INTERESTING', 'KEY_MUTE', 'KEY_VOLUMEDOWN', 'KEY_VOLUMEUP', 'KEY_POWER', 'KEY_KPEQUAL', 'KEY_KPPLUSMINUS', 'KEY_PAUSE', 'KEY_SCALE', 'KEY_KPCOMMA', 'KEY_HANGEUL', 'KEY_HANGUEL', 'KEY_HANJA', 'KEY_YEN', 'KEY_LEFTMETA', 'KEY_RIGHTMETA', 'KEY_COMPOSE', 'KEY_STOP', 'KEY_AGAIN', 'KEY_PROPS', 'KEY_UNDO', 'KEY_FRONT', 'KEY_COPY', 'KEY_OPEN', 'KEY_PASTE', 'KEY_FIND', 'KEY_CUT', 'KEY_HELP', 'KEY_MENU', 'KEY_CALC', 'KEY_SETUP', 'KEY_SLEEP', 'KEY_WAKEUP', 'KEY_FILE', 'KEY_SENDFILE', 'KEY_DELETEFILE', 'KEY_XFER', 'KEY_PROG1', 'KEY_PROG2', 'KEY_WWW', 'KEY_MSDOS', 'KEY_COFFEE', 'KEY_SCREENLOCK', 'KEY_DIRECTION', 'KEY_ROTATE_DISPLAY', 'KEY_CYCLEWINDOWS', 'KEY_MAIL', 'KEY_BOOKMARKS', 'KEY_COMPUTER', 'KEY_BACK', 'KEY_FORWARD', 'KEY_CLOSECD', 'KEY_EJECTCD', 'KEY_EJECTCLOSECD', 'KEY_NEXTSONG', 'KEY_PLAYPAUSE', 'KEY_PREVIOUSSONG', 'KEY_STOPCD', 'KEY_RECORD', 'KEY_REWIND', 'KEY_PHONE', 'KEY_ISO', 'KEY_CONFIG', 'KEY_HOMEPAGE', 'KEY_REFRESH', 'KEY_EXIT', 'KEY_MOVE', 'KEY_EDIT', 'KEY_SCROLLUP', 'KEY_SCROLLDOWN', 'KEY_KPLEFTPAREN', 'KEY_KPRIGHTPAREN', 'KEY_NEW', 'KEY_REDO', 'KEY_F13', 'KEY_F14', 'KEY_F15', 'KEY_F16', 'KEY_F17', 'KEY_F18', 'KEY_F19', 'KEY_F20', 'KEY_F21', 'KEY_F22', 'KEY_F23', 'KEY_F24', 'KEY_PLAYCD', 'KEY_PAUSECD', 'KEY_PROG3', 'KEY_PROG4', 'KEY_DASHBOARD', 'KEY_SUSPEND', 'KEY_CLOSE', 'KEY_PLAY', 'KEY_FASTFORWARD', 'KEY_BASSBOOST', 'KEY_PRINT', 'KEY_HP', 'KEY_CAMERA', 'KEY_SOUND', 'KEY_QUESTION', 'KEY_EMAIL', 'KEY_CHAT', 'KEY_SEARCH', 'KEY_CONNECT', 'KEY_FINANCE', 'KEY_SPORT', 'KEY_SHOP', 'KEY_ALTERASE', 'KEY_CANCEL', 'KEY_BRIGHTNESSDOWN', 'KEY_BRIGHTNESSUP', 'KEY_MEDIA', 'KEY_SWITCHVIDEOMODE', 'KEY_KBDILLUMTOGGLE', 'KEY_KBDILLUMDOWN', 'KEY_KBDILLUMUP', 'KEY_SEND', 'KEY_REPLY', 'KEY_FORWARDMAIL', 'KEY_SAVE', 'KEY_DOCUMENTS', 'KEY_BATTERY', 'KEY_BLUETOOTH', 'KEY_WLAN', 'KEY_UWB', 'KEY_UNKNOWN', 'KEY_VIDEO_NEXT', 'KEY_VIDEO_PREV', 'KEY_BRIGHTNESS_CYCLE', 'KEY_BRIGHTNESS_AUTO', 'KEY_BRIGHTNESS_ZERO', 'KEY_DISPLAY_OFF', 'KEY_WIMAX', 'KEY_WWAN', 'KEY_RFKILL', 'KEY_MICMUTE', 'BTN_0', 'BTN_MISC', 'BTN_1', 'BTN_2', 'BTN_3', 'BTN_4', 'BTN_5', 'BTN_6', 'BTN_7', 'BTN_8', 'BTN_9', 'BTN_LEFT', 'BTN_MOUSE', 'BTN_RIGHT', 'BTN_MIDDLE', 'BTN_SIDE', 'BTN_EXTRA', 'BTN_FORWARD', 'BTN_BACK', 'BTN_TASK', 'BTN_JOYSTICK', 'BTN_TRIGGER', 'BTN_THUMB', 'BTN_THUMB2', 'BTN_TOP', 'BTN_TOP2', 'BTN_PINKIE', 'BTN_BASE', 'BTN_BASE2', 'BTN_BASE3', 'BTN_BASE4', 'BTN_BASE5', 'BTN_BASE6', 'BTN_DEAD', 'BTN_A', 'BTN_GAMEPAD', 'BTN_SOUTH', 'BTN_B', 'BTN_EAST', 'BTN_C', 'BTN_NORTH', 'BTN_X', 'BTN_WEST', 'BTN_Y', 'BTN_Z', 'BTN_TL', 'BTN_TR', 'BTN_TL2', 'BTN_TR2', 'BTN_SELECT', 'BTN_START', 'BTN_MODE', 'BTN_THUMBL', 'BTN_THUMBR', 'BTN_DIGI', 'BTN_TOOL_PEN', 'BTN_TOOL_RUBBER', 'BTN_TOOL_BRUSH', 'BTN_TOOL_PENCIL', 'BTN_TOOL_AIRBRUSH', 'BTN_TOOL_FINGER', 'BTN_TOOL_MOUSE', 'BTN_TOOL_LENS', 'BTN_TOOL_QUINTTAP', 'BTN_TOUCH', 'BTN_STYLUS', 'BTN_STYLUS2', 'BTN_TOOL_DOUBLETAP', 'BTN_TOOL_TRIPLETAP', 'BTN_TOOL_QUADTAP', 'BTN_GEAR_DOWN', 'BTN_WHEEL', 'BTN_GEAR_UP', 'KEY_OK', 'KEY_SELECT', 'KEY_GOTO', 'KEY_CLEAR', 'KEY_POWER2', 'KEY_OPTION', 'KEY_INFO', 'KEY_TIME', 'KEY_VENDOR', 'KEY_ARCHIVE', 'KEY_PROGRAM', 'KEY_CHANNEL', 'KEY_FAVORITES', 'KEY_EPG', 'KEY_PVR', 'KEY_MHP', 'KEY_LANGUAGE', 'KEY_TITLE', 'KEY_SUBTITLE', 'KEY_ANGLE', 'KEY_ZOOM', 'KEY_MODE', 'KEY_KEYBOARD', 'KEY_SCREEN', 'KEY_PC', 'KEY_TV', 'KEY_TV2', 'KEY_VCR', 'KEY_VCR2', 'KEY_SAT', 'KEY_SAT2', 'KEY_CD', 'KEY_TAPE', 'KEY_RADIO', 'KEY_TUNER', 'KEY_PLAYER', 'KEY_TEXT', 'KEY_DVD', 'KEY_AUX', 'KEY_MP3', 'KEY_AUDIO', 'KEY_VIDEO', 'KEY_DIRECTORY', 'KEY_LIST', 'KEY_MEMO', 'KEY_CALENDAR', 'KEY_RED', 'KEY_GREEN', 'KEY_YELLOW', 'KEY_BLUE', 'KEY_CHANNELUP', 'KEY_CHANNELDOWN', 'KEY_FIRST', 'KEY_LAST', 'KEY_AB', 'KEY_NEXT', 'KEY_RESTART', 'KEY_SLOW', 'KEY_SHUFFLE', 'KEY_BREAK', 'KEY_PREVIOUS', 'KEY_DIGITS', 'KEY_TEEN', 'KEY_TWEN', 'KEY_VIDEOPHONE', 'KEY_GAMES', 'KEY_ZOOMIN', 'KEY_ZOOMOUT', 'KEY_ZOOMRESET', 'KEY_WORDPROCESSOR', 'KEY_EDITOR', 'KEY_SPREADSHEET', 'KEY_GRAPHICSEDITOR', 'KEY_PRESENTATION', 'KEY_DATABASE', 'KEY_NEWS', 'KEY_VOICEMAIL', 'KEY_ADDRESSBOOK', 'KEY_MESSENGER', 'KEY_BRIGHTNESS_TOGGLE', 'KEY_DISPLAYTOGGLE', 'KEY_SPELLCHECK', 'KEY_LOGOFF', 'KEY_DOLLAR', 'KEY_EURO', 'KEY_FRAMEBACK', 'KEY_FRAMEFORWARD', 'KEY_CONTEXT_MENU', 'KEY_MEDIA_REPEAT', 'KEY_10CHANNELSUP', 'KEY_10CHANNELSDOWN', 'KEY_IMAGES', 'KEY_DEL_EOL', 'KEY_DEL_EOS', 'KEY_INS_LINE', 'KEY_DEL_LINE', 'KEY_FN', 'KEY_FN_ESC', 'KEY_FN_F1', 'KEY_FN_F2', 'KEY_FN_F3', 'KEY_FN_F4', 'KEY_FN_F5', 'KEY_FN_F6', 'KEY_FN_F7', 'KEY_FN_F8', 'KEY_FN_F9', 'KEY_FN_F10', 'KEY_FN_F11', 'KEY_FN_F12', 'KEY_FN_1', 'KEY_FN_2', 'KEY_FN_D', 'KEY_FN_E', 'KEY_FN_F', 'KEY_FN_S', 'KEY_FN_B', 'KEY_BRL_DOT1', 'KEY_BRL_DOT2', 'KEY_BRL_DOT3', 'KEY_BRL_DOT4', 'KEY_BRL_DOT5', 'KEY_BRL_DOT6', 'KEY_BRL_DOT7', 'KEY_BRL_DOT8', 'KEY_BRL_DOT9', 'KEY_BRL_DOT10', 'KEY_NUMERIC_0', 'KEY_NUMERIC_1', 'KEY_NUMERIC_2', 'KEY_NUMERIC_3', 'KEY_NUMERIC_4', 'KEY_NUMERIC_5', 'KEY_NUMERIC_6', 'KEY_NUMERIC_7', 'KEY_NUMERIC_8', 'KEY_NUMERIC_9', 'KEY_NUMERIC_STAR', 'KEY_NUMERIC_POUND', 'KEY_NUMERIC_A', 'KEY_NUMERIC_B', 'KEY_NUMERIC_C', 'KEY_NUMERIC_D', 'KEY_CAMERA_FOCUS', 'KEY_WPS_BUTTON', 'KEY_TOUCHPAD_TOGGLE', 'KEY_TOUCHPAD_ON', 'KEY_TOUCHPAD_OFF', 'KEY_CAMERA_ZOOMIN', 'KEY_CAMERA_ZOOMOUT', 'KEY_CAMERA_UP', 'KEY_CAMERA_DOWN', 'KEY_CAMERA_LEFT', 'KEY_CAMERA_RIGHT', 'KEY_ATTENDANT_ON', 'KEY_ATTENDANT_OFF', 'KEY_ATTENDANT_TOGGLE', 'KEY_LIGHTS_TOGGLE', 'BTN_DPAD_UP', 'BTN_DPAD_DOWN', 'BTN_DPAD_LEFT', 'BTN_DPAD_RIGHT', 'KEY_ALS_TOGGLE', 'KEY_BUTTONCONFIG', 'KEY_TASKMANAGER', 'KEY_JOURNAL', 'KEY_CONTROLPANEL', 'KEY_APPSELECT', 'KEY_SCREENSAVER', 'KEY_VOICECOMMAND', 'KEY_BRIGHTNESS_MIN', 'KEY_BRIGHTNESS_MAX', 'KEY_KBDINPUTASSIST_PREV', 'KEY_KBDINPUTASSIST_NEXT', 'KEY_KBDINPUTASSIST_PREVGROUP', 'KEY_KBDINPUTASSIST_NEXTGROUP', 'KEY_KBDINPUTASSIST_ACCEPT', 'KEY_KBDINPUTASSIST_CANCEL', 'KEY_RIGHT_UP', 'KEY_RIGHT_DOWN', 'KEY_LEFT_UP', 'KEY_LEFT_DOWN', 'KEY_ROOT_MENU', 'KEY_MEDIA_TOP_MENU', 'KEY_NUMERIC_11', 'KEY_NUMERIC_12', 'KEY_AUDIO_DESC', 'KEY_3D_MODE', 'KEY_NEXT_FAVORITE', 'KEY_STOP_RECORD', 'KEY_PAUSE_RECORD', 'KEY_VOD', 'KEY_UNMUTE', 'KEY_DATA', 'KEY_FASTREVERSE', 'KEY_SLOWREVERSE', 'BTN_TRIGGER_HAPPY', 'BTN_TRIGGER_HAPPY1', 'BTN_TRIGGER_HAPPY2', 'BTN_TRIGGER_HAPPY3', 'BTN_TRIGGER_HAPPY4', 'BTN_TRIGGER_HAPPY5', 'BTN_TRIGGER_HAPPY6', 'BTN_TRIGGER_HAPPY7', 'BTN_TRIGGER_HAPPY8', 'BTN_TRIGGER_HAPPY9', 'BTN_TRIGGER_HAPPY10', 'BTN_TRIGGER_HAPPY11', 'BTN_TRIGGER_HAPPY12', 'BTN_TRIGGER_HAPPY13', 'BTN_TRIGGER_HAPPY14', 'BTN_TRIGGER_HAPPY15', 'BTN_TRIGGER_HAPPY16', 'BTN_TRIGGER_HAPPY17', 'BTN_TRIGGER_HAPPY18', 'BTN_TRIGGER_HAPPY19', 'BTN_TRIGGER_HAPPY20', 'BTN_TRIGGER_HAPPY21', 'BTN_TRIGGER_HAPPY22', 'BTN_TRIGGER_HAPPY23', 'BTN_TRIGGER_HAPPY24', 'BTN_TRIGGER_HAPPY25', 'BTN_TRIGGER_HAPPY26', 'BTN_TRIGGER_HAPPY27', 'BTN_TRIGGER_HAPPY28', 'BTN_TRIGGER_HAPPY29', 'BTN_TRIGGER_HAPPY30', 'BTN_TRIGGER_HAPPY31', 'BTN_TRIGGER_HAPPY32', 'BTN_TRIGGER_HAPPY33', 'BTN_TRIGGER_HAPPY34', 'BTN_TRIGGER_HAPPY35', 'BTN_TRIGGER_HAPPY36', 'BTN_TRIGGER_HAPPY37', 'BTN_TRIGGER_HAPPY38', 'BTN_TRIGGER_HAPPY39', 'BTN_TRIGGER_HAPPY40', 'KEY_FENRIR', 'KEY_SCRIPT', 'KEY_ALT', 'KEY_CTRL', 'KEY_META', 'KEY_SHIFT'] diff --git a/src/fenrir/core/inputManager.py b/src/fenrir/core/inputManager.py index 935487b0..fd5d3e2b 100644 --- a/src/fenrir/core/inputManager.py +++ b/src/fenrir/core/inputManager.py @@ -6,7 +6,6 @@ import time from core import debug -from core import inputEvent class inputManager(): def __init__(self): diff --git a/src/fenrir/core/output.py b/src/fenrir/core/outputData.py similarity index 94% rename from src/fenrir/core/output.py rename to src/fenrir/core/outputData.py index b029e332..684acd60 100644 --- a/src/fenrir/core/output.py +++ b/src/fenrir/core/outputData.py @@ -7,7 +7,7 @@ import time from core import debug -output = { +outputData = { 'nextFlush': time.time(), 'messageText': '', 'messageOffset': None, diff --git a/src/fenrir/core/outputManager.py b/src/fenrir/core/outputManager.py index 63a34d84..dba07819 100644 --- a/src/fenrir/core/outputManager.py +++ b/src/fenrir/core/outputManager.py @@ -119,8 +119,8 @@ class outputManager(): self.env['output']['messageOffset'] = None cursor = self.getBrailleCursor() x, y, self.env['output']['brlText'] = \ - line_utils.getCurrentLine(cursor['x'], cursor['y'], self.env['screenData']['newContentText']) - displayText = self.getBrailleTextWithOffset(self.env['screenData']['newContentText'], self.env['output']['cursorOffset'], cursor) + line_utils.getCurrentLine(cursor['x'], cursor['y'], self.env['screen']['newContentText']) + displayText = self.getBrailleTextWithOffset(self.env['screen']['newContentText'], self.env['output']['cursorOffset'], cursor) self.env['runtime']['brailleDriver'].writeText('notflush'+displayText) else: displayText = self.getBrailleTextWithOffset(self.env['output']['messageText'], self.env['output']['messageOffset']) @@ -147,8 +147,8 @@ class outputManager(): if self.env['output']['messageOffset']: return self.env['output']['messageOffset'], self.env['output']['messageText'] if not self.env['output']['cursorOffset']: - return self.getBrailleCursor(), self.env['screenData']['newContentText'] - return self.env['output']['cursorOffset'], self.env['screenData']['newContentText'] + return self.getBrailleCursor(), self.env['screen']['newContentText'] + return self.env['output']['cursorOffset'], self.env['screen']['newContentText'] def getHorizontalPanSize(self): size = self.env['runtime']['brailleDriver'].getDeviceSize() if self.env['runtime']['settingsManager'].getSettingAsInt('braille', 'panSizeHorizontal') <= 0: diff --git a/src/fenrir/core/punctuation.py b/src/fenrir/core/punctuationData.py similarity index 98% rename from src/fenrir/core/punctuation.py rename to src/fenrir/core/punctuationData.py index e896b8e9..1ba130bd 100644 --- a/src/fenrir/core/punctuation.py +++ b/src/fenrir/core/punctuationData.py @@ -7,7 +7,7 @@ from core import debug import string -punctuation = { +punctuationData = { 'LEVELDICT':{ 'none': '', 'some': '#-$~+*-/\\@', diff --git a/src/fenrir/core/runtime.py b/src/fenrir/core/runtimeData.py similarity index 95% rename from src/fenrir/core/runtime.py rename to src/fenrir/core/runtimeData.py index ad192bf6..1041d4ee 100644 --- a/src/fenrir/core/runtime.py +++ b/src/fenrir/core/runtimeData.py @@ -6,7 +6,7 @@ from core import debug -runtime = { +runtimeData = { 'speechDriver': None, 'screenDriver': None, 'soundDriver': None, diff --git a/src/fenrir/core/screenManager.py b/src/fenrir/core/screenManager.py index 5cff7dba..0472360a 100644 --- a/src/fenrir/core/screenManager.py +++ b/src/fenrir/core/screenManager.py @@ -23,35 +23,35 @@ class screenManager(): def update(self, trigger='onUpdate'): self.env['runtime']['screenDriver'].getCurrScreen() self.env['runtime']['screenDriver'].getSessionInformation() - self.env['screenData']['oldApplication'] = self.env['screenData']['newApplication'] + self.env['screen']['oldApplication'] = self.env['screen']['newApplication'] if self.isScreenChange(): self.changeBrailleScreen() - if not self.isSuspendingScreen(self.env['screenData']['newTTY']): + if not self.isSuspendingScreen(self.env['screen']['newTTY']): self.env['runtime']['screenDriver'].update(trigger) 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['screenData']['lastScreenUpdate'] = time.time() + self.env['screen']['lastScreenUpdate'] = time.time() def isSuspendingScreen(self, screen = None): if screen == None: - screen = self.env['screenData']['newTTY'] + screen = self.env['screen']['newTTY'] ignoreScreens = [] fixIgnoreScreens = self.env['runtime']['settingsManager'].getSetting('screen', 'suspendingScreen') if fixIgnoreScreens != '': ignoreScreens.extend(fixIgnoreScreens.split(',')) if self.env['runtime']['settingsManager'].getSettingAsBool('screen', 'autodetectSuspendingScreen'): - ignoreScreens.extend(self.env['screenData']['autoIgnoreScreens']) + ignoreScreens.extend(self.env['screen']['autoIgnoreScreens']) return (screen in ignoreScreens) def isScreenChange(self): - if not self.env['screenData']['oldTTY']: + if not self.env['screen']['oldTTY']: return False - return self.env['screenData']['newTTY'] != self.env['screenData']['oldTTY'] + return self.env['screen']['newTTY'] != self.env['screen']['oldTTY'] def isDelta(self): - return self.env['screenData']['newDelta'] != '' + return self.env['screen']['newDelta'] != '' def isNegativeDelta(self): - return self.env['screenData']['newNegativeDelta'] != '' + return self.env['screen']['newNegativeDelta'] != '' def getWindowAreaInText(self, text): if not self.env['runtime']['cursorManager'].isApplicationWindowSet(): return text @@ -74,14 +74,14 @@ class screenManager(): return if not self.env['runtime']['brailleDriver']: return - if self.env['screenData']['oldTTY']: - if not self.isSuspendingScreen(self.env['screenData']['oldTTY']): + if self.env['screen']['oldTTY']: + if not self.isSuspendingScreen(self.env['screen']['oldTTY']): try: self.env['runtime']['brailleDriver'].leveScreen() except Exception as e: self.env['runtime']['debug'].writeDebugOut('screenManager:changeBrailleScreen:leveScreen ' + str(e),debug.debugLevel.ERROR) if not self.isSuspendingScreen(): try: - self.env['runtime']['brailleDriver'].enterScreen(self.env['screenData']['newTTY']) + self.env['runtime']['brailleDriver'].enterScreen(self.env['screen']['newTTY']) except Exception as e: self.env['runtime']['debug'].writeDebugOut('screenManager:changeBrailleScreen:enterScreen ' + str(e),debug.debugLevel.ERROR) diff --git a/src/fenrir/core/settings.py b/src/fenrir/core/settingsData.py similarity index 99% rename from src/fenrir/core/settings.py rename to src/fenrir/core/settingsData.py index 02ba9141..4e849d6a 100644 --- a/src/fenrir/core/settings.py +++ b/src/fenrir/core/settingsData.py @@ -6,7 +6,7 @@ from core import debug -settings = { +settingsData = { 'sound': { 'enabled': True, 'driver': 'genericDriver', diff --git a/src/fenrir/core/settingsManager.py b/src/fenrir/core/settingsManager.py index b1fa9f7b..7ade5141 100644 --- a/src/fenrir/core/settingsManager.py +++ b/src/fenrir/core/settingsManager.py @@ -7,6 +7,7 @@ import os import __main__ from configparser import ConfigParser +from core import eventManager from core import inputManager from core import outputManager from core import commandManager @@ -15,14 +16,14 @@ from core import punctuationManager from core import cursorManager from core import applicationManager from core import environment -from core import inputEvent -from core.settings import settings +from core import inputData +from core.settingsData import settingsData from core import debug from utils import module_utils class settingsManager(): def __init__(self): - self.settings = settings + self.settings = settingsData self.settingArgDict = {} def initialize(self, environment): self.env = environment @@ -100,7 +101,7 @@ class settingsManager(): self.env['runtime']['debug'].writeDebugOut("SoundIcon: " + soundIcon + '.' + soundIconFile, debug.debugLevel.INFO, onAnyLevel=True) siConfig.close() 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'): dictConfig = open(dictConfigPath,"r") @@ -203,10 +204,10 @@ class settingsManager(): os.path.dirname(os.path.realpath(__main__.__file__)) + "/" + driverType + '/' + driverName + '.py') self.env['runtime'][driverType] = driver_mod.driver() 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: 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): if self.env['runtime'][driverType] == None: return @@ -302,7 +303,9 @@ class settingsManager(): environment['runtime']['settingsManager'].loadDicts(self.getSetting('general','punctuationProfile')) else: 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'].initialize(environment) environment['runtime']['outputManager'] = outputManager.outputManager() diff --git a/src/fenrir/inputDriver/evdevDriver.py b/src/fenrir/inputDriver/evdevDriver.py index d1e1a6e7..9ac27c5c 100644 --- a/src/fenrir/inputDriver/evdevDriver.py +++ b/src/fenrir/inputDriver/evdevDriver.py @@ -15,7 +15,7 @@ except Exception as e: import time from select import select -from core import inputEvent +from core import inputData from core import debug class driver(): @@ -151,7 +151,7 @@ class driver(): return None if not event: return None - mEvent = inputEvent.inputEvent + mEvent = inputData.inputEvent try: mEvent['EventName'] = evdev.ecodes.keys[event.code] mEvent['EventValue'] = event.code diff --git a/src/fenrir/screenDriver/vcsaDriver.py b/src/fenrir/screenDriver/vcsaDriver.py index f4d572a1..45f800db 100644 --- a/src/fenrir/screenDriver/vcsaDriver.py +++ b/src/fenrir/screenDriver/vcsaDriver.py @@ -23,15 +23,15 @@ class driver(): def shutdown(self): pass def getCurrScreen(self): - self.env['screenData']['oldTTY'] = self.env['screenData']['newTTY'] + self.env['screen']['oldTTY'] = self.env['screen']['newTTY'] try: 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() except Exception as e: self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR) def injectTextToScreen(self, text, screen = None): - useScreen = "/dev/tty" + self.env['screenData']['newTTY'] + useScreen = "/dev/tty" + self.env['screen']['newTTY'] if screen != None: useScreen = screen with open(useScreen, 'w') as fd: @@ -41,7 +41,7 @@ class driver(): def getCurrApplication(self): apps = [] 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') except Exception as e: self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR) @@ -58,8 +58,8 @@ class driver(): not "SH" == i[0] and \ not "PS" == i[0]: if "TTY"+currScreen in i[1]: - if self.env['screenData']['newApplication'] != i[0]: - self.env['screenData']['newApplication'] = i[0] + if self.env['screen']['newApplication'] != i[0]: + self.env['screen']['newApplication'] = i[0] return except Exception as e: 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') inf = dbus.Interface(obj, 'org.freedesktop.login1.Manager') self.ListSessions = inf.get_dbus_method('ListSessions') - sessions = self.ListSessions() - self.env['screenData']['autoIgnoreScreens'] = [] + self.env['screen']['autoIgnoreScreens'] = [] for session in sessions: obj = bus.get_object('org.freedesktop.login1', session[4]) 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) return if sessionType.upper() == 'X11': - self.env['screenData']['autoIgnoreScreens'].append(screen) - if screen == self.env['screenData']['newTTY'] : - if self.env['generalInformation']['currUser'] != session[2]: - self.env['generalInformation']['prevUser'] = self.env['generalInformation']['currUser'] - self.env['generalInformation']['currUser'] = session[2] + self.env['screen']['autoIgnoreScreens'].append(screen) + if screen == self.env['screen']['newTTY'] : + if self.env['general']['currUser'] != session[2]: + self.env['general']['prevUser'] = self.env['general']['currUser'] + self.env['general']['currUser'] = session[2] except Exception as e: 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'): newContentBytes = b'' try: # 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() vcsa.close() if len(newContentBytes) < 5: @@ -108,62 +108,62 @@ class driver(): return screenEncoding = self.env['runtime']['settingsManager'].getSetting('screen', 'encoding') # set new "old" values - self.env['screenData']['oldContentBytes'] = self.env['screenData']['newContentBytes'] - self.env['screenData']['oldContentText'] = self.env['screenData']['newContentText'] - self.env['screenData']['oldContentAttrib'] = self.env['screenData']['newContentAttrib'] - self.env['screenData']['oldCursor'] = self.env['screenData']['newCursor'].copy() - if self.env['screenData']['newCursorAttrib']: - self.env['screenData']['oldCursorAttrib'] = self.env['screenData']['newCursorAttrib'].copy() - self.env['screenData']['oldDelta'] = self.env['screenData']['newDelta'] - self.env['screenData']['oldAttribDelta'] = self.env['screenData']['newAttribDelta'] - self.env['screenData']['oldNegativeDelta'] = self.env['screenData']['newNegativeDelta'] - self.env['screenData']['newContentBytes'] = newContentBytes + self.env['screen']['oldContentBytes'] = self.env['screen']['newContentBytes'] + self.env['screen']['oldContentText'] = self.env['screen']['newContentText'] + self.env['screen']['oldContentAttrib'] = self.env['screen']['newContentAttrib'] + self.env['screen']['oldCursor'] = self.env['screen']['newCursor'].copy() + if self.env['screen']['newCursorAttrib']: + self.env['screen']['oldCursorAttrib'] = self.env['screen']['newCursorAttrib'].copy() + self.env['screen']['oldDelta'] = self.env['screen']['newDelta'] + self.env['screen']['oldAttribDelta'] = self.env['screen']['newAttribDelta'] + self.env['screen']['oldNegativeDelta'] = self.env['screen']['newNegativeDelta'] + self.env['screen']['newContentBytes'] = newContentBytes # get metadata like cursor or screensize - self.env['screenData']['lines'] = int( self.env['screenData']['newContentBytes'][0]) - self.env['screenData']['columns'] = int( self.env['screenData']['newContentBytes'][1]) - self.env['screenData']['newCursor']['x'] = int( self.env['screenData']['newContentBytes'][2]) - self.env['screenData']['newCursor']['y'] = int( self.env['screenData']['newContentBytes'][3]) + self.env['screen']['lines'] = int( self.env['screen']['newContentBytes'][0]) + self.env['screen']['columns'] = int( self.env['screen']['newContentBytes'][1]) + self.env['screen']['newCursor']['x'] = int( self.env['screen']['newContentBytes'][2]) + self.env['screen']['newCursor']['y'] = int( self.env['screen']['newContentBytes'][3]) # analyze content - self.env['screenData']['newContentText'] = self.env['screenData']['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['screenData']['newContentAttrib'] = self.env['screenData']['newContentBytes'][5:][::2] - self.env['screenData']['newContentText'] = screen_utils.insertNewlines(self.env['screenData']['newContentText'], self.env['screenData']['columns']) + self.env['screen']['newContentText'] = self.env['screen']['newContentBytes'][4:][::2].decode(screenEncoding, "replace").encode('utf-8').decode('utf-8') + self.env['screen']['newContentText'] = screen_utils.removeNonprintable(self.env['screen']['newContentText']) + self.env['screen']['newContentAttrib'] = self.env['screen']['newContentBytes'][5:][::2] + self.env['screen']['newContentText'] = screen_utils.insertNewlines(self.env['screen']['newContentText'], self.env['screen']['columns']) - if self.env['screenData']['newTTY'] != self.env['screenData']['oldTTY']: - self.env['screenData']['oldContentBytes'] = b'' - self.env['screenData']['oldContentAttrib'] = b'' - self.env['screenData']['oldContentText'] = '' - self.env['screenData']['oldCursor']['x'] = 0 - self.env['screenData']['oldCursor']['y'] = 0 - self.env['screenData']['oldDelta'] = '' - self.env['screenData']['oldAttribDelta'] = '' - self.env['screenData']['oldCursorAttrib'] = None - self.env['screenData']['newCursorAttrib'] = None - self.env['screenData']['oldNegativeDelta'] = '' + if self.env['screen']['newTTY'] != self.env['screen']['oldTTY']: + self.env['screen']['oldContentBytes'] = b'' + self.env['screen']['oldContentAttrib'] = b'' + self.env['screen']['oldContentText'] = '' + self.env['screen']['oldCursor']['x'] = 0 + self.env['screen']['oldCursor']['y'] = 0 + self.env['screen']['oldDelta'] = '' + self.env['screen']['oldAttribDelta'] = '' + self.env['screen']['oldCursorAttrib'] = None + self.env['screen']['newCursorAttrib'] = None + self.env['screen']['oldNegativeDelta'] = '' # initialize current deltas - self.env['screenData']['newNegativeDelta'] = '' - self.env['screenData']['newDelta'] = '' - self.env['screenData']['newAttribDelta'] = '' + self.env['screen']['newNegativeDelta'] = '' + self.env['screen']['newDelta'] = '' + self.env['screen']['newAttribDelta'] = '' # changes on the screen - oldScreenText = re.sub(' +',' ',self.env['runtime']['screenManager'].getWindowAreaInText(self.env['screenData']['oldContentText'])) - newScreenText = re.sub(' +',' ',self.env['runtime']['screenManager'].getWindowAreaInText(self.env['screenData']['newContentText'])) + oldScreenText = re.sub(' +',' ',self.env['runtime']['screenManager'].getWindowAreaInText(self.env['screen']['oldContentText'])) + newScreenText = re.sub(' +',' ',self.env['runtime']['screenManager'].getWindowAreaInText(self.env['screen']['newContentText'])) typing = False - if (self.env['screenData']['oldContentText'] != self.env['screenData']['newContentText']) and \ - (self.env['screenData']['newContentText'] != '' ): + if (self.env['screen']['oldContentText'] != self.env['screen']['newContentText']) and \ + (self.env['screen']['newContentText'] != '' ): if oldScreenText == '' and\ newScreenText != '': - self.env['screenData']['newDelta'] = newScreenText + self.env['screen']['newDelta'] = newScreenText else: - cursorLineStart = self.env['screenData']['newCursor']['y'] * self.env['screenData']['columns'] + self.env['screenData']['newCursor']['y'] - cursorLineEnd = cursorLineStart + self.env['screenData']['columns'] - if self.env['screenData']['oldCursor']['x'] != self.env['screenData']['newCursor']['x'] and \ - self.env['screenData']['oldCursor']['y'] == self.env['screenData']['newCursor']['y'] and \ - self.env['screenData']['newContentText'][:cursorLineStart] == self.env['screenData']['oldContentText'][:cursorLineStart]: + cursorLineStart = self.env['screen']['newCursor']['y'] * self.env['screen']['columns'] + self.env['screen']['newCursor']['y'] + cursorLineEnd = cursorLineStart + self.env['screen']['columns'] + if self.env['screen']['oldCursor']['x'] != self.env['screen']['newCursor']['x'] and \ + self.env['screen']['oldCursor']['y'] == self.env['screen']['newCursor']['y'] and \ + 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) - newScreenText = self.env['screenData']['newContentText'][cursorLineStart:cursorLineEnd] + newScreenText = self.env['screen']['newContentText'][cursorLineStart:cursorLineEnd] newScreenText = re.sub(' +',' ',newScreenText) diff = difflib.ndiff(oldScreenText, newScreenText) typing = True @@ -174,13 +174,13 @@ class driver(): diffList = list(diff) 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: - self.env['screenData']['newDelta'] = ''.join(x[2:] for x in diffList if x[0] == '+') - self.env['screenData']['newNegativeDelta'] = ''.join(x[2:] for x in diffList if x[0] == '-') + self.env['screen']['newDelta'] = ''.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 - 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'): - 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']) diff --git a/src/fenrir/speechDriver/genericDriver.py b/src/fenrir/speechDriver/genericDriver.py index 98141b8a..0a0912fd 100644 --- a/src/fenrir/speechDriver/genericDriver.py +++ b/src/fenrir/speechDriver/genericDriver.py @@ -43,7 +43,8 @@ class driver(): if self.speechCommand == '': self.speechCommand = 'espeak -a fenrirVolume -s fenrirRate -p fenrirPitch -v fenrirVoice "fenrirText"' 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 if self._isInitialized: @@ -78,10 +79,13 @@ class driver(): if self.proc: try: self.proc.terminate() - except: - self.proc.kill() - finally: - self.proc = None + except Exception as e: + self.env['runtime']['debug'].writeDebugOut('speechDriver:Cancel:self.proc.terminate():' + str(e),debug.debugLevel.WARNING) + try: + self.proc.kill() + except Exception as e: + self.env['runtime']['debug'].writeDebugOut('speechDriver:Cancel:self.proc.kill():' + str(e),debug.debugLevel.WARNING) + self.proc = None self.lock.release() def setCallback(self, callback): print('SpeechDummyDriver: setCallback') diff --git a/src/fenrir/speechDriver/speechdDriver.py b/src/fenrir/speechDriver/speechdDriver.py index 8e147d14..f592bbbb 100644 --- a/src/fenrir/speechDriver/speechdDriver.py +++ b/src/fenrir/speechDriver/speechdDriver.py @@ -21,7 +21,7 @@ class driver(): self._punct = speechd.PunctuationMode() self._isInitialized = True 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 def shutdown(self): @@ -46,6 +46,7 @@ class driver(): self._sd.set_punctuation(self._punct.NONE) self._sd.speak(text) except Exception as e: + self.env['runtime']['debug'].writeDebugOut('speechDriver speak:' + str(e),debug.debugLevel.ERROR) self._isInitialized = False def cancel(self): @@ -54,6 +55,7 @@ class driver(): try: self._sd.cancel() except Exception as e: + self.env['runtime']['debug'].writeDebugOut('speechDriver cancel:' + str(e),debug.debugLevel.ERROR) self._isInitialized = False def setCallback(self, callback): @@ -70,7 +72,7 @@ class driver(): if voice != '': self._sd.set_voice(voice) except Exception as e: - self._isInitialized = False + self.env['runtime']['debug'].writeDebugOut('speechDriver setVoice:' + str(e),debug.debugLevel.ERROR) def setPitch(self, pitch): if not self._isInitialized: @@ -78,7 +80,7 @@ class driver(): try: self._sd.set_pitch(int(-100 + pitch * 200)) except Exception as e: - self._isInitialized = False + self.env['runtime']['debug'].writeDebugOut('speechDriver setPitch:' + str(e),debug.debugLevel.ERROR) def setRate(self, rate): if not self._isInitialized: @@ -86,7 +88,7 @@ class driver(): try: self._sd.set_rate(int(-100 + rate * 200)) except Exception as e: - self._isInitialized = False + self.env['runtime']['debug'].writeDebugOut('speechDriver setRate:' + str(e),debug.debugLevel.ERROR) def setModule(self, module): if not self._isInitialized: @@ -94,7 +96,7 @@ class driver(): try: self._sd.set_output_module(module) except Exception as e: - self._isInitialized = False + self.env['runtime']['debug'].writeDebugOut('speechDriver setModule:' + str(e),debug.debugLevel.ERROR) def setLanguage(self, language): if not self._isInitialized: @@ -107,4 +109,4 @@ class driver(): try: self._sd.set_volume(int(-100 + volume * 200)) except Exception as e: - self._isInitialized = False + self.env['runtime']['debug'].writeDebugOut('speechDriver setVolume:' + str(e),debug.debugLevel.ERROR)