From ee7eb3a9c6688081e55b20b42fa087b2cab8ac38 Mon Sep 17 00:00:00 2001 From: chrys Date: Wed, 5 Oct 2016 23:11:43 +0200 Subject: [PATCH] upload initial history --- .../onInput/65000-char_delete_echo.py | 2 +- src/fenrir/commands/onInput/72000-history.py | 58 ++++++ .../commands/onScreenUpdate/70000-incoming.py | 2 +- src/fenrir/core/commandManager.py | 3 +- src/fenrir/fenrir.egg-info/PKG-INFO | 40 ++++ src/fenrir/fenrir.egg-info/SOURCES.txt | 171 ++++++++++++++++++ .../fenrir.egg-info/dependency_links.txt | 1 + src/fenrir/fenrir.egg-info/not-zip-safe | 1 + src/fenrir/fenrir.egg-info/requires.txt | 3 + src/fenrir/fenrir.egg-info/top_level.txt | 1 + 10 files changed, 279 insertions(+), 3 deletions(-) create mode 100644 src/fenrir/commands/onInput/72000-history.py create mode 100644 src/fenrir/fenrir.egg-info/PKG-INFO create mode 100644 src/fenrir/fenrir.egg-info/SOURCES.txt create mode 100644 src/fenrir/fenrir.egg-info/dependency_links.txt create mode 100644 src/fenrir/fenrir.egg-info/not-zip-safe create mode 100644 src/fenrir/fenrir.egg-info/requires.txt create mode 100644 src/fenrir/fenrir.egg-info/top_level.txt diff --git a/src/fenrir/commands/onInput/65000-char_delete_echo.py b/src/fenrir/commands/onInput/65000-char_delete_echo.py index 4b20a094..1c3dc591 100644 --- a/src/fenrir/commands/onInput/65000-char_delete_echo.py +++ b/src/fenrir/commands/onInput/65000-char_delete_echo.py @@ -34,7 +34,7 @@ class command(): if self.env['screenData']['newNegativeDelta'] == '': return # too much for a single backspace... - if len(self.env['screenData']['newNegativeDelta']) >= 5: + if len(self.env['screenData']['newNegativeDelta']) >= 2: return self.env['runtime']['outputManager'].presentText(self.env['screenData']['newNegativeDelta'], interrupt=True, ignorePunctuation=True, announceCapital=True) diff --git a/src/fenrir/commands/onInput/72000-history.py b/src/fenrir/commands/onInput/72000-history.py new file mode 100644 index 00000000..db93768a --- /dev/null +++ b/src/fenrir/commands/onInput/72000-history.py @@ -0,0 +1,58 @@ +#!/bin/python +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return '' + + def run(self): + if self.env['runtime']['inputManager'].noKeyPressed(): + return + if self.env['screenData']['newTTY'] != self.env['screenData']['oldTTY']: + return + if self.env['screenData']['newCursor']['y'] != self.env['screenData']['oldCursor']['y']: + return + if len(self.env['input']['currInput']) != 1: + 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']] + #if prevLine == currLine: + # return + if currLine.isspace(): + self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True) + else: + currPrompt = currLine.find('$') + rootPrompt = currLine.find('#') + if currPrompt == 0: + if rootPrompt != 0: + currPrompt = rootPrompt + else: + announce = currLine + if currPrompt != 0: + remove_digits = str.maketrans('0123456789', ' ') + if prevLine[:currPrompt].translate(remove_digits) == currLine[:currPrompt].translate(remove_digits): + announce = currLine[currPrompt+1:] + else: + announce = currLine + print(announce) + if currLine.isspace(): + self.env['runtime']['outputManager'].presentText("blank", soundIcon='EmptyLine', interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(announce, interrupt=True) + self.env['commandsIgnore']['onScreenUpdate']['INCOMING_IGNORE'] = True + def setCallback(self, callback): + pass + diff --git a/src/fenrir/commands/onScreenUpdate/70000-incoming.py b/src/fenrir/commands/onScreenUpdate/70000-incoming.py index 317b9444..114e9b14 100644 --- a/src/fenrir/commands/onScreenUpdate/70000-incoming.py +++ b/src/fenrir/commands/onScreenUpdate/70000-incoming.py @@ -25,7 +25,7 @@ class command(): # 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']) <= 5: + if len(self.env['screenData']['newDelta']) <= 2: return self.env['runtime']['outputManager'].presentText(self.env['screenData']['newDelta'], interrupt=False) diff --git a/src/fenrir/core/commandManager.py b/src/fenrir/core/commandManager.py index c8cb31ee..1822066a 100644 --- a/src/fenrir/core/commandManager.py +++ b/src/fenrir/core/commandManager.py @@ -34,6 +34,7 @@ class commandManager(): commandList = glob.glob(commandFolder+'*') for command in commandList: try: + print(command) fileName, fileExtension = os.path.splitext(command) fileName = fileName.split('/')[-1] if fileName in ['__init__','__pycache__']: @@ -46,8 +47,8 @@ class commandManager(): self.env['commandsIgnore'][section][fileName.upper()[fileName.upper().find('-')+1:]+'_IGNORE'] = False self.env['commands'][section][fileName.upper()].initialize(self.env) self.env['runtime']['debug'].writeDebugOut("Load command:" + section + "." + fileName.upper() ,debug.debugLevel.INFO) - except Exception as e: + print(e) self.env['runtime']['debug'].writeDebugOut("Loading command:" + command ,debug.debugLevel.ERROR) self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR) continue diff --git a/src/fenrir/fenrir.egg-info/PKG-INFO b/src/fenrir/fenrir.egg-info/PKG-INFO new file mode 100644 index 00000000..468e22da --- /dev/null +++ b/src/fenrir/fenrir.egg-info/PKG-INFO @@ -0,0 +1,40 @@ +Metadata-Version: 1.1 +Name: fenrir +Version: 0.1a0 +Summary: An TTY Screen Reader For Linux. +Home-page: https://github.com/chrys87/fenrir/ +Author: Chrys and others +Author-email: chrys87@web.de +License: UNKNOWN +Description: # fenrir (Alfa) + An TTY screenreader for Linux. + Its an early alpha version. You can test it. It is not recommended for production use. If you want to help just let me know. + + # requirements + - linux + - python3 + - python-espeak + - python-evdev + - loaded uinput kernel module + Read permission to the following files: + /sys/devices/virtual/tty/tty0/active + /dev/vcsa[1-64] + ReadWrite permission + /dev/input + /dev/uinput + + # optional + - sox [its used by default in the generic sound driver for playing sound-icons] + - speech-dispatcher, python3-speechd [to use the speech-dispatcher driver] + - brltty, python-brlapi [for using braille] # (not implemented yet) + - gstreamer [for soundicons via gstreamer] # not working yet + - python-pyenchant for spell check functionality + + # installation + Currently there is no setupscript (sorry). But you can just run as root or setup needed permission + cd src/fenrir-package/ + sudo ./fenrir.py + Settings are located in the config directory. + +Platform: UNKNOWN +Classifier: Development Status :: 3 - Alpha diff --git a/src/fenrir/fenrir.egg-info/SOURCES.txt b/src/fenrir/fenrir.egg-info/SOURCES.txt new file mode 100644 index 00000000..e8c40a4b --- /dev/null +++ b/src/fenrir/fenrir.egg-info/SOURCES.txt @@ -0,0 +1,171 @@ +setup.py +src/fenrir/fenrir +src/fenrir/braille/__init__.py +src/fenrir/braille/braille.py +src/fenrir/commands/__init__.py +src/fenrir/commands/command_template.py +src/fenrir/commands/switchTrigger_template.py +src/fenrir/commands/commands/__init__.py +src/fenrir/commands/commands/add_word_to_spell_check.py +src/fenrir/commands/commands/bookmark_1.py +src/fenrir/commands/commands/bookmark_10.py +src/fenrir/commands/commands/bookmark_2.py +src/fenrir/commands/commands/bookmark_3.py +src/fenrir/commands/commands/bookmark_4.py +src/fenrir/commands/commands/bookmark_5.py +src/fenrir/commands/commands/bookmark_6.py +src/fenrir/commands/commands/bookmark_7.py +src/fenrir/commands/commands/bookmark_8.py +src/fenrir/commands/commands/bookmark_9.py +src/fenrir/commands/commands/clear_bookmark_1.py +src/fenrir/commands/commands/clear_bookmark_10.py +src/fenrir/commands/commands/clear_bookmark_2.py +src/fenrir/commands/commands/clear_bookmark_3.py +src/fenrir/commands/commands/clear_bookmark_4.py +src/fenrir/commands/commands/clear_bookmark_5.py +src/fenrir/commands/commands/clear_bookmark_6.py +src/fenrir/commands/commands/clear_bookmark_7.py +src/fenrir/commands/commands/clear_bookmark_8.py +src/fenrir/commands/commands/clear_bookmark_9.py +src/fenrir/commands/commands/clear_clipboard.py +src/fenrir/commands/commands/clear_window_application.py +src/fenrir/commands/commands/copy_marked_to_clipboard.py +src/fenrir/commands/commands/curr_char_phonetic.py +src/fenrir/commands/commands/curr_clipboard.py +src/fenrir/commands/commands/curr_screen.py +src/fenrir/commands/commands/curr_screen_after_cursor.py +src/fenrir/commands/commands/curr_screen_before_cursor.py +src/fenrir/commands/commands/curr_word_phonetic.py +src/fenrir/commands/commands/cursor_position.py +src/fenrir/commands/commands/date.py +src/fenrir/commands/commands/dec_sound_volume.py +src/fenrir/commands/commands/dec_speech_pitch.py +src/fenrir/commands/commands/dec_speech_rate.py +src/fenrir/commands/commands/dec_speech_volume.py +src/fenrir/commands/commands/exit_review.py +src/fenrir/commands/commands/first_clipboard.py +src/fenrir/commands/commands/forward_keypress.py +src/fenrir/commands/commands/inc_sound_volume.py +src/fenrir/commands/commands/inc_speech_pitch.py +src/fenrir/commands/commands/inc_speech_rate.py +src/fenrir/commands/commands/inc_speech_volume.py +src/fenrir/commands/commands/indent_curr_line.py +src/fenrir/commands/commands/last_clipboard.py +src/fenrir/commands/commands/last_incoming.py +src/fenrir/commands/commands/linux_paste_clipboard.py +src/fenrir/commands/commands/marked_text.py +src/fenrir/commands/commands/next_clipboard.py +src/fenrir/commands/commands/present_first_line.py +src/fenrir/commands/commands/present_last_line.py +src/fenrir/commands/commands/prev_clipboard.py +src/fenrir/commands/commands/quit_fenrir.py +src/fenrir/commands/commands/remove_marks.py +src/fenrir/commands/commands/remove_word_from_spell_check.py +src/fenrir/commands/commands/review_bottom.py +src/fenrir/commands/commands/review_curr_char.py +src/fenrir/commands/commands/review_curr_line.py +src/fenrir/commands/commands/review_curr_word.py +src/fenrir/commands/commands/review_down.py +src/fenrir/commands/commands/review_line_begin.py +src/fenrir/commands/commands/review_line_end.py +src/fenrir/commands/commands/review_line_first_char.py +src/fenrir/commands/commands/review_line_last_char.py +src/fenrir/commands/commands/review_next_char.py +src/fenrir/commands/commands/review_next_line.py +src/fenrir/commands/commands/review_next_word.py +src/fenrir/commands/commands/review_prev_char.py +src/fenrir/commands/commands/review_prev_line.py +src/fenrir/commands/commands/review_prev_word.py +src/fenrir/commands/commands/review_top.py +src/fenrir/commands/commands/review_up.py +src/fenrir/commands/commands/set_bookmark_1.py +src/fenrir/commands/commands/set_bookmark_10.py +src/fenrir/commands/commands/set_bookmark_2.py +src/fenrir/commands/commands/set_bookmark_3.py +src/fenrir/commands/commands/set_bookmark_4.py +src/fenrir/commands/commands/set_bookmark_5.py +src/fenrir/commands/commands/set_bookmark_6.py +src/fenrir/commands/commands/set_bookmark_7.py +src/fenrir/commands/commands/set_bookmark_8.py +src/fenrir/commands/commands/set_bookmark_9.py +src/fenrir/commands/commands/set_mark.py +src/fenrir/commands/commands/set_window_application.py +src/fenrir/commands/commands/shut_up.py +src/fenrir/commands/commands/spell_check.py +src/fenrir/commands/commands/time.py +src/fenrir/commands/commands/toggle_auto_read.py +src/fenrir/commands/commands/toggle_auto_spell_check.py +src/fenrir/commands/commands/toggle_braille.py +src/fenrir/commands/commands/toggle_output.py +src/fenrir/commands/commands/toggle_punctuation_level.py +src/fenrir/commands/commands/toggle_sound.py +src/fenrir/commands/commands/toggle_speech.py +src/fenrir/commands/commands/toggle_tutorial_mode.py +src/fenrir/commands/onApplicationChange/__init__.py +src/fenrir/commands/onApplicationChange/test.py +src/fenrir/commands/onInput/10000-shut_up.py +src/fenrir/commands/onInput/45000-present_char_if_cursor_change_horizontal.py +src/fenrir/commands/onInput/50000-char_echo.py +src/fenrir/commands/onInput/55000-present_line_if_cursor_change_vertical.py +src/fenrir/commands/onInput/60000-word_echo.py +src/fenrir/commands/onInput/62000-spell_check.py +src/fenrir/commands/onInput/65000-char_delete_echo.py +src/fenrir/commands/onInput/80000-capslock.py +src/fenrir/commands/onInput/80300-scrolllock.py +src/fenrir/commands/onInput/80500-numlock.py +src/fenrir/commands/onInput/__init__.py +src/fenrir/commands/onScreenChanged/10000-shut_up.py +src/fenrir/commands/onScreenChanged/80000-screen_change_announcement.py +src/fenrir/commands/onScreenChanged/85000-screen_chnage_reset_marks.py +src/fenrir/commands/onScreenChanged/85000-screen_chnage_reset_review.py +src/fenrir/commands/onScreenChanged/89000-screen_chnage_leve_review_mode.py +src/fenrir/commands/onScreenChanged/__init__.py +src/fenrir/commands/onScreenUpdate/70000-incoming.py +src/fenrir/commands/onScreenUpdate/75000-incoming_promote.py +src/fenrir/commands/onScreenUpdate/__init__.py +src/fenrir/commands/onSwitchApplicationProfile/__init__.py +src/fenrir/commands/onSwitchApplicationProfile/agetty.py +src/fenrir/commands/onSwitchApplicationProfile/bash.py +src/fenrir/commands/onSwitchApplicationProfile/default.py +src/fenrir/commands/onSwitchApplicationProfile/vim.py +src/fenrir/core/__init__.py +src/fenrir/core/applicationManager.py +src/fenrir/core/commandManager.py +src/fenrir/core/commands.py +src/fenrir/core/cursorManager.py +src/fenrir/core/debug.py +src/fenrir/core/environment.py +src/fenrir/core/generalInformation.py +src/fenrir/core/inputEvent.py +src/fenrir/core/inputManager.py +src/fenrir/core/outputManager.py +src/fenrir/core/punctuationManager.py +src/fenrir/core/runtime.py +src/fenrir/core/screenData.py +src/fenrir/core/screenManager.py +src/fenrir/core/settings.py +src/fenrir/core/settingsManager.py +src/fenrir/fenrir.egg-info/PKG-INFO +src/fenrir/fenrir.egg-info/SOURCES.txt +src/fenrir/fenrir.egg-info/dependency_links.txt +src/fenrir/fenrir.egg-info/not-zip-safe +src/fenrir/fenrir.egg-info/requires.txt +src/fenrir/fenrir.egg-info/top_level.txt +src/fenrir/inputDriver/__init__.py +src/fenrir/inputDriver/evdev.py +src/fenrir/screenDriver/__init__.py +src/fenrir/screenDriver/linux.py +src/fenrir/soundDriver/__init__.py +src/fenrir/soundDriver/generic.py +src/fenrir/soundDriver/gstreamer.py +src/fenrir/speechDriver/__init__.py +src/fenrir/speechDriver/espeak.py +src/fenrir/speechDriver/generic.py +src/fenrir/speechDriver/speechd.py +src/fenrir/utils/__init__.py +src/fenrir/utils/char_utils.py +src/fenrir/utils/fenrir-config.py +src/fenrir/utils/line_utils.py +src/fenrir/utils/mark_utils.py +src/fenrir/utils/review_utils.py +src/fenrir/utils/word_utils.py \ No newline at end of file diff --git a/src/fenrir/fenrir.egg-info/dependency_links.txt b/src/fenrir/fenrir.egg-info/dependency_links.txt new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/src/fenrir/fenrir.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/src/fenrir/fenrir.egg-info/not-zip-safe b/src/fenrir/fenrir.egg-info/not-zip-safe new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/src/fenrir/fenrir.egg-info/not-zip-safe @@ -0,0 +1 @@ + diff --git a/src/fenrir/fenrir.egg-info/requires.txt b/src/fenrir/fenrir.egg-info/requires.txt new file mode 100644 index 00000000..96c1e4c9 --- /dev/null +++ b/src/fenrir/fenrir.egg-info/requires.txt @@ -0,0 +1,3 @@ +evdev +sox +python-espeak diff --git a/src/fenrir/fenrir.egg-info/top_level.txt b/src/fenrir/fenrir.egg-info/top_level.txt new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/src/fenrir/fenrir.egg-info/top_level.txt @@ -0,0 +1 @@ +