From 40da178136872d8a8e620fd4785d2e90d3bbebda Mon Sep 17 00:00:00 2001 From: chrys Date: Wed, 21 Mar 2018 11:10:12 +0100 Subject: [PATCH] replaces namespace fenrir with fenrirscreenreader --- install.sh | 48 +-- play zone/wrapWord.py | 2 +- setup.py | 32 +- src/fenrir/__init__.py | 0 src/fenrir/brailleDriver/__init__.py | 0 src/fenrir/brailleDriver/brlapiDriver.py | 66 --- src/fenrir/brailleDriver/debugDriver.py | 49 --- src/fenrir/brailleDriver/dummyDriver.py | 12 - src/fenrir/commands/__init__.py | 0 src/fenrir/commands/command_template.py | 21 - .../commands/commands/00_init_commands.py | 26 -- src/fenrir/commands/commands/__init__.py | 0 .../commands/add_word_to_spell_check.py | 55 --- .../commands/commands/attribute_cursor.py | 27 -- src/fenrir/commands/commands/bookmark_1.py | 48 --- src/fenrir/commands/commands/bookmark_10.py | 48 --- src/fenrir/commands/commands/bookmark_2.py | 48 --- src/fenrir/commands/commands/bookmark_3.py | 48 --- src/fenrir/commands/commands/bookmark_4.py | 48 --- src/fenrir/commands/commands/bookmark_5.py | 48 --- src/fenrir/commands/commands/bookmark_6.py | 48 --- src/fenrir/commands/commands/bookmark_7.py | 48 --- src/fenrir/commands/commands/bookmark_8.py | 48 --- src/fenrir/commands/commands/bookmark_9.py | 48 --- src/fenrir/commands/commands/braille_flush.py | 21 - .../commands/commands/braille_pan_left.py | 21 - .../commands/commands/braille_pan_right.py | 21 - .../commands/braille_return_to_cursor.py | 21 - .../commands/commands/clear_bookmark_1.py | 27 -- .../commands/commands/clear_bookmark_10.py | 27 -- .../commands/commands/clear_bookmark_2.py | 27 -- .../commands/commands/clear_bookmark_3.py | 27 -- .../commands/commands/clear_bookmark_4.py | 27 -- .../commands/commands/clear_bookmark_5.py | 27 -- .../commands/commands/clear_bookmark_6.py | 27 -- .../commands/commands/clear_bookmark_7.py | 27 -- .../commands/commands/clear_bookmark_8.py | 27 -- .../commands/commands/clear_bookmark_9.py | 27 -- .../commands/commands/clear_clipboard.py | 24 -- .../commands/clear_window_application.py | 27 -- .../commands/copy_last_echo_to_clipboard.py | 26 -- .../commands/copy_marked_to_clipboard.py | 39 -- .../commands/commands/curr_clipboard.py | 27 -- src/fenrir/commands/commands/curr_screen.py | 26 -- .../commands/curr_screen_after_cursor.py | 32 -- .../commands/curr_screen_before_cursor.py | 36 -- src/fenrir/commands/commands/cursor_column.py | 25 -- src/fenrir/commands/commands/cursor_lineno.py | 25 -- .../commands/commands/cursor_position.py | 26 -- .../commands/cursor_read_to_end_of_line.py | 33 -- src/fenrir/commands/commands/date.py | 30 -- .../commands/commands/dec_alsa_volume.py | 39 -- .../commands/commands/dec_sound_volume.py | 33 -- .../commands/commands/dec_speech_pitch.py | 29 -- .../commands/commands/dec_speech_rate.py | 30 -- .../commands/commands/dec_speech_volume.py | 31 -- src/fenrir/commands/commands/exit_review.py | 28 -- .../commands/export_clipboard_to_file.py | 39 -- .../commands/export_clipboard_to_x.py | 50 --- .../commands/commands/first_clipboard.py | 28 -- .../commands/commands/forward_keypress.py | 24 -- .../commands/import_clipboard_from_file.py | 39 -- .../commands/commands/inc_alsa_volume.py | 39 -- .../commands/commands/inc_sound_volume.py | 32 -- .../commands/commands/inc_speech_pitch.py | 30 -- .../commands/commands/inc_speech_rate.py | 30 -- .../commands/commands/inc_speech_volume.py | 30 -- .../commands/commands/indent_curr_line.py | 36 -- .../commands/commands/last_clipboard.py | 28 -- src/fenrir/commands/commands/last_incoming.py | 23 -- src/fenrir/commands/commands/marked_text.py | 38 -- .../commands/commands/next_clipboard.py | 36 -- .../commands/commands/paste_clipboard.py | 30 -- .../commands/commands/present_first_line.py | 30 -- .../commands/commands/present_last_line.py | 30 -- .../commands/commands/prev_clipboard.py | 35 -- src/fenrir/commands/commands/quit_fenrir.py | 24 -- src/fenrir/commands/commands/remove_marks.py | 24 -- .../commands/remove_word_from_spell_check.py | 55 --- src/fenrir/commands/commands/review_bottom.py | 24 -- .../commands/commands/review_curr_char.py | 29 -- .../commands/review_curr_char_phonetic.py | 33 -- .../commands/commands/review_curr_line.py | 32 -- .../commands/commands/review_curr_word.py | 37 -- .../commands/review_curr_word_phonetic.py | 41 -- src/fenrir/commands/commands/review_down.py | 29 -- .../commands/commands/review_line_begin.py | 33 -- .../commands/commands/review_line_end.py | 30 -- .../commands/review_line_first_char.py | 36 -- .../commands/review_line_last_char.py | 30 -- .../commands/commands/review_next_char.py | 33 -- .../commands/review_next_char_phonetic.py | 35 -- .../commands/commands/review_next_line.py | 36 -- .../commands/commands/review_next_word.py | 39 -- .../commands/review_next_word_phonetic.py | 41 -- .../commands/commands/review_prev_char.py | 36 -- .../commands/review_prev_char_phonetic.py | 35 -- .../commands/commands/review_prev_line.py | 35 -- .../commands/commands/review_prev_word.py | 37 -- .../commands/review_prev_word_phonetic.py | 41 -- src/fenrir/commands/commands/review_top.py | 25 -- src/fenrir/commands/commands/review_up.py | 32 -- .../commands/commands/set_bookmark_1.py | 36 -- .../commands/commands/set_bookmark_10.py | 36 -- .../commands/commands/set_bookmark_2.py | 36 -- .../commands/commands/set_bookmark_3.py | 36 -- .../commands/commands/set_bookmark_4.py | 36 -- .../commands/commands/set_bookmark_5.py | 36 -- .../commands/commands/set_bookmark_6.py | 36 -- .../commands/commands/set_bookmark_7.py | 36 -- .../commands/commands/set_bookmark_8.py | 36 -- .../commands/commands/set_bookmark_9.py | 36 -- src/fenrir/commands/commands/set_mark.py | 30 -- .../commands/set_window_application.py | 28 -- src/fenrir/commands/commands/shut_up.py | 23 -- src/fenrir/commands/commands/spell_check.py | 56 --- src/fenrir/commands/commands/subprocess.py | 50 --- .../commands/commands/temp_disable_speech.py | 27 -- src/fenrir/commands/commands/time.py | 30 -- .../commands/commands/toggle_auto_read.py | 26 -- .../commands/toggle_auto_spell_check.py | 27 -- .../commands/commands/toggle_auto_time.py | 26 -- .../commands/commands/toggle_braille.py | 27 -- .../commands/commands/toggle_emoticons.py | 26 -- .../commands/toggle_highlight_tracking.py | 29 -- src/fenrir/commands/commands/toggle_output.py | 34 -- .../commands/toggle_punctuation_level.py | 26 -- src/fenrir/commands/commands/toggle_sound.py | 27 -- src/fenrir/commands/commands/toggle_speech.py | 27 -- .../commands/commands/toggle_tutorial_mode.py | 24 -- src/fenrir/commands/help/Readme.txt | 2 - src/fenrir/commands/help/__init__.py | 0 src/fenrir/commands/help/curr_help.py | 22 - src/fenrir/commands/help/next_help.py | 23 -- src/fenrir/commands/help/prev_help.py | 23 -- .../commands/onApplicationChange/__init__.py | 0 .../onApplicationChange/inactive/test.py | 25 -- .../onCursorChange/45000-char_echo.py | 42 -- .../onCursorChange/46000-tab_completion.py | 42 -- ...resent_char_if_cursor_change_horizontal.py | 51 --- ...-present_line_if_cursor_change_vertical.py | 43 -- .../onCursorChange/60000-word_echo_type.py | 58 --- .../61000-word_echo_navigation.py | 54 --- .../onCursorChange/62000-spell_check.py | 134 ------ .../onCursorChange/65000-char_delete_echo.py | 46 --- .../onCursorChange/66000-exit_review_mode.py | 26 -- .../commands/onCursorChange/__init__.py | 0 .../onHeartBeat/2000-GetSessionInfo.py | 29 -- src/fenrir/commands/onHeartBeat/76000-time.py | 74 ---- src/fenrir/commands/onHeartBeat/__init__.py | 0 .../commands/onHeartBeat/deactive/1.echo.py | 26 -- src/fenrir/commands/onInput/10000-shut_up.py | 37 -- .../onInput/15000-enable_temp_speech.py | 31 -- src/fenrir/commands/onInput/80000-capslock.py | 27 -- .../commands/onInput/80300-scrolllock.py | 27 -- src/fenrir/commands/onInput/80500-numlock.py | 27 -- src/fenrir/commands/onInput/__init__.py | 0 .../onPlugInputDevice/50000-UpdateDevices.py | 21 - .../commands/onPlugInputDevice/__init__.py | 0 .../commands/onScreenChanged/10000-shut_up.py | 23 -- .../80000-screen_change_announcement.py | 25 -- .../onScreenChanged/85000-reset_marks.py | 24 -- .../89000-leave_review_mode.py | 26 -- .../commands/onScreenChanged/__init__.py | 0 .../56000-highlight_tracking.py | 24 -- .../commands/onScreenUpdate/60000-history.py | 57 --- .../commands/onScreenUpdate/70000-incoming.py | 45 -- .../onScreenUpdate/75000-incoming_promote.py | 37 -- .../commands/onScreenUpdate/__init__.py | 0 .../onSwitchApplicationProfile/__init__.py | 1 - .../onSwitchApplicationProfile/default.py | 33 -- .../inactive/agetty.py | 31 -- .../inactive/bash.py | 31 -- .../inactive/vim.py | 31 -- src/fenrir/commands/switchTrigger_template.py | 23 -- src/fenrir/core/__init__.py | 0 src/fenrir/core/applicationManager.py | 31 -- src/fenrir/core/brailleDriver.py | 41 -- src/fenrir/core/commandData.py | 24 -- src/fenrir/core/commandManager.py | 223 ---------- src/fenrir/core/cursorManager.py | 109 ----- src/fenrir/core/debug.py | 13 - src/fenrir/core/debugManager.py | 71 ---- src/fenrir/core/environment.py | 29 -- src/fenrir/core/eventData.py | 24 -- src/fenrir/core/eventManager.py | 85 ---- src/fenrir/core/fenrirManager.py | 185 --------- src/fenrir/core/generalData.py | 18 - src/fenrir/core/headLineManager.py | 55 --- src/fenrir/core/helpManager.py | 81 ---- src/fenrir/core/i18n.py | 11 - src/fenrir/core/inputData.py | 36 -- src/fenrir/core/inputDriver.py | 52 --- src/fenrir/core/inputManager.py | 212 ---------- src/fenrir/core/memoryManager.py | 123 ------ src/fenrir/core/outputData.py | 15 - src/fenrir/core/outputManager.py | 272 ------------- src/fenrir/core/processManager.py | 87 ---- src/fenrir/core/punctuationData.py | 61 --- src/fenrir/core/punctuationManager.py | 83 ---- src/fenrir/core/runtimeData.py | 20 - src/fenrir/core/screenData.py | 55 --- src/fenrir/core/screenDriver.py | 48 --- src/fenrir/core/screenManager.py | 116 ------ src/fenrir/core/settingsData.py | 113 ------ src/fenrir/core/settingsManager.py | 364 ----------------- src/fenrir/core/soundDriver.py | 47 --- src/fenrir/core/speechDriver.py | 100 ----- src/fenrir/core/tableManager.py | 46 --- src/fenrir/fenrir | 21 - src/fenrir/fenrir-daemon | 28 -- src/fenrir/fenrirVersion.py | 11 - src/fenrir/inputDriver/__init__.py | 0 src/fenrir/inputDriver/debugDriver.py | 66 --- src/fenrir/inputDriver/dummyDriver.py | 13 - src/fenrir/inputDriver/evdevDriver.py | 308 -------------- src/fenrir/screenDriver/BAKvcsaDriver.py | 379 ----------------- src/fenrir/screenDriver/__init__.py | 0 src/fenrir/screenDriver/dummyDriver.py | 12 - src/fenrir/screenDriver/ptyDriver.py | 372 ----------------- src/fenrir/screenDriver/vcsaDriver.py | 384 ------------------ src/fenrir/soundDriver/__init__.py | 0 src/fenrir/soundDriver/debugDriver.py | 56 --- src/fenrir/soundDriver/dummyDriver.py | 12 - src/fenrir/soundDriver/genericDriver.py | 63 --- src/fenrir/soundDriver/gstreamerDriver.py | 113 ------ src/fenrir/speechDriver/Readme.md | 3 - src/fenrir/speechDriver/__init__.py | 0 src/fenrir/speechDriver/debugDriver.py | 74 ---- src/fenrir/speechDriver/dummyDriver.py | 13 - src/fenrir/speechDriver/emacspeakDriver.py | 82 ---- src/fenrir/speechDriver/espeakDriver.py | 58 --- src/fenrir/speechDriver/genericDriver.py | 192 --------- src/fenrir/speechDriver/pyttsxDriver.py | 86 ---- src/fenrir/speechDriver/speechdDriver.py | 94 ----- src/fenrir/utils/__init__.py | 0 src/fenrir/utils/char_utils.py | 121 ------ src/fenrir/utils/fenrir-config.py | 23 -- src/fenrir/utils/line_utils.py | 52 --- src/fenrir/utils/mark_utils.py | 60 --- src/fenrir/utils/module_utils.py | 19 - src/fenrir/utils/review_utils.py | 8 - src/fenrir/utils/screen_utils.py | 117 ------ src/fenrir/utils/word_utils.py | 122 ------ uninstall.sh | 8 +- 245 files changed, 45 insertions(+), 11226 deletions(-) delete mode 100755 src/fenrir/__init__.py delete mode 100755 src/fenrir/brailleDriver/__init__.py delete mode 100644 src/fenrir/brailleDriver/brlapiDriver.py delete mode 100644 src/fenrir/brailleDriver/debugDriver.py delete mode 100644 src/fenrir/brailleDriver/dummyDriver.py delete mode 100755 src/fenrir/commands/__init__.py delete mode 100644 src/fenrir/commands/command_template.py delete mode 100644 src/fenrir/commands/commands/00_init_commands.py delete mode 100755 src/fenrir/commands/commands/__init__.py delete mode 100644 src/fenrir/commands/commands/add_word_to_spell_check.py delete mode 100644 src/fenrir/commands/commands/attribute_cursor.py delete mode 100644 src/fenrir/commands/commands/bookmark_1.py delete mode 100644 src/fenrir/commands/commands/bookmark_10.py delete mode 100644 src/fenrir/commands/commands/bookmark_2.py delete mode 100644 src/fenrir/commands/commands/bookmark_3.py delete mode 100644 src/fenrir/commands/commands/bookmark_4.py delete mode 100644 src/fenrir/commands/commands/bookmark_5.py delete mode 100644 src/fenrir/commands/commands/bookmark_6.py delete mode 100644 src/fenrir/commands/commands/bookmark_7.py delete mode 100644 src/fenrir/commands/commands/bookmark_8.py delete mode 100644 src/fenrir/commands/commands/bookmark_9.py delete mode 100644 src/fenrir/commands/commands/braille_flush.py delete mode 100644 src/fenrir/commands/commands/braille_pan_left.py delete mode 100644 src/fenrir/commands/commands/braille_pan_right.py delete mode 100644 src/fenrir/commands/commands/braille_return_to_cursor.py delete mode 100644 src/fenrir/commands/commands/clear_bookmark_1.py delete mode 100644 src/fenrir/commands/commands/clear_bookmark_10.py delete mode 100644 src/fenrir/commands/commands/clear_bookmark_2.py delete mode 100644 src/fenrir/commands/commands/clear_bookmark_3.py delete mode 100644 src/fenrir/commands/commands/clear_bookmark_4.py delete mode 100644 src/fenrir/commands/commands/clear_bookmark_5.py delete mode 100644 src/fenrir/commands/commands/clear_bookmark_6.py delete mode 100644 src/fenrir/commands/commands/clear_bookmark_7.py delete mode 100644 src/fenrir/commands/commands/clear_bookmark_8.py delete mode 100644 src/fenrir/commands/commands/clear_bookmark_9.py delete mode 100644 src/fenrir/commands/commands/clear_clipboard.py delete mode 100644 src/fenrir/commands/commands/clear_window_application.py delete mode 100644 src/fenrir/commands/commands/copy_last_echo_to_clipboard.py delete mode 100644 src/fenrir/commands/commands/copy_marked_to_clipboard.py delete mode 100644 src/fenrir/commands/commands/curr_clipboard.py delete mode 100644 src/fenrir/commands/commands/curr_screen.py delete mode 100644 src/fenrir/commands/commands/curr_screen_after_cursor.py delete mode 100644 src/fenrir/commands/commands/curr_screen_before_cursor.py delete mode 100644 src/fenrir/commands/commands/cursor_column.py delete mode 100644 src/fenrir/commands/commands/cursor_lineno.py delete mode 100644 src/fenrir/commands/commands/cursor_position.py delete mode 100644 src/fenrir/commands/commands/cursor_read_to_end_of_line.py delete mode 100644 src/fenrir/commands/commands/date.py delete mode 100644 src/fenrir/commands/commands/dec_alsa_volume.py delete mode 100644 src/fenrir/commands/commands/dec_sound_volume.py delete mode 100644 src/fenrir/commands/commands/dec_speech_pitch.py delete mode 100644 src/fenrir/commands/commands/dec_speech_rate.py delete mode 100644 src/fenrir/commands/commands/dec_speech_volume.py delete mode 100644 src/fenrir/commands/commands/exit_review.py delete mode 100644 src/fenrir/commands/commands/export_clipboard_to_file.py delete mode 100644 src/fenrir/commands/commands/export_clipboard_to_x.py delete mode 100644 src/fenrir/commands/commands/first_clipboard.py delete mode 100644 src/fenrir/commands/commands/forward_keypress.py delete mode 100644 src/fenrir/commands/commands/import_clipboard_from_file.py delete mode 100644 src/fenrir/commands/commands/inc_alsa_volume.py delete mode 100644 src/fenrir/commands/commands/inc_sound_volume.py delete mode 100644 src/fenrir/commands/commands/inc_speech_pitch.py delete mode 100644 src/fenrir/commands/commands/inc_speech_rate.py delete mode 100644 src/fenrir/commands/commands/inc_speech_volume.py delete mode 100644 src/fenrir/commands/commands/indent_curr_line.py delete mode 100644 src/fenrir/commands/commands/last_clipboard.py delete mode 100644 src/fenrir/commands/commands/last_incoming.py delete mode 100644 src/fenrir/commands/commands/marked_text.py delete mode 100644 src/fenrir/commands/commands/next_clipboard.py delete mode 100644 src/fenrir/commands/commands/paste_clipboard.py delete mode 100644 src/fenrir/commands/commands/present_first_line.py delete mode 100644 src/fenrir/commands/commands/present_last_line.py delete mode 100644 src/fenrir/commands/commands/prev_clipboard.py delete mode 100644 src/fenrir/commands/commands/quit_fenrir.py delete mode 100644 src/fenrir/commands/commands/remove_marks.py delete mode 100644 src/fenrir/commands/commands/remove_word_from_spell_check.py delete mode 100644 src/fenrir/commands/commands/review_bottom.py delete mode 100644 src/fenrir/commands/commands/review_curr_char.py delete mode 100644 src/fenrir/commands/commands/review_curr_char_phonetic.py delete mode 100644 src/fenrir/commands/commands/review_curr_line.py delete mode 100644 src/fenrir/commands/commands/review_curr_word.py delete mode 100644 src/fenrir/commands/commands/review_curr_word_phonetic.py delete mode 100644 src/fenrir/commands/commands/review_down.py delete mode 100644 src/fenrir/commands/commands/review_line_begin.py delete mode 100644 src/fenrir/commands/commands/review_line_end.py delete mode 100644 src/fenrir/commands/commands/review_line_first_char.py delete mode 100644 src/fenrir/commands/commands/review_line_last_char.py delete mode 100644 src/fenrir/commands/commands/review_next_char.py delete mode 100644 src/fenrir/commands/commands/review_next_char_phonetic.py delete mode 100644 src/fenrir/commands/commands/review_next_line.py delete mode 100644 src/fenrir/commands/commands/review_next_word.py delete mode 100644 src/fenrir/commands/commands/review_next_word_phonetic.py delete mode 100644 src/fenrir/commands/commands/review_prev_char.py delete mode 100644 src/fenrir/commands/commands/review_prev_char_phonetic.py delete mode 100644 src/fenrir/commands/commands/review_prev_line.py delete mode 100644 src/fenrir/commands/commands/review_prev_word.py delete mode 100644 src/fenrir/commands/commands/review_prev_word_phonetic.py delete mode 100644 src/fenrir/commands/commands/review_top.py delete mode 100644 src/fenrir/commands/commands/review_up.py delete mode 100644 src/fenrir/commands/commands/set_bookmark_1.py delete mode 100644 src/fenrir/commands/commands/set_bookmark_10.py delete mode 100644 src/fenrir/commands/commands/set_bookmark_2.py delete mode 100644 src/fenrir/commands/commands/set_bookmark_3.py delete mode 100644 src/fenrir/commands/commands/set_bookmark_4.py delete mode 100644 src/fenrir/commands/commands/set_bookmark_5.py delete mode 100644 src/fenrir/commands/commands/set_bookmark_6.py delete mode 100644 src/fenrir/commands/commands/set_bookmark_7.py delete mode 100644 src/fenrir/commands/commands/set_bookmark_8.py delete mode 100644 src/fenrir/commands/commands/set_bookmark_9.py delete mode 100644 src/fenrir/commands/commands/set_mark.py delete mode 100644 src/fenrir/commands/commands/set_window_application.py delete mode 100644 src/fenrir/commands/commands/shut_up.py delete mode 100644 src/fenrir/commands/commands/spell_check.py delete mode 100644 src/fenrir/commands/commands/subprocess.py delete mode 100644 src/fenrir/commands/commands/temp_disable_speech.py delete mode 100644 src/fenrir/commands/commands/time.py delete mode 100644 src/fenrir/commands/commands/toggle_auto_read.py delete mode 100644 src/fenrir/commands/commands/toggle_auto_spell_check.py delete mode 100644 src/fenrir/commands/commands/toggle_auto_time.py delete mode 100644 src/fenrir/commands/commands/toggle_braille.py delete mode 100644 src/fenrir/commands/commands/toggle_emoticons.py delete mode 100644 src/fenrir/commands/commands/toggle_highlight_tracking.py delete mode 100644 src/fenrir/commands/commands/toggle_output.py delete mode 100644 src/fenrir/commands/commands/toggle_punctuation_level.py delete mode 100644 src/fenrir/commands/commands/toggle_sound.py delete mode 100644 src/fenrir/commands/commands/toggle_speech.py delete mode 100644 src/fenrir/commands/commands/toggle_tutorial_mode.py delete mode 100644 src/fenrir/commands/help/Readme.txt delete mode 100755 src/fenrir/commands/help/__init__.py delete mode 100644 src/fenrir/commands/help/curr_help.py delete mode 100644 src/fenrir/commands/help/next_help.py delete mode 100644 src/fenrir/commands/help/prev_help.py delete mode 100644 src/fenrir/commands/onApplicationChange/__init__.py delete mode 100644 src/fenrir/commands/onApplicationChange/inactive/test.py delete mode 100644 src/fenrir/commands/onCursorChange/45000-char_echo.py delete mode 100644 src/fenrir/commands/onCursorChange/46000-tab_completion.py delete mode 100644 src/fenrir/commands/onCursorChange/50000-present_char_if_cursor_change_horizontal.py delete mode 100644 src/fenrir/commands/onCursorChange/55000-present_line_if_cursor_change_vertical.py delete mode 100644 src/fenrir/commands/onCursorChange/60000-word_echo_type.py delete mode 100644 src/fenrir/commands/onCursorChange/61000-word_echo_navigation.py delete mode 100644 src/fenrir/commands/onCursorChange/62000-spell_check.py delete mode 100644 src/fenrir/commands/onCursorChange/65000-char_delete_echo.py delete mode 100644 src/fenrir/commands/onCursorChange/66000-exit_review_mode.py delete mode 100755 src/fenrir/commands/onCursorChange/__init__.py delete mode 100755 src/fenrir/commands/onHeartBeat/2000-GetSessionInfo.py delete mode 100755 src/fenrir/commands/onHeartBeat/76000-time.py delete mode 100755 src/fenrir/commands/onHeartBeat/__init__.py delete mode 100755 src/fenrir/commands/onHeartBeat/deactive/1.echo.py delete mode 100644 src/fenrir/commands/onInput/10000-shut_up.py delete mode 100644 src/fenrir/commands/onInput/15000-enable_temp_speech.py delete mode 100644 src/fenrir/commands/onInput/80000-capslock.py delete mode 100644 src/fenrir/commands/onInput/80300-scrolllock.py delete mode 100644 src/fenrir/commands/onInput/80500-numlock.py delete mode 100644 src/fenrir/commands/onInput/__init__.py delete mode 100755 src/fenrir/commands/onPlugInputDevice/50000-UpdateDevices.py delete mode 100755 src/fenrir/commands/onPlugInputDevice/__init__.py delete mode 100644 src/fenrir/commands/onScreenChanged/10000-shut_up.py delete mode 100644 src/fenrir/commands/onScreenChanged/80000-screen_change_announcement.py delete mode 100644 src/fenrir/commands/onScreenChanged/85000-reset_marks.py delete mode 100644 src/fenrir/commands/onScreenChanged/89000-leave_review_mode.py delete mode 100644 src/fenrir/commands/onScreenChanged/__init__.py delete mode 100644 src/fenrir/commands/onScreenUpdate/56000-highlight_tracking.py delete mode 100644 src/fenrir/commands/onScreenUpdate/60000-history.py delete mode 100644 src/fenrir/commands/onScreenUpdate/70000-incoming.py delete mode 100644 src/fenrir/commands/onScreenUpdate/75000-incoming_promote.py delete mode 100755 src/fenrir/commands/onScreenUpdate/__init__.py delete mode 100644 src/fenrir/commands/onSwitchApplicationProfile/__init__.py delete mode 100644 src/fenrir/commands/onSwitchApplicationProfile/default.py delete mode 100644 src/fenrir/commands/onSwitchApplicationProfile/inactive/agetty.py delete mode 100644 src/fenrir/commands/onSwitchApplicationProfile/inactive/bash.py delete mode 100644 src/fenrir/commands/onSwitchApplicationProfile/inactive/vim.py delete mode 100644 src/fenrir/commands/switchTrigger_template.py delete mode 100644 src/fenrir/core/__init__.py delete mode 100644 src/fenrir/core/applicationManager.py delete mode 100644 src/fenrir/core/brailleDriver.py delete mode 100644 src/fenrir/core/commandData.py delete mode 100644 src/fenrir/core/commandManager.py delete mode 100644 src/fenrir/core/cursorManager.py delete mode 100644 src/fenrir/core/debug.py delete mode 100644 src/fenrir/core/debugManager.py delete mode 100644 src/fenrir/core/environment.py delete mode 100644 src/fenrir/core/eventData.py delete mode 100644 src/fenrir/core/eventManager.py delete mode 100644 src/fenrir/core/fenrirManager.py delete mode 100644 src/fenrir/core/generalData.py delete mode 100644 src/fenrir/core/headLineManager.py delete mode 100755 src/fenrir/core/helpManager.py delete mode 100644 src/fenrir/core/i18n.py delete mode 100644 src/fenrir/core/inputData.py delete mode 100644 src/fenrir/core/inputDriver.py delete mode 100644 src/fenrir/core/inputManager.py delete mode 100644 src/fenrir/core/memoryManager.py delete mode 100644 src/fenrir/core/outputData.py delete mode 100644 src/fenrir/core/outputManager.py delete mode 100644 src/fenrir/core/processManager.py delete mode 100644 src/fenrir/core/punctuationData.py delete mode 100644 src/fenrir/core/punctuationManager.py delete mode 100644 src/fenrir/core/runtimeData.py delete mode 100644 src/fenrir/core/screenData.py delete mode 100644 src/fenrir/core/screenDriver.py delete mode 100644 src/fenrir/core/screenManager.py delete mode 100644 src/fenrir/core/settingsData.py delete mode 100644 src/fenrir/core/settingsManager.py delete mode 100644 src/fenrir/core/soundDriver.py delete mode 100644 src/fenrir/core/speechDriver.py delete mode 100644 src/fenrir/core/tableManager.py delete mode 100755 src/fenrir/fenrir delete mode 100755 src/fenrir/fenrir-daemon delete mode 100644 src/fenrir/fenrirVersion.py delete mode 100644 src/fenrir/inputDriver/__init__.py delete mode 100644 src/fenrir/inputDriver/debugDriver.py delete mode 100644 src/fenrir/inputDriver/dummyDriver.py delete mode 100644 src/fenrir/inputDriver/evdevDriver.py delete mode 100644 src/fenrir/screenDriver/BAKvcsaDriver.py delete mode 100755 src/fenrir/screenDriver/__init__.py delete mode 100644 src/fenrir/screenDriver/dummyDriver.py delete mode 100644 src/fenrir/screenDriver/ptyDriver.py delete mode 100644 src/fenrir/screenDriver/vcsaDriver.py delete mode 100755 src/fenrir/soundDriver/__init__.py delete mode 100644 src/fenrir/soundDriver/debugDriver.py delete mode 100644 src/fenrir/soundDriver/dummyDriver.py delete mode 100644 src/fenrir/soundDriver/genericDriver.py delete mode 100644 src/fenrir/soundDriver/gstreamerDriver.py delete mode 100644 src/fenrir/speechDriver/Readme.md delete mode 100755 src/fenrir/speechDriver/__init__.py delete mode 100644 src/fenrir/speechDriver/debugDriver.py delete mode 100644 src/fenrir/speechDriver/dummyDriver.py delete mode 100644 src/fenrir/speechDriver/emacspeakDriver.py delete mode 100644 src/fenrir/speechDriver/espeakDriver.py delete mode 100644 src/fenrir/speechDriver/genericDriver.py delete mode 100644 src/fenrir/speechDriver/pyttsxDriver.py delete mode 100644 src/fenrir/speechDriver/speechdDriver.py delete mode 100755 src/fenrir/utils/__init__.py delete mode 100644 src/fenrir/utils/char_utils.py delete mode 100644 src/fenrir/utils/fenrir-config.py delete mode 100644 src/fenrir/utils/line_utils.py delete mode 100644 src/fenrir/utils/mark_utils.py delete mode 100644 src/fenrir/utils/module_utils.py delete mode 100644 src/fenrir/utils/review_utils.py delete mode 100644 src/fenrir/utils/screen_utils.py delete mode 100644 src/fenrir/utils/word_utils.py diff --git a/install.sh b/install.sh index 1f0d59f3..38b6e3a9 100755 --- a/install.sh +++ b/install.sh @@ -3,54 +3,54 @@ read -p "This will install Fenrir. Press ctrl+C to cancel, or enter to continue." continue # Fenrir main application -install -m755 -d /opt/fenrir -cp -af src/fenrir/* /opt/fenrir +install -m755 -d /opt/fenrirscreenreader +cp -af src/* /opt/fenrirscreenreader install -m644 -D "autostart/systemd/fenrir.service" /usr/lib/systemd/system/fenrir.service -ln -fs /opt/fenrir/fenrir-daemon /usr/bin/fenrir-daemon -ln -fs /opt/fenrir/fenrir /usr/bin/fenrir +ln -fs /opt/fenrirscreenreader/fenrir-daemon /usr/bin/fenrir-daemon +ln -fs /opt/fenrirscreenreader/fenrir /usr/bin/fenrir # tools -install -m755 -d /usr/share/fenrir/tools -cp -af tools/* /usr/share/fenrir/tools +install -m755 -d /usr/share/fenrirscreenreader/tools +cp -af tools/* /usr/share/fenrirscreenreader/tools # scripts -install -m755 -d /usr/share/fenrir/scripts -cp -af "config/scripts/wlan__-__key_y.sh" /usr/share/fenrir/scripts/ +install -m755 -d /usr/share/fenrirscreenreader/scripts +cp -af "config/scripts/wlan__-__key_y.sh" /usr/share/fenrirscreenreader/scripts/ # keyboard -install -m644 -D "config/keyboard/desktop.conf" /etc/fenrir/keyboard/desktop.conf -install -m644 -D "config/keyboard/laptop.conf" /etc/fenrir/keyboard/laptop.conf +install -m644 -D "config/keyboard/desktop.conf" /etc/fenrirscreenreader/keyboard/desktop.conf +install -m644 -D "config/keyboard/laptop.conf" /etc/fenrirscreenreader/keyboard/laptop.conf # punctuation -install -m755 -d /etc/fenrir/punctuation -cp -af config/punctuation/* /etc/fenrir/punctuation +install -m755 -d /etc/fenrirscreenreader/punctuation +cp -af config/punctuation/* /etc/fenrirscreenreader/punctuation # sound -install -d /usr/share/sounds/fenrir -cp -af config/sound/default /usr/share/sounds/fenrir/default -cp -af config/sound/default-wav /usr/share/sounds/fenrir/default-wav -cp -af config/sound/template /usr/share/sounds/fenrir/template +install -d /usr/share/sounds/fenrirscreenreader +cp -af config/sound/default /usr/share/sounds/fenrirscreenreader/default +cp -af config/sound/default-wav /usr/share/sounds/fenrirscreenreader/default-wav +cp -af config/sound/template /usr/share/sounds/fenrirscreenreader/template # config -if [ -f "/etc/fenrir/settings/settings.conf" ]; then +if [ -f "/etc/fenrirscreenreader/settings/settings.conf" ]; then echo "Do you want to overwrite your current global settings? (y/n)" read yn if [ $yn = "Y" -o $yn = "y" ]; then - mv /etc/fenrir/settings/settings.conf /etc/fenrir/settings/settings.conf.bak + mv /etc/fenrirscreenreader/settings/settings.conf /etc/fenrirscreenreader/settings/settings.conf.bak echo "Your old settings.conf has been backed up to settings.conf.bak." - install -m644 -D "config/settings/settings.conf" /etc/fenrir/settings/settings.conf + install -m644 -D "config/settings/settings.conf" /etc/fenrirscreenreader/settings/settings.conf else - install -m644 -D "config/settings/settings.conf" /etc/fenrir/settings/settings.conf.current + install -m644 -D "config/settings/settings.conf" /etc/fenrirscreenreader/settings/settings.conf.current fi else - install -m644 -D "config/settings/settings.conf" /etc/fenrir/settings/settings.conf + install -m644 -D "config/settings/settings.conf" /etc/fenrirscreenreader/settings/settings.conf fi # end message cat << EOF Installation complete. -install path:/opt/fenrir -settings path:/etc/fenrir +install path:/opt/fenrirscreenreader +settings path:/etc/fenrirscreenreader To test Fenrir sudo systemctl start fenrir @@ -58,6 +58,6 @@ To have Fenrir start on system boot: sudo systemctl enable fenrir Pulseaudio users may want to run -/usr/share/fenrir/tools/configure_pulse.sh +/usr/share/fenrirscreenreader/tools/configure_pulse.sh once from their user account, then once from the root. EOF diff --git a/play zone/wrapWord.py b/play zone/wrapWord.py index 566816a9..27dbc466 100755 --- a/play zone/wrapWord.py +++ b/play zone/wrapWord.py @@ -4,7 +4,7 @@ # Fenrir TTY screen reader # By Chrys, Storm Dragon, and contributers. -#from core import debug +#from fenrirscreenreader.core import debug import string # X Y Word END BREAK # -1, -1, '', True False diff --git a/setup.py b/setup.py index ee28bf24..b621d7f6 100755 --- a/setup.py +++ b/setup.py @@ -6,8 +6,8 @@ from shutil import copyfile from setuptools import find_packages from setuptools import setup -fenrirVersion = '1.5' -packageVersion = 'post11' +fenrirVersion = '1.6' +packageVersion = 'post1' # handle flags for package manager like yaourt and pacaur. forceSettings = False @@ -21,32 +21,32 @@ for directory in directories: files = glob.glob(directory+'/*') destDir = '' if 'config/punctuation' in directory : - destDir = '/etc/fenrir/punctuation' + destDir = '/etc/fenrirscreenreader/punctuation' elif 'config/keyboard' in directory: - destDir = '/etc/fenrir/keyboard' + destDir = '/etc/fenrirscreenreader/keyboard' elif 'config/settings' in directory: - destDir = '/etc/fenrir/settings' + destDir = '/etc/fenrirscreenreader/settings' if not forceSettings: try: del(files[files.index('config/settings/settings.conf')]) except: pass elif 'config/scripts' in directory: - destDir = '/usr/share/fenrir/scripts' + destDir = '/usr/share/fenrirscreenreader/scripts' if destDir != '': data_files.append((destDir, files)) files = glob.glob('config/sound/default-wav/*') -destDir = '/usr/share/sounds/fenrir/default-wav' +destDir = '/usr/share/sounds/fenrirscreenreader/default-wav' data_files.append((destDir, files)) files = glob.glob('config/sound/default/*') -destDir = '/usr/share/sounds/fenrir/default' +destDir = '/usr/share/sounds/fenrirscreenreader/default' data_files.append((destDir, files)) files = glob.glob('config/sound//template/*') -destDir = '/usr/share/sounds/fenrir/template' +destDir = '/usr/share/sounds/fenrirscreenreader/template' data_files.append((destDir, files)) files = glob.glob('tools/*') -data_files.append(('/usr/share/fenrir/tools', files)) +data_files.append(('/usr/share/fenrirscreenreader/tools', files)) data_files.append(('/usr/lib/systemd/system', ['autostart/systemd/fenrir.service'])) data_files.append(('/usr/share/man/man1', ['docu/fenrir.1'])) @@ -78,9 +78,9 @@ setup( author_email="chrysg@linux-a11y.org", # Packages - packages=find_packages('src/fenrir'), - package_dir={'': 'src/fenrir'}, - scripts=['src/fenrir/fenrir','src/fenrir/fenrir-daemon'], + packages=find_packages('src/fenrirscreenreader'), + package_dir={'': 'src/fenrirscreenreader'}, + scripts=['src/fenrir','src/fenrir-daemon'], # Include additional files into the package include_package_data=True, @@ -105,9 +105,9 @@ setup( if not forceSettings: print('') # create settings file from example if not exist - if not os.path.isfile('/etc/fenrir/settings/settings.conf'): + if not os.path.isfile('/etc/fenrirscreenreader/settings/settings.conf'): try: - copyfile('/etc/fenrir/settings/settings.conf.example', '/etc/fenrir/settings/settings.conf') + copyfile('/etc/fenrirscreenreader/settings/settings.conf.example', '/etc/fenrir/settings/settings.conf') print('create settings file in /etc/fenrir/settings/settings.conf') except: pass @@ -118,7 +118,7 @@ print('') print('To have Fenrir start at boot:') print('sudo systemctl enable fenrir') print('Pulseaudio users may want to run:') -print('/usr/share/fenrir/tools/configure_pulse.sh') +print('/usr/share/fenrirscreenreader/tools/configure_pulse.sh') print('once as their user account and once as root to configure Pulseaudio.') print('Please install the following packages manually:') print('- Speech-dispatcher: for the default speech driver') diff --git a/src/fenrir/__init__.py b/src/fenrir/__init__.py deleted file mode 100755 index e69de29b..00000000 diff --git a/src/fenrir/brailleDriver/__init__.py b/src/fenrir/brailleDriver/__init__.py deleted file mode 100755 index e69de29b..00000000 diff --git a/src/fenrir/brailleDriver/brlapiDriver.py b/src/fenrir/brailleDriver/brlapiDriver.py deleted file mode 100644 index f7e63b83..00000000 --- a/src/fenrir/brailleDriver/brlapiDriver.py +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from core.brailleDriver import brailleDriver - -class driver(brailleDriver): - def __init__(self): - brailleDriver.__init__(self) - self._brl = None - - def initialize(self, environment): - self.env = environment - try: - import brlapi - self._brl = brlapi.Connection() - self._deviceSize = self._brl.displaySize - except Exception as e: - print(e) - self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR) - return - self._isInitialized = True - - def getDeviceSize(self): - if not self._isInitialized: - return (0,0) - if not self._deviceSize: - return (0,0) - return self._deviceSize - - def flush(self): - if not self._isInitialized: - return - try: - self._brl.writeText('',0) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('BRAILLE.flush '+str(e),debug.debugLevel.ERROR) - - def writeText(self,text): - if not self._isInitialized: - return - try: - self._brl.writeText(text) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('BRAILLE.writeText '+str(e),debug.debugLevel.ERROR) - - def connectDevice(self): - self._brl = brlapi.Connection() - - def enterScreen(self, screen): - if not self._isInitialized: - return - self._brl.enterTtyMode(int(screen)) - - def leveScreen(self): - if not self._isInitialized: - return - self._brl.leaveTtyMode() - - def shutdown(self): - if not self._isInitialized: - return - self.leveScreen() diff --git a/src/fenrir/brailleDriver/debugDriver.py b/src/fenrir/brailleDriver/debugDriver.py deleted file mode 100644 index ca22bd60..00000000 --- a/src/fenrir/brailleDriver/debugDriver.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from core.brailleDriver import brailleDriver - -class driver(brailleDriver): - def __init__(self): - brailleDriver.__init__(self) - - def initialize(self, environment): - self.env = environment - self._isInitialized = True - self.deviceSize = (40,0) - print('Braille Debug Driver: Initialized') - - def getDeviceSize(self): - if not self._isInitialized: - return (0,0) - print('Braille Debug Driver: getDeviceSize ' + str(self.deviceSize)) - return self.deviceSize - - def writeText(self,text): - if not self._isInitialized: - return - print('Braille Debug Driver: writeText:' + str(text)) - print('Braille Debug Driver: -----------------------------------') - - def connectDevice(self): - print('Braille Debug Driver: connectDevice') - - def enterScreen(self, screen): - if not self._isInitialized: - return - print('Braille Debug Driver: enterScreen') - - def leveScreen(self): - if not self._isInitialized: - return - print('Braille Debug Driver: leveScreen') - - def shutdown(self): - if self._isInitialized: - self.leveScreen() - self._isInitialized = False - print('Braille Debug Driver: Shutdown') diff --git a/src/fenrir/brailleDriver/dummyDriver.py b/src/fenrir/brailleDriver/dummyDriver.py deleted file mode 100644 index be13dd4d..00000000 --- a/src/fenrir/brailleDriver/dummyDriver.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from core.brailleDriver import brailleDriver - -class driver(brailleDriver): - def __init__(self): - brailleDriver.__init__(self) diff --git a/src/fenrir/commands/__init__.py b/src/fenrir/commands/__init__.py deleted file mode 100755 index e69de29b..00000000 diff --git a/src/fenrir/commands/command_template.py b/src/fenrir/commands/command_template.py deleted file mode 100644 index 25b6b1a8..00000000 --- a/src/fenrir/commands/command_template.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/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 'No description found' - def run(self): - pass - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/00_init_commands.py b/src/fenrir/commands/commands/00_init_commands.py deleted file mode 100644 index 4a573ca0..00000000 --- a/src/fenrir/commands/commands/00_init_commands.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -# this command is just to initialize stuff. -# like init index lists in memoryManager -# it is not useful to execute it -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - # clipboard - self.env['runtime']['memoryManager'].addIndexList('clipboardHistory', self.env['runtime']['settingsManager'].getSettingAsInt('general', 'numberOfClipboards')) - def shutdown(self): - pass - def getDescription(self): - return 'No description found' - def run(self): - pass - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/__init__.py b/src/fenrir/commands/commands/__init__.py deleted file mode 100755 index e69de29b..00000000 diff --git a/src/fenrir/commands/commands/add_word_to_spell_check.py b/src/fenrir/commands/commands/add_word_to_spell_check.py deleted file mode 100644 index 2eb5c579..00000000 --- a/src/fenrir/commands/commands/add_word_to_spell_check.py +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import word_utils -import string -initialized = False -try: - import enchant - initialized = True -except: - pass - -class command(): - def __init__(self): - self.language = '' - self.spellChecker = None - def initialize(self, environment): - self.env = environment - self.updateSpellLanguage() - def shutdown(self): - pass - def getDescription(self): - return _('adds the current word to the exceptions dictionary') - def updateSpellLanguage(self): - self.spellChecker = enchant.Dict(self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage')) - self.language = self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage') - - def run(self): - if not initialized: - self.env['runtime']['outputManager'].presentText(_('pyenchant is not installed'), interrupt=True) - return - if self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage') != self.language: - try: - self.updateSpellLanguage() - except Exception as e: - return - cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() - # get the word - 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 currWord != '': - if self.spellChecker.is_added(currWord): - self.env['runtime']['outputManager'].presentText(_('{0} is already in dict').format(currWord,), soundIcon='Cancel', interrupt=True) - else: - self.spellChecker.add(currWord) - self.env['runtime']['outputManager'].presentText(_('{0} added').format(currWord,), soundIcon='Accept', interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/attribute_cursor.py b/src/fenrir/commands/commands/attribute_cursor.py deleted file mode 100644 index 86285b1f..00000000 --- a/src/fenrir/commands/commands/attribute_cursor.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import screen_utils - -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): - cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() - attributes = screen_utils.splitEvery(self.env['screen']['newContentAttrib'], self.env['screen']['columns']) - attributes = attributes[cursorPos['y']][cursorPos['x']] - attributeFormatString = self.env['runtime']['settingsManager'].getSetting('general', 'attributeFormatString') - attributeFormatString = self.env['runtime']['screenManager'].formatAttributes(attributes, attributeFormatString) - self.env['runtime']['outputManager'].presentText(attributeFormatString, soundIcon='', interrupt=True) - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/bookmark_1.py b/src/fenrir/commands/commands/bookmark_1.py deleted file mode 100644 index 28923622..00000000 --- a/src/fenrir/commands/commands/bookmark_1.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import mark_utils -from utils import line_utils - -class command(): - def __init__(self): - self.ID = '1' - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('read Bookmark {0}').format(self.ID,) - - def run(self): - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - if not self.env['commandBuffer']['bookMarks'][self.ID]: - self.env['runtime']['outputManager'].presentText(_('Bookmark {0} not set').format(self.ID,), interrupt=True) - return - if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]: - self.env['runtime']['outputManager'].presentText(_('Bookmark for application {0} not set').format(currApp,), interrupt=True) - return - if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']: - self.env['runtime']['outputManager'].presentText(_('Bookmark for application {0} not set').format(currApp,), interrupt=True) - return - - # set marks - marked = '' - 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['screen']['newContentText']) - else: - x, y, marked = \ - 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: - self.env['runtime']['outputManager'].presentText(marked, interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/bookmark_10.py b/src/fenrir/commands/commands/bookmark_10.py deleted file mode 100644 index d85dcf27..00000000 --- a/src/fenrir/commands/commands/bookmark_10.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import mark_utils -from utils import line_utils - -class command(): - def __init__(self): - self.ID = '10' - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('read Bookmark {0}').format(self.ID,) - - def run(self): - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - if not self.env['commandBuffer']['bookMarks'][self.ID]: - self.env['runtime']['outputManager'].presentText(_('Bookmark {0} not set').format(self.ID,), interrupt=True) - return - if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]: - self.env['runtime']['outputManager'].presentText(_('Bookmark for application {0} not set').format(currApp,), interrupt=True) - return - if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']: - self.env['runtime']['outputManager'].presentText(_('Bookmark for application {0} not set').format(currApp,), interrupt=True) - return - - # set marks - marked = '' - 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['screen']['newContentText']) - else: - x, y, marked = \ - 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: - self.env['runtime']['outputManager'].presentText(marked, interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/bookmark_2.py b/src/fenrir/commands/commands/bookmark_2.py deleted file mode 100644 index e25c59c2..00000000 --- a/src/fenrir/commands/commands/bookmark_2.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import mark_utils -from utils import line_utils - -class command(): - def __init__(self): - self.ID = '2' - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('read Bookmark {0}').format(self.ID,) - - def run(self): - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - if not self.env['commandBuffer']['bookMarks'][self.ID]: - self.env['runtime']['outputManager'].presentText(_('Bookmark {0} not set').format(self.ID,), interrupt=True) - return - if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]: - self.env['runtime']['outputManager'].presentText(_('Bookmark for application {0} not set').format(currApp,), interrupt=True) - return - if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']: - self.env['runtime']['outputManager'].presentText(_('Bookmark for application {0} not set').format(currApp,), interrupt=True) - return - - # set marks - marked = '' - 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['screen']['newContentText']) - else: - x, y, marked = \ - 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: - self.env['runtime']['outputManager'].presentText(marked, interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/bookmark_3.py b/src/fenrir/commands/commands/bookmark_3.py deleted file mode 100644 index 490e49b7..00000000 --- a/src/fenrir/commands/commands/bookmark_3.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import mark_utils -from utils import line_utils - -class command(): - def __init__(self): - self.ID = '3' - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('read Bookmark {0}').format(self.ID,) - - def run(self): - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - if not self.env['commandBuffer']['bookMarks'][self.ID]: - self.env['runtime']['outputManager'].presentText(_('Bookmark {0} not set').format(self.ID,), interrupt=True) - return - if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]: - self.env['runtime']['outputManager'].presentText(_('Bookmark for application {0} not set').format(currApp,), interrupt=True) - return - if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']: - self.env['runtime']['outputManager'].presentText(_('Bookmark for application {0} not set').format(currApp,), interrupt=True) - return - - # set marks - marked = '' - 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['screen']['newContentText']) - else: - x, y, marked = \ - 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: - self.env['runtime']['outputManager'].presentText(marked, interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/bookmark_4.py b/src/fenrir/commands/commands/bookmark_4.py deleted file mode 100644 index 09543ea6..00000000 --- a/src/fenrir/commands/commands/bookmark_4.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import mark_utils -from utils import line_utils - -class command(): - def __init__(self): - self.ID = '4' - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('read Bookmark {0}').format(self.ID,) - - def run(self): - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - if not self.env['commandBuffer']['bookMarks'][self.ID]: - self.env['runtime']['outputManager'].presentText(_('Bookmark {0} not set').format(self.ID,), interrupt=True) - return - if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]: - self.env['runtime']['outputManager'].presentText(_('Bookmark for application {0} not set').format(currApp,), interrupt=True) - return - if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']: - self.env['runtime']['outputManager'].presentText(_('Bookmark for application {0} not set').format(currApp,), interrupt=True) - return - - # set marks - marked = '' - 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['screen']['newContentText']) - else: - x, y, marked = \ - 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: - self.env['runtime']['outputManager'].presentText(marked, interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/bookmark_5.py b/src/fenrir/commands/commands/bookmark_5.py deleted file mode 100644 index 4df87ac9..00000000 --- a/src/fenrir/commands/commands/bookmark_5.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import mark_utils -from utils import line_utils - -class command(): - def __init__(self): - self.ID = '5' - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('read Bookmark {0}').format(self.ID,) - - def run(self): - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - if not self.env['commandBuffer']['bookMarks'][self.ID]: - self.env['runtime']['outputManager'].presentText(_('Bookmark {0} not set').format(self.ID,), interrupt=True) - return - if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]: - self.env['runtime']['outputManager'].presentText(_('Bookmark for application {0} not set').format(currApp,), interrupt=True) - return - if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']: - self.env['runtime']['outputManager'].presentText(_('Bookmark for application {0} not set').format(currApp,), interrupt=True) - return - - # set marks - marked = '' - 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['screen']['newContentText']) - else: - x, y, marked = \ - 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: - self.env['runtime']['outputManager'].presentText(marked, interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/bookmark_6.py b/src/fenrir/commands/commands/bookmark_6.py deleted file mode 100644 index 0073e40a..00000000 --- a/src/fenrir/commands/commands/bookmark_6.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import mark_utils -from utils import line_utils - -class command(): - def __init__(self): - self.ID = '6' - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('read Bookmark {0}').format(self.ID,) - - def run(self): - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - if not self.env['commandBuffer']['bookMarks'][self.ID]: - self.env['runtime']['outputManager'].presentText(_('Bookmark {0} not set').format(self.ID,), interrupt=True) - return - if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]: - self.env['runtime']['outputManager'].presentText(_('Bookmark for application {0} not set').format(currApp,), interrupt=True) - return - if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']: - self.env['runtime']['outputManager'].presentText(_('Bookmark for application {0} not set').format(currApp,), interrupt=True) - return - - # set marks - marked = '' - 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['screen']['newContentText']) - else: - x, y, marked = \ - 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: - self.env['runtime']['outputManager'].presentText(marked, interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/bookmark_7.py b/src/fenrir/commands/commands/bookmark_7.py deleted file mode 100644 index 8275698d..00000000 --- a/src/fenrir/commands/commands/bookmark_7.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import mark_utils -from utils import line_utils - -class command(): - def __init__(self): - self.ID = '7' - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('read Bookmark {0}').format(self.ID,) - - def run(self): - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - if not self.env['commandBuffer']['bookMarks'][self.ID]: - self.env['runtime']['outputManager'].presentText(_('Bookmark {0} not set').format(self.ID,), interrupt=True) - return - if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]: - self.env['runtime']['outputManager'].presentText(_('Bookmark for application {0} not set').format(currApp,), interrupt=True) - return - if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']: - self.env['runtime']['outputManager'].presentText(_('Bookmark for application {0} not set').format(currApp,), interrupt=True) - return - - # set marks - marked = '' - 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['screen']['newContentText']) - else: - x, y, marked = \ - 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: - self.env['runtime']['outputManager'].presentText(marked, interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/bookmark_8.py b/src/fenrir/commands/commands/bookmark_8.py deleted file mode 100644 index 6a5f2e42..00000000 --- a/src/fenrir/commands/commands/bookmark_8.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import mark_utils -from utils import line_utils - -class command(): - def __init__(self): - self.ID = '8' - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('read Bookmark {0}').format(self.ID,) - - def run(self): - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - if not self.env['commandBuffer']['bookMarks'][self.ID]: - self.env['runtime']['outputManager'].presentText(_('Bookmark {0} not set').format(self.ID,), interrupt=True) - return - if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]: - self.env['runtime']['outputManager'].presentText(_('Bookmark for application {0} not set').format(currApp,), interrupt=True) - return - if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']: - self.env['runtime']['outputManager'].presentText(_('Bookmark for application {0} not set').format(currApp,), interrupt=True) - return - - # set marks - marked = '' - 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['screen']['newContentText']) - else: - x, y, marked = \ - 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: - self.env['runtime']['outputManager'].presentText(marked, interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/bookmark_9.py b/src/fenrir/commands/commands/bookmark_9.py deleted file mode 100644 index a86fcd1c..00000000 --- a/src/fenrir/commands/commands/bookmark_9.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import mark_utils -from utils import line_utils - -class command(): - def __init__(self): - self.ID = '9' - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('read Bookmark {0}').format(self.ID,) - - def run(self): - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - if not self.env['commandBuffer']['bookMarks'][self.ID]: - self.env['runtime']['outputManager'].presentText(_('Bookmark {0} not set').format(self.ID,), interrupt=True) - return - if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]: - self.env['runtime']['outputManager'].presentText(_('Bookmark for application {0} not set').format(currApp,), interrupt=True) - return - if not self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1']: - self.env['runtime']['outputManager'].presentText(_('Bookmark for application {0} not set').format(currApp,), interrupt=True) - return - - # set marks - marked = '' - 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['screen']['newContentText']) - else: - x, y, marked = \ - 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: - self.env['runtime']['outputManager'].presentText(marked, interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/braille_flush.py b/src/fenrir/commands/commands/braille_flush.py deleted file mode 100644 index 3c0ece33..00000000 --- a/src/fenrir/commands/commands/braille_flush.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/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 _('flush the braille device if a message is written on') - def run(self): - self.env['runtime']['outputManager'].clearFlushTime() - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/braille_pan_left.py b/src/fenrir/commands/commands/braille_pan_left.py deleted file mode 100644 index 284dacc7..00000000 --- a/src/fenrir/commands/commands/braille_pan_left.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/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 _('Move braille view to the left.') - def run(self): - panned = self.env['runtime']['outputManager'].setPanLeft() - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/braille_pan_right.py b/src/fenrir/commands/commands/braille_pan_right.py deleted file mode 100644 index c0272fba..00000000 --- a/src/fenrir/commands/commands/braille_pan_right.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/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 _('Move braille view to the right.') - def run(self): - panned = self.env['runtime']['outputManager'].setPanRight() - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/braille_return_to_cursor.py b/src/fenrir/commands/commands/braille_return_to_cursor.py deleted file mode 100644 index 01cecbbe..00000000 --- a/src/fenrir/commands/commands/braille_return_to_cursor.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/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 _('Set the braille view back to cursor.') - def run(self): - self.env['runtime']['outputManager'].removePanning() - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/clear_bookmark_1.py b/src/fenrir/commands/commands/clear_bookmark_1.py deleted file mode 100644 index d543a97e..00000000 --- a/src/fenrir/commands/commands/clear_bookmark_1.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -class command(): - def __init__(self): - self.ID = '1' - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('remove Bookmark {0}').format(self.ID,) - - def run(self): - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - - del self.env['commandBuffer']['bookMarks'][self.ID][currApp] - - self.env['runtime']['outputManager'].presentText(_('Bookmark {0} removed for application {1}').format(self.ID, currApp), interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/clear_bookmark_10.py b/src/fenrir/commands/commands/clear_bookmark_10.py deleted file mode 100644 index 5e77a224..00000000 --- a/src/fenrir/commands/commands/clear_bookmark_10.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -class command(): - def __init__(self): - self.ID = '10' - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('remove Bookmark {0}').format(self.ID,) - - def run(self): - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - - del self.env['commandBuffer']['bookMarks'][self.ID][currApp] - - self.env['runtime']['outputManager'].presentText(_('Bookmark {0} removed for application {1}').format(self.ID, currApp), interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/clear_bookmark_2.py b/src/fenrir/commands/commands/clear_bookmark_2.py deleted file mode 100644 index baa3daea..00000000 --- a/src/fenrir/commands/commands/clear_bookmark_2.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -class command(): - def __init__(self): - self.ID = '2' - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('remove Bookmark {0}').format(self.ID,) - - def run(self): - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - - del self.env['commandBuffer']['bookMarks'][self.ID][currApp] - - self.env['runtime']['outputManager'].presentText(_('Bookmark {0} removed for application {1}').format(self.ID, currApp), interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/clear_bookmark_3.py b/src/fenrir/commands/commands/clear_bookmark_3.py deleted file mode 100644 index 924ed7d7..00000000 --- a/src/fenrir/commands/commands/clear_bookmark_3.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -class command(): - def __init__(self): - self.ID = '3' - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('remove Bookmark {0}').format(self.ID,) - - def run(self): - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - - del self.env['commandBuffer']['bookMarks'][self.ID][currApp] - - self.env['runtime']['outputManager'].presentText(_('Bookmark {0} removed for application {1}').format(self.ID, currApp), interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/clear_bookmark_4.py b/src/fenrir/commands/commands/clear_bookmark_4.py deleted file mode 100644 index 781d8aa0..00000000 --- a/src/fenrir/commands/commands/clear_bookmark_4.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -class command(): - def __init__(self): - self.ID = '4' - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('remove Bookmark {0}').format(self.ID,) - - def run(self): - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - - del self.env['commandBuffer']['bookMarks'][self.ID][currApp] - - self.env['runtime']['outputManager'].presentText(_('Bookmark {0} removed for application {1}').format(self.ID, currApp), interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/clear_bookmark_5.py b/src/fenrir/commands/commands/clear_bookmark_5.py deleted file mode 100644 index 54a06923..00000000 --- a/src/fenrir/commands/commands/clear_bookmark_5.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -class command(): - def __init__(self): - self.ID = '5' - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('remove Bookmark {0}').format(self.ID,) - - def run(self): - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - - del self.env['commandBuffer']['bookMarks'][self.ID][currApp] - - self.env['runtime']['outputManager'].presentText(_('Bookmark {0} removed for application {1}').format(self.ID, currApp), interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/clear_bookmark_6.py b/src/fenrir/commands/commands/clear_bookmark_6.py deleted file mode 100644 index a79267fc..00000000 --- a/src/fenrir/commands/commands/clear_bookmark_6.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -class command(): - def __init__(self): - self.ID = '6' - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('remove Bookmark {0}').format(self.ID,) - - def run(self): - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - - del self.env['commandBuffer']['bookMarks'][self.ID][currApp] - - self.env['runtime']['outputManager'].presentText(_('Bookmark {0} removed for application {1}').format(self.ID, currApp), interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/clear_bookmark_7.py b/src/fenrir/commands/commands/clear_bookmark_7.py deleted file mode 100644 index 39cb1435..00000000 --- a/src/fenrir/commands/commands/clear_bookmark_7.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -class command(): - def __init__(self): - self.ID = '7' - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('remove Bookmark {0}').format(self.ID,) - - def run(self): - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - - del self.env['commandBuffer']['bookMarks'][self.ID][currApp] - - self.env['runtime']['outputManager'].presentText(_('Bookmark {0} removed for application {1}').format(self.ID, currApp), interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/clear_bookmark_8.py b/src/fenrir/commands/commands/clear_bookmark_8.py deleted file mode 100644 index b5e22414..00000000 --- a/src/fenrir/commands/commands/clear_bookmark_8.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -class command(): - def __init__(self): - self.ID = '8' - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('remove Bookmark {0}').format(self.ID,) - - def run(self): - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - - del self.env['commandBuffer']['bookMarks'][self.ID][currApp] - - self.env['runtime']['outputManager'].presentText(_('Bookmark {0} removed for application {1}').format(self.ID, currApp), interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/clear_bookmark_9.py b/src/fenrir/commands/commands/clear_bookmark_9.py deleted file mode 100644 index a9fd30a4..00000000 --- a/src/fenrir/commands/commands/clear_bookmark_9.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -class command(): - def __init__(self): - self.ID = '9' - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('remove Bookmark {0}').format(self.ID,) - - def run(self): - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - - del self.env['commandBuffer']['bookMarks'][self.ID][currApp] - - self.env['runtime']['outputManager'].presentText(_('Bookmark {0} removed for application {1}').format(self.ID, currApp), interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/clear_clipboard.py b/src/fenrir/commands/commands/clear_clipboard.py deleted file mode 100644 index 781e6acf..00000000 --- a/src/fenrir/commands/commands/clear_clipboard.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/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 _('clears the currently selected clipboard') - - def run(self): - self.env['runtime']['memoryManager'].clearCurrentIndexList('clipboardHistory') - self.env['runtime']['outputManager'].presentText(_('clipboard cleared'), interrupt=True) - return - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/clear_window_application.py b/src/fenrir/commands/commands/clear_window_application.py deleted file mode 100644 index 11af3045..00000000 --- a/src/fenrir/commands/commands/clear_window_application.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/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 _('Turn off window mode for application') - - def run(self): - if self.env['runtime']['cursorManager'].clearWindowForApplication(): - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - self.env['runtime']['outputManager'].presentText(_('Window Mode off for application {0}').format(currApp,), interrupt=True) - else: - self.env['runtime']['outputManager'].presentText(_("Not in window Mode"), interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/copy_last_echo_to_clipboard.py b/src/fenrir/commands/commands/copy_last_echo_to_clipboard.py deleted file mode 100644 index 061f4bc9..00000000 --- a/src/fenrir/commands/commands/copy_last_echo_to_clipboard.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import mark_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('copies last presented text to the clipboard') - - def run(self): - lastEcho = self.env['runtime']['outputManager'].getLastEcho() - self.env['runtime']['memoryManager'].addValueToFirstIndex('clipboardHistory', lastEcho) - self.env['runtime']['outputManager'].presentText(lastEcho, soundIcon='CopyToClipboard', interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/copy_marked_to_clipboard.py b/src/fenrir/commands/commands/copy_marked_to_clipboard.py deleted file mode 100644 index c83fdeb0..00000000 --- a/src/fenrir/commands/commands/copy_marked_to_clipboard.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import mark_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('copies marked text to the currently selected clipboard') - - def run(self): - if not self.env['commandBuffer']['Marks']['1']: - self.env['runtime']['outputManager'].presentText(_("one or two marks needed"), interrupt=True) - return - if not self.env['commandBuffer']['Marks']['2']: - self.env['runtime']['cursorManager'].setMark() - - # use the last first and the last setted mark as range - startMark = self.env['commandBuffer']['Marks']['1'].copy() - endMark = self.env['commandBuffer']['Marks']['2'].copy() - - marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screen']['newContentText']) - self.env['runtime']['memoryManager'].addValueToFirstIndex('clipboardHistory', marked) - # reset marks - self.env['runtime']['cursorManager'].clearMarks() - - self.env['runtime']['outputManager'].presentText(marked, soundIcon='CopyToClipboard', interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/curr_clipboard.py b/src/fenrir/commands/commands/curr_clipboard.py deleted file mode 100644 index 9c2baf3e..00000000 --- a/src/fenrir/commands/commands/curr_clipboard.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/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 _('speaks the contents of the currently selected clipboard') - - def run(self): - if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'): - self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True) - return - clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') - self.env['runtime']['outputManager'].presentText(clipboard , interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/curr_screen.py b/src/fenrir/commands/commands/curr_screen.py deleted file mode 100644 index 2de39736..00000000 --- a/src/fenrir/commands/commands/curr_screen.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/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 _('reads the contents of the current screen') - - def run(self): - 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['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 deleted file mode 100644 index 1e059cc9..00000000 --- a/src/fenrir/commands/commands/curr_screen_after_cursor.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import mark_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('reads from the cursor to the bottom of the screen') - - def run(self): - # Prefer review cursor over text cursor - cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() - - textAfterCursor = mark_utils.getTextAfterMark(cursorPos, self.env['screen']['newContentText']) - - if textAfterCursor.isspace(): - self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True) - else: - self.env['runtime']['outputManager'].presentText(textAfterCursor, interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/curr_screen_before_cursor.py b/src/fenrir/commands/commands/curr_screen_before_cursor.py deleted file mode 100644 index 8fd0a851..00000000 --- a/src/fenrir/commands/commands/curr_screen_before_cursor.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import mark_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('Reads from the top of the screen to the cursor position') - - def run(self): - # Prefer review cursor over text cursor - if self.env['screen']['newCursorReview']: - cursorPos = self.env['screen']['newCursorReview'].copy() - else: - cursorPos = self.env['screen']['newCursor'].copy() - - textBeforeCursor = mark_utils.getTextBeforeMark(cursorPos, self.env['screen']['newContentText']) - - if textBeforeCursor.isspace(): - self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True) - else: - self.env['runtime']['outputManager'].presentText(textBeforeCursor, interrupt=True) - - def setCallback(self, callback): - pass - diff --git a/src/fenrir/commands/commands/cursor_column.py b/src/fenrir/commands/commands/cursor_column.py deleted file mode 100644 index d3c119a6..00000000 --- a/src/fenrir/commands/commands/cursor_column.py +++ /dev/null @@ -1,25 +0,0 @@ -#!/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 _('presents the current column number for review cursor in review mode or the text cursor if not. Starts with 1') - def run(self): - cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() - self.env['runtime']['outputManager'].presentText(str(cursorPos['x'] + 1) , interrupt=True) - self.env['runtime']['outputManager'].announceActiveCursor() - self.env['runtime']['outputManager'].presentText(' column number' , interrupt=False) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/cursor_lineno.py b/src/fenrir/commands/commands/cursor_lineno.py deleted file mode 100644 index a8b39ce6..00000000 --- a/src/fenrir/commands/commands/cursor_lineno.py +++ /dev/null @@ -1,25 +0,0 @@ -#!/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 _('presents the current line number for review cursor in review mode or the text cursor if not. Starts with 1') - def run(self): - cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() - self.env['runtime']['outputManager'].presentText(str(cursorPos['y'] + 1), interrupt=True) - self.env['runtime']['outputManager'].announceActiveCursor() - self.env['runtime']['outputManager'].presentText(' line number' , interrupt=False) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/cursor_position.py b/src/fenrir/commands/commands/cursor_position.py deleted file mode 100644 index 99b13fab..00000000 --- a/src/fenrir/commands/commands/cursor_position.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/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 _('displays the position of the review cursor') - - def run(self): - # Prefer review cursor over text cursor - cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() - - self.env['runtime']['outputManager'].presentText(_("line {0}, column {1}").format(cursorPos['y']+1, cursorPos['x']+1), interrupt=True) - - def setCallback(self, callback): - pass 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 deleted file mode 100644 index 93e8a8a0..00000000 --- a/src/fenrir/commands/commands/cursor_read_to_end_of_line.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import line_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('read to end of line, use review cursor if you are in review mode, otherwhise use text cursor') - - def run(self): - cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() - - x, y, currLine = \ - line_utils.getCurrentLine(cursorPos['x'], cursorPos['y'], self.env['screen']['newContentText']) - - if currLine.isspace(): - self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True) - else: - self.env['runtime']['outputManager'].presentText(currLine[cursorPos['x']], interrupt=True) - self.env['runtime']['outputManager'].announceActiveCursor() - def setCallback(self, callback): - pass - diff --git a/src/fenrir/commands/commands/date.py b/src/fenrir/commands/commands/date.py deleted file mode 100644 index 39fc28ef..00000000 --- a/src/fenrir/commands/commands/date.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -import datetime - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('presents the date') - - def run(self): - dateFormat = self.env['runtime']['settingsManager'].getSetting('general', 'dateFormat') - - # get the time formatted - dateString = datetime.datetime.strftime(datetime.datetime.now(), dateFormat) - - # present the time via speak and braile, there is no soundicon, interrupt the current speech - self.env['runtime']['outputManager'].presentText(dateString , soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/dec_alsa_volume.py b/src/fenrir/commands/commands/dec_alsa_volume.py deleted file mode 100644 index cd2aee07..00000000 --- a/src/fenrir/commands/commands/dec_alsa_volume.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -initialized = False -try: - import alsaaudio - initialized = True -except: - pass - -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 _("Decrease system volume") - - def run(self): - if not initialized: - self.env['runtime']['outputManager'].presentText(_('alsaaudio is not installed'), interrupt=True) - return - mixer = alsaaudio.Mixer() - value = mixer.getvolume()[0] - value = value - 5 - if value < 5: - value = 5 - mixer.setvolume(value) - self.env['runtime']['outputManager'].presentText(_("{0} percent system volume").format(value), interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/dec_sound_volume.py b/src/fenrir/commands/commands/dec_sound_volume.py deleted file mode 100644 index c97414ce..00000000 --- a/src/fenrir/commands/commands/dec_sound_volume.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -import math - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('decrease sound volume') - - def run(self): - - value = self.env['runtime']['settingsManager'].getSettingAsFloat('sound', 'volume') - - value = round((math.ceil(10 * value) / 10) - 0.1, 2) - if value < 0.1: - value = 0.1 - self.env['runtime']['settingsManager'].setSetting('sound', 'volume', str(value)) - - self.env['runtime']['outputManager'].presentText(_("{0} percent sound volume").format(int(value * 100)), soundIcon='SoundOff', interrupt=True) - - def setCallback(self, callback): - pass - diff --git a/src/fenrir/commands/commands/dec_speech_pitch.py b/src/fenrir/commands/commands/dec_speech_pitch.py deleted file mode 100644 index 09e53b7c..00000000 --- a/src/fenrir/commands/commands/dec_speech_pitch.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -import math - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('decreases the pitch of the speech') - - def run(self): - value = self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'pitch') - value = round((math.ceil(10 * value) / 10) - 0.1, 2) - if value < 0.0: - value = 0.0 - self.env['runtime']['settingsManager'].setSetting('speech', 'pitch', str(value)) - self.env['runtime']['outputManager'].presentText(_('{0} percent speech pitch').format(int(value * 100)), soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/dec_speech_rate.py b/src/fenrir/commands/commands/dec_speech_rate.py deleted file mode 100644 index a0248662..00000000 --- a/src/fenrir/commands/commands/dec_speech_rate.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -import math - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('decreases the rate of the speech') - - def run(self): - value = self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'rate') - value = round((math.ceil(10 * value) / 10) - 0.1, 2) - if value < 0.0: - value = 0.0 - self.env['runtime']['settingsManager'].setSetting('speech', 'rate', str(value)) - - self.env['runtime']['outputManager'].presentText(_("{0} percent speech rate").format(int(value * 100)), soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/dec_speech_volume.py b/src/fenrir/commands/commands/dec_speech_volume.py deleted file mode 100644 index 946803cb..00000000 --- a/src/fenrir/commands/commands/dec_speech_volume.py +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -import math - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('decreases the volume of the speech') - - def run(self): - value = self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'volume') - value = round((math.ceil(10 * value) / 10) - 0.1, 2) - if value < 0.1: - value = 0.1 - self.env['runtime']['settingsManager'].setSetting('speech', 'volume', str(value)) - - self.env['runtime']['outputManager'].presentText(_("{0} percent speech volume").format(int(value * 100)), soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass - diff --git a/src/fenrir/commands/commands/exit_review.py b/src/fenrir/commands/commands/exit_review.py deleted file mode 100644 index 9c0369c4..00000000 --- a/src/fenrir/commands/commands/exit_review.py +++ /dev/null @@ -1,28 +0,0 @@ -#!/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 _('exits review mode') - - def run(self): - if not self.env['runtime']['cursorManager'].isReviewMode(): - self.env['runtime']['outputManager'].presentText(_("Not in review mode"), interrupt=True) - return - - self.env['runtime']['cursorManager'].clearReviewCursor() - self.env['runtime']['outputManager'].presentText(_("leave review mode"), interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/export_clipboard_to_file.py b/src/fenrir/commands/commands/export_clipboard_to_file.py deleted file mode 100644 index 0e1078ac..00000000 --- a/src/fenrir/commands/commands/export_clipboard_to_file.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -import os - -class command(): - def __init__(self): - pass - def initialize(self, environment, scriptPath=''): - self.env = environment - - def shutdown(self): - pass - def getDescription(self): - return _('export the current fenrir clipboard to a file') - def run(self): - clipboardFilePath = self.env['runtime']['settingsManager'].getSetting('general', 'clipboardExportPath') - clipboardFilePath = clipboardFilePath.replace('$user',self.env['general']['currUser']) - clipboardFilePath = clipboardFilePath.replace('$USER',self.env['general']['currUser']) - clipboardFilePath = clipboardFilePath.replace('$User',self.env['general']['currUser']) - clipboardFile = open(clipboardFilePath,'w') - try: - if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'): - self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True) - return - clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') - clipboardFile.write(clipboard) - clipboardFile.close() - os.chmod(clipboardFilePath, 0o666) - self.env['runtime']['outputManager'].presentText(_('clipboard exported to file'), interrupt=True) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('export_clipboard_to_file:run: Filepath:'+ clipboardFile +' trace:' + str(e),debug.debugLevel.ERROR) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/export_clipboard_to_x.py b/src/fenrir/commands/commands/export_clipboard_to_x.py deleted file mode 100644 index 25175c1f..00000000 --- a/src/fenrir/commands/commands/export_clipboard_to_x.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -import subprocess, os -from subprocess import Popen, PIPE -import _thread - -class command(): - def __init__(self): - pass - def initialize(self, environment, scriptPath=''): - self.env = environment - self.scriptPath = scriptPath - def shutdown(self): - pass - def getDescription(self): - return _('export the current fenrir clipboard to X clipboard') - def run(self): - _thread.start_new_thread(self._threadRun , ()) - - def _threadRun(self): - try: - if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'): - self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True) - return - clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') - for display in range(10): - p = Popen('su ' + self.env['general']['currUser'] + ' -c "echo -n \\\"' + clipboard.replace('"','\\\\\\"') +'\\\" | xclip -d :' + str(display) + ' -selection c"' , stdout=PIPE, stderr=PIPE, shell=True) - stdout, stderr = p.communicate() - self.env['runtime']['outputManager'].interruptOutput() - #screenEncoding = self.env['runtime']['settingsManager'].getSetting('screen', 'encoding') - stderr = stderr.decode('utf-8') - stdout = stdout.decode('utf-8') - if (stderr == ''): - break - #stderr = stderr.decode(screenEncoding, "replace").encode('utf-8').decode('utf-8') - #stdout = stdout.decode(screenEncoding, "replace").encode('utf-8').decode('utf-8') - if stderr != '': - self.env['runtime']['outputManager'].presentText(stderr , soundIcon='', interrupt=False) - else: - self.env['runtime']['outputManager'].presentText('exported to the X session.', interrupt=True) - except Exception as e: - self.env['runtime']['outputManager'].presentText(e , soundIcon='', interrupt=False) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/first_clipboard.py b/src/fenrir/commands/commands/first_clipboard.py deleted file mode 100644 index a4d98c87..00000000 --- a/src/fenrir/commands/commands/first_clipboard.py +++ /dev/null @@ -1,28 +0,0 @@ -#!/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 _('selects the first clipboard') - - def run(self): - if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'): - self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True) - return - self.env['runtime']['memoryManager'].setFirstIndex('clipboardHistory') - clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') - self.env['runtime']['outputManager'].presentText(clipboard, interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/forward_keypress.py b/src/fenrir/commands/commands/forward_keypress.py deleted file mode 100644 index c3e718fe..00000000 --- a/src/fenrir/commands/commands/forward_keypress.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/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 _('sends the following keypress to the terminal') - - def run(self): - self.env['input']['keyForeward'] = 3 - self.env['runtime']['outputManager'].presentText(_('Forward next keypress'), interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/import_clipboard_from_file.py b/src/fenrir/commands/commands/import_clipboard_from_file.py deleted file mode 100644 index 67b4f398..00000000 --- a/src/fenrir/commands/commands/import_clipboard_from_file.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import mark_utils -import os - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('imports text from clipboard file to the clipboard') - - def run(self): - clipboardFilePath = self.env['runtime']['settingsManager'].getSetting('general', 'clipboardExportPath') - clipboardFilePath = clipboardFilePath.replace('$user',self.env['general']['currUser']) - clipboardFilePath = clipboardFilePath.replace('$USER',self.env['general']['currUser']) - clipboardFilePath = clipboardFilePath.replace('$User',self.env['general']['currUser']) - if not os.path.exists(clipboardFilePath): - self.env['runtime']['outputManager'].presentText(_('File does not exist'), soundIcon='', interrupt=True) - return - clipboardFile = open(clipboardFilePath,'r') - imported = clipboardFile.read() - clipboardFile.close() - self.env['runtime']['memoryManager'].addValueToFirstIndex('clipboardHistory', imported) - - self.env['runtime']['outputManager'].presentText('Import to Clipboard', soundIcon='CopyToClipboard', interrupt=True) - self.env['runtime']['outputManager'].presentText(imported, soundIcon='', interrupt=False) - - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/inc_alsa_volume.py b/src/fenrir/commands/commands/inc_alsa_volume.py deleted file mode 100644 index 51f38c79..00000000 --- a/src/fenrir/commands/commands/inc_alsa_volume.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -initialized = False -try: - import alsaaudio - initialized = True -except: - pass - -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 _("Increase system volume") - - def run(self): - if not initialized: - self.env['runtime']['outputManager'].presentText(_('alsaaudio is not installed'), interrupt=True) - return - mixer = alsaaudio.Mixer() - value = mixer.getvolume()[0] - value = value + 5 - if value > 100: - value = 100 - mixer.setvolume(value) - self.env['runtime']['outputManager'].presentText(_("{0} percent system volume").format(value), interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/inc_sound_volume.py b/src/fenrir/commands/commands/inc_sound_volume.py deleted file mode 100644 index 78eee847..00000000 --- a/src/fenrir/commands/commands/inc_sound_volume.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -import math - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('adjusts the volume for in coming sounds') - - def run(self): - - value = self.env['runtime']['settingsManager'].getSettingAsFloat('sound', 'volume') - - value = round((math.ceil(10 * value) / 10) + 0.1, 2) - if value > 1.0: - value = 1.0 - self.env['runtime']['settingsManager'].setSetting('sound', 'volume', str(value)) - - self.env['runtime']['outputManager'].presentText(_("{0} percent sound volume").format(int(value * 100)), soundIcon='SoundOn', interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/inc_speech_pitch.py b/src/fenrir/commands/commands/inc_speech_pitch.py deleted file mode 100644 index cb267b66..00000000 --- a/src/fenrir/commands/commands/inc_speech_pitch.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -import math - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('increases the pitch of the speech') - - def run(self): - value = self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'pitch') - value = round((math.ceil(10 * value) / 10) + 0.1, 2) - if value > 1.0: - value = 1.0 - self.env['runtime']['settingsManager'].setSetting('speech', 'pitch', str(value)) - - self.env['runtime']['outputManager'].presentText(_("{0} percent speech pitch").format(int(value * 100)), soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/inc_speech_rate.py b/src/fenrir/commands/commands/inc_speech_rate.py deleted file mode 100644 index 4db1763d..00000000 --- a/src/fenrir/commands/commands/inc_speech_rate.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -import math - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('increase the speech rate') - - def run(self): - value = self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'rate') - value = round((math.ceil(10 * value) / 10) + 0.1, 2) - if value > 1.0: - value = 1.0 - self.env['runtime']['settingsManager'].setSetting('speech', 'rate', str(value)) - - self.env['runtime']['outputManager'].presentText(_("{0} percent speech rate").format(int(value * 100)), soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/inc_speech_volume.py b/src/fenrir/commands/commands/inc_speech_volume.py deleted file mode 100644 index 1c6716e6..00000000 --- a/src/fenrir/commands/commands/inc_speech_volume.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -import math - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('increase the speech volume') - - def run(self): - value = self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'volume') - value = round((math.ceil(10 * value) / 10) + 0.1, 2) - if value > 1.0: - value = 1.0 - self.env['runtime']['settingsManager'].setSetting('speech', 'volume', str(value)) - - self.env['runtime']['outputManager'].presentText(_("{0} percent speech volume").format(int(value * 100)), soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/indent_curr_line.py b/src/fenrir/commands/commands/indent_curr_line.py deleted file mode 100644 index 09907691..00000000 --- a/src/fenrir/commands/commands/indent_curr_line.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import line_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('shows the indention level for the current line') - - def run(self): - # Prefer review cursor over text cursor - - if self.env['screen']['newCursorReview']: - cursorPos = self.env['screen']['newCursorReview'].copy() - else: - cursorPos = self.env['screen']['newCursor'].copy() - x, y, currLine = \ - line_utils.getCurrentLine(cursorPos['x'], cursorPos['y'], self.env['screen']['newContentText']) - - if currLine.isspace(): - self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True) - else: - self.env['runtime']['outputManager'].presentText(_("indent {0}").format(len(currLine) - len(currLine.lstrip())), interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/last_clipboard.py b/src/fenrir/commands/commands/last_clipboard.py deleted file mode 100644 index 2cf2f0bd..00000000 --- a/src/fenrir/commands/commands/last_clipboard.py +++ /dev/null @@ -1,28 +0,0 @@ -#!/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 _('selects the last clipboard') - - def run(self): - if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'): - self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True) - return - self.env['runtime']['memoryManager'].setLastIndex('clipboardHistory') - clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') - self.env['runtime']['outputManager'].presentText(clipboard, interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/last_incoming.py b/src/fenrir/commands/commands/last_incoming.py deleted file mode 100644 index effb7f37..00000000 --- a/src/fenrir/commands/commands/last_incoming.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/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 _('displays the last received text') - - def run(self): - 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 deleted file mode 100644 index 9341382a..00000000 --- a/src/fenrir/commands/commands/marked_text.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import mark_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('speaks the currently selected text that will be copied to the clipboard') - - def run(self): - if not (self.env['commandBuffer']['Marks']['1'] and \ - self.env['commandBuffer']['Marks']['2']): - self.env['runtime']['outputManager'].presentText(_("please set begin and endmark"), interrupt=True) - return - - # use the last first and the last setted mark as range - startMark = self.env['commandBuffer']['Marks']['1'].copy() - endMark = self.env['commandBuffer']['Marks']['2'].copy() - - marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screen']['newContentText']) - - if marked.isspace(): - self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True) - else: - self.env['runtime']['outputManager'].presentText(marked, interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/next_clipboard.py b/src/fenrir/commands/commands/next_clipboard.py deleted file mode 100644 index 01d5607a..00000000 --- a/src/fenrir/commands/commands/next_clipboard.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/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 _('selects the next clipboard') - - def run(self): - if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'): - self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True) - return - self.env['runtime']['memoryManager'].getNextIndex('clipboardHistory') - isFirst = self.env['runtime']['memoryManager'].isFirstIndex('clipboardHistory') - isLast = self.env['runtime']['memoryManager'].isLastIndex('clipboardHistory') - clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') - if isFirst: - self.env['runtime']['outputManager'].presentText(_('First clipboard '), interrupt=True) - if isLast: - self.env['runtime']['outputManager'].presentText(_('Last clipboard '), interrupt=True) - - speechInterrupt = not(isLast or isFirst) - self.env['runtime']['outputManager'].presentText(clipboard, interrupt = speechInterrupt) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/paste_clipboard.py b/src/fenrir/commands/commands/paste_clipboard.py deleted file mode 100644 index 1223a54b..00000000 --- a/src/fenrir/commands/commands/paste_clipboard.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -import time - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - self.env['runtime']['memoryManager'].addIndexList('clipboardHistory', self.env['runtime']['settingsManager'].getSettingAsInt('general', 'numberOfClipboards')) - def shutdown(self): - pass - def getDescription(self): - return _('pastes the text from the currently selected clipboard') - - def run(self): - if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'): - self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True) - return - self.env['runtime']['outputManager'].presentText('paste clipboard', soundIcon='PasteClipboardOnScreen', interrupt=True) - clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') - self.env['runtime']['screenManager'].injectTextToScreen(clipboard) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/present_first_line.py b/src/fenrir/commands/commands/present_first_line.py deleted file mode 100644 index 9d54e879..00000000 --- a/src/fenrir/commands/commands/present_first_line.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import line_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('present first line') - - def run(self): - x, y, firstLine = \ - line_utils.getCurrentLine(0, 0, self.env['screen']['newContentText']) - - if firstLine.isspace(): - self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True) - else: - self.env['runtime']['outputManager'].presentText(firstLine, interrupt=True) - def setCallback(self, callback): - pass - diff --git a/src/fenrir/commands/commands/present_last_line.py b/src/fenrir/commands/commands/present_last_line.py deleted file mode 100644 index 25316f4c..00000000 --- a/src/fenrir/commands/commands/present_last_line.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import line_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('current line') - - def run(self): - x, y, lastLine = \ - 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) - else: - self.env['runtime']['outputManager'].presentText(lastLine, interrupt=True) - def setCallback(self, callback): - pass - diff --git a/src/fenrir/commands/commands/prev_clipboard.py b/src/fenrir/commands/commands/prev_clipboard.py deleted file mode 100644 index 9fa6c575..00000000 --- a/src/fenrir/commands/commands/prev_clipboard.py +++ /dev/null @@ -1,35 +0,0 @@ -#!/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 _('selects the previous clipboard') - - def run(self): - if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'): - self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True) - return - self.env['runtime']['memoryManager'].setPrefIndex('clipboardHistory') - isFirst = self.env['runtime']['memoryManager'].isFirstIndex('clipboardHistory') - isLast = self.env['runtime']['memoryManager'].isLastIndex('clipboardHistory') - clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') - if isFirst: - self.env['runtime']['outputManager'].presentText(_('First clipboard '), interrupt=True) - if isLast: - self.env['runtime']['outputManager'].presentText(_('Last clipboard '), interrupt=True) - speechInterrupt = not(isLast or isFirst) - self.env['runtime']['outputManager'].presentText(clipboard, interrupt = speechInterrupt) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/quit_fenrir.py b/src/fenrir/commands/commands/quit_fenrir.py deleted file mode 100644 index ea633658..00000000 --- a/src/fenrir/commands/commands/quit_fenrir.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/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 _('exits Fenrir') - - def run(self): - self.env['runtime']['eventManager'].stopMainEventLoop() - - def setCallback(self, callback): - pass - diff --git a/src/fenrir/commands/commands/remove_marks.py b/src/fenrir/commands/commands/remove_marks.py deleted file mode 100644 index 0c2547e4..00000000 --- a/src/fenrir/commands/commands/remove_marks.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/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 _('removes marks from selected text') - - def run(self): - self.env['runtime']['cursorManager'].clearMarks() - self.env['runtime']['outputManager'].presentText(_('Remove marks'), interrupt=True) - - 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 deleted file mode 100644 index f212ee27..00000000 --- a/src/fenrir/commands/commands/remove_word_from_spell_check.py +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import word_utils -import string -initialized = False -try: - import enchant - initialized = True -except: - pass - -class command(): - def __init__(self): - self.language = '' - self.spellChecker = None - def initialize(self, environment): - self.env = environment - self.updateSpellLanguage() - def shutdown(self): - pass - def getDescription(self): - return _('removes the current word from the exceptions dictionary') - def updateSpellLanguage(self): - self.spellChecker = enchant.Dict(self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage')) - self.language = self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage') - - def run(self): - if not initialized: - self.env['runtime']['outputManager'].presentText(_('pyenchant is not installed'), interrupt=True) - return - if self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage') != self.language: - try: - self.updateSpellLanguage() - except: - return - - cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() - - # get the word - 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(): - if self.spellChecker.is_removed(currWord): - self.env['runtime']['outputManager'].presentText(_('{0} is already removed from dict').format(currWord,), soundIcon='Cancel', interrupt=True) - else: - self.spellChecker.remove(currWord) - self.env['runtime']['outputManager'].presentText(_('{0} removed').format(currWord,), soundIcon='Accept', interrupt=True) - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/review_bottom.py b/src/fenrir/commands/commands/review_bottom.py deleted file mode 100644 index 07a431f4..00000000 --- a/src/fenrir/commands/commands/review_bottom.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/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 _('move review to bottom of screen') - - def run(self): - 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): - pass diff --git a/src/fenrir/commands/commands/review_curr_char.py b/src/fenrir/commands/commands/review_curr_char.py deleted file mode 100644 index 6784ba5f..00000000 --- a/src/fenrir/commands/commands/review_curr_char.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import char_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('presents the current character.') - - def run(self): - self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() - - 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) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/review_curr_char_phonetic.py b/src/fenrir/commands/commands/review_curr_char_phonetic.py deleted file mode 100644 index 061eec43..00000000 --- a/src/fenrir/commands/commands/review_curr_char_phonetic.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import char_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('set review and phonetically presents the current character') - - def run(self): - self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() - - 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) - else: - currChar = char_utils.getPhonetic(currChar) - self.env['runtime']['outputManager'].presentText(currChar ,interrupt=True, announceCapital=True, flush=False) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/review_curr_line.py b/src/fenrir/commands/commands/review_curr_line.py deleted file mode 100644 index af1de983..00000000 --- a/src/fenrir/commands/commands/review_curr_line.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import line_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('current line') - - def run(self): - self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() - - 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) - else: - self.env['runtime']['outputManager'].presentText(currLine, interrupt=True, flush=False) - def setCallback(self, callback): - pass - diff --git a/src/fenrir/commands/commands/review_curr_word.py b/src/fenrir/commands/commands/review_curr_word.py deleted file mode 100644 index 4436cd03..00000000 --- a/src/fenrir/commands/commands/review_curr_word.py +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import word_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('current word.') - - def run(self): - self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() - - 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) - else: - self.env['runtime']['outputManager'].presentText(currWord, interrupt=True, flush=False) - if endOfScreen: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): - self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen') - if lineBreak: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'): - self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine') - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/review_curr_word_phonetic.py b/src/fenrir/commands/commands/review_curr_word_phonetic.py deleted file mode 100644 index c58568cb..00000000 --- a/src/fenrir/commands/commands/review_curr_word_phonetic.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import word_utils -from utils import char_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('phonetically spells the current word and set review to it') - - def run(self): - self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() - 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) - else: - firstSequence = True - for c in currWord: - currChar = char_utils.getPhonetic(c) - self.env['runtime']['outputManager'].presentText(currChar, interrupt=firstSequence, announceCapital=True, flush=False) - firstSequence = False - if endOfScreen: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): - self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen') - if lineBreak: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'): - self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine') - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/review_down.py b/src/fenrir/commands/commands/review_down.py deleted file mode 100644 index 2428083e..00000000 --- a/src/fenrir/commands/commands/review_down.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import char_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('set review cursor to char below the current char and present it.') - - def run(self): - cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() - 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'): - self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen') - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/review_line_begin.py b/src/fenrir/commands/commands/review_line_begin.py deleted file mode 100644 index c788a5ca..00000000 --- a/src/fenrir/commands/commands/review_line_begin.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import char_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('set review cursor to begin of current line and display the content') - - def run(self): - cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() - self.env['runtime']['cursorManager'].setReviewCursorPosition(0 ,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']) - - if currChar.isspace(): - self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False) - else: - self.env['runtime']['outputManager'].presentText(currChar ,interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) - self.env['runtime']['outputManager'].presentText(_("beginning of line"), interrupt=False) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/review_line_end.py b/src/fenrir/commands/commands/review_line_end.py deleted file mode 100644 index 1af5b558..00000000 --- a/src/fenrir/commands/commands/review_line_end.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import char_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('set review cursor to end of current line and display the content') - - def run(self): - cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() - 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) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/review_line_first_char.py b/src/fenrir/commands/commands/review_line_first_char.py deleted file mode 100644 index 82f687a8..00000000 --- a/src/fenrir/commands/commands/review_line_first_char.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import line_utils -from utils import char_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('set review cursor to end of current line and display the content') - - def run(self): - cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() - x, y, currLine = \ - 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['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) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/review_line_last_char.py b/src/fenrir/commands/commands/review_line_last_char.py deleted file mode 100644 index f30265ee..00000000 --- a/src/fenrir/commands/commands/review_line_last_char.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import char_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('set review cursor to end of current line and display the content') - - def run(self): - cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() - 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) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/review_next_char.py b/src/fenrir/commands/commands/review_next_char.py deleted file mode 100644 index e3c0a2ee..00000000 --- a/src/fenrir/commands/commands/review_next_char.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import char_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('moves review to the next character and presents it') - - def run(self): - self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() - 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: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): - self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen') - if lineBreak: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'): - self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine') - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/review_next_char_phonetic.py b/src/fenrir/commands/commands/review_next_char_phonetic.py deleted file mode 100644 index f4ae4aa3..00000000 --- a/src/fenrir/commands/commands/review_next_char_phonetic.py +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import char_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('phonetically presents the next character and set review to it') - - def run(self): - self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() - - 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) - if endOfScreen: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): - self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen') - if lineBreak: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'): - self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine') - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/review_next_line.py b/src/fenrir/commands/commands/review_next_line.py deleted file mode 100644 index a41550c1..00000000 --- a/src/fenrir/commands/commands/review_next_line.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import line_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('moves review to the next line and presents it') - - def run(self): - 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['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) - else: - self.env['runtime']['outputManager'].presentText(nextLine, interrupt=True, flush=False) - if endOfScreen: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): - self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen') - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/review_next_word.py b/src/fenrir/commands/commands/review_next_word.py deleted file mode 100644 index c05ca59a..00000000 --- a/src/fenrir/commands/commands/review_next_word.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import word_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('moves review to the next word and presents it') - - def run(self): - 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['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) - else: - self.env['runtime']['outputManager'].presentText(nextWord, interrupt=True, flush=False) - if endOfScreen: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): - self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen') - if lineBreak: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'): - self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine') - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/review_next_word_phonetic.py b/src/fenrir/commands/commands/review_next_word_phonetic.py deleted file mode 100644 index f0e9f90e..00000000 --- a/src/fenrir/commands/commands/review_next_word_phonetic.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import word_utils -from utils import char_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('phonetically spells the current word and set review to it') - - def run(self): - self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() - 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) - else: - firstSequence = True - for c in nextWord: - currChar = char_utils.getPhonetic(c) - self.env['runtime']['outputManager'].presentText(currChar, interrupt=firstSequence, announceCapital=True, flush=False) - firstSequence = False - if endOfScreen: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): - self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen') - if lineBreak: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'): - self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine') - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/review_prev_char.py b/src/fenrir/commands/commands/review_prev_char.py deleted file mode 100644 index 444eb32a..00000000 --- a/src/fenrir/commands/commands/review_prev_char.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import char_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('moves review to the previous character and presents it') - - def run(self): - 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['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: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): - self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen') - if lineBreak: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'): - self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine') - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/review_prev_char_phonetic.py b/src/fenrir/commands/commands/review_prev_char_phonetic.py deleted file mode 100644 index e66e0883..00000000 --- a/src/fenrir/commands/commands/review_prev_char_phonetic.py +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import char_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('phonetically presents the previous character and set review to it') - - def run(self): - self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() - - 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) - if endOfScreen: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): - self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen') - if lineBreak: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'): - self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine') - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/review_prev_line.py b/src/fenrir/commands/commands/review_prev_line.py deleted file mode 100644 index c3601955..00000000 --- a/src/fenrir/commands/commands/review_prev_line.py +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import line_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('moves review to the previous line and presents it') - - def run(self): - self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() - - 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) - else: - self.env['runtime']['outputManager'].presentText(prevLine, interrupt=True, flush=False) - if endOfScreen: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): - self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen') - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/review_prev_word.py b/src/fenrir/commands/commands/review_prev_word.py deleted file mode 100644 index b36f3038..00000000 --- a/src/fenrir/commands/commands/review_prev_word.py +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import word_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('moves review focus to the previous word and presents it') - - def run(self): - self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() - - 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) - else: - self.env['runtime']['outputManager'].presentText(prevWord, interrupt=True, flush=False) - if endOfScreen: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): - self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=False, soundIcon='EndOfScreen') - if lineBreak: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'): - self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine') - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/review_prev_word_phonetic.py b/src/fenrir/commands/commands/review_prev_word_phonetic.py deleted file mode 100644 index eeddfd3e..00000000 --- a/src/fenrir/commands/commands/review_prev_word_phonetic.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import word_utils -from utils import char_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('phonetically spells the current word and set review to it') - - def run(self): - self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() - 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) - else: - firstSequence = True - for c in prevWord: - currChar = char_utils.getPhonetic(c) - self.env['runtime']['outputManager'].presentText(currChar, interrupt=firstSequence, announceCapital=True, flush=False) - firstSequence = False - if endOfScreen: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): - self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen') - if lineBreak: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'): - self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine') - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/review_top.py b/src/fenrir/commands/commands/review_top.py deleted file mode 100644 index aaaed438..00000000 --- a/src/fenrir/commands/commands/review_top.py +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import char_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('move review to top of screen') - - def run(self): - self.env['screen']['newCursorReview'] = {'x':0,'y':0} - self.env['runtime']['outputManager'].presentText(_("Top"), interrupt=True, flush=False) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/review_up.py b/src/fenrir/commands/commands/review_up.py deleted file mode 100644 index 1867e878..00000000 --- a/src/fenrir/commands/commands/review_up.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import char_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('set review cursor to the char in the line below and present it') - - def run(self): - cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() - 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'): - self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen') - if lineBreak: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'): - self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine') - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/set_bookmark_1.py b/src/fenrir/commands/commands/set_bookmark_1.py deleted file mode 100644 index 6a59ec79..00000000 --- a/src/fenrir/commands/commands/set_bookmark_1.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -class command(): - def __init__(self): - self.ID = '1' - def initialize(self, environment): - self.env = environment - self.env['commandBuffer']['bookMarks'][self.ID] = {} - def shutdown(self): - pass - def getDescription(self): - return _('set Bookmark {0}').format(self.ID,) - - def run(self): - if not self.env['commandBuffer']['Marks']['1']: - self.env['runtime']['outputManager'].presentText(_("No Mark found"), interrupt=True) - return - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - self.env['commandBuffer']['bookMarks'][self.ID][currApp] = {} - - self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'] = self.env['commandBuffer']['Marks']['1'].copy() - if self.env['commandBuffer']['Marks']['2']: - self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'] = self.env['commandBuffer']['Marks']['2'].copy() - else: - self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'] = None - self.env['runtime']['outputManager'].presentText(_('Bookmark {0} set for application {1}').format(self.ID, currApp), interrupt=True) - self.env['commandBuffer']['Marks']['1'] = None - self.env['commandBuffer']['Marks']['2'] = None - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/set_bookmark_10.py b/src/fenrir/commands/commands/set_bookmark_10.py deleted file mode 100644 index 4a565c2f..00000000 --- a/src/fenrir/commands/commands/set_bookmark_10.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -class command(): - def __init__(self): - self.ID = '10' - def initialize(self, environment): - self.env = environment - self.env['commandBuffer']['bookMarks'][self.ID] = {} - def shutdown(self): - pass - def getDescription(self): - return _('set Bookmark {0}').format(self.ID,) - - def run(self): - if not self.env['commandBuffer']['Marks']['1']: - self.env['runtime']['outputManager'].presentText(_("No Mark found"), interrupt=True) - return - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - self.env['commandBuffer']['bookMarks'][self.ID][currApp] = {} - - self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'] = self.env['commandBuffer']['Marks']['1'].copy() - if self.env['commandBuffer']['Marks']['2']: - self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'] = self.env['commandBuffer']['Marks']['2'].copy() - else: - self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'] = None - self.env['runtime']['outputManager'].presentText(_('Bookmark {0} set for application {1}').format(self.ID, currApp), interrupt=True) - self.env['commandBuffer']['Marks']['1'] = None - self.env['commandBuffer']['Marks']['2'] = None - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/set_bookmark_2.py b/src/fenrir/commands/commands/set_bookmark_2.py deleted file mode 100644 index 26d02637..00000000 --- a/src/fenrir/commands/commands/set_bookmark_2.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -class command(): - def __init__(self): - self.ID = '2' - def initialize(self, environment): - self.env = environment - self.env['commandBuffer']['bookMarks'][self.ID] = {} - def shutdown(self): - pass - def getDescription(self): - return _('set Bookmark {0}').format(self.ID,) - - def run(self): - if not self.env['commandBuffer']['Marks']['1']: - self.env['runtime']['outputManager'].presentText(_("No Mark found"), interrupt=True) - return - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - self.env['commandBuffer']['bookMarks'][self.ID][currApp] = {} - - self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'] = self.env['commandBuffer']['Marks']['1'].copy() - if self.env['commandBuffer']['Marks']['2']: - self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'] = self.env['commandBuffer']['Marks']['2'].copy() - else: - self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'] = None - self.env['runtime']['outputManager'].presentText(_('Bookmark {0} set for application {1}').format(self.ID, currApp), interrupt=True) - self.env['commandBuffer']['Marks']['1'] = None - self.env['commandBuffer']['Marks']['2'] = None - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/set_bookmark_3.py b/src/fenrir/commands/commands/set_bookmark_3.py deleted file mode 100644 index 8645ee3c..00000000 --- a/src/fenrir/commands/commands/set_bookmark_3.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -class command(): - def __init__(self): - self.ID = '3' - def initialize(self, environment): - self.env = environment - self.env['commandBuffer']['bookMarks'][self.ID] = {} - def shutdown(self): - pass - def getDescription(self): - return _('set Bookmark {0}').format(self.ID,) - - def run(self): - if not self.env['commandBuffer']['Marks']['1']: - self.env['runtime']['outputManager'].presentText(_("No Mark found"), interrupt=True) - return - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - self.env['commandBuffer']['bookMarks'][self.ID][currApp] = {} - - self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'] = self.env['commandBuffer']['Marks']['1'].copy() - if self.env['commandBuffer']['Marks']['2']: - self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'] = self.env['commandBuffer']['Marks']['2'].copy() - else: - self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'] = None - self.env['runtime']['outputManager'].presentText(_('Bookmark {0} set for application {1}').format(self.ID, currApp), interrupt=True) - self.env['commandBuffer']['Marks']['1'] = None - self.env['commandBuffer']['Marks']['2'] = None - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/set_bookmark_4.py b/src/fenrir/commands/commands/set_bookmark_4.py deleted file mode 100644 index b098a50d..00000000 --- a/src/fenrir/commands/commands/set_bookmark_4.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -class command(): - def __init__(self): - self.ID = '4' - def initialize(self, environment): - self.env = environment - self.env['commandBuffer']['bookMarks'][self.ID] = {} - def shutdown(self): - pass - def getDescription(self): - return _('set Bookmark {0}').format(self.ID,) - - def run(self): - if not self.env['commandBuffer']['Marks']['1']: - self.env['runtime']['outputManager'].presentText(_("No Mark found"), interrupt=True) - return - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - self.env['commandBuffer']['bookMarks'][self.ID][currApp] = {} - - self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'] = self.env['commandBuffer']['Marks']['1'].copy() - if self.env['commandBuffer']['Marks']['2']: - self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'] = self.env['commandBuffer']['Marks']['2'].copy() - else: - self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'] = None - self.env['runtime']['outputManager'].presentText(_('Bookmark {0} set for application {1}').format(self.ID, currApp), interrupt=True) - self.env['commandBuffer']['Marks']['1'] = None - self.env['commandBuffer']['Marks']['2'] = None - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/set_bookmark_5.py b/src/fenrir/commands/commands/set_bookmark_5.py deleted file mode 100644 index 6c082f91..00000000 --- a/src/fenrir/commands/commands/set_bookmark_5.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -class command(): - def __init__(self): - self.ID = '5' - def initialize(self, environment): - self.env = environment - self.env['commandBuffer']['bookMarks'][self.ID] = {} - def shutdown(self): - pass - def getDescription(self): - return _('set Bookmark {0}').format(self.ID,) - - def run(self): - if not self.env['commandBuffer']['Marks']['1']: - self.env['runtime']['outputManager'].presentText(_("No Mark found"), interrupt=True) - return - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - self.env['commandBuffer']['bookMarks'][self.ID][currApp] = {} - - self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'] = self.env['commandBuffer']['Marks']['1'].copy() - if self.env['commandBuffer']['Marks']['2']: - self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'] = self.env['commandBuffer']['Marks']['2'].copy() - else: - self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'] = None - self.env['runtime']['outputManager'].presentText(_('Bookmark {0} set for application {1}').format(self.ID, currApp), interrupt=True) - self.env['commandBuffer']['Marks']['1'] = None - self.env['commandBuffer']['Marks']['2'] = None - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/set_bookmark_6.py b/src/fenrir/commands/commands/set_bookmark_6.py deleted file mode 100644 index a309d089..00000000 --- a/src/fenrir/commands/commands/set_bookmark_6.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -class command(): - def __init__(self): - self.ID = '6' - def initialize(self, environment): - self.env = environment - self.env['commandBuffer']['bookMarks'][self.ID] = {} - def shutdown(self): - pass - def getDescription(self): - return _('set Bookmark {0}').format(self.ID,) - - def run(self): - if not self.env['commandBuffer']['Marks']['1']: - self.env['runtime']['outputManager'].presentText(_("No Mark found"), interrupt=True) - return - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - self.env['commandBuffer']['bookMarks'][self.ID][currApp] = {} - - self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'] = self.env['commandBuffer']['Marks']['1'].copy() - if self.env['commandBuffer']['Marks']['2']: - self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'] = self.env['commandBuffer']['Marks']['2'].copy() - else: - self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'] = None - self.env['runtime']['outputManager'].presentText(_('Bookmark {0} set for application {1}').format(self.ID, currApp), interrupt=True) - self.env['commandBuffer']['Marks']['1'] = None - self.env['commandBuffer']['Marks']['2'] = None - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/set_bookmark_7.py b/src/fenrir/commands/commands/set_bookmark_7.py deleted file mode 100644 index 4803487f..00000000 --- a/src/fenrir/commands/commands/set_bookmark_7.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -class command(): - def __init__(self): - self.ID = '7' - def initialize(self, environment): - self.env = environment - self.env['commandBuffer']['bookMarks'][self.ID] = {} - def shutdown(self): - pass - def getDescription(self): - return _('set Bookmark {0}').format(self.ID,) - - def run(self): - if not self.env['commandBuffer']['Marks']['1']: - self.env['runtime']['outputManager'].presentText(_("No Mark found"), interrupt=True) - return - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - self.env['commandBuffer']['bookMarks'][self.ID][currApp] = {} - - self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'] = self.env['commandBuffer']['Marks']['1'].copy() - if self.env['commandBuffer']['Marks']['2']: - self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'] = self.env['commandBuffer']['Marks']['2'].copy() - else: - self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'] = None - self.env['runtime']['outputManager'].presentText(_('Bookmark {0} set for application {1}').format(self.ID, currApp), interrupt=True) - self.env['commandBuffer']['Marks']['1'] = None - self.env['commandBuffer']['Marks']['2'] = None - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/set_bookmark_8.py b/src/fenrir/commands/commands/set_bookmark_8.py deleted file mode 100644 index 362f61c9..00000000 --- a/src/fenrir/commands/commands/set_bookmark_8.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -class command(): - def __init__(self): - self.ID = '8' - def initialize(self, environment): - self.env = environment - self.env['commandBuffer']['bookMarks'][self.ID] = {} - def shutdown(self): - pass - def getDescription(self): - return _('set Bookmark {0}').format(self.ID,) - - def run(self): - if not self.env['commandBuffer']['Marks']['1']: - self.env['runtime']['outputManager'].presentText(_("No Mark found"), interrupt=True) - return - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - self.env['commandBuffer']['bookMarks'][self.ID][currApp] = {} - - self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'] = self.env['commandBuffer']['Marks']['1'].copy() - if self.env['commandBuffer']['Marks']['2']: - self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'] = self.env['commandBuffer']['Marks']['2'].copy() - else: - self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'] = None - self.env['runtime']['outputManager'].presentText(_('Bookmark {0} set for application {1}').format(self.ID, currApp), interrupt=True) - self.env['commandBuffer']['Marks']['1'] = None - self.env['commandBuffer']['Marks']['2'] = None - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/set_bookmark_9.py b/src/fenrir/commands/commands/set_bookmark_9.py deleted file mode 100644 index ef53c390..00000000 --- a/src/fenrir/commands/commands/set_bookmark_9.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -class command(): - def __init__(self): - self.ID = '9' - def initialize(self, environment): - self.env = environment - self.env['commandBuffer']['bookMarks'][self.ID] = {} - def shutdown(self): - pass - def getDescription(self): - return _('set Bookmark {0}').format(self.ID,) - - def run(self): - if not self.env['commandBuffer']['Marks']['1']: - self.env['runtime']['outputManager'].presentText(_("No Mark found"), interrupt=True) - return - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - self.env['commandBuffer']['bookMarks'][self.ID][currApp] = {} - - self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'] = self.env['commandBuffer']['Marks']['1'].copy() - if self.env['commandBuffer']['Marks']['2']: - self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'] = self.env['commandBuffer']['Marks']['2'].copy() - else: - self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'] = None - self.env['runtime']['outputManager'].presentText(_('Bookmark {0} set for application {1}').format(self.ID, currApp), interrupt=True) - self.env['commandBuffer']['Marks']['1'] = None - self.env['commandBuffer']['Marks']['2'] = None - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/set_mark.py b/src/fenrir/commands/commands/set_mark.py deleted file mode 100644 index 82e1f90c..00000000 --- a/src/fenrir/commands/commands/set_mark.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/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 _('places marks to select text to copy to the clipboard') - - def run(self): - if not self.env['runtime']['cursorManager'].isReviewMode(): - self.env['runtime']['outputManager'].presentText(_('no review cursor'), interrupt=True) - return - - currMark = self.env['runtime']['cursorManager'].setMark() - if currMark == 1: - self.env['runtime']['outputManager'].presentText(_('set mark'), soundIcon='PlaceStartMark', interrupt=True) - elif currMark == 2: - self.env['runtime']['outputManager'].presentText(_('set mark'),soundIcon='PlaceEndMark', interrupt=True) - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/set_window_application.py b/src/fenrir/commands/commands/set_window_application.py deleted file mode 100644 index 9413fcd5..00000000 --- a/src/fenrir/commands/commands/set_window_application.py +++ /dev/null @@ -1,28 +0,0 @@ -#!/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 _('set Window Mode, needs 2 marks ') - - def run(self): - if self.env['runtime']['cursorManager'].setWindowForApplication(): - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - self.env['runtime']['outputManager'].presentText(_('Window Mode on for application {0}').format(currApp), interrupt=True) - self.env['runtime']['cursorManager'].clearMarks() - else: - self.env['runtime']['outputManager'].presentText(_("Set window begin and end marks"), interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/shut_up.py b/src/fenrir/commands/commands/shut_up.py deleted file mode 100644 index aad7226b..00000000 --- a/src/fenrir/commands/commands/shut_up.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/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 _('interrupts the current presentation') - def run(self): - if len(self.env['input']['prevDeepestInput']) > len(self.env['input']['currInput']): - return - self.env['runtime']['outputManager'].interruptOutput() - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/spell_check.py b/src/fenrir/commands/commands/spell_check.py deleted file mode 100644 index c251ca02..00000000 --- a/src/fenrir/commands/commands/spell_check.py +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import word_utils -initialized = False -try: - import enchant - initialized = True -except: - pass - -class command(): - def __init__(self): - self.language = '' - self.spellChecker = None - def initialize(self, environment): - self.env = environment - self.updateSpellLanguage() - def shutdown(self): - pass - def getDescription(self): - return _('checks the spelling of the current word') - def updateSpellLanguage(self): - if not initialized: - self.env['runtime']['outputManager'].presentText(_('pyenchant is not installed'), interrupt=True) - return - self.spellChecker = enchant.Dict(self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage')) - self.language = self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage') - - def run(self): - if not initialized: - self.env['runtime']['outputManager'].presentText(_('pyenchant is not installed'), interrupt=True) - return - if self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage') != self.language: - try: - self.updateSpellLanguage() - except: - return - - cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() - - # get the word - 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(): - if not self.spellChecker.check(currWord): - self.env['runtime']['outputManager'].presentText(_('misspelled'),soundIcon='mispell', interrupt=True) - elif not ignore: - self.env['runtime']['outputManager'].presentText(_('correct'),soundIcon='', interrupt=True) - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/subprocess.py b/src/fenrir/commands/commands/subprocess.py deleted file mode 100644 index ac53e8d8..00000000 --- a/src/fenrir/commands/commands/subprocess.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -import subprocess, os -from subprocess import Popen, PIPE -import _thread - -class command(): - def __init__(self): - pass - def initialize(self, environment, scriptPath=''): - self.env = environment - self.scriptPath = scriptPath - def shutdown(self): - pass - def getDescription(self): - return _('script: {0} fullpath: {1}').format(os.path.basename(self.scriptPath), self.scriptPath) - def run(self): - if not os.path.exists(self.scriptPath): - self.env['runtime']['outputManager'].presentText(_('scriptfile does not exist'), soundIcon='', interrupt=False) - return - if not os.path.isfile(self.scriptPath): - self.env['runtime']['outputManager'].presentText(_('scriptfile is not a file'), soundIcon='', interrupt=False) - return - if not os.access(self.scriptPath, os.X_OK): - self.env['runtime']['outputManager'].presentText(_('scriptfile is not executable'), soundIcon='', interrupt=False) - return - _thread.start_new_thread(self._threadRun , ()) - - def _threadRun(self): - try: - callstring = self.scriptPath + ' ' + self.env['general']['currUser'] - p = Popen(callstring , stdout=PIPE, stderr=PIPE, shell=True) - stdout, stderr = p.communicate() - stdout = stdout.decode('utf-8') - stderr = stderr.decode('utf-8') - self.env['runtime']['outputManager'].interruptOutput() - if stderr != '': - self.env['runtime']['outputManager'].presentText(str(stderr) , soundIcon='', interrupt=False) - if stdout != '': - self.env['runtime']['outputManager'].presentText(str(stdout) , soundIcon='', interrupt=False) - except Exception as e: - self.env['runtime']['outputManager'].presentText(e , soundIcon='', interrupt=False) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/temp_disable_speech.py b/src/fenrir/commands/commands/temp_disable_speech.py deleted file mode 100644 index c560e780..00000000 --- a/src/fenrir/commands/commands/temp_disable_speech.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/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 _('disables speech until next keypress') - - def run(self): - if self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'enabled'): - self.env['runtime']['outputManager'].presentText(_("speech temporary disabled"), soundIcon='SpeechOff', interrupt=True) - self.env['commandBuffer']['enableSpeechOnKeypress'] = True - self.env['runtime']['settingsManager'].setSetting('speech', 'enabled', str(not self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'enabled'))) - self.env['runtime']['outputManager'].interruptOutput() - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/time.py b/src/fenrir/commands/commands/time.py deleted file mode 100644 index 4c6aa9d8..00000000 --- a/src/fenrir/commands/commands/time.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -import datetime - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('presents the time') - - def run(self): - timeFormat = self.env['runtime']['settingsManager'].getSetting('general', 'timeFormat') - - # get the time formatted - timeString = datetime.datetime.strftime(datetime.datetime.now(), timeFormat) - - # present the time via speak and braile, there is no soundicon, interrupt the current speech - self.env['runtime']['outputManager'].presentText(timeString , soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/toggle_auto_read.py b/src/fenrir/commands/commands/toggle_auto_read.py deleted file mode 100644 index d60e9da8..00000000 --- a/src/fenrir/commands/commands/toggle_auto_read.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/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 _('enables or disables automatic reading of new text as it appears') - - def run(self): - self.env['runtime']['settingsManager'].setSetting('speech', 'autoReadIncoming', str(not self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'autoReadIncoming'))) - if self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'autoReadIncoming'): - self.env['runtime']['outputManager'].presentText(_("autoread enabled"), soundIcon='', interrupt=True) - else: - self.env['runtime']['outputManager'].presentText(_("autoread disabled"), soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/toggle_auto_spell_check.py b/src/fenrir/commands/commands/toggle_auto_spell_check.py deleted file mode 100644 index 19d1e06d..00000000 --- a/src/fenrir/commands/commands/toggle_auto_spell_check.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/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 _('enables or disables automatic spell checking') - - def run(self): - self.env['runtime']['settingsManager'].setSetting('general', 'autoSpellCheck', str(not self.env['runtime']['settingsManager'].getSettingAsBool('general', 'autoSpellCheck'))) - if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'autoSpellCheck'): - self.env['runtime']['outputManager'].presentText(_("auto spellcheck enabled"), soundIcon='', interrupt=True) - else: - self.env['runtime']['outputManager'].presentText(_("auto spellcheck disabled"), soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/toggle_auto_time.py b/src/fenrir/commands/commands/toggle_auto_time.py deleted file mode 100644 index 831cca44..00000000 --- a/src/fenrir/commands/commands/toggle_auto_time.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/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 _('enables or disables automatic reading of time after an period') - - def run(self): - self.env['runtime']['settingsManager'].setSetting('time', 'enabled', str(not self.env['runtime']['settingsManager'].getSettingAsBool('time', 'enabled'))) - if self.env['runtime']['settingsManager'].getSettingAsBool('time', 'enabled'): - self.env['runtime']['outputManager'].presentText(_("autotime enabled"), soundIcon='', interrupt=True) - else: - self.env['runtime']['outputManager'].presentText(_("autotime disabled"), soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/toggle_braille.py b/src/fenrir/commands/commands/toggle_braille.py deleted file mode 100644 index 0929d489..00000000 --- a/src/fenrir/commands/commands/toggle_braille.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/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 _('enables and disables output in braille') - - def run(self): - if self.env['runtime']['settingsManager'].getSettingAsBool('braille', 'enabled'): - self.env['runtime']['outputManager'].presentText(_('braille disabled'), soundIcon='BrailleOff', interrupt=True) - self.env['runtime']['settingsManager'].setSetting('braille', 'enabled', str(not self.env['runtime']['settingsManager'].getSettingAsBool('braille', 'enabled'))) - if self.env['runtime']['settingsManager'].getSettingAsBool('braille', 'enabled'): - self.env['runtime']['outputManager'].presentText(_('braille enabled'), soundIcon='BrailleOn', interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/toggle_emoticons.py b/src/fenrir/commands/commands/toggle_emoticons.py deleted file mode 100644 index e44e6da3..00000000 --- a/src/fenrir/commands/commands/toggle_emoticons.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/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 _('enables or disables announcement of emoticons instead of chars') - - def run(self): - self.env['runtime']['settingsManager'].setSetting('general', 'emoticons', str(not self.env['runtime']['settingsManager'].getSettingAsBool('general', 'emoticons'))) - if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'emoticons'): - self.env['runtime']['outputManager'].presentText(_('emoticons enabled'), soundIcon='', interrupt=True) - else: - self.env['runtime']['outputManager'].presentText(_('emoticons disabled'), soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/toggle_highlight_tracking.py b/src/fenrir/commands/commands/toggle_highlight_tracking.py deleted file mode 100644 index bc2f5107..00000000 --- a/src/fenrir/commands/commands/toggle_highlight_tracking.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/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 _('enables or disables tracking of highlighted text') - - def run(self): - currMode = self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'highlight') - - self.env['runtime']['settingsManager'].setSetting('focus', 'highlight', str(not currMode)) - self.env['runtime']['settingsManager'].setSetting('focus', 'cursor', str(currMode)) - if self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'highlight'): - self.env['runtime']['outputManager'].presentText(_('highlight tracking'), soundIcon='', interrupt=True) - else: - self.env['runtime']['outputManager'].presentText(_('cursor tracking'), soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/toggle_output.py b/src/fenrir/commands/commands/toggle_output.py deleted file mode 100644 index a1b29cec..00000000 --- a/src/fenrir/commands/commands/toggle_output.py +++ /dev/null @@ -1,34 +0,0 @@ -#!/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 _('toggles all output settings') - - def run(self): - if self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'enabled') or \ - self.env['runtime']['settingsManager'].getSettingAsBool('sound', 'enabled') or \ - self.env['runtime']['settingsManager'].getSettingAsBool('braille', 'enabled'): - self.env['runtime']['outputManager'].presentText(_('Fenrir muted'), soundIcon='Accept', interrupt=True) - self.env['runtime']['settingsManager'].setSetting('speech', 'enabled','False') - self.env['runtime']['settingsManager'].setSetting('sound', 'enabled','False') - self.env['runtime']['settingsManager'].setSetting('braille', 'enabled','False') - else: - self.env['runtime']['settingsManager'].setSetting('speech', 'enabled','True') - self.env['runtime']['settingsManager'].setSetting('sound', 'enabled','True') - self.env['runtime']['settingsManager'].setSetting('braille', 'enabled','True') - self.env['runtime']['outputManager'].presentText(_('Fenrir unmuted'), soundIcon='Cancel', interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/toggle_punctuation_level.py b/src/fenrir/commands/commands/toggle_punctuation_level.py deleted file mode 100644 index 257ff0f6..00000000 --- a/src/fenrir/commands/commands/toggle_punctuation_level.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/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']['punctuationManager'].cyclePunctuation(): - self.env['runtime']['outputManager'].presentText(self.env['runtime']['settingsManager'].getSetting('general', 'punctuationLevel'), interrupt=True, ignorePunctuation=True) - else: - self.env['runtime']['outputManager'].presentText(_('No punctuation found.'), interrupt=True, ignorePunctuation=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/toggle_sound.py b/src/fenrir/commands/commands/toggle_sound.py deleted file mode 100644 index 8febec81..00000000 --- a/src/fenrir/commands/commands/toggle_sound.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/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 _('enables or disables sound') - - def run(self): - if self.env['runtime']['settingsManager'].getSettingAsBool('sound', 'enabled'): - self.env['runtime']['outputManager'].presentText(_('sound disabled'), soundIcon='SoundOff', interrupt=True) - self.env['runtime']['settingsManager'].setSetting('sound', 'enabled', str(not self.env['runtime']['settingsManager'].getSettingAsBool('sound', 'enabled'))) - if self.env['runtime']['settingsManager'].getSettingAsBool('sound', 'enabled'): - self.env['runtime']['outputManager'].presentText(_('sound enabled'), soundIcon='SoundOn', interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/toggle_speech.py b/src/fenrir/commands/commands/toggle_speech.py deleted file mode 100644 index 83675c0e..00000000 --- a/src/fenrir/commands/commands/toggle_speech.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/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 _('enables or disables speech') - - def run(self): - if self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'enabled'): - self.env['runtime']['outputManager'].presentText(_('speech disabled'), soundIcon='SpeechOff', interrupt=True) - self.env['runtime']['settingsManager'].setSetting('speech', 'enabled', str(not self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'enabled'))) - if self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'enabled'): - self.env['runtime']['outputManager'].presentText(_('speech enabled'), soundIcon='SpeechOn', interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/commands/toggle_tutorial_mode.py b/src/fenrir/commands/commands/toggle_tutorial_mode.py deleted file mode 100644 index 8c89f957..00000000 --- a/src/fenrir/commands/commands/toggle_tutorial_mode.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/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): - self.env['runtime']['helpManager'].toggleTutorialMode() - #self.env['runtime']['outputManager'].presentText(, interrupt=True) - return _('You are leaving the tutorial mode. Press that shortcut again to enter the tutorial mode again.') - def run(self): - self.env['runtime']['helpManager'].toggleTutorialMode() - self.env['runtime']['outputManager'].presentText( _('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.'), interrupt=True) - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/help/Readme.txt b/src/fenrir/commands/help/Readme.txt deleted file mode 100644 index c90f7a6b..00000000 --- a/src/fenrir/commands/help/Readme.txt +++ /dev/null @@ -1,2 +0,0 @@ -this folder contains help and tutorial related functions. -those are not bindable but hard coded. diff --git a/src/fenrir/commands/help/__init__.py b/src/fenrir/commands/help/__init__.py deleted file mode 100755 index e69de29b..00000000 diff --git a/src/fenrir/commands/help/curr_help.py b/src/fenrir/commands/help/curr_help.py deleted file mode 100644 index 1de0abc5..00000000 --- a/src/fenrir/commands/help/curr_help.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/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 _('get current help message') - def run(self): - text = self.env['runtime']['helpManager'].getHelpForCurrentIndex() - self.env['runtime']['outputManager'].presentText(text, interrupt=True) - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/help/next_help.py b/src/fenrir/commands/help/next_help.py deleted file mode 100644 index 0f268aa8..00000000 --- a/src/fenrir/commands/help/next_help.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/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 _('get next help message') - def run(self): - self.env['runtime']['helpManager'].nextIndex() - text = self.env['runtime']['helpManager'].getHelpForCurrentIndex() - self.env['runtime']['outputManager'].presentText(text, interrupt=True) - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/help/prev_help.py b/src/fenrir/commands/help/prev_help.py deleted file mode 100644 index 31eccbb6..00000000 --- a/src/fenrir/commands/help/prev_help.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/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 _('get prev help message') - def run(self): - self.env['runtime']['helpManager'].prevIndex() - text = self.env['runtime']['helpManager'].getHelpForCurrentIndex() - self.env['runtime']['outputManager'].presentText(text, interrupt=True) - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/onApplicationChange/__init__.py b/src/fenrir/commands/onApplicationChange/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/fenrir/commands/onApplicationChange/inactive/test.py b/src/fenrir/commands/onApplicationChange/inactive/test.py deleted file mode 100644 index f17d8160..00000000 --- a/src/fenrir/commands/onApplicationChange/inactive/test.py +++ /dev/null @@ -1,25 +0,0 @@ -#!/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 -*- - -# 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']]. - -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 - -[['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']] - - 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/onCursorChange/45000-char_echo.py b/src/fenrir/commands/onCursorChange/45000-char_echo.py deleted file mode 100644 index fbf086dc..00000000 --- a/src/fenrir/commands/onCursorChange/45000-char_echo.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/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 'No Description found' - - def run(self): - # 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) - xMove = abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']) - if xMove > 1: - return - if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'charEcho'): - return - # detect deletion or chilling - if self.env['screen']['newCursor']['x'] <= self.env['screen']['oldCursor']['x']: - return - # is there any change? - if not self.env['runtime']['screenManager'].isDelta(): - return - - # filter unneded space on word begin - currDelta = self.env['screen']['newDelta'] - if len(currDelta.strip()) != len(currDelta) and \ - currDelta.strip() != '': - currDelta = currDelta.strip() - self.env['runtime']['outputManager'].presentText(currDelta, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) - - def setCallback(self, callback): - pass - diff --git a/src/fenrir/commands/onCursorChange/46000-tab_completion.py b/src/fenrir/commands/onCursorChange/46000-tab_completion.py deleted file mode 100644 index a90c07f5..00000000 --- a/src/fenrir/commands/onCursorChange/46000-tab_completion.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/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 'No Description found' - - def run(self): - # try to detect the tab completion by cursor change - xMove = abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']) - if xMove == 1: - return - # is there any change? - if not self.env['runtime']['screenManager'].isDelta(): - return - if not( (xMove > 1) and xMove == len(self.env['screen']['newDelta'])): - return - # detect deletion or chilling - if self.env['screen']['newCursor']['x'] <= self.env['screen']['oldCursor']['x']: - return - - # filter unneded space on word begin - currDelta = self.env['screen']['newDelta'] - if len(currDelta.strip()) != len(currDelta) and \ - currDelta.strip() != '': - currDelta = currDelta.strip() - self.env['runtime']['outputManager'].presentText(currDelta, interrupt=True, announceCapital=True, flush=False) - - def setCallback(self, callback): - pass - diff --git a/src/fenrir/commands/onCursorChange/50000-present_char_if_cursor_change_horizontal.py b/src/fenrir/commands/onCursorChange/50000-present_char_if_cursor_change_horizontal.py deleted file mode 100644 index ab09adaa..00000000 --- a/src/fenrir/commands/onCursorChange/50000-present_char_if_cursor_change_horizontal.py +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import char_utils - -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 not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'cursor'): - return - if self.env['runtime']['screenManager'].isScreenChange(): - return - # detect an change on the screen, we just want to cursor arround, so no change should appear - if self.env['runtime']['screenManager'].isDelta(): - return - if self.env['runtime']['screenManager'].isNegativeDelta(): - return - # is a vertical change? - if self.env['runtime']['cursorManager'].isCursorVerticalMove(): - return - # is it a horizontal change? - if not self.env['runtime']['cursorManager'].isCursorHorizontalMove(): - return - - # echo word insteed of char - if self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'wordEcho'): - if abs(self.env['screen']['oldCursor']['x'] - self.env['screen']['newCursor']['x']) != 1: - # get the word - 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) - if self.env['screen']['newCursor']['x'] == x: - return - 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): - pass - diff --git a/src/fenrir/commands/onCursorChange/55000-present_line_if_cursor_change_vertical.py b/src/fenrir/commands/onCursorChange/55000-present_line_if_cursor_change_vertical.py deleted file mode 100644 index fb0bd721..00000000 --- a/src/fenrir/commands/onCursorChange/55000-present_line_if_cursor_change_vertical.py +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import line_utils -from utils import word_utils - -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 not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'cursor'): - return - if self.env['runtime']['screenManager'].isScreenChange(): - 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(): - return - - # is a vertical change? - if not self.env['runtime']['cursorManager'].isCursorVerticalMove(): - return - - 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) - else: - self.env['runtime']['outputManager'].presentText(currLine, interrupt=True, flush=False) - - def setCallback(self, callback): - pass - diff --git a/src/fenrir/commands/onCursorChange/60000-word_echo_type.py b/src/fenrir/commands/onCursorChange/60000-word_echo_type.py deleted file mode 100644 index 995dd85f..00000000 --- a/src/fenrir/commands/onCursorChange/60000-word_echo_type.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import word_utils -import string - -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): - # is it enabled? - if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'wordEcho'): - return - # is naviation? - if self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x'] != 1: - return - # just when cursor move worddetection is needed - if not self.env['runtime']['cursorManager'].isCursorHorizontalMove(): - return - # for now no new line - if self.env['runtime']['cursorManager'].isCursorVerticalMove(): - return - # currently writing - if self.env['runtime']['screenManager'].isDelta(): - return - - # get the word - 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) - - # is there a word? - if currWord == '': - return - # at the end of a word - if not newContent[self.env['screen']['newCursor']['x']].isspace(): - return - # at the end of a word - if (x + len(currWord) != self.env['screen']['newCursor']['x']) and \ - (x + len(currWord) != self.env['screen']['newCursor']['x']-1): - return - - self.env['runtime']['outputManager'].presentText(currWord, interrupt=True, flush=False) - - def setCallback(self, callback): - pass - diff --git a/src/fenrir/commands/onCursorChange/61000-word_echo_navigation.py b/src/fenrir/commands/onCursorChange/61000-word_echo_navigation.py deleted file mode 100644 index 69963a15..00000000 --- a/src/fenrir/commands/onCursorChange/61000-word_echo_navigation.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import word_utils -import string - -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): - # is navigation? - if not abs(self.env['screen']['oldCursor']['x'] - self.env['screen']['newCursor']['x']) > 1: - return - - # just when cursor move worddetection is needed - if not self.env['runtime']['cursorManager'].isCursorHorizontalMove(): - return - # for now no new line - if self.env['runtime']['cursorManager'].isCursorVerticalMove(): - return - # currently writing - if self.env['runtime']['screenManager'].isDelta(): - return - - # get the word - 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) - - # is there a word? - if currWord == '': - return - - # at the start of a word - if (x + len(currWord) != self.env['screen']['newCursor']['x']) and \ - (self.env['screen']['newCursor']['x'] != x): - return - - self.env['runtime']['outputManager'].presentText(currWord, interrupt=True, flush=False) - - def setCallback(self, callback): - pass - diff --git a/src/fenrir/commands/onCursorChange/62000-spell_check.py b/src/fenrir/commands/onCursorChange/62000-spell_check.py deleted file mode 100644 index 2894d274..00000000 --- a/src/fenrir/commands/onCursorChange/62000-spell_check.py +++ /dev/null @@ -1,134 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import word_utils -import os, string - -initialized = False -try: - import enchant - initialized = True -except: - pass - -class command(): - def __init__(self): - self.language = '' - self.spellChecker = '' - def initialize(self, environment): - self.env = environment - self.updateSpellLanguage() - def shutdown(self): - pass - def getDescription(self): - return 'No Description found' - - def updateSpellLanguage(self): - if not initialized: - self.env['runtime']['outputManager'].presentText('pychant is not installed', interrupt=True) - return - self.spellChecker = enchant.Dict(self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage')) - self.language = self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage') - - def run(self): - if not initialized: - return - if not self.env['runtime']['settingsManager'].getSettingAsBool('general', 'autoSpellCheck'): - return - if self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage') != self.language: - try: - self.updateSpellLanguage() - except: - return - - # just when horizontal cursor move worddetection is needed - if not self.env['runtime']['cursorManager'].isCursorHorizontalMove(): - return - - # for now no new line - if self.env['runtime']['cursorManager'].isCursorVerticalMove(): - return - # more than a keyecho? - 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['screen']['newCursor']['x'] == 0: - return - - # get the word (just for speedup only look at current line - 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['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['screen']['newCursor']['x']].isspace(): - return - 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['screen']['newCursor']['x'] > 0: - if not newContent[self.env['screen']['oldCursor']['x'] - 1].lower() in string.ascii_lowercase: - return - - # ignore bash buildins - if currWord in ['cd','fg','bg','alias','bind','dir','caller','buildin','command','declare','echo','enable','help','let','local','logout',\ - 'mapfile','printf','read','readarray','source','type','typeset','ulimit','unalias']: - return - # ignore the application name - if currWord.upper() == 'FENRIR': - return - if currWord[0] =='-': - return - if currWord[0] == '/': - return - if currWord[0] == '#': - return - if currWord.startswith('./'): - return - if '@' in currWord and '.' in currWord: - return - if currWord[0] == '@': - return - if currWord.isnumeric(): - return - if currWord.isdecimal(): - return - if currWord.isspace(): - return - - try: - if os.path.exists("/bin/"+currWord): - return - except: - pass - try: - if os.path.exists("/usr/bin/"+currWord): - return - except: - pass - try: - if os.path.exists("/sbin/"+currWord): - return - except: - pass - - if not self.spellChecker.check(currWord): - self.env['runtime']['outputManager'].presentText(_('misspelled'), soundIcon='mispell', interrupt=False, flush=False) - - def setCallback(self, callback): - pass - diff --git a/src/fenrir/commands/onCursorChange/65000-char_delete_echo.py b/src/fenrir/commands/onCursorChange/65000-char_delete_echo.py deleted file mode 100644 index 51310877..00000000 --- a/src/fenrir/commands/onCursorChange/65000-char_delete_echo.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/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 'No Description found' - - def run(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'charDeleteEcho'): - return - # detect typing or chilling - if self.env['screen']['newCursor']['x'] >= self.env['screen']['oldCursor']['x']: - return - - # More than just a deletion happend - if self.env['runtime']['screenManager'].isDelta(ignoreSpace=True): - return - - # no deletion - if not self.env['runtime']['screenManager'].isNegativeDelta(): - return - - # too much for a single backspace... - # word begin produce a diff wiht len == 2 |a | others with 1 |a| - if len(self.env['screen']['newNegativeDelta']) > 2: - return - - currNegativeDelta = self.env['screen']['newNegativeDelta'] - if len(currNegativeDelta.strip()) != len(currNegativeDelta) and \ - currNegativeDelta.strip() != '': - currNegativeDelta = currNegativeDelta.strip() - self.env['runtime']['outputManager'].presentText(currNegativeDelta, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) - def setCallback(self, callback): - pass - diff --git a/src/fenrir/commands/onCursorChange/66000-exit_review_mode.py b/src/fenrir/commands/onCursorChange/66000-exit_review_mode.py deleted file mode 100644 index 2f7a8cfa..00000000 --- a/src/fenrir/commands/onCursorChange/66000-exit_review_mode.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/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 _('exits review mode') - - def run(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('review', 'leaveReviewOnCursorChange'): - return - if self.env['runtime']['cursorManager'].isReviewMode(): - self.env['runtime']['cursorManager'].clearReviewCursor() - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/onCursorChange/__init__.py b/src/fenrir/commands/onCursorChange/__init__.py deleted file mode 100755 index e69de29b..00000000 diff --git a/src/fenrir/commands/onHeartBeat/2000-GetSessionInfo.py b/src/fenrir/commands/onHeartBeat/2000-GetSessionInfo.py deleted file mode 100755 index b4d822a3..00000000 --- a/src/fenrir/commands/onHeartBeat/2000-GetSessionInfo.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/python -import time -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -import time -import datetime - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - self.lastTime = datetime.datetime.now() - self.lastDateString = '' - self.lastTimeString = '' - def shutdown(self): - pass - def getDescription(self): - return 'No Description found' - - def run(self): - self.env['runtime']['screenDriver'].getSessionInformation() - def setCallback(self, callback): - pass - diff --git a/src/fenrir/commands/onHeartBeat/76000-time.py b/src/fenrir/commands/onHeartBeat/76000-time.py deleted file mode 100755 index 3b9b55b6..00000000 --- a/src/fenrir/commands/onHeartBeat/76000-time.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/python -import time -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -import time -import datetime - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - self.lastTime = datetime.datetime.now() - self.lastDateString = '' - self.lastTimeString = '' - def shutdown(self): - pass - def getDescription(self): - return 'No Description found' - - def run(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('time', 'enabled'): - return - onMinutes = self.env['runtime']['settingsManager'].getSetting('time', 'onMinutes') - delaySec = self.env['runtime']['settingsManager'].getSettingAsInt('time', 'delaySec') - # no need - if onMinutes == '' and delaySec <= 0: - return - onMinutes = onMinutes.split(',') - now = datetime.datetime.now() - # ignore onMinutes if there is a delaySec - if delaySec > 0: - if int((now-self.lastTime).total_seconds()) < delaySec: - return - else: - # shoul announce? - if not str(now.minute) in onMinutes: - return - # already announced? - if now.hour == self.lastTime.hour: - if now.minute == self.lastTime.minute: - return - dateFormat = self.env['runtime']['settingsManager'].getSetting('general', 'dateFormat') - dateString = datetime.datetime.strftime(now, dateFormat) - - presentDate = self.env['runtime']['settingsManager'].getSettingAsBool('time', 'presentDate') and \ - self.lastDateString != dateString - presentTime = self.env['runtime']['settingsManager'].getSettingAsBool('time', 'presentTime') - # no changed value to announce - if not (presentDate or presentTime): - return - timeFormat = self.env['runtime']['settingsManager'].getSetting('general', 'timeFormat') - timeString = datetime.datetime.strftime(now, timeFormat) - - if self.env['runtime']['settingsManager'].getSettingAsBool('time', 'interrupt'): - self.env['runtime']['outputManager'].interruptOutput() - if self.env['runtime']['settingsManager'].getSettingAsBool('time', 'announce'): - self.env['runtime']['outputManager'].playSoundIcon('announce') - - if presentTime: - # present the time - self.env['runtime']['outputManager'].presentText(_('Autotime: {0}').format(timeString), soundIcon='', interrupt=False) - # and date if changes - if presentDate: - self.env['runtime']['outputManager'].presentText(dateString , soundIcon='', interrupt=False) - self.lastDateString = dateString - self.lastTime = datetime.datetime.now() - self.lastTimeString = timeString - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/onHeartBeat/__init__.py b/src/fenrir/commands/onHeartBeat/__init__.py deleted file mode 100755 index e69de29b..00000000 diff --git a/src/fenrir/commands/onHeartBeat/deactive/1.echo.py b/src/fenrir/commands/onHeartBeat/deactive/1.echo.py deleted file mode 100755 index 678dc9cd..00000000 --- a/src/fenrir/commands/onHeartBeat/deactive/1.echo.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/python -import time -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -import time - -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(time.time()) - def setCallback(self, callback): - pass - diff --git a/src/fenrir/commands/onInput/10000-shut_up.py b/src/fenrir/commands/onInput/10000-shut_up.py deleted file mode 100644 index b3a2dea7..00000000 --- a/src/fenrir/commands/onInput/10000-shut_up.py +++ /dev/null @@ -1,37 +0,0 @@ -#!/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 not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'interruptOnKeyPress'): - return - if self.env['runtime']['inputManager'].noKeyPressed(): - return - if self.env['runtime']['screenManager'].isScreenChange(): - return - if len(self.env['input']['currInput']) <= len(self.env['input']['prevInput']): - return - # if the filter is set - if self.env['runtime']['settingsManager'].getSetting('keyboard', 'interruptOnKeyPressFilter').strip() != '': - filterList = self.env['runtime']['settingsManager'].getSetting('keyboard', 'interruptOnKeyPressFilter').split(',') - for currInput in self.env['input']['currInput']: - if not currInput in filterList: - return - self.env['runtime']['outputManager'].interruptOutput() - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/onInput/15000-enable_temp_speech.py b/src/fenrir/commands/onInput/15000-enable_temp_speech.py deleted file mode 100644 index a6de077e..00000000 --- a/src/fenrir/commands/onInput/15000-enable_temp_speech.py +++ /dev/null @@ -1,31 +0,0 @@ -#!/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 _('disables speech until next keypress') - - def run(self): - if self.env['runtime']['inputManager'].noKeyPressed(): - return - if len(self.env['input']['prevInput']) >0: - return - if not self.env['commandBuffer']['enableSpeechOnKeypress']: - return - self.env['runtime']['settingsManager'].setSetting('speech', 'enabled', str(self.env['commandBuffer']['enableSpeechOnKeypress'])) - self.env['commandBuffer']['enableSpeechOnKeypress'] = False - self.env['runtime']['outputManager'].presentText(_("speech enabled"), soundIcon='SpeechOn', interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/onInput/80000-capslock.py b/src/fenrir/commands/onInput/80000-capslock.py deleted file mode 100644 index 84819bc5..00000000 --- a/src/fenrir/commands/onInput/80000-capslock.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/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 'No description found' - def run(self): - if self.env['input']['oldCapsLock'] == self.env['input']['newCapsLock']: - return - if self.env['input']['newCapsLock']: - self.env['runtime']['outputManager'].presentText(_("Capslock on"), interrupt=True) - else: - self.env['runtime']['outputManager'].presentText(_("Capslock off"), interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/onInput/80300-scrolllock.py b/src/fenrir/commands/onInput/80300-scrolllock.py deleted file mode 100644 index f159a4a0..00000000 --- a/src/fenrir/commands/onInput/80300-scrolllock.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/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 'No description found' - def run(self): - if self.env['input']['oldScrollLock'] == self.env['input']['newScrollLock']: - return - if self.env['input']['newScrollLock']: - self.env['runtime']['outputManager'].presentText(_("Scrolllock on"), interrupt=True) - else: - self.env['runtime']['outputManager'].presentText(_("Scrolllock off"), interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/onInput/80500-numlock.py b/src/fenrir/commands/onInput/80500-numlock.py deleted file mode 100644 index 86ab5341..00000000 --- a/src/fenrir/commands/onInput/80500-numlock.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/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 'No description found' - def run(self): - if self.env['input']['oldNumLock'] == self.env['input']['newNumLock']: - return - if self.env['input']['newNumLock']: - self.env['runtime']['outputManager'].presentText(_("Numlock on"), interrupt=True) - else: - self.env['runtime']['outputManager'].presentText(_("Numlock off"), interrupt=True) - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/onInput/__init__.py b/src/fenrir/commands/onInput/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/fenrir/commands/onPlugInputDevice/50000-UpdateDevices.py b/src/fenrir/commands/onPlugInputDevice/50000-UpdateDevices.py deleted file mode 100755 index 37a392ed..00000000 --- a/src/fenrir/commands/onPlugInputDevice/50000-UpdateDevices.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/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 'No description found' - def run(self): - self.env['runtime']['inputManager'].updateInputDevices() - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/onPlugInputDevice/__init__.py b/src/fenrir/commands/onPlugInputDevice/__init__.py deleted file mode 100755 index e69de29b..00000000 diff --git a/src/fenrir/commands/onScreenChanged/10000-shut_up.py b/src/fenrir/commands/onScreenChanged/10000-shut_up.py deleted file mode 100644 index 884c4264..00000000 --- a/src/fenrir/commands/onScreenChanged/10000-shut_up.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/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): - self.env['runtime']['outputManager'].interruptOutput() - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/onScreenChanged/80000-screen_change_announcement.py b/src/fenrir/commands/onScreenChanged/80000-screen_change_announcement.py deleted file mode 100644 index b59b8631..00000000 --- a/src/fenrir/commands/onScreenChanged/80000-screen_change_announcement.py +++ /dev/null @@ -1,25 +0,0 @@ -#!/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 'No Description found' - - def run(self): - 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/onScreenChanged/85000-reset_marks.py b/src/fenrir/commands/onScreenChanged/85000-reset_marks.py deleted file mode 100644 index 501f7ad0..00000000 --- a/src/fenrir/commands/onScreenChanged/85000-reset_marks.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/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 'No Description found' - - def run(self): - self.env['runtime']['cursorManager'].clearMarks() - - def setCallback(self, callback): - pass - diff --git a/src/fenrir/commands/onScreenChanged/89000-leave_review_mode.py b/src/fenrir/commands/onScreenChanged/89000-leave_review_mode.py deleted file mode 100644 index 84240ebe..00000000 --- a/src/fenrir/commands/onScreenChanged/89000-leave_review_mode.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/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 'No Description found' - - def run(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('review', 'leaveReviewOnScreenChange'): - return - self.env['runtime']['cursorManager'].clearReviewCursor() - - def setCallback(self, callback): - pass - diff --git a/src/fenrir/commands/onScreenChanged/__init__.py b/src/fenrir/commands/onScreenChanged/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/fenrir/commands/onScreenUpdate/56000-highlight_tracking.py b/src/fenrir/commands/onScreenUpdate/56000-highlight_tracking.py deleted file mode 100644 index 419966f8..00000000 --- a/src/fenrir/commands/onScreenUpdate/56000-highlight_tracking.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/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 _('enables or disables tracking of highlighted') - - def run(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'highlight'): - return - 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/onScreenUpdate/60000-history.py b/src/fenrir/commands/onScreenUpdate/60000-history.py deleted file mode 100644 index 0ecea111..00000000 --- a/src/fenrir/commands/onScreenUpdate/60000-history.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/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['screen']['newAttribDelta'] != '': - return - if self.env['runtime']['screenManager'].isScreenChange(): - return - if self.env['runtime']['cursorManager'].isCursorVerticalMove(): - return - if not (self.env['runtime']['inputManager'].getLastDeepestInput() in [['KEY_UP'],['KEY_DOWN']]): - return - 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 prevLine == currLine: - if self.env['screen']['newDelta'] != '': - return - if not currLine.isspace(): - 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 - - if currLine.isspace(): - self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False) - else: - self.env['runtime']['outputManager'].presentText(announce, interrupt=True, flush=False) - self.env['commandsIgnore']['onScreenUpdate']['CHAR_DELETE_ECHO'] = True - self.env['commandsIgnore']['onScreenUpdate']['CHAR_ECHO'] = 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 deleted file mode 100644 index 1e2840e1..00000000 --- a/src/fenrir/commands/onScreenUpdate/70000-incoming.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/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 'No Description found' - - def run(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'autoReadIncoming'): - return - # is there something to read? - if not self.env['runtime']['screenManager'].isDelta(ignoreSpace=True): - return - # this must be a keyecho or something - #if len(self.env['screen']['newDelta'].strip(' \n\t')) <= 1: - xMove = abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']) - yMove = abs(self.env['screen']['newCursor']['y'] - self.env['screen']['oldCursor']['y']) - self.env['runtime']['debug'].writeDebugOut('newX:' + str(self.env['screen']['newCursor']['x']) + 'oldX:' + str(self.env['screen']['oldCursor']['x']),debug.debugLevel.INFO) - self.env['runtime']['debug'].writeDebugOut('newY:' + str(self.env['screen']['newCursor']['y']) + 'oldY:' + str(self.env['screen']['oldCursor']['y']),debug.debugLevel.INFO) - self.env['runtime']['debug'].writeDebugOut('xMove:'+ str(xMove)+' yMove:'+str(yMove),debug.debugLevel.INFO) - self.env['runtime']['debug'].writeDebugOut('NewDeltaLen:'+str(len(self.env['screen']['newDelta'])),debug.debugLevel.INFO) - self.env['runtime']['debug'].writeDebugOut(str(self.env['screen']),debug.debugLevel.INFO) - - if (xMove >= 1) and xMove == len(self.env['screen']['newDelta']): - # if len(self.env['screen']['newDelta'].strip(' \n\t0123456789')) <= 2: - return - #if yMove == 1: - # if len(self.env['screen']['newDelta'].strip(' \n\t0123456789')) <= 2: - # return - 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 deleted file mode 100644 index 63cb2c82..00000000 --- a/src/fenrir/commands/onScreenUpdate/75000-incoming_promote.py +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/python -import time -# -*- 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 'No Description found' - - def run(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('promote', 'enabled'): - return - if self.env['runtime']['settingsManager'].getSetting('promote', 'list').strip(" \t\n") == '': - 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['screen']['newDelta']: - self.env['runtime']['outputManager'].playSoundIcon('PromotedText') - self.env['input']['lastInputTime'] = time.time() - return - - def setCallback(self, callback): - pass - diff --git a/src/fenrir/commands/onScreenUpdate/__init__.py b/src/fenrir/commands/onScreenUpdate/__init__.py deleted file mode 100755 index e69de29b..00000000 diff --git a/src/fenrir/commands/onSwitchApplicationProfile/__init__.py b/src/fenrir/commands/onSwitchApplicationProfile/__init__.py deleted file mode 100644 index 8b137891..00000000 --- a/src/fenrir/commands/onSwitchApplicationProfile/__init__.py +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/fenrir/commands/onSwitchApplicationProfile/default.py b/src/fenrir/commands/onSwitchApplicationProfile/default.py deleted file mode 100644 index 04558ae3..00000000 --- a/src/fenrir/commands/onSwitchApplicationProfile/default.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/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 'No description found' - def load(self): - return - print('--------------') - print('default') - print('load new',self.env['screen']['newApplication']) - print('--------------') - - def unload(self): - return - print('--------------') - print('default') - print('unload old',self.env['screen']['oldApplication']) - print('--------------') - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/onSwitchApplicationProfile/inactive/agetty.py b/src/fenrir/commands/onSwitchApplicationProfile/inactive/agetty.py deleted file mode 100644 index 1fb59c8d..00000000 --- a/src/fenrir/commands/onSwitchApplicationProfile/inactive/agetty.py +++ /dev/null @@ -1,31 +0,0 @@ -#!/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 'No description found' - def load(self): - print('--------------') - print('agetty') - print('load new',self.env['screen']['newApplication']) - print('--------------') - - def unload(self): - print('--------------') - print('agetty') - print('unload old',self.env['screen']['oldApplication']) - print('--------------') - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/onSwitchApplicationProfile/inactive/bash.py b/src/fenrir/commands/onSwitchApplicationProfile/inactive/bash.py deleted file mode 100644 index 7a5d7540..00000000 --- a/src/fenrir/commands/onSwitchApplicationProfile/inactive/bash.py +++ /dev/null @@ -1,31 +0,0 @@ -#!/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 'No description found' - def load(self): - print('--------------') - print('bash') - print('load new',self.env['screen']['newApplication']) - print('--------------') - - def unload(self): - print('--------------') - print('bash') - print('unload old',self.env['screen']['oldApplication']) - print('--------------') - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/onSwitchApplicationProfile/inactive/vim.py b/src/fenrir/commands/onSwitchApplicationProfile/inactive/vim.py deleted file mode 100644 index 78f02af9..00000000 --- a/src/fenrir/commands/onSwitchApplicationProfile/inactive/vim.py +++ /dev/null @@ -1,31 +0,0 @@ -#!/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 'No description found' - def load(self): - print('--------------') - print('vim') - print('load new',self.env['screen']['newApplication']) - print('--------------') - - def unload(self): - print('--------------') - print('vim') - print('unload old',self.env['screen']['oldApplication']) - print('--------------') - - def setCallback(self, callback): - pass diff --git a/src/fenrir/commands/switchTrigger_template.py b/src/fenrir/commands/switchTrigger_template.py deleted file mode 100644 index 8efbea56..00000000 --- a/src/fenrir/commands/switchTrigger_template.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/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 'No description found' - def unload(self): - pass - def load(self): - pass - def setCallback(self, callback): - pass diff --git a/src/fenrir/core/__init__.py b/src/fenrir/core/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/fenrir/core/applicationManager.py b/src/fenrir/core/applicationManager.py deleted file mode 100644 index 202e6e35..00000000 --- a/src/fenrir/core/applicationManager.py +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -class applicationManager(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getCurrentApplication(self): - currApp = self.env['screen']['newApplication'].upper() - if not currApp: - currApp == 'DEFAULT' - if currApp == '': - currApp == 'DEFAULT' - return currApp - def getPrevApplication(self): - prevApp = self.env['screen']['oldApplication'].upper() - if not prevApp: - prevApp == 'DEFAULT' - if prevApp == '': - prevApp == 'DEFAULT' - return prevApp - def isApplicationChange(self): - return self.env['screen']['oldApplication'] != self.env['screen']['newApplication'] diff --git a/src/fenrir/core/brailleDriver.py b/src/fenrir/core/brailleDriver.py deleted file mode 100644 index a3504cec..00000000 --- a/src/fenrir/core/brailleDriver.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -class brailleDriver(): - def __init__(self): - self._isInitialized = False - self.deviceSize = None - def initialize(self, environment): - self.env = environment - self._isInitialized = True - - def getDeviceSize(self): - if not self._isInitialized: - return (0,0) - return (0,0) - - def writeText(self,text): - if not self._isInitialized: - return - - def connectDevice(self): - pass - - def enterScreen(self, screen): - if not self._isInitialized: - return - - def leveScreen(self): - if not self._isInitialized: - return - - def shutdown(self): - if not self._isInitialized: - return - self.leveScreen() - self._isInitialized = False diff --git a/src/fenrir/core/commandData.py b/src/fenrir/core/commandData.py deleted file mode 100644 index e653de30..00000000 --- a/src/fenrir/core/commandData.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -import time - -# used as shared memory between commands -# use this in your own commands -commandBuffer = { -'enableSpeechOnKeypress': False, -'Marks':{'1':None, '2':None}, -'bookMarks':{}, -'windowArea':{}, -} - -# used by the commandManager -commandInfo = { -#'currCommand': '', -'lastCommandExecutionTime': time.time(), -'lastCommandRequestTime': time.time(), -} diff --git a/src/fenrir/core/commandManager.py b/src/fenrir/core/commandManager.py deleted file mode 100644 index fd10c13c..00000000 --- a/src/fenrir/core/commandManager.py +++ /dev/null @@ -1,223 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -import glob, os, time, inspect -currentdir = os.path.dirname(os.path.realpath(os.path.abspath(inspect.getfile(inspect.currentframe())))) -fenrirPath = os.path.dirname(currentdir) - -from core import debug -from utils import module_utils - -class commandManager(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - # commands - self.env['commands'] = {} - self.env['commandsIgnore'] = {} - for commandFolder in self.env['general']['commandFolderList']: - self.env['runtime']['commandManager'].loadCommands(commandFolder) - if self.env['runtime']['settingsManager'].getSetting('general', 'commandPath') != '': - self.env['runtime']['commandManager'].loadCommands(commandFolder, - self.env['runtime']['settingsManager'].getSetting('general', 'commandPath')) - - # scripts for scriptKey - self.env['runtime']['commandManager'].loadScriptCommands() - - def shutdown(self): - for commandFolder in self.env['general']['commandFolderList']: - self.env['runtime']['commandManager'].shutdownCommands(commandFolder) - - def loadCommands(self, section='commands',commandPath=''): - if commandPath =='': - commandPath = fenrirPath+ "/commands/" - if not commandPath.endswith('/'): - commandPath += '/' - commandFolder = commandPath + section +"/" - if not os.path.exists(commandFolder): - self.env['runtime']['debug'].writeDebugOut("commandFolder not exists:" + commandFolder ,debug.debugLevel.WARNING) - return - if not os.path.isdir(commandFolder): - self.env['runtime']['debug'].writeDebugOut("commandFolder not a directory:" + commandFolder ,debug.debugLevel.ERROR) - return - if not os.access(commandFolder, os.R_OK): - self.env['runtime']['debug'].writeDebugOut("commandFolder not readable:" + commandFolder ,debug.debugLevel.ERROR) - return - self.env['commands'][section] = {} - self.env['commandsIgnore'][section] = {} - commandList = glob.glob(commandFolder+'*') - for command in commandList: - try: - fileName, fileExtension = os.path.splitext(command) - fileName = fileName.split('/')[-1] - if fileName.startswith('__'): - continue - try: - if self.env['commands'][section][fileName.upper()] != None: - continue - except: - pass - if fileExtension.lower() == '.py': - command_mod = module_utils.importModule(fileName, command) - self.env['commands'][section][fileName.upper()] = command_mod.command() - 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, onAnyLevel=True) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut("Loading command:" + command ,debug.debugLevel.ERROR) - self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR) - continue - - def loadScriptCommands(self, section='commands', scriptPath=''): - if scriptPath =='': - scriptPath = self.env['runtime']['settingsManager'].getSetting('general', 'scriptPath') - if not scriptPath.endswith('/'): - scriptPath += '/' - if not os.path.exists(scriptPath): - if os.path.exists(fenrirPath +'/../../config/scripts/'): - scriptPath = fenrirPath +'/../../config/scripts/' - else: - self.env['runtime']['debug'].writeDebugOut("scriptpath not exists:" + scriptPath ,debug.debugLevel.WARNING) - return - if not os.path.isdir(scriptPath): - self.env['runtime']['debug'].writeDebugOut("scriptpath not a directory:" + scriptPath ,debug.debugLevel.ERROR) - return - if not os.access(scriptPath, os.R_OK): - self.env['runtime']['debug'].writeDebugOut("scriptpath not readable:" + scriptPath ,debug.debugLevel.ERROR) - return - commandList = glob.glob(scriptPath+'*') - subCommand = fenrirPath + '/commands/commands/subprocess.py' - for command in commandList: - invalid = False - try: - fileName, fileExtension = os.path.splitext(command) - fileName = fileName.split('/')[-1] - if fileName.startswith('__'): - continue - if fileName.upper() in self.env['commands'][section]: - continue - command_mod = module_utils.importModule(fileName ,subCommand) - self.env['commands'][section][fileName.upper()] = command_mod.command() - self.env['commands'][section][fileName.upper()].initialize(self.env,command) - self.env['runtime']['debug'].writeDebugOut("Load script:" + section + "." + fileName.upper() ,debug.debugLevel.INFO, onAnyLevel=True) - commSettings = fileName.upper().split('__-__') - if len(commSettings) == 1: - keys = commSettings[0] - elif len(commSettings) == 2: - keys = commSettings[1] - elif len(commSettings) > 2: - continue - keys = keys.split('__+__') - shortcutKeys = [] - shortcut = [] - for key in keys: - if not self.env['runtime']['settingsManager'].isValidKey(key.upper()): - self.env['runtime']['debug'].writeDebugOut("invalid key : "+ key.upper() + ' command:' +commandName ,debug.debugLevel.WARNING) - invalid = True - break - shortcutKeys.append(key.upper()) - if invalid: - continue - if not 'KEY_SCRIPT' in shortcutKeys: - shortcutKeys.append('KEY_SCRIPT') - shortcut.append(1) - shortcut.append(sorted(shortcutKeys)) - self.env['bindings'][str(shortcut)] = fileName.upper() - except Exception as e: - self.env['runtime']['debug'].writeDebugOut("Loading script:" + command ,debug.debugLevel.ERROR) - self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR) - continue - def shutdownCommands(self, section): - for command in sorted(self.env['commands'][section]): - try: - self.env['commands'][section][command].shutdown() - del self.env['commands'][section][command] - except Exception as e: - self.env['runtime']['debug'].writeDebugOut("Shutdown command:" + section + "." + command ,debug.debugLevel.ERROR) - self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR) - continue - - def executeSwitchTrigger(self, trigger, unLoadScript, loadScript): - if self.env['runtime']['screenManager'].isSuspendingScreen(): - return - #unload - oldScript = unLoadScript - if self.commandExists(oldScript, trigger): - try: - self.env['runtime']['debug'].writeDebugOut("Executing switchtrigger.unload:" + trigger + "." + oldScript ,debug.debugLevel.INFO) - self.env['commands'][trigger][oldScript].unload() - except Exception as e: - self.env['runtime']['debug'].writeDebugOut("Executing trigger:" + trigger + "." + oldScript ,debug.debugLevel.ERROR) - self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR) - #load - newScript = loadScript - if self.commandExists(newScript, trigger): - try: - self.env['runtime']['debug'].writeDebugOut("Executing switchtrigger.load:" + trigger + "." + newScript ,debug.debugLevel.INFO) - self.env['commands'][trigger][newScript].load() - except Exception as e: - self.env['runtime']['debug'].writeDebugOut("Executing trigger:" + trigger + "." + newScript ,debug.debugLevel.ERROR) - self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR) - - def executeDefaultTrigger(self, trigger, force=False): - if not force: - if self.env['runtime']['screenManager'].isSuspendingScreen(): - return - for command in sorted(self.env['commands'][trigger]): - if self.commandExists(command, trigger): - try: - if self.env['commandsIgnore'][trigger][command[command.find('-')+1:]+'_IGNORE']: - self.env['commandsIgnore'][trigger][command[command.find('-')+1:]+'_IGNORE'] = False - self.env['runtime']['debug'].writeDebugOut("Ignore trigger.command:" + trigger + "." + command ,debug.debugLevel.INFO) - else: - self.env['runtime']['debug'].writeDebugOut("Executing trigger.command:" + trigger + "." + command ,debug.debugLevel.INFO) - self.env['commands'][trigger][command].run() - except Exception as e: - self.env['runtime']['debug'].writeDebugOut("Executing trigger:" + trigger + "." + command + str(e) ,debug.debugLevel.ERROR) - - def executeCommand(self, command, section = 'commands'): - if self.env['runtime']['screenManager'].isSuspendingScreen(): - return - if self.commandExists(command, section): - try: - if self.env['runtime']['helpManager'].isTutorialMode() and section != 'help': - self.env['runtime']['debug'].writeDebugOut("Tutorial for command:" + section + "." + command ,debug.debugLevel.INFO) - description = self.getCommandDescription(command, section) - self.env['runtime']['outputManager'].presentText(description, interrupt=True) - else: - self.env['runtime']['debug'].writeDebugOut("Executing command:" + section + "." + command ,debug.debugLevel.INFO) - self.runCommand(command, section) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut("Executing command:" + section + "." + command +' ' + str(e),debug.debugLevel.ERROR) - - - def runCommand(self, command, section = 'commands'): - if self.commandExists(command, section): - try: - self.env['runtime']['debug'].writeDebugOut("runCommand command:" + section + "." + command ,debug.debugLevel.INFO) - self.env['commands'][section][command].run() - except Exception as e: - self.env['runtime']['debug'].writeDebugOut("runCommand command:" + section + "." + command +' ' + str(e),debug.debugLevel.ERROR) - self.env['commandInfo']['lastCommandExecutionTime'] = time.time() - - def getCommandDescription(self, command, section = 'commands'): - if self.commandExists(command, section): - try: - return self.env['commands'][section][command].getDescription() - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('commandManager.getCommandDescription:' + str(e),debug.debugLevel.ERROR) - self.env['commandInfo']['lastCommandExecutionTime'] = time.time() - - def commandExists(self, command, section = 'commands'): - return( command in self.env['commands'][section]) - def getShortcutForCommand(self, command): - shortcut = '' - try: - shortcut = list(self.env['bindings'].keys())[list(self.env['bindings'].values()).index(command)] - except: - pass - return shortcut diff --git a/src/fenrir/core/cursorManager.py b/src/fenrir/core/cursorManager.py deleted file mode 100644 index 2a3191e1..00000000 --- a/src/fenrir/core/cursorManager.py +++ /dev/null @@ -1,109 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -class cursorManager(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def clearMarks(self): - self.env['commandBuffer']['Marks']['1'] = None - self.env['commandBuffer']['Marks']['2'] = None - def isMarkSet(self): - return self.env['commandBuffer']['Marks']['1'] != None - def isSingleMark(self): - return self.env['commandBuffer']['Marks']['1'] != None and \ - self.env['commandBuffer']['Marks']['2'] == None - def isMultibleMark(self): - return self.env['commandBuffer']['Marks']['1'] != None and \ - self.env['commandBuffer']['Marks']['2'] != None - def setMark(self): - currCursor = None - if self.env['screen']['newCursorReview']: - currCursor = self.env['screen']['newCursorReview'].copy() - else: - currCursor = self.env['screen']['newCursor'].copy() - if not self.env['commandBuffer']['Marks']['1']: - self.env['commandBuffer']['Marks']['1'] = currCursor.copy() - return 1 - else: - self.env['commandBuffer']['Marks']['2'] = currCursor.copy() - return 2 - return 0 - def getReviewOrTextCursor(self): - if self.env['screen']['newCursorReview']: - return self.env['screen']['newCursorReview'].copy() - else: - return self.env['screen']['newCursor'].copy() - def clearReviewCursor(self): - if not self.isReviewMode(): - return - self.env['screen']['oldCursorReview'] = None - self.env['screen']['newCursorReview'] = None - - def isCursorHorizontalMove(self): - return self.env['screen']['newCursor']['x'] != self.env['screen']['oldCursor']['x'] - - def isCursorVerticalMove(self): - return self.env['screen']['newCursor']['y'] != self.env['screen']['oldCursor']['y'] - - def isReviewMode(self): - return self.env['screen']['newCursorReview'] != None - - def enterReviewModeCurrTextCursor(self, overwrite=False): - if self.isReviewMode() and not overwrite: - return - 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['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['screen']['oldCursorReview'] = self.env['screen']['newCursorReview'] - self.env['screen']['newCursorReview']['x'] = x - self.env['screen']['newCursorReview']['y'] = y - - def isApplicationWindowSet(self): - try: - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - if self.env['commandBuffer']['windowArea'][currApp]['1'] != None: - return True - except: - pass - return False - def setWindowForApplication(self): - if not self.env['commandBuffer']['Marks']['1']: - return False - if not self.env['commandBuffer']['Marks']['2']: - return False - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - self.env['commandBuffer']['windowArea'][currApp] = {} - - if self.env['commandBuffer']['Marks']['1']['x'] * self.env['commandBuffer']['Marks']['1']['y'] <= \ - self.env['commandBuffer']['Marks']['2']['x'] * self.env['commandBuffer']['Marks']['2']['y']: - self.env['commandBuffer']['windowArea'][currApp]['1'] = self.env['commandBuffer']['Marks']['1'].copy() - self.env['commandBuffer']['windowArea'][currApp]['2'] = self.env['commandBuffer']['Marks']['2'].copy() - else: - self.env['commandBuffer']['windowArea'][currApp]['1'] = self.env['commandBuffer']['Marks']['2'].copy() - self.env['commandBuffer']['windowArea'][currApp]['2'] = self.env['commandBuffer']['Marks']['1'].copy() - return True - def clearWindowForApplication(self): - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - try: - del self.env['commandBuffer']['windowArea'][currApp] - except: - return False - return True diff --git a/src/fenrir/core/debug.py b/src/fenrir/core/debug.py deleted file mode 100644 index 72b5a61a..00000000 --- a/src/fenrir/core/debug.py +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/python - -from enum import Enum - -class debugLevel(Enum): - DEACTIVE = 0 - ERROR = 1 - WARNING = 2 - INFO = 3 - def __int__(self): - return self.value - def __str__(self): - return self.name diff --git a/src/fenrir/core/debugManager.py b/src/fenrir/core/debugManager.py deleted file mode 100644 index 304ebbd7..00000000 --- a/src/fenrir/core/debugManager.py +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/python -# Debugger module for the Fenrir screen reader. - -from core import debug -from datetime import datetime - -class debugManager(): - def __init__(self, fileName='/var/log/fenrir.log'): - self._fileName = fileName - self._file = None - self._fileOpened = False - def initialize(self, environment): - self.env = environment - def shutdown(self): - self.closeDebugFile() - def __del__(self): - try: - self.shutdown() - except: - pass - - def openDebugFile(self, fileName = ''): - self._fileOpened = False - if fileName != '': - self._fileName = fileName - if self._fileName != '': - self._file = open(self._fileName,'a') - self._fileOpened = True - - def writeDebugOut(self, text, level = debug.debugLevel.DEACTIVE, onAnyLevel=False): - - mode = self.env['runtime']['settingsManager'].getSetting('general','debugMode') - if mode == '': - mode = 'FILE' - mode = mode.upper().split(',') - fileMode = 'FILE' in mode - printMode = 'PRINT' in mode - - if (self.env['runtime']['settingsManager'].getSettingAsInt('general','debugLevel') < int(level)) and \ - not (onAnyLevel and self.env['runtime']['settingsManager'].getSettingAsInt('general','debugLevel') > int(debug.debugLevel.DEACTIVE)) : - if self._fileOpened: - self.closeDebugFile() - return - else: - if not self._fileOpened and fileMode: - self.openDebugFile() - if onAnyLevel: - msg = 'ANY '+ str(level) + ' ' + str(datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f')) - else: - msg = str(level) +' ' + str(datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f') -) - msg += ': ' + text - if printMode: - print(msg) - if fileMode: - self._file.write(msg + '\n') - - def closeDebugFile(self): - if not self._fileOpened: - return False - if self._file != None: - self._file.close() - self._fileOpened = False - return True - - def getDebugFile(self): - return self._fileName - - def setDebugFile(self, fileName): - self.closeDebugFile() - self._fileName = fileName diff --git a/src/fenrir/core/environment.py b/src/fenrir/core/environment.py deleted file mode 100644 index b8838e15..00000000 --- a/src/fenrir/core/environment.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -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 = { -'screen': screenData, -'runtime': runtimeData, -'general': generalData, -'settings': settingsData, -'commandInfo': commandData.commandInfo, -'commandBuffer': commandData.commandBuffer, -'input': inputData, -'punctuation': punctuationData, -'output': outputData, -'soundIcons': {}, -'bindings': {}, -} diff --git a/src/fenrir/core/eventData.py b/src/fenrir/core/eventData.py deleted file mode 100644 index be5db45a..00000000 --- a/src/fenrir/core/eventData.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from enum import Enum - -class fenrirEventType(Enum): - Ignore = 0 - StopMainLoop = 1 - ScreenUpdate = 2 - KeyboardInput = 3 - BrailleInput = 4 - PlugInputDevice = 5 - BrailleFlush = 6 - ScreenChanged = 7 - HeartBeat = 8 # for time based scheduling - ExecuteCommand = 9 - def __int__(self): - return self.value - def __str__(self): - return self.name diff --git a/src/fenrir/core/eventManager.py b/src/fenrir/core/eventManager.py deleted file mode 100644 index d34ac94e..00000000 --- a/src/fenrir/core/eventManager.py +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from core.eventData import fenrirEventType -from queue import Empty -import time -from multiprocessing import Queue -from multiprocessing.sharedctypes import Value -from ctypes import c_bool - -class eventManager(): - def __init__(self): - self.running = Value(c_bool, True) - self._eventQueue = Queue() # multiprocessing.Queue() - self.cleanEventQueue() - def initialize(self, environment): - self.env = environment - def shutdown(self): - self.cleanEventQueue() - - def proceedEventLoop(self): - event = self._eventQueue.get() - st = time.time() - self.eventDispatcher(event) - #print('NET loop ' + str(time.time() - st)) - def eventDispatcher(self, event): - self.env['runtime']['debug'].writeDebugOut('eventManager:eventDispatcher:start: event:' + str(event['Type']) + ' QueueSize:' + str( self._eventQueue.qsize()),debug.debugLevel.INFO) - if not event: - return - if not event['Type']: - return - if event['Type'] == fenrirEventType.Ignore: - return - elif event['Type'] == fenrirEventType.StopMainLoop: - self.handleStopMainLoop(event) - elif event['Type'] == fenrirEventType.ScreenUpdate: - self.env['runtime']['fenrirManager'].handleScreenUpdate(event) - elif event['Type'] == fenrirEventType.KeyboardInput: - self.env['runtime']['fenrirManager'].handleInput(event) - elif event['Type'] == fenrirEventType.BrailleInput: - pass - elif event['Type'] == fenrirEventType.PlugInputDevice: - self.env['runtime']['fenrirManager'].handlePlugInputDevice(event) - pass - elif event['Type'] == fenrirEventType.BrailleFlush: - pass - elif event['Type'] == fenrirEventType.ScreenChanged: - self.env['runtime']['fenrirManager'].handleScreenChange(event) - elif event['Type'] == fenrirEventType.HeartBeat: - self.env['runtime']['fenrirManager'].handleHeartBeat(event) - elif event['Type'] == fenrirEventType.ExecuteCommand: - self.env['runtime']['fenrirManager'].handleExecuteCommand(event) - def isMainEventLoopRunning(self): - return self.running.value == 1 - def startMainEventLoop(self): - self.running.value = 1 - while( self.isMainEventLoopRunning()): - self.proceedEventLoop() - - def handleStopMainLoop(self, event): - self.running.value = 0 - time.sleep(0.1) - def stopMainEventLoop(self): - self._eventQueue.put({"Type":fenrirEventType.StopMainLoop,"Data":None}) - def cleanEventQueue(self): - if self._eventQueue.empty(): - return - try: - while True: - self._eventQueue.get_nowait() - except Empty: - pass - def getEventQueue(self): - return self._eventQueue - def getRunning(self): - return self.running - def putToEventQueue(self,event, data): - if not isinstance(event, fenrirEventType): - return False - self._eventQueue.put({"Type":event,"Data":data}) - return True diff --git a/src/fenrir/core/fenrirManager.py b/src/fenrir/core/fenrirManager.py deleted file mode 100644 index 92afa4f2..00000000 --- a/src/fenrir/core/fenrirManager.py +++ /dev/null @@ -1,185 +0,0 @@ -#!/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -import os, sys, signal, time - -from core import i18n -from core import settingsManager -from core import debug -from core.eventData import fenrirEventType -import argparse - -class fenrirManager(): - def __init__(self): - self.initialized = False - cliArgs = self.handleArgs() - if not cliArgs: - return - try: - self.environment = settingsManager.settingsManager().initFenrirConfig(cliArgs, self) - if not self.environment: - raise RuntimeError('Cannot Initialize. Maybe the configfile is not available or not parseable') - except RuntimeError: - raise - self.environment['runtime']['outputManager'].presentText(_("Start Fenrir"), soundIcon='ScreenReaderOn', interrupt=True) - signal.signal(signal.SIGINT, self.captureSignal) - signal.signal(signal.SIGTERM, self.captureSignal) - self.initialized = True - self.modifierInput = False - self.singleKeyCommand = False - self.command = '' - def handleArgs(self): - args = None - 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') - parser.add_argument('-d', '--debug', action='store_true', help='Turns on Debugmode') - parser.add_argument('-p', '--print', action='store_true', help='Print debug messages on screen') - try: - args = parser.parse_args() - except Exception as e: - parser.print_help() - return args - def proceed(self): - if not self.initialized: - return - self.environment['runtime']['eventManager'].startMainEventLoop() - self.shutdown() - def handleInput(self, event): - #startTime = time.time - self.environment['runtime']['debug'].writeDebugOut('DEBUG INPUT fenrirMan:' + str(event),debug.debugLevel.INFO) - if not event['Data']: - event['Data'] = self.environment['runtime']['inputManager'].getInputEvent() - if event['Data']: - event['Data']['EventName'] = self.environment['runtime']['inputManager'].convertEventName(event['Data']['EventName']) - self.environment['runtime']['inputManager'].handleInputEvent(event['Data']) - else: - return - if self.environment['runtime']['inputManager'].noKeyPressed(): - self.environment['runtime']['inputManager'].clearLastDeepInput() - if self.environment['runtime']['screenManager'].isSuspendingScreen(): - self.environment['runtime']['inputManager'].writeEventBuffer() - else: - if self.environment['runtime']['helpManager'].isTutorialMode(): - self.environment['runtime']['inputManager'].clearEventBuffer() - - self.detectCommand() - - if self.modifierInput: - self.environment['runtime']['inputManager'].clearEventBuffer() - if self.singleKeyCommand: - if self.environment['runtime']['inputManager'].noKeyPressed(): - self.environment['runtime']['inputManager'].clearEventBuffer() - else: - self.environment['runtime']['inputManager'].writeEventBuffer() - if self.environment['runtime']['inputManager'].noKeyPressed(): - self.modifierInput = False - self.singleKeyCommand = False - if self.environment['input']['keyForeward'] > 0: - self.environment['input']['keyForeward'] -=1 - self.environment['runtime']['commandManager'].executeDefaultTrigger('onInput') - #print('handleInput:',time.time() - startTime) - def handleExecuteCommand(self, event): - if event['Data'] == '': - return - command = event['Data'] - - if self.environment['runtime']['helpManager'].isTutorialMode(): - if self.environment['runtime']['commandManager'].commandExists( command, 'help'): - self.environment['runtime']['commandManager'].executeCommand( command, 'help') - return - self.environment['runtime']['commandManager'].executeCommand( command, 'commands') - def handleScreenChange(self, event): - self.environment['runtime']['screenManager'].hanldeScreenChange(event['Data']) - ''' - if self.environment['runtime']['applicationManager'].isApplicationChange(): - self.environment['runtime']['commandManager'].executeDefaultTrigger('onApplicationChange') - self.environment['runtime']['commandManager'].executeSwitchTrigger('onSwitchApplicationProfile', \ - self.environment['runtime']['applicationManager'].getPrevApplication(), \ - self.environment['runtime']['applicationManager'].getCurrentApplication()) - ''' - self.environment['runtime']['commandManager'].executeDefaultTrigger('onScreenChanged') - self.environment['runtime']['screenDriver'].getCurrScreen() - def handleScreenUpdate(self, event): - #startTime = time.time() - self.environment['runtime']['screenManager'].handleScreenUpdate(event['Data']) - ''' - if self.environment['runtime']['applicationManager'].isApplicationChange(): - self.environment['runtime']['commandManager'].executeDefaultTrigger('onApplicationChange') - self.environment['runtime']['commandManager'].executeSwitchTrigger('onSwitchApplicationProfile', \ - self.environment['runtime']['applicationManager'].getPrevApplication(), \ - self.environment['runtime']['applicationManager'].getCurrentApplication()) - ''' - # timout for the last keypress - if time.time() - self.environment['runtime']['inputManager'].getLastInputTime() >= 0.3: - self.environment['runtime']['inputManager'].clearLastDeepInput() - # has cursor changed? - if self.environment['runtime']['cursorManager'].isCursorVerticalMove() or \ - self.environment['runtime']['cursorManager'].isCursorHorizontalMove(): - self.environment['runtime']['commandManager'].executeDefaultTrigger('onCursorChange') - self.environment['runtime']['commandManager'].executeDefaultTrigger('onScreenUpdate') - self.environment['runtime']['inputManager'].clearLastDeepInput() - #print('handleScreenUpdate:',time.time() - startTime) - - def handlePlugInputDevice(self, event): - self.environment['runtime']['commandManager'].executeDefaultTrigger('onPlugInputDevice', force=True) - - def handleHeartBeat(self, event): - self.environment['runtime']['commandManager'].executeDefaultTrigger('onHeartBeat',force=True) - #self.environment['runtime']['outputManager'].brailleText(flush=False) - - def detectCommand(self): - if self.environment['input']['keyForeward'] > 0: - return - if self.environment['runtime']['inputManager'].isKeyPress(): - self.modifierInput = self.environment['runtime']['inputManager'].currKeyIsModifier() - else: - if not self.environment['runtime']['inputManager'].noKeyPressed(): - if self.singleKeyCommand: - self.singleKeyCommand = len( self.environment['runtime']['inputManager'].getLastDeepestInput() ) == 1 - # key is already released. we need the old one - if not( self.singleKeyCommand and self.environment['runtime']['inputManager'].noKeyPressed()): - shortcut = self.environment['runtime']['inputManager'].getCurrShortcut() - self.command = self.environment['runtime']['inputManager'].getCommandForShortcut(shortcut) - if not self.modifierInput: - if self.environment['runtime']['inputManager'].isKeyPress(): - if self.command != '': - self.singleKeyCommand = True - - if not (self.singleKeyCommand or self.modifierInput): - return - - # fire event - if self.command != '': - if self.modifierInput: - self.environment['runtime']['eventManager'].putToEventQueue(fenrirEventType.ExecuteCommand, self.command) - self.command = '' - else: - if self.singleKeyCommand: - if self.environment['runtime']['inputManager'].noKeyPressed(): - self.environment['runtime']['eventManager'].putToEventQueue(fenrirEventType.ExecuteCommand, self.command) - self.command = '' - - def shutdownRequest(self): - try: - self.environment['runtime']['eventManager'].stopMainEventLoop() - except: - pass - def captureSignal(self, siginit, frame): - self.shutdownRequest() - - def shutdown(self): - self.environment['runtime']['eventManager'].stopMainEventLoop() - self.environment['runtime']['outputManager'].presentText(_("Quit Fenrir"), soundIcon='ScreenReaderOff', interrupt=True) - self.environment['runtime']['eventManager'].cleanEventQueue() - time.sleep(1) - for currManager in self.environment['general']['managerList']: - if self.environment['runtime'][currManager]: - self.environment['runtime'][currManager].shutdown() - del self.environment['runtime'][currManager] - - self.environment = None - diff --git a/src/fenrir/core/generalData.py b/src/fenrir/core/generalData.py deleted file mode 100644 index 98404ccf..00000000 --- a/src/fenrir/core/generalData.py +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -generalData = { -'args': None, -'tutorialMode': False, -'currUser':'', -'prevUser':'', -'managerList':['processManager', 'punctuationManager', 'cursorManager', 'applicationManager', 'commandManager' - , 'screenManager', 'inputManager','outputManager', 'helpManager', 'memoryManager', 'eventManager', 'debug'], -'commandFolderList':['commands','onInput', 'onCursorChange', 'onScreenUpdate','onScreenChanged','onHeartBeat', 'onPlugInputDevice' - ,'onApplicationChange','onSwitchApplicationProfile','help',], -} diff --git a/src/fenrir/core/headLineManager.py b/src/fenrir/core/headLineManager.py deleted file mode 100644 index 54ed1bb3..00000000 --- a/src/fenrir/core/headLineManager.py +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -import re, string - -class headLineManager(): - def __init__(self): - self.regExSingle = re.compile(r'(([^\w\s])\2{5,})') - self.regExDouble = re.compile(r'([^\w\s]{2,}){5,}') - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def replaceHeadLines(self, text): - # fast len check for bigger typing echo - if len(text) < 5: - return text - # more strong check, to not match if not needed: - if len(text.strip(string.ascii_letters+string.digits+string.whitespace)) < 5: - return text - result = '' - newText = '' - lastPos = 0 - for match in self.regExDouble.finditer(text): - span = match.span() - newText += text[lastPos:span[0]] - numberOfChars = len(text[span[0]:span[1]]) - name = text[span[0]:span[1]][:2] - if name[0] == name[1]: - newText += ' ' + str(numberOfChars) + ' ' + self.env['runtime']['punctuationManager'].proceedPunctuation(name[0], True) + ' ' - else: - newText += ' ' + str(int(numberOfChars / 2)) + ' ' + self.env['runtime']['punctuationManager'].proceedPunctuation(name, True) + ' ' - lastPos = span[1] - if lastPos != 0: - newText += ' ' - newText += text[lastPos:] - lastPos = 0 - for match in self.regExSingle.finditer(newText): - span = match.span() - result += text[lastPos:span[0]] - numberOfChars = len(newText[span[0]:span[1]]) - name = newText[span[0]:span[1]][:2] - if name[0] == name[1]: - result += ' ' + str(numberOfChars) + ' ' + self.env['runtime']['punctuationManager'].proceedPunctuation(name[0], True) + ' ' - else: - result += ' ' + str(int(numberOfChars / 2)) + ' ' + self.env['runtime']['punctuationManager'].proceedPunctuation(name, True) + ' ' - lastPos = span[1] - if lastPos != 0: - result += ' ' - result += newText[lastPos:] - return result diff --git a/src/fenrir/core/helpManager.py b/src/fenrir/core/helpManager.py deleted file mode 100755 index 0370ed70..00000000 --- a/src/fenrir/core/helpManager.py +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - - -class helpManager(): - def __init__(self): - self.helpDict = {} - self.tutorialListIndex = None - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def toggleTutorialMode(self): - self.setTutorialMode(not self.env['general']['tutorialMode']) - def setTutorialMode(self, newTutorialMode): - self.env['general']['tutorialMode'] = newTutorialMode - if newTutorialMode: - self.createHelpDict() - self.env['bindings'][str([1, ['KEY_ESC']])] = 'TOGGLE_TUTORIAL_MODE' - self.env['bindings'][str([1, ['KEY_UP']])] = 'PREV_HELP' - self.env['bindings'][str([1, ['KEY_DOWN']])] = 'NEXT_HELP' - self.env['bindings'][str([1, ['KEY_SPACE']])] = 'CURR_HELP' - else: - try: - del(self.env['bindings'][str([1, ['KEY_ESC']])]) - del(self.env['bindings'][str([1, ['KEY_UP']])]) - del(self.env['bindings'][str([1, ['KEY_DOWN']])]) - del(self.env['bindings'][str([1, ['KEY_SPACE']])]) - except: - pass - def isTutorialMode(self): - return self.env['general']['tutorialMode'] - def getCommandHelpText(self, command, section = 'commands'): - commandName = command.lower() - commandName = commandName.split('__-__')[0] - commandName = commandName.replace('_',' ') - commandName = commandName.replace('_',' ') - if command == 'TOGGLE_TUTORIAL_MODE': - commandDescription = _('toggles the tutorial mode') - else: - commandDescription = self.env['runtime']['commandManager'].getCommandDescription( command, section = 'commands') - if commandDescription == '': - commandDescription = 'no Description available' - commandShortcut = self.env['runtime']['commandManager'].getShortcutForCommand( command) - commandShortcut = commandShortcut.replace('KEY_',' ') - commandShortcut = commandShortcut.replace('[','') - commandShortcut = commandShortcut.replace(']','') - commandShortcut = commandShortcut.replace("'",'') - if commandShortcut == '': - commandShortcut = 'unbound' - helptext = commandName + ', Shortcut ' + commandShortcut + ', Description ' + commandDescription - return helptext - def createHelpDict(self, section = 'commands'): - self.helpDict = {} - for command in sorted(self.env['commands'][section].keys()): - self.helpDict[len(self.helpDict)] = self.getCommandHelpText(command, section) - if len(self.helpDict) > 0: - self.tutorialListIndex = 0 - else: - self.tutorialListIndex = None - def getHelpForCurrentIndex(self): - if self.tutorialListIndex == None: - return '' - return self.helpDict[self.tutorialListIndex] - def nextIndex(self): - if self.tutorialListIndex == None: - return - self.tutorialListIndex += 1 - if self.tutorialListIndex >= len(self.helpDict): - self.tutorialListIndex = 0 - def prevIndex(self): - if self.tutorialListIndex == None: - return - self.tutorialListIndex -= 1 - if self.tutorialListIndex < 0: - self.tutorialListIndex = len(self.helpDict) - 1 diff --git a/src/fenrir/core/i18n.py b/src/fenrir/core/i18n.py deleted file mode 100644 index 6f1c3085..00000000 --- a/src/fenrir/core/i18n.py +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -import gettext -import locale - -# the only function we really need to call here is gettext.install. Python3 has simplified this. -gettext.install("fenrir") diff --git a/src/fenrir/core/inputData.py b/src/fenrir/core/inputData.py deleted file mode 100644 index 6b2fdf95..00000000 --- a/src/fenrir/core/inputData.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -import time - -inputData = { -'currInput': [], -'prevDeepestInput': [], -'eventBuffer': [], -'shortcutRepeat': 0, -'fenrirKey': [], -'scriptKey': [], -'keyForeward': 0, -'lastInputTime':time.time(), -'oldNumLock': True, -'newNumLock':True, -'oldScrollLock': True, -'newScrollLock':True, -'oldCapsLock':False, -'newCapsLock':False -} - -inputEvent = { -'EventName': '', -'EventValue': '', -'EventSec': 0, -'EventUsec': 0, -'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/inputDriver.py b/src/fenrir/core/inputDriver.py deleted file mode 100644 index f4d19e46..00000000 --- a/src/fenrir/core/inputDriver.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -class inputDriver(): - def __init__(self): - self._initialized = False - def initialize(self, environment): - self.env = environment - self._isInitialized = True - def shutdown(self): - if self._initialized: - self.releaseDevices() - self._isInitialized = False - def getInputEvent(self): - time.sleep(0.05) - return None - def handleInputEvent(self, event): - time.sleep(0.05) - if not self._initialized: - return - def writeEventBuffer(self): - if not self._initialized: - return - def clearEventBuffer(self): - if not self._initialized: - return - del self.env['input']['eventBuffer'][:] - def updateInputDevices(self, force = False, init = False): - if not self._initialized: - return - def getLedState(self, led = 0): - if not self._initialized: - return False - return False - def toggleLedState(self, led = 0): - if not self._initialized: - return None - def grabDevices(self): - if not self._initialized: - return None - def releaseDevices(self): - if not self._initialized: - return None - def __del__(self): - if not self._initialized: - return None - self.releaseDevices() diff --git a/src/fenrir/core/inputManager.py b/src/fenrir/core/inputManager.py deleted file mode 100644 index 43195074..00000000 --- a/src/fenrir/core/inputManager.py +++ /dev/null @@ -1,212 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -import time -from core import debug - -class inputManager(): - def __init__(self): - self.setLedState = True - def initialize(self, environment): - self.env = environment - self.env['runtime']['settingsManager'].loadDriver(\ - self.env['runtime']['settingsManager'].getSetting('keyboard', 'driver'), 'inputDriver') - self.updateInputDevices() - # init LEDs with current state - self.env['input']['newNumLock'] = self.env['runtime']['inputDriver'].getLedState() - self.env['input']['oldNumLock'] = self.env['input']['newNumLock'] - self.env['input']['newCapsLock'] = self.env['runtime']['inputDriver'].getLedState(1) - self.env['input']['oldCapsLock'] = self.env['input']['newCapsLock'] - self.env['input']['newScrollLock'] = self.env['runtime']['inputDriver'].getLedState(2) - self.env['input']['oldScrollLock'] = self.env['input']['newScrollLock'] - self.lastDeepestInput = [] - self.lastInputTime = time.time() - def shutdown(self): - self.removeAllDevices() - self.env['runtime']['settingsManager'].shutdownDriver('inputDriver') - def getInputEvent(self): - return self.env['runtime']['inputDriver'].getInputEvent() - def handleInputEvent(self, eventData): - self.env['runtime']['debug'].writeDebugOut('DEBUG INPUT inputMan:' + str(eventData),debug.debugLevel.INFO) - if not eventData: - return - self.env['input']['prevInput'] = self.env['input']['currInput'].copy() - if eventData['EventState'] == 0: - if eventData['EventName'] in self.env['input']['currInput']: - self.env['input']['currInput'].remove(eventData['EventName']) - if len(self.env['input']['currInput']) > 1: - self.env['input']['currInput'] = sorted(self.env['input']['currInput']) - elif len(self.env['input']['currInput']) == 0: - self.env['input']['shortcutRepeat'] = 1 - self.setLedState = self.handleLedStates(eventData) - self.lastInputTime = time.time() - elif eventData['EventState'] == 1: - if not eventData['EventName'] in self.env['input']['currInput']: - self.env['input']['currInput'].append(eventData['EventName']) - if len(self.env['input']['currInput']) > 1: - self.env['input']['currInput'] = sorted(self.env['input']['currInput']) - if len(self.lastDeepestInput) < len(self.env['input']['currInput']): - self.setLastDeepestInput( self.env['input']['currInput'].copy()) - elif self.lastDeepestInput == self.env['input']['currInput']: - if time.time() - self.lastInputTime <= self.env['runtime']['settingsManager'].getSettingAsFloat('keyboard','doubleTapTimeout'): - self.env['input']['shortcutRepeat'] += 1 - else: - self.env['input']['shortcutRepeat'] = 1 - self.setLedState = self.handleLedStates(eventData) - self.lastInputTime = time.time() - elif eventData['EventState'] == 2: - self.lastInputTime = time.time() - - self.env['input']['oldNumLock'] = self.env['input']['newNumLock'] - self.env['input']['newNumLock'] = self.env['runtime']['inputDriver'].getLedState() - self.env['input']['oldCapsLock'] = self.env['input']['newCapsLock'] - self.env['input']['newCapsLock'] = self.env['runtime']['inputDriver'].getLedState(1) - self.env['input']['oldScrollLock'] = self.env['input']['newScrollLock'] - self.env['input']['newScrollLock'] = self.env['runtime']['inputDriver'].getLedState(2) - self.env['runtime']['debug'].writeDebugOut("currInput " + str(self.env['input']['currInput'] ) ,debug.debugLevel.INFO) - if self.noKeyPressed(): - self.env['input']['prevInput'] = [] - self.setLedState = True - - def handleLedStates(self, mEvent): - if not self.setLedState: - return self.setLedState - if mEvent['EventName'] == 'KEY_NUMLOCK': - if mEvent['EventState'] == 1 and not self.env['input']['newNumLock'] == 1: - self.env['runtime']['inputDriver'].toggleLedState() - return False - if mEvent['EventState'] == 0 and not self.env['input']['newNumLock'] == 0: - self.env['runtime']['inputDriver'].toggleLedState() - return False - if mEvent['EventName'] == 'KEY_CAPSLOCK': - if mEvent['EventState'] == 1 and not self.env['input']['newCapsLock'] == 1: - self.env['runtime']['inputDriver'].toggleLedState(1) - return False - if mEvent['EventState'] == 0 and not self.env['input']['newCapsLock'] == 0: - self.env['runtime']['inputDriver'].toggleLedState(1) - return False - if mEvent['EventName'] == 'KEY_SCROLLLOCK': - if mEvent['EventState'] == 1 and not self.env['input']['newScrollLock'] == 1: - self.env['runtime']['inputDriver'].toggleLedState(2) - return False - if mEvent['EventState'] == 0 and not self.env['input']['newScrollLock'] == 0: - self.env['runtime']['inputDriver'].toggleLedState(2) - return False - return self.setLedState - - def grabAllDevices(self): - if self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'): - self.env['runtime']['inputDriver'].grabAllDevices() - - def updateInputDevices(self): - try: - self.env['runtime']['inputDriver'].updateInputDevices() - except: - pass - - def removeAllDevices(self): - try: - self.env['runtime']['inputDriver'].removeAllDevices() - except: - pass - - def convertEventName(self, eventName): - if not eventName: - return '' - if eventName == '': - return '' - eventName = eventName.upper() - if eventName == 'KEY_LEFTCTRL': - eventName = 'KEY_CTRL' - elif eventName == 'KEY_RIGHTCTRL': - eventName = 'KEY_CTRL' - elif eventName == 'KEY_LEFTSHIFT': - eventName = 'KEY_SHIFT' - elif eventName == 'KEY_RIGHTSHIFT': - eventName = 'KEY_SHIFT' - elif eventName == 'KEY_LEFTALT': - eventName = 'KEY_ALT' - elif eventName == 'KEY_RIGHTALT': - eventName = 'KEY_ALT' - elif eventName == 'KEY_LEFTMETA': - eventName = 'KEY_META' - elif eventName == 'KEY_RIGHTMETA': - eventName = 'KEY_META' - if self.isFenrirKey(eventName): - eventName = 'KEY_FENRIR' - if self.isScriptKey(eventName): - eventName = 'KEY_SCRIPT' - return eventName - - def clearEventBuffer(self): - self.env['runtime']['inputDriver'].clearEventBuffer() - def setLastDeepestInput(self, currentDeepestInput): - self.lastDeepestInput = currentDeepestInput - def clearLastDeepInput(self): - self.lastDeepestInput = [] - def getLastInputTime(self): - return self.lastInputTime - def getLastDeepestInput(self): - return self.lastDeepestInput - def writeEventBuffer(self): - try: - if self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'): - self.env['runtime']['inputDriver'].writeEventBuffer() - self.clearEventBuffer() - except Exception as e: - self.env['runtime']['debug'].writeDebugOut("Error while writeUInput",debug.debugLevel.ERROR) - self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR) - - def noKeyPressed(self): - return self.env['input']['currInput'] == [] - def isKeyPress(self): - return (self.env['input']['prevInput'] == []) and (self.env['input']['currInput'] != []) - def getPrevDeepestShortcut(self): - shortcut = [] - shortcut.append(self.env['input']['shortcutRepeat']) - shortcut.append(self.getLastDeepestInput()) - return str(shortcut) - - def getPrevShortcut(self): - shortcut = [] - shortcut.append(self.env['input']['shortcutRepeat']) - shortcut.append(self.env['input']['prevInput']) - return str(shortcut) - - def getCurrShortcut(self, inputSequence = None): - shortcut = [] - shortcut.append(self.env['input']['shortcutRepeat']) - if inputSequence: - shortcut.append(inputSequence) - else: - shortcut.append(self.env['input']['currInput']) - if len(self.env['input']['prevInput']) < len(self.env['input']['currInput']): - if self.env['input']['shortcutRepeat'] > 1 and not self.shortcutExists(str(shortcut)): - shortcut = [] - self.env['input']['shortcutRepeat'] = 1 - shortcut.append(self.env['input']['shortcutRepeat']) - shortcut.append(self.env['input']['currInput']) - self.env['runtime']['debug'].writeDebugOut("currShortcut " + str(shortcut) ,debug.debugLevel.INFO) - return str(shortcut) - - def currKeyIsModifier(self): - if len(self.getLastDeepestInput()) != 1: - return False - return (self.env['input']['currInput'][0] =='KEY_FENRIR') or (self.env['input']['currInput'][0] == 'KEY_SCRIPT') - - def isFenrirKey(self, eventName): - return eventName in self.env['input']['fenrirKey'] - - def isScriptKey(self, eventName): - return eventName in self.env['input']['scriptKey'] - - def getCommandForShortcut(self, shortcut): - if not self.shortcutExists(shortcut): - return '' - return self.env['bindings'][shortcut] - - def shortcutExists(self, shortcut): - return(shortcut in self.env['bindings']) diff --git a/src/fenrir/core/memoryManager.py b/src/fenrir/core/memoryManager.py deleted file mode 100644 index 797d4e71..00000000 --- a/src/fenrir/core/memoryManager.py +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -import time -from core import debug - -class memoryManager(): - def __init__(self): - self.listStorage = {} - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def listStorageValid(self,name, checkIndex = False): - try: - if checkIndex: - index = self.listStorage[name]['index'] - if index == -1: - return self.listStorage[name]['list'] == [] - return self.listStorage[name]['list'][index] != None - else: - return isinstance(self.listStorage[name]['list'],list) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut("listStorageValid " + str(e),debug.debugLevel.ERROR) - return False - def addValueToFirstIndex(self, name, value): - if not self.listStorageValid(name): - return - if self.listStorage[name]['maxLength'] == None: - self.listStorage[name]['list'] = [value] + self.listStorage[name]['list'] - else: - self.listStorage[name]['list'] = [value] + self.listStorage[name]['list'][:self.listStorage[name]['maxLength'] -1] - self.listStorage[name]['index'] = 0 - def addIndexList(self, name, maxLength = None, currList = [], currIndex = -1): - if len(currList) != 0 and (currIndex == -1): - currIndex = 0 - self.listStorage[name] = {'list': currList, 'index': currIndex, 'maxLength': maxLength} - def isLastIndex(self, name): - if not self.listStorageValid(name): - return False - return self.listStorage[name]['index'] == len(self.listStorage[name]['list']) - 1 - def isFirstIndex(self, name): - if not self.listStorageValid(name): - return False - return self.listStorage[name]['index'] == 0 - def getNextIndex(self, name): - if not self.listStorageValid(name): - return False - if self.isIndexListEmpty(name): - self.listStorage[name]['index'] = -1 - return False - self.listStorage[name]['index'] += 1 - if self.listStorage[name]['index'] > len(self.listStorage[name]['list']) -1: - self.listStorage[name]['index'] = 0 - return True - def setPrefIndex(self, name): - if not self.listStorageValid(name): - return False - if self.isIndexListEmpty(name): - self.listStorage[name]['index'] = -1 - return False - self.listStorage[name]['index'] -= 1 - if self.listStorage[name]['index'] < 0: - self.listStorage[name]['index'] = len(self.listStorage[name]['list']) -1 - return True - def setFirstIndex(self, name): - if not self.listStorageValid(name): - return False - if self.isIndexListEmpty(name): - self.listStorage[name]['index'] = -1 - return False - self.listStorage[name]['index'] = 0 - return True - def getIndexListLen(self, name): - if not self.listStorageValid(name): - return 0 - if self.isIndexListEmpty(name): - self.listStorage[name]['index'] = -1 - return 0 - return len(self.listStorage[name]) - def setLastIndex(self, name): - if not self.listStorageValid(name): - return False - if self.isIndexListEmpty(name): - self.listStorage[name]['index'] = -1 - return False - self.listStorage[name]['index'] = len(self.listStorage[name]['list']) -1 - return True - def clearCurrentIndexList(self, name): - if not self.listStorageValid(name): - return False - self.listStorage[name]['index'] = [] - self.listStorage[name]['index'] = -1 - def getCurrentIndex(self,name): - if not self.listStorageValid(name): - return False - if self.isIndexListEmpty(name): - self.listStorage[name]['index'] = -1 - return False - try: - return self.listStorage[name]['index'] - except: - retrun -1 - def isIndexListEmpty(self, name): - if not self.listStorageValid(name): - return False - return len(self.listStorage[name]['list']) == 0 - def getIndexListElement(self, name): - if not self.listStorageValid(name): - return None - if self.isIndexListEmpty(name): - self.listStorage[name]['index'] = -1 - return None - currIndex = self.getCurrentIndex(name) - if currIndex == -1: - return None - try: - return self.listStorage[name]['list'][currIndex] - except: - return None diff --git a/src/fenrir/core/outputData.py b/src/fenrir/core/outputData.py deleted file mode 100644 index 684acd60..00000000 --- a/src/fenrir/core/outputData.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -import time -from core import debug - -outputData = { -'nextFlush': time.time(), -'messageText': '', -'messageOffset': None, -'cursorOffset': None, -} diff --git a/src/fenrir/core/outputManager.py b/src/fenrir/core/outputManager.py deleted file mode 100644 index ff59ed02..00000000 --- a/src/fenrir/core/outputManager.py +++ /dev/null @@ -1,272 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from utils import line_utils -import string, time, re - -class outputManager(): - def __init__(self): - self.lastEcho = '' - def initialize(self, environment): - self.env = environment - self.env['runtime']['settingsManager'].loadDriver(\ - self.env['runtime']['settingsManager'].getSetting('speech', 'driver'), 'speechDriver') - self.env['runtime']['settingsManager'].loadDriver(\ - self.env['runtime']['settingsManager'].getSetting('sound', 'driver'), 'soundDriver') - self.env['runtime']['settingsManager'].loadDriver(\ - self.env['runtime']['settingsManager'].getSetting('braille', 'driver'), 'brailleDriver') - def shutdown(self): - self.env['runtime']['settingsManager'].shutdownDriver('soundDriver') - self.env['runtime']['settingsManager'].shutdownDriver('speechDriver') - self.env['runtime']['settingsManager'].shutdownDriver('brailleDriver') - - def presentText(self, text, interrupt=True, soundIcon = '', ignorePunctuation=False, announceCapital=False, flush=True): - if text == '': - return - self.env['runtime']['debug'].writeDebugOut("presentText:\nsoundIcon:'"+soundIcon+"'\nText:\n" + text ,debug.debugLevel.INFO) - if self.playSoundIcon(soundIcon, interrupt): - self.env['runtime']['debug'].writeDebugOut("soundIcon found" ,debug.debugLevel.INFO) - return - if (len(text) > 1) and (text.strip(string.whitespace) == ''): - return - toAnnounceCapital = announceCapital and text[0].isupper() - if toAnnounceCapital: - if self.playSoundIcon('capital', False): - toAnnounceCapital = False - self.lastEcho = text - self.speakText(text, interrupt, ignorePunctuation,toAnnounceCapital) - if flush: - self.brailleText(text, flush) - def getLastEcho(self): - return self.lastEcho - def speakText(self, text, interrupt=True, ignorePunctuation=False, announceCapital=False): - if not self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'enabled'): - self.env['runtime']['debug'].writeDebugOut("Speech disabled in outputManager.speakText",debug.debugLevel.INFO) - return - if self.env['runtime']['speechDriver'] == None: - self.env['runtime']['debug'].writeDebugOut("No speechDriver in outputManager.speakText",debug.debugLevel.ERROR) - return - if interrupt: - self.interruptOutput() - try: - self.env['runtime']['speechDriver'].setLanguage(self.env['runtime']['settingsManager'].getSetting('speech', 'language')) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut("setting speech language in outputManager.speakText",debug.debugLevel.ERROR) - self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR) - - try: - self.env['runtime']['speechDriver'].setVoice(self.env['runtime']['settingsManager'].getSetting('speech', 'voice')) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut("Error while setting speech voice in outputManager.speakText",debug.debugLevel.ERROR) - self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR) - - try: - if announceCapital: - self.env['runtime']['speechDriver'].setPitch(self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'capitalPitch')) - else: - self.env['runtime']['speechDriver'].setPitch(self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'pitch')) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut("setting speech pitch in outputManager.speakText",debug.debugLevel.ERROR) - self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR) - - try: - self.env['runtime']['speechDriver'].setRate(self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'rate')) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut("setting speech rate in outputManager.speakText",debug.debugLevel.ERROR) - self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR) - - try: - self.env['runtime']['speechDriver'].setModule(self.env['runtime']['settingsManager'].getSetting('speech', 'module')) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut("setting speech module in outputManager.speakText",debug.debugLevel.ERROR) - self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR) - - try: - self.env['runtime']['speechDriver'].setVolume(self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'volume')) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut("setting speech volume in outputManager.speakText ",debug.debugLevel.ERROR) - self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR) - - try: - cleanText = text.replace('\n',' , ') - cleanText = self.env['runtime']['headLineManager'].replaceHeadLines(cleanText) - cleanText = self.env['runtime']['punctuationManager'].proceedPunctuation(cleanText, ignorePunctuation) - cleanText = re.sub(' +$',' ', cleanText) - self.env['runtime']['speechDriver'].speak(cleanText) - self.env['runtime']['debug'].writeDebugOut("Speak: "+ cleanText,debug.debugLevel.INFO) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut("\"speak\" in outputManager.speakText ",debug.debugLevel.ERROR) - self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR) - - def brailleText(self, text='', flush=True): - if not self.env['runtime']['settingsManager'].getSettingAsBool('braille', 'enabled'): - return - if self.env['runtime']['brailleDriver'] == None: - return - if flush: - self.env['output']['nextFlush'] = time.time() + self.getFlushTime(text) - self.env['output']['messageOffset'] = {'x':0,'y':0} - self.env['output']['messageText'] = text - displayText = self.getBrailleTextWithOffset(self.env['output']['messageText'], self.env['output']['messageOffset']) - self.env['runtime']['brailleDriver'].writeText('flush '+ displayText) - else: - if self.env['output']['nextFlush'] < time.time(): - if self.env['output']['messageText'] != '': - self.env['output']['messageText'] = '' - if self.env['output']['messageOffset'] != None: - self.env['output']['messageOffset'] = None - cursor = self.getBrailleCursor() - x, y, self.env['output']['brlText'] = \ - 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']) - self.env['runtime']['brailleDriver'].writeText('flush'+displayText) - - def getBrailleCursor(self): - if self.env['runtime']['settingsManager'].getSetting('braille', 'cursorFollowMode').upper() == 'REVIEW': - return self.env['runtime']['cursorManager'].getReviewOrTextCursor() - if self.env['runtime']['settingsManager'].getSetting('braille', 'cursorFollowMode').upper() == 'MANUAL': - return self.env['runtime']['cursorManager'].getReviewOrTextCursor() - if self.env['runtime']['settingsManager'].getSetting('braille', 'cursorFollowMode').upper() == 'LAST': - return self.env['runtime']['cursorManager'].getReviewOrTextCursor() - return self.env['runtime']['cursorManager'].getReviewOrTextCursor() - - def getFixCursorCell(self): - size = self.env['runtime']['brailleDriver'].getDeviceSize()[0] - fixCell = self.env['runtime']['settingsManager'].getSettingAsInt('braille', 'fixCursorOnCell') - if fixCell <= -1: - return size[0] - if fixCell >= size[0]: - return size[0] - return fixCell - def getActiveOffsetAndText(self): - 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['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: - return size[0] - if self.env['runtime']['settingsManager'].getSettingAsInt('braille', 'panSizeHorizontal') >= size[0]: - return size[0] - return self.env['runtime']['settingsManager'].getSettingAsInt('braille', 'panSizeHorizontal') - def getHorizontalPanLevel(self,offsetChange = 0): - panned = True - panSize = self.getHorizontalPanSize() - offset, text = self.getActiveOffsetAndText() - currline = text.split('\n')[offset['y']] - newOffsetStart = (int(offset['x'] / panSize) + offsetChange) * panSize - if newOffsetStart < 0: - newOffsetStart = 0 - panned = False - if newOffsetStart >= len(text): - newOffsetStart = int((len(text) - panSize - 1) / panSize) - panned = False - return newOffsetStart, panned - def setPanLeft(self): - newPan, panned = self.getHorizontalPanLevel(-1) - if self.env['output']['messageOffset']: - self.env['output']['messageOffset'] = newPan.copy() - else: - self.env['output']['cursorOffset'] = newPan.copy() - return panned - def setPanRight(self): - newPan, panned = self.getHorizontalPanLevel(1) - if self.env['output']['messageOffset']: - self.env['output']['messageOffset'] = newPan.copy() - else: - self.env['output']['cursorOffset'] = newPan.copy() - return panned - def removePanning(self): - if self.env['output']['messageOffset']: - self.env['output']['messageOffset'] = None - else: - self.env['output']['cursorOffset'] = None - def getBrailleTextWithOffset(self, text, offset = None, cursor = None): - if text == '': - return '' - size = self.env['runtime']['brailleDriver'].getDeviceSize() - offsetText = text - - if cursor and not offset: - if self.env['runtime']['settingsManager'].getSetting('braille', 'cursorFollowMode').upper() == 'FIXCELL': - #fix cell - cursorCell = self.getFixCursorCell() - offsetStart = cursor['x'] - if offsetStart < size[0]: - if offsetStart <= cursorCell: - return offsetText[0: size[0]] - - offsetStart -= cursorCell - if offsetStart >= len(offsetText): - offsetStart = len(offsetText) - 1 - else: - # page and fallback - offsetStart = int(cursor['x'] / size[0]) * size[0] - else: - if not offset: - offset = {'x':0,'y':0} - offsetStart = offset['x'] - if offsetStart >= len(offsetText): - offsetStart = len(offsetText) - size[0] - - if offsetStart < 0: - offsetStart = 0 - offsetEnd = offsetStart + size[0] - offsetText = offsetText[offsetStart: offsetEnd] - return offsetText - def interruptOutput(self): - self.env['runtime']['speechDriver'].cancel() - self.env['runtime']['debug'].writeDebugOut("Interrupt speech",debug.debugLevel.INFO) - - def clearFlushTime(self): - self.setFlushTime(0.0) - - def setFlushTime(self,newTime): - self.env['output']['nextFlush'] = newTime - - def getFlushTime(self,text=''): - if self.env['runtime']['settingsManager'].getSettingAsFloat('braille', 'flushTimeout') < 0 or \ - self.env['runtime']['settingsManager'].getSetting('braille', 'flushMode').upper() == 'NONE': - return 999999999999 - if self.env['runtime']['settingsManager'].getSetting('braille', 'flushMode').upper() == 'FIX': - return self.env['runtime']['settingsManager'].getSettingAsFloat('braille', 'flushTimeout') - if self.env['runtime']['settingsManager'].getSetting('braille', 'flushMode').upper() == 'CHAR': - return self.env['runtime']['settingsManager'].getSettingAsFloat('braille', 'flushTimeout') * len(text) - if self.env['runtime']['settingsManager'].getSetting('braille', 'flushMode').upper() == 'WORD': - wordsList = text.split(' ') - return self.env['runtime']['settingsManager'].getSettingAsFloat('braille', 'flushTimeout') * len( list( filter(None, wordsList) ) ) - - def playSoundIcon(self, soundIcon = '', interrupt=True): - if soundIcon == '': - return False - soundIcon = soundIcon.upper() - if not self.env['runtime']['settingsManager'].getSettingAsBool('sound', 'enabled'): - self.env['runtime']['debug'].writeDebugOut("Sound disabled in outputManager.speakText",debug.debugLevel.INFO) - return False - - if self.env['runtime']['soundDriver'] == None: - self.env['runtime']['debug'].writeDebugOut("No speechDriver in outputManager.speakText",debug.debugLevel.ERROR) - return False - try: - self.env['runtime']['soundDriver'].setVolume(self.env['runtime']['settingsManager'].getSettingAsFloat('sound', 'volume')) - self.env['runtime']['soundDriver'].playSoundFile(self.env['soundIcons'][soundIcon], interrupt) - return True - except Exception as e: - self.env['runtime']['debug'].writeDebugOut("\"playSoundIcon\" in outputManager.speakText ",debug.debugLevel.ERROR) - self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR) - return False - def announceActiveCursor(self, interrupt_p=False): - if self.env['runtime']['cursorManager'].isReviewMode(): - self.presentText(' review cursor ', interrupt=interrupt_p) - else: - self.presentText(' text cursor ', interrupt=interrupt_p) - diff --git a/src/fenrir/core/processManager.py b/src/fenrir/core/processManager.py deleted file mode 100644 index 0f29837a..00000000 --- a/src/fenrir/core/processManager.py +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from core.eventData import fenrirEventType -import time -from threading import Thread -from multiprocessing import Process - -class processManager(): - def __init__(self): - self._Processes = [] - self._Threads = [] - def initialize(self, environment): - self.env = environment - self.running = self.env['runtime']['eventManager'].getRunning() - self.addSimpleEventThread(fenrirEventType.HeartBeat, self.heartBeatTimer, multiprocess=True) - def shutdown(self): - self.terminateAllProcesses() - - def terminateAllProcesses(self): - for proc in self._Processes: - try: - proc.terminate() - except Exception as e: - print(e) - def heartBeatTimer(self, active): - try: - time.sleep(0.5) - except: - pass - return time.time() - def addCustomEventThread(self, function, pargs = None, multiprocess = False, runOnce = False): - eventQueue = self.env['runtime']['eventManager'].getEventQueue() - if multiprocess: - t = Process(target=self.customEventWorkerThread, args=(eventQueue, function, pargs, runOnce)) - self._Processes.append(t) - else:# thread not implemented yet - t = Thread(target=self.customEventWorkerThread, args=(eventQueue, function, pargs, runOnce)) - self._Threads.append(t) - t.start() - - def addSimpleEventThread(self, event, function, pargs = None, multiprocess = False, runOnce = False): - if multiprocess: - t = Process(target=self.simpleEventWorkerThread, args=(event, function, pargs, runOnce)) - self._Processes.append(t) - else: - t = Thread(target=self.simpleEventWorkerThread, args=(event, function, pargs, runOnce)) - self._Threads.append(t) - t.start() - - def customEventWorkerThread(self, eventQueue, function, pargs = None, runOnce = False): - #if not isinstance(eventQueue, Queue): - # return - if not callable(function): - return - while self.running.value: - try: - if pargs: - function(self.running, eventQueue, pargs) - else: - function(self.running, eventQueue) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('processManager:customEventWorkerThread:function():' + str(e),debug.debugLevel.ERROR) - if runOnce: - break - - def simpleEventWorkerThread(self, event, function, pargs = None, runOnce = False): - if not isinstance(event, fenrirEventType): - return - if not callable(function): - return - while self.running.value: - Data = None - try: - if pargs: - Data = function(self.running, pargs) - else: - Data = function(self.running) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('processManager:simpleEventWorkerThread:function():' + str(e),debug.debugLevel.ERROR) - self.env['runtime']['eventManager'].putToEventQueue(event, Data) - if runOnce: - break diff --git a/src/fenrir/core/punctuationData.py b/src/fenrir/core/punctuationData.py deleted file mode 100644 index 1ba130bd..00000000 --- a/src/fenrir/core/punctuationData.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -import string - -punctuationData = { -'LEVELDICT':{ - 'none': '', - 'some': '#-$~+*-/\\@', - 'most': '.,:-$~ +*-/\\@!#%^&*()[]}{<>;', - 'all': string.punctuation + ' ยง', - }, -'PUNCTDICT':{ - ' ':'space', - '&':'and', - "'":"apostrophe", - '@':'at', - '\\':'backslash', - '|':'bar', - '!':'bang', - '^':'carrot', - ':':'colon', - ',':'comma', - '-':'dash', - '$':'dollar', - '.':'dot', - '>':'greater', - '`':'grave', - '#':'hash', - '{':'left brace', - '[':'left bracket', - '(':'left paren', - '<':'less', - '%':'percent', - '+':'plus', - '?':'question', - '"':'quote', - ')':'right paren', - '}':'right brace', - ']':'right bracket', - ';':'semicolon', - '/':'slash', - '*':'star', - '~':'tilde', - '_':'line', - '=':'equals', - }, -'CUSTOMDICT':{ - }, -'EMOTICONDICT':{ - ':)':'smiley', - ';)':'winking face', - 'XD':'loool', - ':@':'angry face', - ':D':'lought' - }, -} diff --git a/src/fenrir/core/punctuationManager.py b/src/fenrir/core/punctuationManager.py deleted file mode 100644 index 3038ebe8..00000000 --- a/src/fenrir/core/punctuationManager.py +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -import string -from core import debug - -class punctuationManager(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - self.allPunctNone = dict.fromkeys(map(ord, string.punctuation +"ยง "), ' ') - # replace with None: - # dot, comma, grave, apostrophe - #for char in [ord('`'),ord("'")]: - # self.allPunctNone[char] = None - # dont restore the following (for announce correct pause) - for char in [ord("'"),ord('.'), ord(','), ord(';'), ord(':'), ord('?'), ord('!'), ord('-')]: - self.allPunctNone[char] = chr(char) - def shutdown(self): - pass - def removeUnused(self, text, currLevel = ''): - # dont translate dot and comma because they create a pause - currAllPunctNone = self.allPunctNone.copy() - for char in currLevel: - try: - del currAllPunctNone[ord(char)] - except: - pass - return text.translate(currAllPunctNone) - - def useCustomDict(self, text, customDict, seperator=''): - resultText = str(text) - if customDict: - for key,item in customDict.items(): - resultText = resultText.replace(str(key),seperator + str(item) + seperator) - return resultText - - def usePunctuationDict(self, text, punctuationDict, punctuation): - resultText = str(text) - - if punctuationDict and punctuation and punctuation != '': - if ' ' in punctuation: - resultText = resultText.replace(' ',' ' + punctuationDict[' '] + ' ') - for key,item in punctuationDict.items(): - if key in punctuation and key not in ' ': - if self.env['runtime']['settingsManager'].getSetting('general', 'respectPunctuationPause') and \ - len(key) == 1 and \ - key in "',.;:?!": - resultText = resultText.replace(str(key),' ' +str(item) + str(key) + ' ') - else: - resultText = resultText.replace(str(key),' ' +str(item) + ' ') - return resultText - - def proceedPunctuation(self, text, ignorePunctuation=False): - resultText = text - resultText = self.useCustomDict(resultText, self.env['punctuation']['CUSTOMDICT']) - if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'emoticons'): - resultText = self.useCustomDict(resultText, self.env['punctuation']['EMOTICONDICT'], ' ') - currPunctLevel = '' - if not ignorePunctuation and self.env['runtime']['settingsManager'].getSetting('general', 'punctuationLevel').lower() in self.env['punctuation']['LEVELDICT']: - currPunctLevel = self.env['punctuation']['LEVELDICT'][self.env['runtime']['settingsManager'].getSetting('general', 'punctuationLevel').lower()] - else: - currPunctLevel = string.punctuation +' ยง' - resultText = self.usePunctuationDict(resultText, self.env['punctuation']['PUNCTDICT'], currPunctLevel) - resultText = self.removeUnused(resultText, currPunctLevel) - return resultText - - def cyclePunctuation(self): - punctList = list(self.env['punctuation']['LEVELDICT'].keys()) - try: - currIndex = punctList.index(self.env['runtime']['settingsManager'].getSetting('general', 'punctuationLevel').lower()) # curr punctuation - except: - return False - currIndex += 1 - if currIndex >= len(punctList): - currIndex = 0 - currLevel = punctList[currIndex] - self.env['runtime']['settingsManager'].setSetting('general', 'punctuationLevel', currLevel.lower()) - return True diff --git a/src/fenrir/core/runtimeData.py b/src/fenrir/core/runtimeData.py deleted file mode 100644 index 1041d4ee..00000000 --- a/src/fenrir/core/runtimeData.py +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -runtimeData = { -'speechDriver': None, -'screenDriver': None, -'soundDriver': None, -'inputDriver': None, -'brailleDriver': None, -'inputManager': None, -'commandManager': None, -'screenManager': None, -'outputManager': None, -'debug':None, -} diff --git a/src/fenrir/core/screenData.py b/src/fenrir/core/screenData.py deleted file mode 100644 index 9f4d0a61..00000000 --- a/src/fenrir/core/screenData.py +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -import time - -screenData = { -'columns': 0, -'lines': 0, -'oldDelta': '', -'oldAttribDelta': '', -'oldNegativeDelta': '', -'oldCursorReview':None, -'oldCursorAttrib':None, -'oldCursor':{'x':0,'y':0}, -'oldContentBytes': b'', -'oldContentText': '', -'oldContentAttrib': None, -'oldApplication': '', -'oldTTY':None, -'newDelta': '', -'newNegativeDelta': '', -'newAttribDelta': '', -'newCursorReview':None, -'newCursorAttrib':None, -'newCursor':{'x':0,'y':0}, -'newContentBytes': b'', -'newContentText': '', -'newContentAttrib': None, -'newTTY':'0', -'newApplication': '', -'lastScreenUpdate': time.time(), -'autoIgnoreScreens':[], -} -''' -screenData = { -'columns': 0, -'lines': 0, -'textDelta': '', -'negativeDelta': '', -'attribDelta': '', -'reviewCursor':None, #{'x':0,'y':0} -'attribCursor':None, #{'x':0,'y':0} -'textCursor':None, #{'x':0,'y':0} -'content': None, #{'x':0,'y':0} -'Text': '', -'Attrib': None, -'screen': None, -'application': '', -'timestamp': time.time(), -} -''' diff --git a/src/fenrir/core/screenDriver.py b/src/fenrir/core/screenDriver.py deleted file mode 100644 index 418a67f0..00000000 --- a/src/fenrir/core/screenDriver.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. -#attrib: -#http://rampex.ihep.su/Linux/linux_howto/html/tutorials/mini/Colour-ls-6.html -#0 = black, 1 = blue, 2 = green, 3 = cyan, 4 = red, 5 = purple, 6 = brown/yellow, 7 = white. -#https://github.com/jwilk/vcsapeek/blob/master/linuxvt.py -#blink = 5 if attr & 1 else 0 -#bold = 1 if attr & 16 else 0 - - -from core import debug - -class screenDriver(): - def __init__(self): - self._isInitialized = False - self.bgColorNames = {0: _('black'), 1: _('blue'), 2: _('green'), 3: _('cyan'), 4: _('red'), 5: _('Magenta'), 6: _('brown/yellow'), 7: _('white')} - self.fgColorNames = {0: _('Black'), 1: _('Blue'), 2: _('Green'), 3: _('Cyan'), 4: _('Red'), 5: _('Magenta'), 6: _('brown/yellow'), 7: _('Light gray'), 8: _('Dark gray'), 9: _('Light blue'), 10: ('Light green'), 11: _('Light cyan'), 12: _('Light red'), 13: _('Light magenta'), 14: _('Light yellow'), 15: _('White')} - def initialize(self, environment): - self.env = environment - self._isInitialized = True - def shutdown(self): - self._isInitialized = False - def getCurrScreen(self): - pass - def getCurrApplication(self): - pass - def getSessionInformation(self): - pass - def getFenrirBGColor(self, attribute): - return '' - def getFenrirFGColor(self, attribute): - return '' - def getFenrirUnderline(self, attribute): - return '' - def getFenrirBold(self, attribute): - return '' - def getFenrirBlink(self, attribute): - return '' - def getFenrirFont(self, attribute): - return '' - def getFenrirFontSize(self, attribute): - return '' - def update(self, trigger='onUpdate'): - pass - diff --git a/src/fenrir/core/screenManager.py b/src/fenrir/core/screenManager.py deleted file mode 100644 index a7fbc7d1..00000000 --- a/src/fenrir/core/screenManager.py +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -import time, os - -class screenManager(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - self.env['runtime']['settingsManager'].loadDriver(\ - self.env['runtime']['settingsManager'].getSetting('screen', 'driver'), 'screenDriver') - self.env['runtime']['screenDriver'].getCurrScreen() - self.env['runtime']['screenDriver'].getSessionInformation() - - def shutdown(self): - self.env['runtime']['settingsManager'].shutdownDriver('screenDriver') - def hanldeScreenChange(self, eventData): - self.env['runtime']['screenDriver'].getCurrScreen() - self.env['runtime']['screenDriver'].getSessionInformation() - if self.isScreenChange(): - self.changeBrailleScreen() - if not self.isSuspendingScreen(self.env['screen']['newTTY']): - self.env['runtime']['screenDriver'].update(eventData, 'onScreenChange') - self.env['screen']['lastScreenUpdate'] = time.time() - def handleScreenUpdate(self, eventData): - self.env['screen']['oldApplication'] = self.env['screen']['newApplication'] - if not self.isSuspendingScreen(self.env['screen']['newTTY']): - self.env['runtime']['screenDriver'].update(eventData, 'onScreenUpdate') - #if trigger == 'onUpdate' or self.isScreenChange() \ - # or len(self.env['screen']['newDelta']) > 6: - # self.env['runtime']['screenDriver'].getCurrApplication() - self.env['screen']['lastScreenUpdate'] = time.time() - def formatAttributes(self, attribute, attributeFormatString = None): - if not attributeFormatString: - attributeFormatString = self.env['runtime']['settingsManager'].getSetting('general', 'attributeFormatString') - if not attributeFormatString: - return '' - if attributeFormatString == '': - return '' - attributeFormatString = attributeFormatString.replace('fenrirBGColor', self.env['runtime']['screenDriver'].getFenrirBGColor(attribute)) - attributeFormatString = attributeFormatString.replace('fenrirFGColor', self.env['runtime']['screenDriver'].getFenrirFGColor(attribute)) - attributeFormatString = attributeFormatString.replace('fenrirUnderline', self.env['runtime']['screenDriver'].getFenrirUnderline(attribute)) - attributeFormatString = attributeFormatString.replace('fenrirBold', self.env['runtime']['screenDriver'].getFenrirBold(attribute)) - attributeFormatString = attributeFormatString.replace('fenrirBlink', self.env['runtime']['screenDriver'].getFenrirBlink(attribute)) - attributeFormatString = attributeFormatString.replace('fenrirFontSize', self.env['runtime']['screenDriver'].getFenrirFontSize(attribute)) - attributeFormatString = attributeFormatString.replace('fenrirFont', self.env['runtime']['screenDriver'].getFenrirFont(attribute)) - return attributeFormatString - def isSuspendingScreen(self, screen = None): - if screen == None: - 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['screen']['autoIgnoreScreens']) - self.env['runtime']['debug'].writeDebugOut('screenManager:isSuspendingScreen ' + str(ignoreScreens) + ' '+ str(self.env['screen']['newTTY']),debug.debugLevel.INFO) - try: - ignoreFileName = self.env['runtime']['settingsManager'].getSetting('screen', 'suspendingScreenFile') - if ignoreFileName != '': - if os.access(ignoreFileName, os.R_OK): - with open(ignoreFileName) as fp: - ignoreScreens.extend(fp.read().replace('\n','').split(',')) - except: - pass - return (screen in ignoreScreens) - - def isScreenChange(self): - if not self.env['screen']['oldTTY']: - return False - return self.env['screen']['newTTY'] != self.env['screen']['oldTTY'] - def isDelta(self, ignoreSpace=False): - newDelta = self.env['screen']['newDelta'] - if ignoreSpace: - newDelta = newDelta.strip() - return newDelta != '' - def isNegativeDelta(self): - return self.env['screen']['newNegativeDelta'] != '' - def getWindowAreaInText(self, text): - if not self.env['runtime']['cursorManager'].isApplicationWindowSet(): - return text - windowText = '' - windowList = text.split('\n') - currApp = self.env['runtime']['applicationManager'].getCurrentApplication() - windowList = windowList[self.env['commandBuffer']['windowArea'][currApp]['1']['y']:self.env['commandBuffer']['windowArea'][currApp]['2']['y'] + 1] - for line in windowList: - windowText += line[self.env['commandBuffer']['windowArea'][currApp]['1']['x']:self.env['commandBuffer']['windowArea'][currApp]['2']['x'] + 1] + '\n' - return windowText - - def injectTextToScreen(self, text, screen = None): - try: - self.env['runtime']['screenDriver'].injectTextToScreen(text, screen) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('screenManager:injectTextToScreen ' + str(e),debug.debugLevel.ERROR) - - def changeBrailleScreen(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('braille', 'enabled'): - return - if not self.env['runtime']['brailleDriver']: - return - 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['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/settingsData.py b/src/fenrir/core/settingsData.py deleted file mode 100644 index cb99ac10..00000000 --- a/src/fenrir/core/settingsData.py +++ /dev/null @@ -1,113 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -settingsData = { -'sound': { - 'enabled': True, - 'driver': 'genericDriver', - 'theme': 'default', - 'volume': 1.0, - 'genericPlayFileCommand': 'play -q -v fenrirVolume fenrirSoundFile', - 'genericFrequencyCommand': 'play -q -v fenrirVolume -n -c1 synth fenrirDuration sine fenrirFrequence' -}, -'speech':{ - 'enabled': True, - 'driver': 'genericDriver', - 'serverPath': '', - 'rate': 0.75, - 'pitch': 0.5, - 'capitalPitch':0.8, - 'volume': 1.0, - 'module': '', - 'voice': 'en-us', - 'language': '', - 'autoReadIncoming': True, - 'genericSpeechCommand':'espeak -a fenrirVolume -s fenrirRate -p fenrirPitch -v fenrirVoice "fenrirText"', - 'fenrirMinVolume':0, - 'fenrirMaxVolume':200, - 'fenrirMinPitch':0, - 'fenrirMaxPitch':99, - 'fenrirMinRate':80, - 'fenrirMaxRate':450, -}, -'braille':{ - 'enabled': False, - 'driver':'brlapiDriver', - 'layout': 'en', - 'flushMode': 'word', #NONE,FIX,CHAR,WORD - 'flushTimeout': 3, - 'cursorFocusMode':'page', # page,fixCell - 'fixCursorOnCell': -1, - 'cursorFollowMode': 'review', # none, review, last, text - 'panSizeHorizontal': 0 # 0 = display size -}, -'screen':{ - 'driver': 'vcsaDriver', - 'encoding': 'auto', - 'screenUpdateDelay': 0.1, - 'suspendingScreen': '', - 'suspendingScreenFile': '/tmp/fenrirSuspend', - 'autodetectSuspendingScreen': False, -}, -'general':{ - 'debugLevel': debug.debugLevel.DEACTIVE, - 'debugMode': 'FILE', - 'punctuationProfile':'default', - 'punctuationLevel': 'some', - 'respectPunctuationPause':True, - 'newLinePause':True, - 'numberOfClipboards': 10, - 'emoticons': True, - 'fenrirKeys': 'KEY_KP0,KEY_META', - 'scriptKeys': 'KEY_COMPOSE', - 'timeFormat': '%I:%M%P', - 'dateFormat': '%A, %B %d, %Y', - 'autoSpellCheck': False, - 'spellCheckLanguage': 'en_US', - 'scriptPath': '/usr/share/fenrir/scripts', - 'commandPath': '/usr/share/fenrir/commands', - 'attributeFormatString': 'Background fenrirBGColor,Foreground fenrirFGColor,fenrirUnderline,fenrirBold,fenrirBlink, Font fenrirFont,Fontsize fenrirFontSize' -}, -'focus':{ - 'cursor': True, - 'highlight': False, -}, -'review':{ - 'lineBreak': True, - 'endOfScreen': True, - 'leaveReviewOnCursorChange': True, - 'leaveReviewOnScreenChange': True, -}, -'promote':{ - 'enabled': True, - 'inactiveTimeoutSec': 120, - 'list': '', -}, -'time':{ - 'enabled': False, - 'presentTime': True, - 'presentDate': True, - 'delaySec': 0, - 'onMinutes': '00,30', - 'announce': True, - 'interrupt': False, -}, -'keyboard':{ - 'driver': 'evdev', - 'device': 'all', - 'grabDevices': True, - 'ignoreShortcuts': False, - 'keyboardLayout': "desktop", - 'charEcho': False, - 'charDeleteEcho': True, - 'wordEcho': True, - 'interruptOnKeyPress': True, - 'interruptOnKeyPressFilter': '', - 'doubleTapTimeout': 0.2, -} -} diff --git a/src/fenrir/core/settingsManager.py b/src/fenrir/core/settingsManager.py deleted file mode 100644 index 0811de29..00000000 --- a/src/fenrir/core/settingsManager.py +++ /dev/null @@ -1,364 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -import os, inspect -currentdir = os.path.dirname(os.path.realpath(os.path.abspath(inspect.getfile(inspect.currentframe())))) -fenrirPath = os.path.dirname(currentdir) - -from configparser import ConfigParser -from core import debugManager -from core import memoryManager -from core import processManager -from core import eventManager -from core import inputManager -from core import outputManager -from core import commandManager -from core import screenManager -from core import punctuationManager -from core import cursorManager -from core import applicationManager -from core import helpManager -from core import headLineManager -from core import tableManager -from core import environment -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 = settingsData - self.settingArgDict = {} - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def loadShortcuts(self, kbConfigPath=fenrirPath + '/../../config/keyboard/desktop.conf'): - kbConfig = open(kbConfigPath,"r") - while(True): - invalid = False - line = kbConfig.readline() - if not line: - break - line = line.replace('\n','') - if line.replace(" ","") == '': - continue - if line.replace(" ","").startswith("#"): - continue - if line.count("=") != 1: - continue - sepLine = line.split('=') - commandName = sepLine[1].upper() - sepLine[0] = sepLine[0].replace(" ","") - sepLine[0] = sepLine[0].replace("'","") - sepLine[0] = sepLine[0].replace('"',"") - keys = sepLine[0].split(',') - shortcutKeys = [] - shortcutRepeat = 1 - shortcut = [] - for key in keys: - try: - shortcutRepeat = int(key) - except: - if not self.isValidKey(key.upper()): - self.env['runtime']['debug'].writeDebugOut("invalid key : "+ key.upper() + ' command:' +commandName ,debug.debugLevel.WARNING) - invalid = True - break - shortcutKeys.append(key.upper()) - if invalid: - continue - shortcut.append(shortcutRepeat) - shortcut.append(sorted(shortcutKeys)) - if len(shortcutKeys) != 1 and not 'KEY_FENRIR' in shortcutKeys: - self.env['runtime']['debug'].writeDebugOut("invalid shortcut (missing KEY_FENRIR): "+ str(shortcut) + ' command:' +commandName ,debug.debugLevel.ERROR) - continue - self.env['runtime']['debug'].writeDebugOut("Shortcut: "+ str(shortcut) + ' command:' +commandName ,debug.debugLevel.INFO, onAnyLevel=True) - self.env['bindings'][str(shortcut)] = commandName - kbConfig.close() - # fix bindings - self.env['bindings'][str([1, ['KEY_F1', 'KEY_FENRIR']])] = 'TOGGLE_TUTORIAL_MODE' - - def loadSoundIcons(self, soundIconPath): - siConfig = open(soundIconPath + '/soundicons.conf',"r") - while(True): - line = siConfig.readline() - if not line: - break - line = line.replace('\n','') - if line.replace(" ","") == '': - continue - if line.replace(" ","").startswith("#"): - continue - if line.count("=") != 1: - continue - Values = line.split('=') - soundIcon = Values[0].upper() - Values[1] = Values[1].replace("'","") - Values[1] = Values[1].replace('"',"") - soundIconFile = '' - if os.path.exists(Values[1]): - soundIconFile = Values[1] - else: - if not soundIconPath.endswith("/"): - soundIconPath += '/' - if os.path.exists(soundIconPath + Values[1]): - soundIconFile = soundIconPath + Values[1] - self.env['soundIcons'][soundIcon] = soundIconFile - self.env['runtime']['debug'].writeDebugOut("SoundIcon: " + soundIcon + '.' + soundIconFile, debug.debugLevel.INFO, onAnyLevel=True) - siConfig.close() - def isValidKey(self, key): - return key in inputData.keyNames - - def loadDicts(self, dictConfigPath=fenrirPath + '/../../config/punctuation/default.conf'): - dictConfig = open(dictConfigPath,"r") - currDictName = '' - while(True): - line = dictConfig.readline() - if not line: - break - line = line.replace('\n','') - if line.replace(" ","") == '': - continue - if line.replace(" ","").startswith("#"): - continue - if line.replace(" ","").upper().startswith("[") and \ - line.replace(" ","").upper().endswith("DICT]"): - currDictName = line[line.find('[') + 1 :line.upper().find('DICT]') + 4].upper() - else: - if currDictName == '': - continue - if not ":===:" in line: - continue - sepLine = line.split(':===:') - if len(sepLine) == 1: - sepLine.append('') - elif len(sepLine) < 1: - continue - elif len(sepLine) > 2: - sepLine[1] = ':===:' - self.env['punctuation'][currDictName][sepLine[0]] = sepLine[1] - self.env['runtime']['debug'].writeDebugOut("Punctuation: " + currDictName + '.' + str(sepLine[0]) + ' :' + sepLine[1] ,debug.debugLevel.INFO, onAnyLevel=True) - dictConfig.close() - - def loadSettings(self, settingConfigPath): - if not os.path.exists(settingConfigPath): - return False - self.env['settings'] = ConfigParser() - self.env['settings'].read(settingConfigPath) - return True - - def setSetting(self, section, setting, value): - self.env['settings'].set(section, setting, value) - - def getSetting(self, section, setting): - value = '' - try: - value = self.settingArgDict[section.lower()][setting.lower()] - return value - except: - pass - try: - value = self.env['settings'].get(section, setting) - except: - value = str(self.settings[section][setting]) - return value - - def getSettingAsInt(self, section, setting): - value = 0 - try: - value = int(self.settingArgDict[section.lower()][setting.lower()]) - return value - except Exception as e: - pass - try: - value = self.env['settings'].getint(section, setting) - except: - value = self.settings[section][setting] - return value - - def getSettingAsFloat(self, section, setting): - value = 0.0 - try: - value = float(self.settingArgDict[section.lower()][setting.lower()]) - return value - except Exception as e: - pass - try: - value = self.env['settings'].getfloat(section, setting) - except: - value = self.settings[section][setting] - return value - - def getSettingAsBool(self, section, setting): - value = False - try: - value = self.settingArgDict[section.lower()][setting.lower()].upper() in ['1','YES','JA','TRUE'] - return value - except Exception as e: - pass - try: - value = self.env['settings'].getboolean(section, setting) - except: - value = self.settings[section][setting] - return value - - def loadDriver(self, driverName, driverType): - try: - if self.env['runtime'][driverType] != None: - self.env['runtime'][driverType].shutdown(self.env) - driver_mod = module_utils.importModule(driverName, - fenrirPath + "/" + 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 + ' (' + driverName +") OK",debug.debugLevel.INFO, onAnyLevel=True) - except Exception as e: - self.env['runtime'][driverType] = None - 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 - self.env['runtime'][driverType].shutdown() - del self.env['runtime'][driverType] - - def setFenrirKeys(self, keys): - keys = keys.upper() - keyList = keys.split(',') - for key in keyList: - if not key in self.env['input']['fenrirKey']: - self.env['input']['fenrirKey'].append(key) - def setScriptKeys(self, keys): - keys = keys.upper() - keyList = keys.split(',') - for key in keyList: - if not key in self.env['input']['scriptKey']: - self.env['input']['scriptKey'].append(key) - def setOptionArgDict(self, section, option, value): - section = section.lower() - option = option.lower() - try: - e = self.settingArgDict[section] - except KeyError: - self.settingArgDict[section] = {} - self.settingArgDict[section][option] = str(value) - - def parseSettingArgs(self, settingArgs): - for optionElem in settingArgs.split(';'): - if len(optionElem.split('#',1)) != 2: - continue - if len(optionElem.split('#',1)[1].split('=',1)) != 2: - continue - section = str(optionElem.split('#',1)[0]).lower() - option = str(optionElem.split('#',1)[1].split('=',1)[0]).lower() - value = optionElem.split('#',1)[1].split('=',1)[1] - self.setOptionArgDict(section, option, value) - - def initFenrirConfig(self, cliArgs, fenrirManager = None, environment = environment.environment): - settingsRoot = '/etc/fenrir/' - settingsFile = cliArgs.setting - soundRoot = '/usr/share/sounds/fenrir/' - environment['runtime']['debug'] = debugManager.debugManager() - environment['runtime']['debug'].initialize(environment) - # get fenrir settings root - if not os.path.exists(settingsRoot): - if os.path.exists(fenrirPath +'/../../config/'): - settingsRoot = fenrirPath +'/../../config/' - else: - return None - # get settings file - if not os.path.exists(settingsFile): - if os.path.exists(settingsRoot + '/settings/settings.conf'): - settingsFile = settingsRoot + '/settings/settings.conf' - else: - return None - # get sound themes root - if not os.path.exists(soundRoot): - if os.path.exists(fenrirPath + '/../../config/sound/'): - soundRoot = fenrirPath + '/../../config/sound/' - - environment['runtime']['settingsManager'] = self - environment['runtime']['settingsManager'].initialize(environment) - - validConfig = environment['runtime']['settingsManager'].loadSettings(settingsFile) - if not validConfig: - return None - - if cliArgs.options != '': - self.parseSettingArgs(cliArgs.options) - if cliArgs.debug: - self.setOptionArgDict('general', 'debugLevel', 3) - if cliArgs.print: - self.setOptionArgDict('general', 'debugLevel', 3) - self.setOptionArgDict('general', 'debugMode', 'PRINT') - self.setFenrirKeys(self.getSetting('general','fenrirKeys')) - self.setScriptKeys(self.getSetting('general','scriptKeys')) - - if not os.path.exists(self.getSetting('keyboard','keyboardLayout')): - if os.path.exists(settingsRoot + 'keyboard/' + self.getSetting('keyboard','keyboardLayout')): - self.setSetting('keyboard', 'keyboardLayout', settingsRoot + 'keyboard/' + self.getSetting('keyboard','keyboardLayout')) - environment['runtime']['settingsManager'].loadShortcuts(self.getSetting('keyboard','keyboardLayout')) - if os.path.exists(settingsRoot + 'keyboard/' + self.getSetting('keyboard','keyboardLayout') + '.conf'): - self.setSetting('keyboard', 'keyboardLayout', settingsRoot + 'keyboard/' + self.getSetting('keyboard','keyboardLayout') + '.conf') - environment['runtime']['settingsManager'].loadShortcuts(self.getSetting('keyboard','keyboardLayout')) - else: - environment['runtime']['settingsManager'].loadShortcuts(self.getSetting('keyboard','keyboardLayout')) - - if not os.path.exists(self.getSetting('sound','theme') + '/soundicons.conf'): - if os.path.exists(soundRoot + self.getSetting('sound','theme')): - self.setSetting('sound', 'theme', soundRoot + self.getSetting('sound','theme')) - if os.path.exists(self.getSetting('sound','theme') + '/soundicons.conf'): - environment['runtime']['settingsManager'].loadSoundIcons(self.getSetting('sound','theme')) - else: - environment['runtime']['settingsManager'].loadSoundIcons(self.getSetting('sound','theme')) - - if not os.path.exists(self.getSetting('general','punctuationProfile')): - if os.path.exists(settingsRoot + 'punctuation/' + self.getSetting('general','punctuationProfile')): - self.setSetting('general', 'punctuationProfile', settingsRoot + 'punctuation/' + self.getSetting('general','punctuationProfile')) - environment['runtime']['settingsManager'].loadDicts(self.getSetting('general','punctuationProfile')) - if os.path.exists(settingsRoot + 'punctuation/' + self.getSetting('general','punctuationProfile') + '.conf'): - self.setSetting('general', 'punctuationProfile', settingsRoot + 'punctuation/' + self.getSetting('general','punctuationProfile') + '.conf') - environment['runtime']['settingsManager'].loadDicts(self.getSetting('general','punctuationProfile')) - else: - environment['runtime']['settingsManager'].loadDicts(self.getSetting('general','punctuationProfile')) - - if fenrirManager: - environment['runtime']['fenrirManager'] = fenrirManager - environment['runtime']['memoryManager'] = memoryManager.memoryManager() - environment['runtime']['memoryManager'].initialize(environment) - environment['runtime']['eventManager'] = eventManager.eventManager() - environment['runtime']['eventManager'].initialize(environment) - environment['runtime']['processManager'] = processManager.processManager() - environment['runtime']['processManager'].initialize(environment) - environment['runtime']['outputManager'] = outputManager.outputManager() - environment['runtime']['outputManager'].initialize(environment) - environment['runtime']['commandManager'] = commandManager.commandManager() - environment['runtime']['commandManager'].initialize(environment) - environment['runtime']['inputManager'] = inputManager.inputManager() - environment['runtime']['inputManager'].initialize(environment) - environment['runtime']['punctuationManager'] = punctuationManager.punctuationManager() - environment['runtime']['punctuationManager'].initialize(environment) - environment['runtime']['cursorManager'] = cursorManager.cursorManager() - environment['runtime']['cursorManager'].initialize(environment) - environment['runtime']['applicationManager'] = applicationManager.applicationManager() - environment['runtime']['applicationManager'].initialize(environment) - environment['runtime']['helpManager'] = helpManager.helpManager() - environment['runtime']['helpManager'].initialize(environment) - environment['runtime']['headLineManager'] = headLineManager.headLineManager() - environment['runtime']['headLineManager'].initialize(environment) - environment['runtime']['tableManager'] = tableManager.tableManager() - environment['runtime']['tableManager'].initialize(environment) - if environment['runtime']['screenManager'] == None: - environment['runtime']['screenManager'] = screenManager.screenManager() - environment['runtime']['screenManager'].initialize(environment) - - environment['runtime']['debug'].writeDebugOut('\/-------environment-------\/',debug.debugLevel.INFO, onAnyLevel=True) - environment['runtime']['debug'].writeDebugOut(str(environment), debug.debugLevel.INFO, onAnyLevel=True) - environment['runtime']['debug'].writeDebugOut('\/-------settings.conf-------\/', debug.debugLevel.INFO, onAnyLevel=True) - environment['runtime']['debug'].writeDebugOut(str(environment['settings']._sections) , debug.debugLevel.INFO, onAnyLevel=True) - environment['runtime']['debug'].writeDebugOut('\/-------self.settingArgDict-------\/',debug.debugLevel.INFO, onAnyLevel=True) - environment['runtime']['debug'].writeDebugOut(str( self.settingArgDict) ,debug.debugLevel.INFO, onAnyLevel=True) - return environment - diff --git a/src/fenrir/core/soundDriver.py b/src/fenrir/core/soundDriver.py deleted file mode 100644 index 0f2d4ab7..00000000 --- a/src/fenrir/core/soundDriver.py +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -class soundDriver(): - def __init__(self): - self.volume = None - self._initialized = False - - def initialize(self, environment): - self.env = environment - self._initialized = True - - def shutdown(self): - if not self._initialized: - return - self.cancel() - self._isInitialized = False - - def playFrequence(self, frequence = 1000, duration = 0.3, adjustVolume = 0): - if not self._initialized: - return - if interrupt: - self.cancel() - - def playSoundFile(self, filePath, interrupt = True): - if not self._initialized: - return - if interrupt: - self.cancel() - - def cancel(self): - if not self._initialized: - return - - def setCallback(self, callback): - if not self._initialized: - return - - def setVolume(self, volume): - if not self._initialized: - return - self.volume = volume diff --git a/src/fenrir/core/speechDriver.py b/src/fenrir/core/speechDriver.py deleted file mode 100644 index 539412f3..00000000 --- a/src/fenrir/core/speechDriver.py +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -class speechDriver(): - def __init__(self): - self._isInitialized = False - self.language = None - self.voice = None - self.module = None - self.pitch = None - self.rate = None - self.volume = None - def initialize(self, environment): - self.env = environment - self._isInitialized = True - - def shutdown(self): - if self._isInitialized: - self.cancel() - self._isInitialized = False - - def speak(self,text, queueable=True): - if not self._isInitialized: - return - if not queueable: - self.cancel() - - def cancel(self): - if not self._isInitialized: - return - - def setCallback(self, callback): - if not self._isInitialized: - return - if not callback: - return - - def clear_buffer(self): - if not self._isInitialized: - return - - def setVoice(self, voice): - if not self._isInitialized: - return - if voice == '': - return - self.voice = voice - - def setPitch(self, pitch): - if not self._isInitialized: - return - if not isinstance(pitch, float): - return - if pitch < 0.0: - retrun - if pitch > 1.0: - return - self.pitch = pitch - def setRate(self, rate): - if not self._isInitialized: - return - if not isinstance(rate, float): - return - if rate < 0.0: - retrun - if rate > 1.0: - return - self.rate = rate - def setModule(self, module): - if not self._isInitialized: - return - if not isinstance(module, str): - return - if module == '': - return - self.module = module - - def setLanguage(self, language): - if not self._isInitialized: - return - if not isinstance(language, str): - return - if language == '': - return - self.language = language - def setVolume(self, volume): - if not self._isInitialized: - return - if not isinstance(volume,float): - return - if volume < 0.0: - retrun - if volume > 1.0: - return - self.volume = volume diff --git a/src/fenrir/core/tableManager.py b/src/fenrir/core/tableManager.py deleted file mode 100644 index 60a31cf4..00000000 --- a/src/fenrir/core/tableManager.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -import re - -class tableManager(): - def __init__(self): - self.headLine = '' - self.defaultSeparators = ['+',';','|',' '] - self.noOfHeadLineColumns = 0 - self.headColumnSep = '' - self.rowColumnSep = '' - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def resetTableMode(self): - self.setHeadLine() - def setHeadColumnSep(self, columnSep = ''): - self.headColumnSep = columnSep - if columnSep == '': - self.noOfHeadLineColumns = 0 - else: - self.counNoOfHeadColumns() - def counNoOfHeadColumns(self): - pass - def searchForHeadColumnSep(self, headLine): - if ' ' in headLine: - return ' ' - return '' - def setRowColumnSep(self, columnSep = ''): - self.rowColumnSep = columnSep - - def setHeadLine(self, headLine = ''): - self.setHeadColumnSep() - self.setRowColumnSep() - if headLine != '': - sep = self.searchForHeadColumnSep(headLine) - if sep != '': - self.headLine = headLine - self.setHeadColumnSep(sep) - diff --git a/src/fenrir/fenrir b/src/fenrir/fenrir deleted file mode 100755 index d8107dfe..00000000 --- a/src/fenrir/fenrir +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -import os, sys, inspect -fenrirPath = os.path.dirname(os.path.realpath(os.path.abspath(inspect.getfile(inspect.currentframe())))) - -if not fenrirPath in sys.path: - sys.path.append(fenrirPath) - -from core import fenrirManager - -def main(): - app = fenrirManager.fenrirManager() - app.proceed() - del app - -if __name__ == "__main__": - main() diff --git a/src/fenrir/fenrir-daemon b/src/fenrir/fenrir-daemon deleted file mode 100755 index eefc5054..00000000 --- a/src/fenrir/fenrir-daemon +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -import os, sys, inspect -fenrirPath = os.path.dirname(os.path.realpath(os.path.abspath(inspect.getfile(inspect.currentframe())))) - -if not fenrirPath in sys.path: - sys.path.append(fenrirPath) - -from core import fenrirManager -from daemonize import Daemonize - -pidFile = "/run/fenrir.pid" - -def main(): - app = fenrirManager.fenrirManager() - app.proceed() - del app - -if __name__ == "__main__": - # for debug in foreground - #daemon = Daemonize(app="fenrir-daemon", pid=pidFile, action=main, foreground=True,chdir=os.path.dirname(os.path.realpath(fenrirVersion.__file__))) - daemon = Daemonize(app="fenrir-daemon", pid=pidFile, action=main, chdir=fenrirPath) - daemon.start() - diff --git a/src/fenrir/fenrirVersion.py b/src/fenrir/fenrirVersion.py deleted file mode 100644 index f070cefd..00000000 --- a/src/fenrir/fenrirVersion.py +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -import os, sys -import __main__ - -version = 1.5 -codename = 'gampert' diff --git a/src/fenrir/inputDriver/__init__.py b/src/fenrir/inputDriver/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/fenrir/inputDriver/debugDriver.py b/src/fenrir/inputDriver/debugDriver.py deleted file mode 100644 index 90e4c4ce..00000000 --- a/src/fenrir/inputDriver/debugDriver.py +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -import time -from core import debug -from core.inputDriver import inputDriver - -class driver(inputDriver): - def __init__(self): - inputDriver.__init__(self) - - def initialize(self, environment): - self.env = environment - self._initialized = True - print('Input Debug Driver: Initialized') - - def shutdown(self): - if self._initialized: - self.releaseDevices() - self._initialized = False - print('Input Debug Driver: Shutdown') - - def getInputEvent(self): - time.sleep(0.05) - if not self._initialized: - return None - print('Input Debug Driver: getInputEvent') - return None - def writeEventBuffer(self): - if not self._initialized: - return - print('Input Debug Driver: writeEventBuffer') - def clearEventBuffer(self): - if not self._initialized: - return - del self.env['input']['eventBuffer'][:] - print('Input Debug Driver: clearEventBuffer') - def updateInputDevices(self, force = False, init = False): - if not self._initialized: - return - print('Input Debug Driver: updateInputDevices') - def getLedState(self, led = 0): - if not self._initialized: - return False - return False - def toggleLedState(self, led = 0): - if not self._initialized: - return - print('Input Debug Driver: toggleLedState') - def grabDevices(self): - if not self._initialized: - return - print('Input Debug Driver: grabDevices') - def releaseDevices(self): - if not self._initialized: - return - print('Input Debug Driver: releaseDevices') - def __del__(self): - if self._initialized: - self.releaseDevices() - print('Input Debug Driver: __del__') - - diff --git a/src/fenrir/inputDriver/dummyDriver.py b/src/fenrir/inputDriver/dummyDriver.py deleted file mode 100644 index 917ee1f7..00000000 --- a/src/fenrir/inputDriver/dummyDriver.py +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -import time -from core import debug -from core.inputDriver import inputDriver - -class driver(inputDriver): - def __init__(self): - inputDriver.__init__(self) diff --git a/src/fenrir/inputDriver/evdevDriver.py b/src/fenrir/inputDriver/evdevDriver.py deleted file mode 100644 index 06a5f355..00000000 --- a/src/fenrir/inputDriver/evdevDriver.py +++ /dev/null @@ -1,308 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -_evdevAvailable = False -_udevAvailable = False -_evdevAvailableError = '' -_udevAvailableError = '' -try: - import evdev - from evdev import InputDevice, UInput - _evdevAvailable = True - -except Exception as e: - _evdevAvailableError = str(e) - -try: - import pyudev - _udevAvailable = True -except Exception as e: - _udevAvailableError = str(e) - -import time -from select import select -import multiprocessing -from multiprocessing.sharedctypes import Value -from ctypes import c_bool - -from core.eventData import fenrirEventType -from core import inputData -from core import debug -from core.inputDriver import inputDriver - -class driver(inputDriver): - def __init__(self): - inputDriver.__init__(self) - self._manager = multiprocessing.Manager() - self.iDevices = {} - self.iDevicesFD = self._manager.list() - self.uDevices = {} - self.iDeviceNo = 0 - self.watchDog = Value(c_bool, True) - def initialize(self, environment): - self.env = environment - global _evdevAvailable - global _udevAvailable - self._initialized = _evdevAvailable - if not self._initialized: - global _evdevAvailableError - self.env['runtime']['debug'].writeDebugOut('InputDriver: ' + _evdevAvailableError,debug.debugLevel.ERROR) - return - if _udevAvailable: - self.env['runtime']['processManager'].addCustomEventThread(self.plugInputDeviceWatchdogUdev) - else: - self.env['runtime']['processManager'].addSimpleEventThread(fenrirEventType.PlugInputDevice, self.plugInputDeviceWatchdogTimer) - self.env['runtime']['processManager'].addCustomEventThread(self.inputWatchdog) - def plugInputDeviceWatchdogUdev(self,active , eventQueue): - context = pyudev.Context() - monitor = pyudev.Monitor.from_netlink(context) - monitor.filter_by(subsystem='input') - monitor.start() - while active.value: - devices = monitor.poll(2) - if devices: - while monitor.poll(0.5): - time.sleep(0.2) - eventQueue.put({"Type":fenrirEventType.PlugInputDevice,"Data":None}) - return time.time() - def plugInputDeviceWatchdogTimer(self, active): - time.sleep(2.5) - return time.time() - - def inputWatchdog(self,active , eventQueue): - while active.value: - r, w, x = select(self.iDevices, [], [], 0.5) - for fd in r: - event = None - foreward = False - eventFired = False - try: - event = self.iDevices[fd].read_one() - except: - self.removeDevice(fd) - while(event): - self.env['input']['eventBuffer'].append( [self.iDevices[fd], self.uDevices[fd], event]) - if event.type == evdev.events.EV_KEY: - if event.code != 0: - currMapEvent = self.mapEvent(event) - if not currMapEvent: - foreward = True - if not isinstance(currMapEvent['EventName'], str): - foreward = True - if not foreward or eventFired: - if currMapEvent['EventState'] in [0,1,2]: - eventQueue.put({"Type":fenrirEventType.KeyboardInput,"Data":currMapEvent.copy()}) - eventFired = True - else: - if not event.type in [0,4]: - foreward = True - - event = self.iDevices[fd].read_one() - if foreward and not eventFired: - self.writeEventBuffer() - self.clearEventBuffer() - - def handleInputEvent(self, event): - return - - def writeEventBuffer(self): - if not self._initialized: - return - for iDevice, uDevice, event in self.env['input']['eventBuffer']: - self.writeUInput(uDevice, event) - - def clearEventBuffer(self): - if not self._initialized: - return - del self.env['input']['eventBuffer'][:] - - def writeUInput(self, uDevice, event): - if not self._initialized: - return - uDevice.write_event(event) - uDevice.syn() - time.sleep(0.00001) - - def updateInputDevices(self, force = False, init = False): - if init: - self.removeAllDevices() - deviceFileList = evdev.list_devices() - if not force and False: - if len(deviceFileList) == self.iDeviceNo: - return - mode = self.env['runtime']['settingsManager'].getSetting('keyboard', 'device').upper() - iDevicesFiles = [] - for device in self.iDevices: - iDevicesFiles.append(self.iDevices[device].fn) - if len(iDevicesFiles) == len(deviceFileList): - return - eventType = evdev.events - for deviceFile in deviceFileList: - try: - if deviceFile in iDevicesFiles: - continue - try: - open(deviceFile) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut("Not readable Inputdevice : " + deviceFile +' ' + str(e),debug.debugLevel.ERROR) - continue - # 3 pos absolute - # 2 pos relative - # 1 Keys - currDevice = evdev.InputDevice(deviceFile) - if currDevice.name.upper() in ['','SPEAKUP','PY-EVDEV-UINPUT']: - continue - if 'BRLTTY' in currDevice.name.upper(): - continue - cap = currDevice.capabilities() - if mode in ['ALL','NOMICE']: - if eventType.EV_KEY in cap: - if 116 in cap[eventType.EV_KEY] and len(cap[eventType.EV_KEY]) < 10: - self.env['runtime']['debug'].writeDebugOut('Device Skipped (has 116):' + currDevice.name,debug.debugLevel.INFO) - continue - if len(cap[eventType.EV_KEY]) < 30: - self.env['runtime']['debug'].writeDebugOut('Device Skipped (< 30 keys):' + currDevice.name,debug.debugLevel.INFO) - continue - if mode == 'ALL': - self.iDevices[currDevice.fd] = currDevice - self.grabDevice(currDevice.fd) - self.env['runtime']['debug'].writeDebugOut('Device added (ALL):' + self.iDevices[currDevice.fd].name, debug.debugLevel.INFO) - elif mode == 'NOMICE': - if not ((eventType.EV_REL in cap) or (eventType.EV_ABS in cap)): - self.iDevices[currDevice.fd] = currDevice - self.grabDevice(currDevice.fd) - self.env['runtime']['debug'].writeDebugOut('Device added (NOMICE):' + self.iDevices[currDevice.fd].name,debug.debugLevel.INFO) - else: - self.env['runtime']['debug'].writeDebugOut('Device Skipped (NOMICE):' + currDevice.name,debug.debugLevel.INFO) - elif currDevice.name.upper() in mode.split(','): - self.iDevices[currDevice.fd] = currDevice - self.grabDevice(currDevice.fd) - self.env['runtime']['debug'].writeDebugOut('Device added (Name):' + self.iDevices[currDevice.fd].name,debug.debugLevel.INFO) - except Exception as e: - print(e) - self.env['runtime']['debug'].writeDebugOut("Device Skipped (Exception): " + deviceFile +' ' + currDevice.name +' '+ str(e),debug.debugLevel.INFO) - self.iDeviceNo = len(evdev.list_devices()) - self.updateMPiDevicesFD() - - def updateMPiDevicesFD(self): - for fd in self.iDevices: - if not fd in self.iDevicesFD: - self.iDevicesFD.append(fd) - for fd in self.iDevicesFD: - if not fd in self.iDevices: - self.iDevicesFD.remove(fd) - def mapEvent(self, event): - if not self._initialized: - return None - if not event: - return None - mEvent = inputData.inputEvent - try: - mEvent['EventName'] = evdev.ecodes.keys[event.code] - mEvent['EventValue'] = event.code - mEvent['EventSec'] = event.sec - mEvent['EventUsec'] = event.usec - mEvent['EventState'] = event.value - mEvent['EventType'] = event.type - return mEvent - except Exception as e: - return None - - def getLedState(self, led = 0): - if not self.hasIDevices(): - return False - # 0 = Numlock - # 1 = Capslock - # 2 = Rollen - for fd, dev in self.iDevices.items(): - if led in dev.leds(): - return True - return False - def toggleLedState(self, led = 0): - if not self.hasIDevices(): - return False - ledState = self.getLedState(led) - for i in self.iDevices: - # 17 LEDs - if 17 in self.iDevices[i].capabilities(): - if ledState == 1: - self.iDevices[i].set_led(led , 0) - else: - self.iDevices[i].set_led(led , 1) - def grabAllDevices(self): - if not self._initialized: - return - for fd in self.iDevices: - self.grabDevice(fd) - - def grabDevice(self, fd): - if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'): - self.uDevices[fd] = None - return - try: - self.uDevices[fd] = UInput.from_device(self.iDevices[fd].fn) - except Exception as e: - try: - self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: compat fallback: ' + str(e),debug.debugLevel.WARNING) - dev = self.iDevices[fd] - cap = dev.capabilities() - del cap[0] - self.uDevices[fd] = UInput( - cap, - dev.name, - ) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: init Uinput not possible: ' + str(e),debug.debugLevel.ERROR) - return - try: - self.iDevices[fd].grab() - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: grabing not possible: ' + str(e),debug.debugLevel.ERROR) - - def removeDevice(self,fd): - self.clearEventBuffer() - try: - self.iDevices[fd].ungrab() - except: - pass - try: - self.iDevices[fd].close() - except: - pass - try: - self.uDevices[fd].close() - except: - pass - try: - del(self.iDevices[fd]) - except: - pass - try: - del(self.uDevices[fd]) - except: - pass - self.updateMPiDevicesFD() - - def hasIDevices(self): - if not self._initialized: - return False - if not self.iDevices: - return False - if len(self.iDevices) == 0: - return False - return True - - def removeAllDevices(self): - if not self.hasIDevices(): - return - devices = self.iDevices.copy() - for fd in devices: - self.removeDevice(fd) - self.iDevices.clear() - self.uDevices.clear() - self.iDeviceNo = 0 - - diff --git a/src/fenrir/screenDriver/BAKvcsaDriver.py b/src/fenrir/screenDriver/BAKvcsaDriver.py deleted file mode 100644 index d7a31cb2..00000000 --- a/src/fenrir/screenDriver/BAKvcsaDriver.py +++ /dev/null @@ -1,379 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. -#attrib: -#http://rampex.ihep.su/Linux/linux_howto/html/tutorials/mini/Colour-ls-6.html -#0 = black, 1 = blue, 2 = green, 3 = cyan, 4 = red, 5 = purple, 6 = brown/yellow, 7 = white. -#https://github.com/jwilk/vcsapeek/blob/master/linuxvt.py -#blink = 5 if attr & 1 else 0 -#bold = 1 if attr & 16 else 0 - - -import difflib -import re -import subprocess -import glob, os -import termios -import time -import select -import dbus -import fcntl -from array import array -import errno -import sys -from utils import screen_utils -from fcntl import ioctl -from struct import unpack_from, unpack, pack -from core import debug -from core.eventData import fenrirEventType -from core.screenDriver import screenDriver - -class driver(screenDriver): - def __init__(self): - screenDriver.__init__(self) - self.vcsaDevicePath = '/dev/vcsa' - self.ListSessions = None - self.charmap = {} - self.bgColorNames = {0: _('black'), 1: _('blue'), 2: _('green'), 3: _('cyan'), 4: _('red'), 5: _('Magenta'), 6: _('brown/yellow'), 7: _('white')} - self.fgColorNames = {0: _('Black'), 1: _('Blue'), 2: _('Green'), 3: _('Cyan'), 4: _('Red'), 5: _('Magenta'), 6: _('brown/yellow'), 7: _('Light gray'), 8: _('Dark gray'), 9: _('Light blue'), 10: ('Light green'), 11: _('Light cyan'), 12: _('Light red'), 13: _('Light magenta'), 14: _('Light yellow'), 15: _('White')} - self.hichar = None - def initialize(self, environment): - self.env = environment - self.env['runtime']['processManager'].addCustomEventThread(self.updateWatchdog) - def getCurrScreen(self): - self.env['screen']['oldTTY'] = self.env['screen']['newTTY'] - try: - currScreenFile = open('/sys/devices/virtual/tty/tty0/active','r') - 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['screen']['newTTY'] - if screen != None: - useScreen = screen - with open(useScreen, 'w') as fd: - for c in text: - fcntl.ioctl(fd, termios.TIOCSTI, c) - - def getCurrApplication(self): - apps = [] - try: - 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) - return - try: - for i in apps: - i = i.upper() - i = i.split() - i[0] = i[0] - i[1] = i[1] - if '+' in i[2]: - if i[0] != '': - if not "GREP" == i[0] and \ - not "SH" == i[0] and \ - not "PS" == i[0]: - if "TTY"+currScreen in i[1]: - 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) - - def getSessionInformation(self): - try: - bus = dbus.SystemBus() - if not self.ListSessions: - 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['screen']['autoIgnoreScreens'] = [] - for session in sessions: - obj = bus.get_object('org.freedesktop.login1', session[4]) - inf = dbus.Interface(obj, 'org.freedesktop.DBus.Properties') - sessionType = inf.Get('org.freedesktop.login1.Session', 'Type') - screen = str(inf.Get('org.freedesktop.login1.Session', 'VTNr')) - if screen == '': - screen = str(inf.Get('org.freedesktop.login1.Session', 'TTY')) - screen = screen[screen.upper().find('TTY') + 3:] - if screen == '': - self.env['runtime']['debug'].writeDebugOut('No TTY found for session:' + session[4],debug.debugLevel.ERROR) - return - if sessionType.upper() == 'X11': - 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['screen']['autoIgnoreScreens'] = [] - #self.env['runtime']['debug'].writeDebugOut('getSessionInformation:' + str(self.env['screen']['autoIgnoreScreens']) + ' ' + str(self.env['general']) ,debug.debugLevel.INFO) - - def updateWatchdog(self,active , eventQueue): - try: - vcsa = {} - vcsaDevices = glob.glob('/dev/vcsa*') - for vcsaDev in vcsaDevices: - index = vcsaDev[9:] - vcsa[str(index)] = open(vcsaDev,'rb') - - tty = open('/sys/devices/virtual/tty/tty0/active','r') - currScreen = str(tty.read()[3:-1]) - oldScreen = currScreen - watchdog = select.epoll() - watchdog.register(vcsa[currScreen], select.POLLPRI | select.POLLERR) - watchdog.register(tty, select.POLLPRI | select.POLLERR) - while active.value == 1: - changes = watchdog.poll(2) - for change in changes: - fileno = change[0] - event = change[1] - if fileno == tty.fileno(): - self.env['runtime']['debug'].writeDebugOut('ScreenChange',debug.debugLevel.INFO) - tty.seek(0) - currScreen = str(tty.read()[3:-1]) - if currScreen != oldScreen: - try: - watchdog.unregister(vcsa[ oldScreen ]) - except: - pass - try: - watchdog.register(vcsa[ currScreen ], select.POLLPRI | select.POLLERR) - except: - pass - oldScreen = currScreen - eventQueue.put({"Type":fenrirEventType.ScreenChanged,"Data":''}) - try: - vcsa[currScreen].seek(0) - lastScreenContent = vcsa[currScreen].read() - except: - pass - else: - self.env['runtime']['debug'].writeDebugOut('ScreenUpdate',debug.debugLevel.INFO) - vcsa[currScreen].seek(0) - dirtyContent = vcsa[currScreen].read() - screenContent = b'' - timeout = time.time() - while screenContent != dirtyContent: - screenContent = dirtyContent - if time.time() - timeout >= 0.4: - break - time.sleep(0.008) - vcsa[currScreen].seek(0) - dirtyContent = vcsa[currScreen].read() - eventQueue.put({"Type":fenrirEventType.ScreenUpdate,"Data":None}) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('VCSA:updateWatchdog:' + str(e),debug.debugLevel.ERROR) - - def updateCharMap(self, screen): - self.charmap = {} - try: - tty = open('/dev/tty' + screen, 'rb') - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('VCSA:updateCharMap:' + str(e),debug.debugLevel.ERROR) - return - GIO_UNIMAP = 0x4B66 - VT_GETHIFONTMASK = 0x560D - himask = array("H", (0,)) - ioctl(tty, VT_GETHIFONTMASK, himask) - self.hichar, = unpack_from("@H", himask) - sz = 512 - line = '' - while True: - try: - unipairs = array("H", [0]*(2*sz)) - unimapdesc = array("B", pack("@HP", sz, unipairs.buffer_info()[0])) - ioctl(tty.fileno(), GIO_UNIMAP, unimapdesc) - break - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('VCSA:updateCharMap:scaling up sz=' + str(sz) + ' ' + str(e),debug.debugLevel.WARNING) - sz *= 2 - tty.close() - ncodes, = unpack_from("@H", unimapdesc) - utable = unpack_from("@%dH" % (2*ncodes), unipairs) - for u, b in zip(utable[::2], utable[1::2]): - if self.charmap.get(b) is None: - self.charmap[b] = chr(u) - - def autoDecodeVCSA(self, allData, rows, cols): - allText = '' - allAttrib = [] - i = 0 - for y in range(rows): - lineText = '' - lineAttrib = [] - for x in range(cols): - data = allData[i: i + 2] - i += 2 - if data == b' \x07': - #attr = 7 - #ink = 7 - #paper = 0 - #ch = ' ' - lineAttrib.append((7,15,0,0,0,0)) # attribute, ink, paper, blink, bold, underline - lineText += ' ' - continue - (sh,) = unpack("=H", data) - attr = (sh >> 8) & 0xFF - ch = sh & 0xFF - if self.hichar == 0x100: - attr >>= 1 - ink = attr & 0x0F - paper = (attr>>4) & 0x0F - blink = 0 - #if attr & 1: - # blink = 1 - bold = 0 - #if attr & 16: - # bold = 1 - #if (ink != 7) or (paper != 0): - # print(ink,paper) - if sh & self.hichar: - ch |= 0x100 - try: - lineText += self.charmap[ch] - except KeyError: - lineText += '?' - lineAttrib.append((attr,ink, paper,blink,bold,0)) # attribute, ink, paper, blink, bold, underline - allText += lineText + '\n' - allAttrib += lineAttrib - return str(allText), allAttrib - def getFenrirBGColor(self, attribute): - try: - return self.bgColorNames[attribute[2]] - except Exception as e: - print(e) - return '' - def getFenrirFGColor(self, attribute): - try: - return self.fgColorNames[attribute[1]] - except Exception as e: - print(e) - return '' - def getFenrirUnderline(self, attribute): - if attribute[5] == 1: - return _('underlined') - return '' - def getFenrirBold(self, attribute): - if attribute[4] == 1: - return _('bold') - return '' - def getFenrirBlink(self, attribute): - if attribute[3] == 1: - return _('blink') - return '' - def getFenrirFont(self, attribute): - return _('Default') - def getFenrirFontSize(self, attribute): - return _('Default') - def update(self, trigger='onUpdate'): - if trigger == 'onInput': # no need for an update on input for VCSA - return - newContentBytes = b'' - try: - # read screen - vcsa = open(self.vcsaDevicePath + self.env['screen']['newTTY'],'rb',0) - newContentBytes = vcsa.read() - vcsa.close() - if len(newContentBytes) < 5: - return - except Exception as e: - self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR) - return - # set new "old" values - 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['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.updateCharMap(str(self.env['screen']['newTTY'])) - self.env['screen']['newContentText'], \ - self.env['screen']['newContentAttrib'] =\ - self.autoDecodeVCSA(self.env['screen']['newContentBytes'][4:], self.env['screen']['lines'], self.env['screen']['columns']) - - if self.env['screen']['newTTY'] != self.env['screen']['oldTTY']: - self.env['screen']['oldContentBytes'] = b'' - self.env['screen']['oldContentAttrib'] = None - 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['screen']['newNegativeDelta'] = '' - self.env['screen']['newDelta'] = '' - self.env['screen']['newAttribDelta'] = '' - - # changes on the screen - 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 - diffList = [] - if (self.env['screen']['oldContentText'] != self.env['screen']['newContentText']): - if self.env['screen']['newContentText'] != '' and self.env['screen']['oldContentText'] == '': - if oldScreenText == '' and\ - newScreenText != '': - self.env['screen']['newDelta'] = newScreenText - else: - cursorLineStart = self.env['screen']['newCursor']['y'] * self.env['screen']['columns'] + self.env['screen']['newCursor']['y'] - cursorLineEnd = cursorLineStart + self.env['screen']['columns'] - if abs(self.env['screen']['oldCursor']['x'] - self.env['screen']['newCursor']['x']) >= 1 and \ - self.env['screen']['oldCursor']['y'] == self.env['screen']['newCursor']['y'] and \ - self.env['screen']['newContentText'][:cursorLineStart] == self.env['screen']['oldContentText'][:cursorLineStart] and \ - self.env['screen']['newContentText'][cursorLineEnd:] == self.env['screen']['oldContentText'][cursorLineEnd:]: - cursorLineStartOffset = cursorLineStart - cursorLineEndOffset = cursorLineEnd - #if cursorLineStart < cursorLineStart + self.env['screen']['newCursor']['x'] - 4: - # cursorLineStartOffset = cursorLineStart + self.env['screen']['newCursor']['x'] - 4 - if cursorLineEnd > cursorLineStart + self.env['screen']['newCursor']['x'] + 3: - cursorLineEndOffset = cursorLineStart + self.env['screen']['newCursor']['x'] + 3 - oldScreenText = self.env['screen']['oldContentText'][cursorLineStartOffset:cursorLineEndOffset] - # oldScreenText = re.sub(' +',' ',oldScreenText) - newScreenText = self.env['screen']['newContentText'][cursorLineStartOffset:cursorLineEndOffset] - #newScreenText = re.sub(' +',' ',newScreenText) - diff = difflib.ndiff(oldScreenText, newScreenText) - diffList = list(diff) - tempNewDelta = ''.join(x[2:] for x in diffList if x[0] == '+') - if tempNewDelta.strip() != '': - if tempNewDelta != ''.join(newScreenText[self.env['screen']['oldCursor']['x']:self.env['screen']['newCursor']['x']].rstrip()): - diffList = ['+ ' + self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']]] - - typing = True - else: - diff = difflib.ndiff( oldScreenText.split('\n'),\ - newScreenText.split('\n')) - - diffList = list(diff) - - if self.env['runtime']['settingsManager'].getSetting('general', 'newLinePause') and not typing: - self.env['screen']['newDelta'] = '\n'.join(x[2:] for x in diffList if x[0] == '+') - else: - 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['screen']['oldContentAttrib'] != self.env['screen']['newContentAttrib']: - if self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'highlight'): - 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/screenDriver/__init__.py b/src/fenrir/screenDriver/__init__.py deleted file mode 100755 index e69de29b..00000000 diff --git a/src/fenrir/screenDriver/dummyDriver.py b/src/fenrir/screenDriver/dummyDriver.py deleted file mode 100644 index 6318b734..00000000 --- a/src/fenrir/screenDriver/dummyDriver.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from core.screenDriver import screenDriver - -class driver(screenDriver): - def __init__(self): - screenDriver.__init__(self) diff --git a/src/fenrir/screenDriver/ptyDriver.py b/src/fenrir/screenDriver/ptyDriver.py deleted file mode 100644 index 10b1c180..00000000 --- a/src/fenrir/screenDriver/ptyDriver.py +++ /dev/null @@ -1,372 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. -#attrib: -#http://rampex.ihep.su/Linux/linux_howto/html/tutorials/mini/Colour-ls-6.html -#0 = black, 1 = blue, 2 = green, 3 = cyan, 4 = red, 5 = purple, 6 = brown/yellow, 7 = white. -#https://github.com/jwilk/vcsapeek/blob/master/linuxvt.py -#blink = 5 if attr & 1 else 0 -#bold = 1 if attr & 16 else 0 - - -import difflib -import re -import subprocess -import glob, os -import termios -import time -import select -import dbus -import fcntl -from array import array -import errno -import sys -from utils import screen_utils -from fcntl import ioctl -from struct import unpack_from, unpack, pack -from core import debug -from core.eventData import fenrirEventType -from core.screenDriver import screenDriver - -class driver(screenDriver): - def __init__(self): - screenDriver.__init__(self) - self.vcsaDevicePath = '/dev/vcsa' - self.ListSessions = None - self.charmap = {} - self.bgColorNames = {0: _('black'), 1: _('blue'), 2: _('green'), 3: _('cyan'), 4: _('red'), 5: _('Magenta'), 6: _('brown/yellow'), 7: _('white')} - self.fgColorNames = {0: _('Black'), 1: _('Blue'), 2: _('Green'), 3: _('Cyan'), 4: _('Red'), 5: _('Magenta'), 6: _('brown/yellow'), 7: _('Light gray'), 8: _('Dark gray'), 9: _('Light blue'), 10: ('Light green'), 11: _('Light cyan'), 12: _('Light red'), 13: _('Light magenta'), 14: _('Light yellow'), 15: _('White')} - self.hichar = None - def initialize(self, environment): - self.env = environment - self.env['runtime']['processManager'].addCustomEventThread(self.updateWatchdog) - def getCurrScreen(self): - self.env['screen']['oldTTY'] = self.env['screen']['newTTY'] - try: - currScreenFile = open('/sys/devices/virtual/tty/tty0/active','r') - 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['screen']['newTTY'] - if screen != None: - useScreen = screen - with open(useScreen, 'w') as fd: - for c in text: - fcntl.ioctl(fd, termios.TIOCSTI, c) - - def getCurrApplication(self): - apps = [] - try: - 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) - return - try: - for i in apps: - i = i.upper() - i = i.split() - i[0] = i[0] - i[1] = i[1] - if '+' in i[2]: - if i[0] != '': - if not "GREP" == i[0] and \ - not "SH" == i[0] and \ - not "PS" == i[0]: - if "TTY"+currScreen in i[1]: - 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) - - def getSessionInformation(self): - try: - bus = dbus.SystemBus() - if not self.ListSessions: - 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['screen']['autoIgnoreScreens'] = [] - for session in sessions: - obj = bus.get_object('org.freedesktop.login1', session[4]) - inf = dbus.Interface(obj, 'org.freedesktop.DBus.Properties') - sessionType = inf.Get('org.freedesktop.login1.Session', 'Type') - screen = str(inf.Get('org.freedesktop.login1.Session', 'VTNr')) - if screen == '': - screen = str(inf.Get('org.freedesktop.login1.Session', 'TTY')) - screen = screen[screen.upper().find('TTY') + 3:] - if screen == '': - self.env['runtime']['debug'].writeDebugOut('No TTY found for session:' + session[4],debug.debugLevel.ERROR) - return - if sessionType.upper() == 'X11': - 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['screen']['autoIgnoreScreens'] = [] - self.env['runtime']['debug'].writeDebugOut('getSessionInformation:' + str(self.env['screen']['autoIgnoreScreens']) + ' ' + str(self.env['general']) ,debug.debugLevel.INFO) - - def updateWatchdog(self,active , eventQueue): - try: - vcsa = {} - vcsaDevices = glob.glob('/dev/vcsa*') - for vcsaDev in vcsaDevices: - index = vcsaDev[9:] - vcsa[str(index)] = open(vcsaDev,'rb') - - tty = open('/sys/devices/virtual/tty/tty0/active','r') - currScreen = str(tty.read()[3:-1]) - oldScreen = currScreen - watchdog = select.epoll() - watchdog.register(vcsa[currScreen], select.POLLPRI | select.POLLERR) - watchdog.register(tty, select.POLLPRI | select.POLLERR) - while active.value == 1: - changes = watchdog.poll(2) - for change in changes: - fileno = change[0] - event = change[1] - if fileno == tty.fileno(): - self.env['runtime']['debug'].writeDebugOut('ScreenChange',debug.debugLevel.INFO) - tty.seek(0) - currScreen = str(tty.read()[3:-1]) - if currScreen != oldScreen: - try: - watchdog.unregister(vcsa[ oldScreen ]) - except: - pass - try: - watchdog.register(vcsa[ currScreen ], select.POLLPRI | select.POLLERR) - except: - pass - oldScreen = currScreen - eventQueue.put({"Type":fenrirEventType.ScreenChanged,"Data":''}) - try: - vcsa[currScreen].seek(0) - lastScreenContent = vcsa[currScreen].read() - except: - pass - else: - self.env['runtime']['debug'].writeDebugOut('ScreenUpdate',debug.debugLevel.INFO) - vcsa[currScreen].seek(0) - dirtyContent = vcsa[currScreen].read() - screenContent = b'' - timeout = time.time() - while screenContent != dirtyContent: - screenContent = dirtyContent - if time.time() - timeout >= 0.4: - break - time.sleep(0.007) - vcsa[currScreen].seek(0) - dirtyContent = vcsa[currScreen].read() - eventQueue.put({"Type":fenrirEventType.ScreenUpdate,"Data":None}) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('VCSA:updateWatchdog:' + str(e),debug.debugLevel.ERROR) - - def updateCharMap(self, screen): - self.charmap = {} - try: - tty = open('/dev/tty' + screen, 'rb') - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('VCSA:updateCharMap:' + str(e),debug.debugLevel.ERROR) - return - GIO_UNIMAP = 0x4B66 - VT_GETHIFONTMASK = 0x560D - himask = array("H", (0,)) - ioctl(tty, VT_GETHIFONTMASK, himask) - self.hichar, = unpack_from("@H", himask) - sz = 512 - line = '' - while True: - try: - unipairs = array("H", [0]*(2*sz)) - unimapdesc = array("B", pack("@HP", sz, unipairs.buffer_info()[0])) - ioctl(tty.fileno(), GIO_UNIMAP, unimapdesc) - break - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('VCSA:updateCharMap:scaling up sz=' + str(sz) + ' ' + str(e),debug.debugLevel.WARNING) - sz *= 2 - tty.close() - ncodes, = unpack_from("@H", unimapdesc) - utable = unpack_from("@%dH" % (2*ncodes), unipairs) - for u, b in zip(utable[::2], utable[1::2]): - if self.charmap.get(b) is None: - self.charmap[b] = chr(u) - - def autoDecodeVCSA(self, allData, rows, cols): - allText = '' - allAttrib = [] - i = 0 - for y in range(rows): - lineText = '' - lineAttrib = [] - for x in range(cols): - data = allData[i: i + 2] - i += 2 - if data == b' \x07': - #attr = 7 - #ink = 7 - #paper = 0 - #ch = ' ' - lineAttrib.append((7,15,0,0,0,0)) # attribute, ink, paper, blink, bold, underline - lineText += ' ' - continue - (sh,) = unpack("=H", data) - attr = (sh >> 8) & 0xFF - ch = sh & 0xFF - if self.hichar == 0x100: - attr >>= 1 - ink = attr & 0x0F - paper = (attr>>4) & 0x0F - blink = 0 - #if attr & 1: - # blink = 1 - bold = 0 - #if attr & 16: - # bold = 1 - #if (ink != 7) or (paper != 0): - # print(ink,paper) - if sh & self.hichar: - ch |= 0x100 - try: - lineText += self.charmap[ch] - except KeyError: - lineText += '?' - lineAttrib.append((attr,ink, paper,blink,bold,0)) # attribute, ink, paper, blink, bold, underline - allText += lineText + '\n' - allAttrib += lineAttrib - return str(allText), allAttrib - def getFenrirBGColor(self, attribute): - try: - return self.bgColorNames[attribute[2]] - except Exception as e: - print(e) - return '' - def getFenrirFGColor(self, attribute): - try: - return self.fgColorNames[attribute[1]] - except Exception as e: - print(e) - return '' - def getFenrirUnderline(self, attribute): - if attribute[5] == 1: - return _('underlined') - return '' - def getFenrirBold(self, attribute): - if attribute[4] == 1: - return _('bold') - return '' - def getFenrirBlink(self, attribute): - if attribute[3] == 1: - return _('blink') - return '' - def getFenrirFont(self, attribute): - return _('Default') - def getFenrirFontSize(self, attribute): - return _('Default') - def update(self, trigger='onUpdate'): - if trigger == 'onInput': # no need for an update on input for VCSA - return - newContentBytes = b'' - try: - # read screen - vcsa = open(self.vcsaDevicePath + self.env['screen']['newTTY'],'rb',0) - newContentBytes = vcsa.read() - vcsa.close() - if len(newContentBytes) < 5: - return - except Exception as e: - self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR) - return - # set new "old" values - 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['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.updateCharMap(str(self.env['screen']['newTTY'])) - self.env['screen']['newContentText'], \ - self.env['screen']['newContentAttrib'] =\ - self.autoDecodeVCSA(self.env['screen']['newContentBytes'][4:], self.env['screen']['lines'], self.env['screen']['columns']) - - if self.env['screen']['newTTY'] != self.env['screen']['oldTTY']: - self.env['screen']['oldContentBytes'] = b'' - self.env['screen']['oldContentAttrib'] = None - 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['screen']['newNegativeDelta'] = '' - self.env['screen']['newDelta'] = '' - self.env['screen']['newAttribDelta'] = '' - - # changes on the screen - 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['screen']['oldContentText'] != self.env['screen']['newContentText']): - if self.env['screen']['newContentText'] != '' and self.env['screen']['oldContentText'] == '': - if oldScreenText == '' and\ - newScreenText != '': - self.env['screen']['newDelta'] = newScreenText - else: - cursorLineStart = self.env['screen']['newCursor']['y'] * self.env['screen']['columns'] + self.env['screen']['newCursor']['y'] - cursorLineEnd = cursorLineStart + self.env['screen']['columns'] - if abs(self.env['screen']['oldCursor']['x'] - self.env['screen']['newCursor']['x']) == 1 and \ - self.env['screen']['oldCursor']['y'] == self.env['screen']['newCursor']['y'] and \ - self.env['screen']['newContentText'][:cursorLineStart] == self.env['screen']['oldContentText'][:cursorLineStart] and \ - self.env['screen']['newContentText'][cursorLineEnd:] == self.env['screen']['oldContentText'][cursorLineEnd:]: - cursorLineStartOffset = cursorLineStart - cursorLineEndOffset = cursorLineEnd - #if cursorLineStart < cursorLineStart + self.env['screen']['newCursor']['x'] - 4: - # cursorLineStartOffset = cursorLineStart + self.env['screen']['newCursor']['x'] - 4 - if cursorLineEnd > cursorLineStart + self.env['screen']['newCursor']['x'] + 3: - cursorLineEndOffset = cursorLineStart + self.env['screen']['newCursor']['x'] + 3 - oldScreenText = self.env['screen']['oldContentText'][cursorLineStartOffset:cursorLineEndOffset] - oldScreenText = re.sub(' +',' ',oldScreenText) - newScreenText = self.env['screen']['newContentText'][cursorLineStartOffset:cursorLineEndOffset] - newScreenText = re.sub(' +',' ',newScreenText) - diff = difflib.ndiff(oldScreenText, newScreenText) - typing = True - else: - diff = difflib.ndiff( oldScreenText.split('\n'),\ - newScreenText.split('\n')) - - diffList = list(diff) - - if self.env['runtime']['settingsManager'].getSetting('general', 'newLinePause') and not typing: - self.env['screen']['newDelta'] = '\n'.join(x[2:] for x in diffList if x[0] == '+') - else: - 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['screen']['oldContentAttrib'] != self.env['screen']['newContentAttrib']: - if self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'highlight'): - 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/screenDriver/vcsaDriver.py b/src/fenrir/screenDriver/vcsaDriver.py deleted file mode 100644 index 25ca4680..00000000 --- a/src/fenrir/screenDriver/vcsaDriver.py +++ /dev/null @@ -1,384 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. -#attrib: -#http://rampex.ihep.su/Linux/linux_howto/html/tutorials/mini/Colour-ls-6.html -#0 = black, 1 = blue, 2 = green, 3 = cyan, 4 = red, 5 = purple, 6 = brown/yellow, 7 = white. -#https://github.com/jwilk/vcsapeek/blob/master/linuxvt.py -#blink = 5 if attr & 1 else 0 -#bold = 1 if attr & 16 else 0 - - -import difflib -import re -import subprocess -import glob, os -import termios -import time -import select -import dbus -import fcntl -from array import array -import errno -import sys -from utils import screen_utils -from fcntl import ioctl -from struct import unpack_from, unpack, pack -from core import debug -from core.eventData import fenrirEventType -from core.screenDriver import screenDriver - -class driver(screenDriver): - def __init__(self): - screenDriver.__init__(self) - self.vcsaDevicePath = '/dev/vcsa' - self.ListSessions = None - self.charmap = {} - self.bgColorNames = {0: _('black'), 1: _('blue'), 2: _('green'), 3: _('cyan'), 4: _('red'), 5: _('Magenta'), 6: _('brown/yellow'), 7: _('white')} - self.fgColorNames = {0: _('Black'), 1: _('Blue'), 2: _('Green'), 3: _('Cyan'), 4: _('Red'), 5: _('Magenta'), 6: _('brown/yellow'), 7: _('Light gray'), 8: _('Dark gray'), 9: _('Light blue'), 10: ('Light green'), 11: _('Light cyan'), 12: _('Light red'), 13: _('Light magenta'), 14: _('Light yellow'), 15: _('White')} - self.hichar = None - def initialize(self, environment): - self.env = environment - self.env['runtime']['processManager'].addCustomEventThread(self.updateWatchdog) - def getCurrScreen(self): - self.env['screen']['oldTTY'] = self.env['screen']['newTTY'] - try: - currScreenFile = open('/sys/devices/virtual/tty/tty0/active','r') - 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['screen']['newTTY'] - if screen != None: - useScreen = screen - with open(useScreen, 'w') as fd: - for c in text: - fcntl.ioctl(fd, termios.TIOCSTI, c) - - def getCurrApplication(self): - apps = [] - try: - 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) - return - try: - for i in apps: - i = i.upper() - i = i.split() - i[0] = i[0] - i[1] = i[1] - if '+' in i[2]: - if i[0] != '': - if not "GREP" == i[0] and \ - not "SH" == i[0] and \ - not "PS" == i[0]: - if "TTY"+currScreen in i[1]: - 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) - - def getSessionInformation(self): - try: - bus = dbus.SystemBus() - if not self.ListSessions: - 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['screen']['autoIgnoreScreens'] = [] - for session in sessions: - obj = bus.get_object('org.freedesktop.login1', session[4]) - inf = dbus.Interface(obj, 'org.freedesktop.DBus.Properties') - sessionType = inf.Get('org.freedesktop.login1.Session', 'Type') - screen = str(inf.Get('org.freedesktop.login1.Session', 'VTNr')) - if screen == '': - screen = str(inf.Get('org.freedesktop.login1.Session', 'TTY')) - screen = screen[screen.upper().find('TTY') + 3:] - if screen == '': - self.env['runtime']['debug'].writeDebugOut('No TTY found for session:' + session[4],debug.debugLevel.ERROR) - return - if sessionType.upper() != 'TTY': - 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['screen']['autoIgnoreScreens'] = [] - #self.env['runtime']['debug'].writeDebugOut('getSessionInformation:' + str(self.env['screen']['autoIgnoreScreens']) + ' ' + str(self.env['general']) ,debug.debugLevel.INFO) - - def updateWatchdog(self,active , eventQueue): - screenData = { - 'columns': 0, - 'lines': 0, - 'delta': '', - 'negativeDelta': '', - 'attribDelta': '', - 'cursorAttrib':None, - 'cursor':{'x':0,'y':0}, - 'Bytes': b'', - 'Text': '', - 'Attributes': None, - 'Scren':'0', - 'Application': '', - 'screenUpdateTime': time.time(), - } - try: - vcsa = {} - vcsaDevices = glob.glob('/dev/vcsa*') - for vcsaDev in vcsaDevices: - index = vcsaDev[9:] - vcsa[str(index)] = open(vcsaDev,'rb') - - tty = open('/sys/devices/virtual/tty/tty0/active','r') - currScreen = str(tty.read()[3:-1]) - oldScreen = currScreen - watchdog = select.epoll() - watchdog.register(vcsa[currScreen], select.POLLPRI | select.POLLERR) - watchdog.register(tty, select.POLLPRI | select.POLLERR) - while active.value == 1: - changes = watchdog.poll(2) - for change in changes: - fileno = change[0] - event = change[1] - if fileno == tty.fileno(): - self.env['runtime']['debug'].writeDebugOut('ScreenChange',debug.debugLevel.INFO) - tty.seek(0) - currScreen = str(tty.read()[3:-1]) - if currScreen != oldScreen: - try: - watchdog.unregister(vcsa[ oldScreen ]) - except: - pass - try: - watchdog.register(vcsa[ currScreen ], select.POLLPRI | select.POLLERR) - except: - pass - oldScreen = currScreen - try: - vcsa[currScreen].seek(0) - lastScreenContent = vcsa[currScreen].read() - except: - pass - eventQueue.put({"Type":fenrirEventType.ScreenChanged,"Data":lastScreenContent}) - else: - self.env['runtime']['debug'].writeDebugOut('ScreenUpdate',debug.debugLevel.INFO) - vcsa[currScreen].seek(0) - dirtyContent = vcsa[currScreen].read() - screenContent = b'' - timeout = time.time() - while screenContent != dirtyContent: - screenContent = dirtyContent - if time.time() - timeout >= 0.4: - break - time.sleep(0.02) - vcsa[currScreen].seek(0) - dirtyContent = vcsa[currScreen].read() - eventQueue.put({"Type":fenrirEventType.ScreenUpdate,"Data":screenContent}) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('VCSA:updateWatchdog:' + str(e),debug.debugLevel.ERROR) - - def updateCharMap(self, screen): - self.charmap = {} - try: - tty = open('/dev/tty' + screen, 'rb') - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('VCSA:updateCharMap:' + str(e),debug.debugLevel.ERROR) - return - GIO_UNIMAP = 0x4B66 - VT_GETHIFONTMASK = 0x560D - himask = array("H", (0,)) - ioctl(tty, VT_GETHIFONTMASK, himask) - self.hichar, = unpack_from("@H", himask) - sz = 512 - line = '' - while True: - try: - unipairs = array("H", [0]*(2*sz)) - unimapdesc = array("B", pack("@HP", sz, unipairs.buffer_info()[0])) - ioctl(tty.fileno(), GIO_UNIMAP, unimapdesc) - break - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('VCSA:updateCharMap:scaling up sz=' + str(sz) + ' ' + str(e),debug.debugLevel.WARNING) - sz *= 2 - tty.close() - ncodes, = unpack_from("@H", unimapdesc) - utable = unpack_from("@%dH" % (2*ncodes), unipairs) - for u, b in zip(utable[::2], utable[1::2]): - if self.charmap.get(b) is None: - self.charmap[b] = chr(u) - - def autoDecodeVCSA(self, allData, rows, cols): - allText = '' - allAttrib = [] - i = 0 - for y in range(rows): - lineText = '' - lineAttrib = [] - for x in range(cols): - data = allData[i: i + 2] - i += 2 - if data == b' \x07': - #attr = 7 - #ink = 7 - #paper = 0 - #ch = ' ' - lineAttrib.append((7,15,0,0,0,0)) # attribute, ink, paper, blink, bold, underline - lineText += ' ' - continue - (sh,) = unpack("=H", data) - attr = (sh >> 8) & 0xFF - ch = sh & 0xFF - if self.hichar == 0x100: - attr >>= 1 - ink = attr & 0x0F - paper = (attr>>4) & 0x0F - blink = 0 - #if attr & 1: - # blink = 1 - bold = 0 - #if attr & 16: - # bold = 1 - #if (ink != 7) or (paper != 0): - # print(ink,paper) - if sh & self.hichar: - ch |= 0x100 - try: - lineText += self.charmap[ch] - except KeyError: - lineText += '?' - lineAttrib.append((attr,ink, paper,blink,bold,0)) # attribute, ink, paper, blink, bold, underline - allText += lineText + '\n' - allAttrib += lineAttrib - return str(allText), allAttrib - def getFenrirBGColor(self, attribute): - try: - return self.bgColorNames[attribute[2]] - except Exception as e: - print(e) - return '' - def getFenrirFGColor(self, attribute): - try: - return self.fgColorNames[attribute[1]] - except Exception as e: - print(e) - return '' - def getFenrirUnderline(self, attribute): - if attribute[5] == 1: - return _('underlined') - return '' - def getFenrirBold(self, attribute): - if attribute[4] == 1: - return _('bold') - return '' - def getFenrirBlink(self, attribute): - if attribute[3] == 1: - return _('blink') - return '' - def getFenrirFont(self, attribute): - return _('Default') - def getFenrirFontSize(self, attribute): - return _('Default') - def update(self, text, trigger='onUpdate'): - newContentBytes = text - # set new "old" values - 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['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.updateCharMap(str(self.env['screen']['newTTY'])) - self.env['screen']['newContentText'], \ - self.env['screen']['newContentAttrib'] =\ - self.autoDecodeVCSA(self.env['screen']['newContentBytes'][4:], self.env['screen']['lines'], self.env['screen']['columns']) - - if self.env['screen']['newTTY'] != self.env['screen']['oldTTY']: - self.env['screen']['oldContentBytes'] = b'' - self.env['screen']['oldContentAttrib'] = None - 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 - if self.env['screen']['oldTTY'] == None: - self.env['screen']['oldTTY'] = self.env['screen']['newTTY'] - 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['screen']['oldContentText'])) - newScreenText = re.sub(' +',' ',self.env['runtime']['screenManager'].getWindowAreaInText(self.env['screen']['newContentText'])) - typing = False - diffList = [] - if (self.env['screen']['oldContentText'] != self.env['screen']['newContentText']): - if self.env['screen']['newContentText'] != '' and self.env['screen']['oldContentText'] == '': - if oldScreenText == '' and\ - newScreenText != '': - self.env['screen']['newDelta'] = newScreenText - else: - cursorLineStart = self.env['screen']['newCursor']['y'] * self.env['screen']['columns'] + self.env['screen']['newCursor']['y'] - cursorLineEnd = cursorLineStart + self.env['screen']['columns'] - if abs(self.env['screen']['oldCursor']['x'] - self.env['screen']['newCursor']['x']) >= 1 and \ - self.env['screen']['oldCursor']['y'] == self.env['screen']['newCursor']['y'] and \ - self.env['screen']['newContentText'][:cursorLineStart] == self.env['screen']['oldContentText'][:cursorLineStart] and \ - self.env['screen']['newContentText'][cursorLineEnd:] == self.env['screen']['oldContentText'][cursorLineEnd:]: - cursorLineStartOffset = cursorLineStart - cursorLineEndOffset = cursorLineEnd - #if cursorLineStart < cursorLineStart + self.env['screen']['newCursor']['x'] - 4: - # cursorLineStartOffset = cursorLineStart + self.env['screen']['newCursor']['x'] - 4 - if cursorLineEnd > cursorLineStart + self.env['screen']['newCursor']['x'] + 3: - cursorLineEndOffset = cursorLineStart + self.env['screen']['newCursor']['x'] + 3 - oldScreenText = self.env['screen']['oldContentText'][cursorLineStartOffset:cursorLineEndOffset] - # oldScreenText = re.sub(' +',' ',oldScreenText) - newScreenText = self.env['screen']['newContentText'][cursorLineStartOffset:cursorLineEndOffset] - #newScreenText = re.sub(' +',' ',newScreenText) - diff = difflib.ndiff(oldScreenText, newScreenText) - diffList = list(diff) - tempNewDelta = ''.join(x[2:] for x in diffList if x[0] == '+') - if tempNewDelta.strip() != '': - if tempNewDelta != ''.join(newScreenText[self.env['screen']['oldCursor']['x']:self.env['screen']['newCursor']['x']].rstrip()): - diffList = ['+ ' + self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']]] - - typing = True - else: - diff = difflib.ndiff( oldScreenText.split('\n'),\ - newScreenText.split('\n')) - - diffList = list(diff) - - if self.env['runtime']['settingsManager'].getSetting('general', 'newLinePause') and not typing: - self.env['screen']['newDelta'] = '\n'.join(x[2:] for x in diffList if x[0] == '+') - else: - 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['screen']['oldContentAttrib'] != self.env['screen']['newContentAttrib']: - if self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'highlight'): - 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/soundDriver/__init__.py b/src/fenrir/soundDriver/__init__.py deleted file mode 100755 index e69de29b..00000000 diff --git a/src/fenrir/soundDriver/debugDriver.py b/src/fenrir/soundDriver/debugDriver.py deleted file mode 100644 index e782dbde..00000000 --- a/src/fenrir/soundDriver/debugDriver.py +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from core.soundDriver import soundDriver - -class driver(soundDriver): - def __init__(self): - soundDriver.__init__(self) - - def initialize(self, environment): - self.env = environment - self._initialized = True - print('Sound Debug Driver: Initialized') - - def shutdown(self): - if not self._initialized: - return - self.cancel() - self._initialized = False - print('Sound Debug Driver: Shutdown') - - def playFrequence(self, frequence = 1000, duration = 0.3, adjustVolume = 0): - if not self._initialized: - return - if interrupt: - self.cancel() - print('Sound Debug Driver: playFrequence:' + ' freq:' + str(frequence) + ' duration:' + str(duration) + ' adjustVolume:' + str(adjustVolume) ) - print('Sound Debug Driver: -----------------------------------') - - def playSoundFile(self, filePath, interrupt = True): - if not self._initialized: - return - if interrupt: - self.cancel() - print('Sound Debug Driver: playSoundFile:' + str(filePath)) - print('Sound Debug Driver: -----------------------------------') - - def cancel(self): - if not self._initialized: - return - print('Sound Debug Driver: Cancel') - - def setCallback(self, callback): - if not self._initialized: - return - print('Sound Debug Driver: setCallback') - - def setVolume(self, volume): - if not self._initialized: - return - self.volume = volume - print('Sound Debug Driver: setVolume:' + str(self.volume)) diff --git a/src/fenrir/soundDriver/dummyDriver.py b/src/fenrir/soundDriver/dummyDriver.py deleted file mode 100644 index 87e8a6a1..00000000 --- a/src/fenrir/soundDriver/dummyDriver.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from core.soundDriver import soundDriver - -class driver(soundDriver): - def __init__(self): - soundDriver.__init__(self) diff --git a/src/fenrir/soundDriver/genericDriver.py b/src/fenrir/soundDriver/genericDriver.py deleted file mode 100644 index f982bfd1..00000000 --- a/src/fenrir/soundDriver/genericDriver.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -import subprocess -import shlex -from core.soundDriver import soundDriver - -class driver(soundDriver): - def __init__(self): - soundDriver.__init__(self) - self.proc = None - self.soundType = '' - self.soundFileCommand = '' - self.frequenceCommand = '' - def initialize(self, environment): - self.env = environment - self.soundFileCommand = self.env['runtime']['settingsManager'].getSetting('sound', 'genericPlayFileCommand') - self.frequenceCommand = self.env['runtime']['settingsManager'].getSetting('sound', 'genericFrequencyCommand') - if self.soundFileCommand == '': - self.soundFileCommand = 'play -q -v fenrirVolume fenrirSoundFile' - if self.frequenceCommand == '': - self.frequenceCommand = 'play -q -v fenrirVolume -n -c1 synth fenrirDuration sine fenrirFrequence' - self._initialized = True - - def playFrequence(self, frequence = 1000, duration = 0.3, adjustVolume = 0): - if not self._initialized: - return - if interrupt: - self.cancel() - popenFrequenceCommand = shlex.split(self.frequenceCommand) - for idx, word in enumerate(popenFrequenceCommand): - word = word.replace('fenrirVolume', str(self.volume + adjustVolume )) - word = word.replace('fenrirFreqDuration', str(duration)) - word = word.replace('fenrirFrequence', str(frequence)) - popenFrequenceCommand[idx] = word - self.proc = subprocess.Popen(popenFrequenceCommand, shell=False) - self.soundType = 'frequence' - def playSoundFile(self, filePath, interrupt = True): - if not self._initialized: - return - if interrupt: - self.cancel() - popenSoundFileCommand = shlex.split(self.soundFileCommand) - for idx, word in enumerate(popenSoundFileCommand): - word = word.replace('fenrirVolume', str(self.volume )) - word = word.replace('fenrirSoundFile', str(filePath)) - popenSoundFileCommand[idx] = word - self.proc = subprocess.Popen(popenSoundFileCommand, shell=False) - self.soundType = 'file' - def cancel(self): - if not self._initialized: - return - if self.soundType == '': - return - if self.soundType == 'file': - self.proc.kill() - if self.soundType == 'frequence': - self.proc.kill() - self.soundType = '' diff --git a/src/fenrir/soundDriver/gstreamerDriver.py b/src/fenrir/soundDriver/gstreamerDriver.py deleted file mode 100644 index 33565d53..00000000 --- a/src/fenrir/soundDriver/gstreamerDriver.py +++ /dev/null @@ -1,113 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -import time, threading -from core.soundDriver import soundDriver - -_gstreamerAvailable = False -try: - import gi - from gi.repository import GLib - gi.require_version('Gst', '1.0') - from gi.repository import Gst - _gstreamerAvailable, args = Gst.init_check(None) -except Exception as e: - _gstreamerAvailable = False - _availableError = str(e) - -class driver(soundDriver): - def __init__(self): - soundDriver.__init__(self) - self._source = None - self._sink = None - - def initialize(self, environment): - self.env = environment - global _gstreamerAvailable - self._initialized = _gstreamerAvailable - if not self._initialized: - global _availableError - self.environment['runtime']['debug'].writeDebugOut('Gstreamer not available ' + _availableError,debug.debugLevel.ERROR) - return - self._player = Gst.ElementFactory.make('playbin', 'player') - bus = self._player.get_bus() - bus.add_signal_watch() - bus.connect("message", self._onPlayerMessage) - - self._pipeline = Gst.Pipeline(name='fenrir-pipeline') - bus = self._pipeline.get_bus() - bus.add_signal_watch() - bus.connect("message", self._onPipelineMessage) - - self._source = Gst.ElementFactory.make('audiotestsrc', 'src') - self._sink = Gst.ElementFactory.make('autoaudiosink', 'output') - self._pipeline.add(self._source) - self._pipeline.add(self._sink) - self._source.link(self._sink) - self.mainloop = GLib.MainLoop() - self.thread = threading.Thread(target=self.mainloop.run) - self.thread.start() - - def shutdown(self): - if not self._initialized: - return - self.cancel() - self.mainloop.quit() - - def _onPlayerMessage(self, bus, message): - if not self._initialized: - return - if message.type == Gst.MessageType.EOS: - self._player.set_state(Gst.State.NULL) - elif message.type == Gst.MessageType.ERROR: - self._player.set_state(Gst.State.NULL) - error, info = message.parse_error() - self.env['runtime']['debug'].writeDebugOut('GSTREAMER: _onPlayerMessage'+ str(error) + str(info),debug.debugLevel.WARNING) - - def _onPipelineMessage(self, bus, message): - if not self._initialized: - return - if message.type == Gst.MessageType.EOS: - self._pipeline.set_state(Gst.State.NULL) - elif message.type == Gst.MessageType.ERROR: - self._pipeline.set_state(Gst.State.NULL) - error, info = message.parse_error() - self.env['runtime']['debug'].writeDebugOut('GSTREAMER: _onPipelineMessage'+ str(error) + str(info),debug.debugLevel.WARNING) - - def _onTimeout(self, element): - if not self._initialized: - return - element.set_state(Gst.State.NULL) - - def playSoundFile(self, fileName, interrupt=True): - if not self._initialized: - return - if interrupt: - self.cancel() - self._player.set_property('uri', 'file://%s' % fileName) - self._player.set_state(Gst.State.PLAYING) - - def playFrequence(self, frequence, duration, adjustVolume, interrupt=True): - if not self._initialized: - return - if interrupt: - self.cancel() - self._source.set_property('volume', tone.volume) - self._source.set_property('freq', tone.frequency) - self._source.set_property('wave', tone.wave) - self._pipeline.set_state(Gst.State.PLAYING) - duration = int(1000 * tone.duration) - GLib.timeout_add(duration, self._onTimeout, self._pipeline) - - def cancel(self, element=None): - if not self._initialized: - return - if element: - element.set_state(Gst.State.NULL) - return - self._player.set_state(Gst.State.NULL) - self._pipeline.set_state(Gst.State.NULL) diff --git a/src/fenrir/speechDriver/Readme.md b/src/fenrir/speechDriver/Readme.md deleted file mode 100644 index de077fd4..00000000 --- a/src/fenrir/speechDriver/Readme.md +++ /dev/null @@ -1,3 +0,0 @@ -espeak = espeak driver -speechd = speech-dispatcher driver -generic = generic driver via /bin/say diff --git a/src/fenrir/speechDriver/__init__.py b/src/fenrir/speechDriver/__init__.py deleted file mode 100755 index e69de29b..00000000 diff --git a/src/fenrir/speechDriver/debugDriver.py b/src/fenrir/speechDriver/debugDriver.py deleted file mode 100644 index c3ab9118..00000000 --- a/src/fenrir/speechDriver/debugDriver.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. -# generic driver - -from core import debug -from core.speechDriver import speechDriver - -class driver(speechDriver): - def __init__(self): - speechDriver.__init__(self - def initialize(self, environment): - self._isInitialized = True - self.env = environment - print('Speech Debug Driver: Iitialized') - - def shutdown(self): - if self._isInitialized: - self.cancel() - self._isInitialized = False - print('Speech Debug Driver: Shutdown') - - def speak(self,text, queueable=True): - if not self._isInitialized: - return - if not queueable: - self.cancel() - print('Speech Debug Driver: Speak:'+text) - print('Speech Debug Driver: -----------------------------------') - - def cancel(self): - if not self._isInitialized: - return - print('Speech Debug Driver: Cancel') - - def setCallback(self, callback): - print('Speech Debug Driver: setCallback') - - def clear_buffer(self): - if not self._isInitialized: - return - print('Speech Debug Driver: clear_buffer') - - def setVoice(self, voice): - if not self._isInitialized: - return - print('Speech Debug Driver: setVoice:' + str(voice)) - - def setPitch(self, pitch): - if not self._isInitialized: - return - print('Speech Debug Driver: setPitch:' + str(pitch)) - - def setRate(self, rate): - if not self._isInitialized: - return - print('Speech Debug Driver: setRate:' + str(rate)) - - def setModule(self, module): - if not self._isInitialized: - return - print('Speech Debug Driver: setModule:' + str(module)) - - def setLanguage(self, language): - if not self._isInitialized: - return - print('Speech Debug Driver: setLanguage:' + str(language)) - - def setVolume(self, volume): - if not self._isInitialized: - return - print('Speech Debug Driver: setVolume:' + str(volume)) diff --git a/src/fenrir/speechDriver/dummyDriver.py b/src/fenrir/speechDriver/dummyDriver.py deleted file mode 100644 index c8ea4faa..00000000 --- a/src/fenrir/speechDriver/dummyDriver.py +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. -# generic driver - -from core import debug -from core.speechDriver import speechDriver - -class driver(speechDriver): - def __init__(self): - speechDriver.__init__(self) diff --git a/src/fenrir/speechDriver/emacspeakDriver.py b/src/fenrir/speechDriver/emacspeakDriver.py deleted file mode 100644 index d9d91818..00000000 --- a/src/fenrir/speechDriver/emacspeakDriver.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. -# generic driver - -from subprocess import Popen, PIPE -import pexpect -import ptyprocess -import shlex -import sys -import time -from core import debug -from core.speechDriver import speechDriver - -class driver(speechDriver): - def __init__(self): - speechDriver.__init__(self) - def initialize(self, environment): - self.env = environment - try: - #self.server = ptyprocess.PtyProcessUnicode.spawn(['/usr/bin/tclsh', self.env['runtime']['settingsManager'].getSetting('speech', 'serverPath')]) - self.server = pexpect.spawn('tclsh ' + self.env['runtime']['settingsManager'].getSetting('speech', 'serverPath')) - self._isInitialized = True - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('speechDriver:initialize:' + str(e),debug.debugLevel.ERROR) - print(e) - - def shutdown(self): - if self.server: - try: - self.server.terminate() - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('speechDriver:shutdown:self.server.terminate():' + str(e),debug.debugLevel.ERROR) - - def speak(self,text, queueable=True): - if not self._isInitialized: - return - if not queueable: - self.cancel() - try: - cleanText = shlex.split('tts_say "'+text.replace(',','')+'"') - for idx, word in enumerate(cleanText): - cleanText[idx] = word - cleanText = ' '.join(cleanText) - #print(cleanText[0]) - #self.server.write('tts_say ' + '"' + cleanText[0] +'"\n') - #print(self.server.read(1000)) - #self.server.sendline('tts_say ' + '"' + cleanText + '"') - self.server.sendline(cleanText) - print(cleanText) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('speechDriver:speak:self.server.sendline():' + str(e),debug.debugLevel.ERROR) - - def cancel(self): - if not self._isInitialized: - return - try: - pass - #self.server.write('s\n') - #print(self.server.read(1000)) - #self.server.sendline('stop') - except Exception as e: - print(e) - self.env['runtime']['debug'].writeDebugOut('speechDriver:cancel:self.server.sendline():' + str(e),debug.debugLevel.ERROR) - - def setRate(self, rate): - if not self._isInitialized: - return - try: - pass - #self.server.write('tts_set_speech_rate ' + str(int(rate * 400)) + '\n') - #self.server.sendline('tts_set_speech_rate ' + str(int(rate * 400)) + '') - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('speechDriver:setRate:self.server.sendline():' + str(e),debug.debugLevel.ERROR) - - def setLanguage(self, language): - if not self._isInitialized: - return - #self.server.write('set_lang ' + language + '\n') - #self.server.sendline('set_lang ' + language + '') diff --git a/src/fenrir/speechDriver/espeakDriver.py b/src/fenrir/speechDriver/espeakDriver.py deleted file mode 100644 index 7cf8fcac..00000000 --- a/src/fenrir/speechDriver/espeakDriver.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. -# Espeak driver - -from core import debug -from core.speechDriver import speechDriver - -class driver(speechDriver): - def __init__(self): - speechDriver.__init__(self) - self._es = None - - def initialize(self, environment): - self.env = environment - try: - from espeak import espeak - self._es = espeak - self._isInitialized = True - except Exception as e: - self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR) - self._initialized = False - - def speak(self,text, interrupt=True): - if not self._isInitialized: - return - if not interrupt: - self.cancel() - if self.language != None: - if self.language != '': - self._es.set_voice(self.language) - elif self.voice != None: - if self.voice != '': - self._es.set_voice(self.voice) - self._es.synth(text) - - def cancel(self): - if not self._isInitialized: - return - self._es.cancel() - return - - def setPitch(self, pitch): - if not self._isInitialized: - return - return self._es.set_parameter(self._es.Parameter().Pitch, int(pitch * 99)) - - def setRate(self, rate): - if not self._isInitialized: - return - return self._es.set_parameter(self._es.Parameter().Rate, int(rate * 899 + 100)) - - def setVolume(self, volume): - if not self._isInitialized: - return - return self._es.set_parameter(self._es.Parameter().Volume, int(volume * 200)) diff --git a/src/fenrir/speechDriver/genericDriver.py b/src/fenrir/speechDriver/genericDriver.py deleted file mode 100644 index 2f2286fc..00000000 --- a/src/fenrir/speechDriver/genericDriver.py +++ /dev/null @@ -1,192 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. -# generic driver - -from core import debug -from threading import Thread, Lock -from queue import Queue, Empty -import shlex -from subprocess import Popen -from core.speechDriver import speechDriver - -class speakQueue(Queue): - def clear(self): - try: - while True: - self.get_nowait() - except Empty: - pass - -class driver(speechDriver): - def __init__(self): - speechDriver.__init__(self) - self.proc = None - self.speechThread = Thread(target=self.worker) - self.lock = Lock() - self.textQueue = speakQueue() - def initialize(self, environment): - self.env = environment - self.minVolume = self.env['runtime']['settingsManager'].getSettingAsInt('speech', 'fenrirMinVolume') - self.maxVolume = self.env['runtime']['settingsManager'].getSettingAsInt('speech', 'fenrirMaxVolume') - self.minPitch = self.env['runtime']['settingsManager'].getSettingAsInt('speech', 'fenrirMinPitch') - self.maxPitch = self.env['runtime']['settingsManager'].getSettingAsInt('speech', 'fenrirMaxPitch') - self.minRate = self.env['runtime']['settingsManager'].getSettingAsInt('speech', 'fenrirMinRate') - self.maxRate = self.env['runtime']['settingsManager'].getSettingAsInt('speech', 'fenrirMaxRate') - - self.speechCommand = self.env['runtime']['settingsManager'].getSetting('speech', 'genericSpeechCommand') - 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 = 'flite -t "fenrirText"' - - self._isInitialized = True - if self._isInitialized: - self.speechThread.start() - def shutdown(self): - if not self._isInitialized: - return - self.cancel() - self.textQueue.put(-1) - - def speak(self,text, queueable=True): - if not self._isInitialized: - return - if not queueable: - self.cancel() - utterance = { - 'text': text, - 'volume': self.volume, - 'rate': self.rate, - 'pitch': self.pitch, - 'module': self.module, - 'language': self.language, - 'voice': self.voice, - } - self.textQueue.put(utterance.copy()) - - def cancel(self): - if not self._isInitialized: - return - self.clear_buffer() - self.lock.acquire(True) - if self.proc: - try: - self.proc.terminate() - 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') - - def clear_buffer(self): - if not self._isInitialized: - return - self.textQueue.clear() - - def setVoice(self, voice): - if not self._isInitialized: - return - self.voice = str(voice) - - def setPitch(self, pitch): - if not self._isInitialized: - return - self.pitch = str(self.minPitch + pitch * (self.maxPitch - self.minPitch )) - - def setRate(self, rate): - if not self._isInitialized: - return - self.rate = str(self.minRate + rate * (self.maxRate - self.minRate )) - - def setModule(self, module): - if not self._isInitialized: - return - self.module = str(module) - - def setLanguage(self, language): - if not self._isInitialized: - return - self.language = str(language) - - def setVolume(self, volume): - if not self._isInitialized: - return - self.volume = str(self.minVolume + volume * (self.maxVolume - self.minVolume )) - - def worker(self): - while True: - utterance = self.textQueue.get() - - if isinstance(utterance, int): - if utterance == -1: - return - else: - continue - elif not isinstance(utterance, dict): - continue - # no text means nothing to speak - if not 'text' in utterance: - continue - if not isinstance(utterance['text'],str): - continue - if utterance['text'] == '': - continue - # check for valid data fields - if not 'volume' in utterance: - utterance['volume'] = '' - if not isinstance(utterance['volume'],str): - utterance['volume'] = '' - if not 'module' in utterance: - utterance['module'] = '' - if not isinstance(utterance['module'],str): - utterance['module'] = '' - if not 'language' in utterance: - utterance['language'] = '' - if not isinstance(utterance['language'],str): - utterance['language'] = '' - if not 'voice' in utterance: - utterance['voice'] = '' - if not isinstance(utterance['voice'],str): - utterance['voice'] = '' - if not 'pitch' in utterance: - utterance['pitch'] = '' - if not isinstance(utterance['pitch'],str): - utterance['pitch'] = '' - if not 'rate' in utterance: - utterance['rate'] = '' - if not isinstance(utterance['rate'],str): - utterance['rate'] = '' - - popenSpeechCommand = shlex.split(self.speechCommand) - for idx, word in enumerate(popenSpeechCommand): - word = word.replace('fenrirVolume', str(utterance['volume'] )) - word = word.replace('fenrirModule', str(utterance['module'])) - word = word.replace('fenrirLanguage', str(utterance['language'])) - word = word.replace('fenrirVoice', str(utterance['voice'])) - word = word.replace('fenrirPitch', str(utterance['pitch'])) - word = word.replace('fenrirRate', str(utterance['rate'])) - word = word.replace('fenrirText', str(utterance['text'])) - popenSpeechCommand[idx] = word - - try: - self.env['runtime']['debug'].writeDebugOut('speechDriver:worker:' + ' '.join(popenSpeechCommand),debug.debugLevel.INFO) - self.lock.acquire(True) - self.proc = Popen(popenSpeechCommand, shell=False) - self.lock.release() - self.proc.wait() - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('speechDriver:worker:' + str(e),debug.debugLevel.ERROR) - - self.lock.acquire(True) - self.proc = None - self.lock.release() - diff --git a/src/fenrir/speechDriver/pyttsxDriver.py b/src/fenrir/speechDriver/pyttsxDriver.py deleted file mode 100644 index 1ea98e29..00000000 --- a/src/fenrir/speechDriver/pyttsxDriver.py +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. -# Espeak driver - -from threading import Thread, Lock -from core import debug -from core.speechDriver import speechDriver - -class driver(speechDriver): - def __init__(self): - speechDriver.__init__(self) - self._engine = None - def initialize(self, environment): - self.env = environment - def shutdown(self): - if self._isInitialized: - self.cancel() - self._engine.endLoop() - self._initialized = False - def eventLoop(self): - self._engine.startLoop() - def startEngine(self): - try: - import pyttsx3 - if self.module != '': - self._engine = pyttsx3.init(self.module) - else: - self._engine = pyttsx3.init() - self.eventLoopThread = Thread(target=self.eventLoop) - self._isInitialized = True - self.eventLoopThread.start() - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('SpeechDriver:initialize:' + str(e),debug.debugLevel.ERROR) - - def speak(self,text, interrupt=True): - if not self._isInitialized: - self.startEngine() - if not self._isInitialized: - return - if not interrupt: - self.cancel() - try: - self._engine.setProperty('volume', self.volume) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('SpeechDriver:speak:volume:' + str(e),debug.debugLevel.ERROR) - try: - self._engine.setProperty('rate', self.rate) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('SpeechDriver:speak:rate:' + str(e),debug.debugLevel.ERROR) - try: - self._engine.setProperty('pitch', self.pitch) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('SpeechDriver:speak:pitch:' + str(e),debug.debugLevel.ERROR) - if self.language != None: - if self.language != '': - try: - self._engine.setProperty('voice', self.language) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('SpeechDriver:speak:language:' + str(e),debug.debugLevel.ERROR) - - elif self.voice != None: - if self.voice != '': - try: - self._engine.setProperty('voice', self.voice) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('SpeechDriver:speak:voice:' + str(e),debug.debugLevel.ERROR) - self._engine.say(text) - - def cancel(self): - if not self._isInitialized: - return - self._engine.stop() - self._engine.proxy.stop() - - def setPitch(self, pitch): - if not self._isInitialized: - return - self.pitch = pitch - - def setRate(self, rate): - if not self._isInitialized: - return - self.rate = rate diff --git a/src/fenrir/speechDriver/speechdDriver.py b/src/fenrir/speechDriver/speechdDriver.py deleted file mode 100644 index 99293a8f..00000000 --- a/src/fenrir/speechDriver/speechdDriver.py +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. -# speech-dispatcher driver - -from core import debug -from core.speechDriver import speechDriver - -class driver(speechDriver): - def __init__(self): - speechDriver.__init__(self) - self._sd = None - - def initialize(self, environment): - self.env = environment - try: - import speechd - self._sd = speechd.SSIPClient('fenrir') - self._punct = speechd.PunctuationMode() - self._isInitialized = True - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('speechDriver initialize:' + str(e),debug.debugLevel.ERROR) - - def shutdown(self): - if not self._isInitialized: - return - self.cancel() - try: - self._sd.close() - except: - pass - self._isInitialized = False - - def speak(self,text, queueable=True): - if not queueable: - self.cancel() - if not self._isInitialized: - self.initialize(self.env) - if not self._isInitialized: - return - try: - self._sd.set_output_module(self.module) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('speechDriver setModule:' + str(e),debug.debugLevel.ERROR) - - try: - if self.voice: - if self.voice != '': - self._sd.set_voice(self.voice) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('speechDriver setVoice:' + str(e),debug.debugLevel.ERROR) - try: - if self.language != '': - self._sd.set_synthesis_voice(self.language) - 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): - if not self._isInitialized: - return - try: - self._sd.cancel() - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('speechDriver cancel:' + str(e),debug.debugLevel.ERROR) - self._isInitialized = False - - def setPitch(self, pitch): - if not self._isInitialized: - return - try: - self._sd.set_pitch(int(-100 + pitch * 200)) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('speechDriver setPitch:' + str(e),debug.debugLevel.ERROR) - - def setRate(self, rate): - if not self._isInitialized: - return - try: - self._sd.set_rate(int(-100 + rate * 200)) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('speechDriver setRate:' + str(e),debug.debugLevel.ERROR) - - def setVolume(self, volume): - if not self._isInitialized: - return - try: - self._sd.set_volume(int(-100 + volume * 200)) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('speechDriver setVolume:' + str(e),debug.debugLevel.ERROR) diff --git a/src/fenrir/utils/__init__.py b/src/fenrir/utils/__init__.py deleted file mode 100755 index e69de29b..00000000 diff --git a/src/fenrir/utils/char_utils.py b/src/fenrir/utils/char_utils.py deleted file mode 100644 index 1dc9d266..00000000 --- a/src/fenrir/utils/char_utils.py +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -def getPrevChar(currX,currY, currText): - lineBreak = False - endOfScreen = False - if currText == '': - return -1, -1, '', endOfScreen, lineBreak - wrappedLines = currText.split('\n') - x = currX - y = currY - if x - 1 < 0: - if y - 1 >= 0: - y -= 1 - x = len(wrappedLines[y]) - 1 - lineBreak = True - else: - lineBreak = False - endOfScreen = True - else: - x -= 1 - currChar = '' - if not endOfScreen: - currChar = wrappedLines[y][x] - return x, y, currChar, endOfScreen, lineBreak - -def getCurrentChar(currX,currY, currText): - if currText == '': - return -1, -1, '' - wrappedLines = currText.split('\n') - currChar = wrappedLines[currY][currX] - return currX, currY, currChar - -def getUpChar(currX,currY, currText): - endOfScreen = False - if currText == '': - return -1, -1, '', endOfScreen - wrappedLines = currText.split('\n') - currY -= 1 - if currY < 0: - currY = 0 - else: - endOfScreen = True - currChar = '' - if not endOfScreen: - currChar = wrappedLines[currY][currX] - return currX, currY, currChar, endOfScreen - -def getDownChar(currX,currY, currText): - endOfScreen = False - if currText == '': - return -1, -1, '', endOfScreen - wrappedLines = currText.split('\n') - currY += 1 - if currY >= len(wrappedLines): - currY = len(wrappedLines) -1 - else: - endOfScreen = True - currChar = '' - if not endOfScreen: - currChar = wrappedLines[currY][currX] - return currX, currY, currChar, endOfScreen - -def getLastCharInLine(currY, currText): - endOfScreen = False - if currText == '': - return -1, -1, '' - wrappedLines = currText.split('\n') - currX = len(wrappedLines[currY].rstrip())-1 - if currX < 0: - currX = 0 - currChar = wrappedLines[currY][currX] - return currX, currY, currChar - -def getNextChar(currX,currY, currText): - lineBreak = False - endOfScreen = False - if currText == '': - return -1, -1, '', endOfScreen, lineBreak - wrappedLines = currText.split('\n') - x = currX - y = currY - if x + 1 == len(wrappedLines[y]): - if y + 1 < len(wrappedLines) - 1: - y += 1 - x = 0 - lineBreak = True - else: - lineBreak = False - endOfScreen = True - else: - x += 1 - currChar = '' - if not endOfScreen: - currChar = wrappedLines[y][x] - return x, y, currChar, endOfScreen, lineBreak - -def getPhonetic(currChar): - if len(currChar) != 1: - return currChar - phoneticsDict = { - "A":"alpha", "B":"bravo", "C":"charlie", "D":"delta", "E":"echo", - "F":"foxtrot", "G":"golf", "H":"hotel", "I":"india", "J":"juliet", - "K":"kilo", "L":"lima", "M":"mike", "N":"november", "O":"oscar", - "P":"papa", "Q":"quebec", "R":"romeo", "S":"sierra", "T":"tango", - "U":"uniform", "V":"victor", "W":"whisky", "X":"x ray", - "Y":"yankee", "Z":"zulu" - } - try: - phonChar = phoneticsDict[currChar.upper()] - if currChar.isupper(): - phonChar = phonChar[0].upper() + phonChar[1:] - return phonChar - except: - return currChar - diff --git a/src/fenrir/utils/fenrir-config.py b/src/fenrir/utils/fenrir-config.py deleted file mode 100644 index d512ba67..00000000 --- a/src/fenrir/utils/fenrir-config.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/python - -import configparser -import os -import sys -from os import listdir -from os.path import isfile, join -from inspect import isfunction -from xdg import BaseDirectory - -# Get configuration directory -if len(sys.argv) > 1: - configPath = sys.argv[1] -elif os.geteuid() == 0: - # Save settings system wide - configPath = "/etc/fenrir.conf" -else: - # Use local settings - configPath = BaseDirectory.xdg_data_home + "/fenrir" - if not os.path.exists(configPath): os.makedirs(configPath) - configPath = configPath + "/fenrir.conf" - - diff --git a/src/fenrir/utils/line_utils.py b/src/fenrir/utils/line_utils.py deleted file mode 100644 index 7e6340f0..00000000 --- a/src/fenrir/utils/line_utils.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from collections import Counter - -def getPrevLine(currX,currY, currText): - endOfScreen = False - if currText == '': - return -1, -1, '', endOfScreen - wrappedLines = currText.split('\n') - x = currX - y = currY - if y - 1 >= 0: - y -= 1 - else: - endOfScreen = True - x = 0 - currLine = '' - if not endOfScreen: - currLine = wrappedLines[y] - return x, y, currLine, endOfScreen - -def getCurrentLine(currX,currY, currText): - if currText == '': - return -1, -1, '' - wrappedLines = currText.split('\n') - x = currX - y = currY - x = 0 - currLine = wrappedLines[y] - return x, y, currLine - -def getNextLine(currX,currY, currText): - endOfScreen = False - if currText == '': - return -1, -1, '', endOfScreen - wrappedLines = currText.split('\n') - x = currX - y = currY - if y + 1 < len(wrappedLines): - y += 1 - else: - endOfScreen = True - x = 0 - currLine = '' - if not endOfScreen: - currLine = wrappedLines[y] - return x, y, currLine, endOfScreen diff --git a/src/fenrir/utils/mark_utils.py b/src/fenrir/utils/mark_utils.py deleted file mode 100644 index d52b53f1..00000000 --- a/src/fenrir/utils/mark_utils.py +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - -def getTextBetweenMarks(firstMark, secondMark, inText): - if inText == None: - return '' - if not isinstance(inText, list): - inText = inText.split('\n') - if len(inText) < 1: - return '' - if firstMark == None: - return '' - if secondMark == None: - return '' - if (firstMark['y'] + 1) * (firstMark['x'] + 1) <= (secondMark['y'] + 1) * (secondMark['x'] + 1): - startMark = firstMark.copy() - endMark = secondMark.copy() - else: - endMark = firstMark.copy() - startMark = secondMark.copy() - textPart = '' - if startMark['y'] == endMark['y']: - textPart += inText[startMark['y']][startMark['x']:endMark['x'] + 1] - else: - currY = startMark['y'] - while currY <= endMark['y']: - if currY < endMark['y']: - if currY == startMark['y']: - textPart += inText[currY][startMark['x']:] - else: - textPart += inText[currY] - if len(inText[currY].strip()) != 0: - if len(textPart) - len(textPart.rstrip()) > 0: - textPart = textPart[:len(textPart.rstrip())] + "\n" - else: - textPart += '\n' - else: - textPart += inText[currY][:endMark['x'] + 1] - currY += 1 - return textPart - -def getTextBeforeMark(mark, inText): - if inText == None: - return '' - if mark == None: - return '' - return getTextBetweenMarks({'x':0,'y':0}, mark, inText) - -def getTextAfterMark(mark, inText): - if inText == None: - return '' - if mark == None: - return '' - inText = inText.split('\n') - return getTextBetweenMarks(mark, {'x':len(inText[0])-1,'y':len(inText)-1}, inText) diff --git a/src/fenrir/utils/module_utils.py b/src/fenrir/utils/module_utils.py deleted file mode 100644 index 5b141e83..00000000 --- a/src/fenrir/utils/module_utils.py +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. -import sys -version = sys.version[:3] # we only need major.minor version. -if version in ["3.3","3.4"]: - from importlib.machinery import SourceFileLoader -else: # Python 3.5+, no support for python < 3.3. - import importlib.util - -def importModule(moduleName, moduleLocation): - if version in ["3.3","3.4"]: - return SourceFileLoader(moduleName, moduleLocation).load_module() - else: - spec = importlib.util.spec_from_file_location(moduleName, moduleLocation) - driver_mod = importlib.util.module_from_spec(spec) - spec.loader.exec_module(driver_mod) - return driver_mod diff --git a/src/fenrir/utils/review_utils.py b/src/fenrir/utils/review_utils.py deleted file mode 100644 index 1bca1526..00000000 --- a/src/fenrir/utils/review_utils.py +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug - diff --git a/src/fenrir/utils/screen_utils.py b/src/fenrir/utils/screen_utils.py deleted file mode 100644 index 6a3db6ec..00000000 --- a/src/fenrir/utils/screen_utils.py +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -from collections import Counter -import string -from select import select -from select import epoll -import select -import re - -def removeNonprintable(text): - # Get the difference of all ASCII characters from the set of printable characters - nonprintable = set([chr(i) for i in range(128)]).difference(string.printable) - # Use translate to remove all non-printable characters - return text.translate({ord(character):None for character in nonprintable}) - -def insertNewlines(string, every=64): - return '\n'.join(string[i:i+every] for i in range(0, len(string), every)) - -def splitEvery(toSplit, every=64): - return list(toSplit[i:i+every] for i in range(0, len(toSplit), every)) - -def hasMoreRead(fd): - r, w, e = select([fd], [], [], 0) - return (fd in r) - -def hasMorePollPri(fd): - p = epoll() - p.register(fd, select.POLLPRI | select.POLLERR) - r = p.poll(0) - return (fd in r) - -def trackHighlights(oldAttr, newAttr, text, lenght): - result = '' - currCursor = None - if oldAttr == newAttr: - return result, currCursor - if len(newAttr) == 0: - return result, currCursor - if len(oldAttr) != len(newAttr): - return result, currCursor - - old = splitEvery(oldAttr,lenght) - new = splitEvery(newAttr,lenght) - textLines = text.split('\n') - background = [] - - if len(textLines) - 1 != len(new): - return result, currCursor - try: - bgStat = Counter(newAttr).most_common(3) - background.append(bgStat[0][0]) - # if there is a third color add a secondary background (for dialogs for example) - if len(bgStat) > 2: - if bgStat[1][1] > 40: - background.append(bgStat[1][0]) - except Exception as e: - background.append((7,7,0,0,0,0)) - for line in range(len(new)): - if old[line] != new[line]: - for column in range(len(new[line])): - print(new[line][column]) - if old[line][column] != new[line][column]: - if not new[line][column] in background: - if not currCursor: - currCursor = {} - currCursor['x'] = column - currCursor['y'] = line - result += textLines[line][column] - result += ' ' - return result, currCursor - -''' -t = 'hallo\nwelt!' -old = ((1,1,0,0),(1,1,0,0),(1,1,0,0),(1,1,0,0),(1,1,0,0),(1,1,0,0),(1,1,0,0),(1,1,0,0),(1,1,0,0),(1,1,0,0)) -new = ((0,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,1,1),(1,1,0,0),(1,1,0,0),(1,1,0,0),(1,1,0,0),(1,1,0,0)) - -trackHighlights(old,new,t,5) -''' - -class headLineManipulation: - def __init__(self): - self.regExSingle = re.compile(r'(([^\w\s])\2{5,})') - self.regExDouble = re.compile(r'([^\w\s]{2,}){5,}') - def replaceHeadLines(self, text): - result = '' - newText = '' - lastPos = 0 - for match in self.regExDouble.finditer(text): - span = match.span() - newText += text[lastPos:span[0]] - numberOfChars = len(text[span[0]:span[1]]) - name = text[span[0]:span[1]][:2] - if name.strip(name[0]) == '': - newText += ' ' + str(numberOfChars) + ' ' + name[0] + ' ' - else: - newText += ' ' + str(int(numberOfChars / 2)) + ' ' + name + ' ' - lastPos = span[1] - newText += ' ' + text[lastPos:] - lastPos = 0 - for match in self.regExSingle.finditer(newText): - span = match.span() - result += text[lastPos:span[0]] - numberOfChars = len(newText[span[0]:span[1]]) - name = newText[span[0]:span[1]][:2] - if name.strip(name[0]) == '': - result += ' ' + str(numberOfChars) + ' ' + name[0] + ' ' - else: - result += ' ' + str(int(numberOfChars / 2)) + ' ' + name + ' ' - lastPos = span[1] - result += ' ' + newText[lastPos:] - return result - diff --git a/src/fenrir/utils/word_utils.py b/src/fenrir/utils/word_utils.py deleted file mode 100644 index 349b172a..00000000 --- a/src/fenrir/utils/word_utils.py +++ /dev/null @@ -1,122 +0,0 @@ -#!/bin/python -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from core import debug -import string - -def getCurrentWord(currX,currY, currText): - lineBreak = False - endOfScreen = False - if currText == '': - return -1, -1, '', endOfScreen, lineBreak - if currText.strip( string.whitespace) == '': - return currX, currY, '', endOfScreen, lineBreak - x = currX - y = currY - currWord = '' - wrappedLines = currText.split('\n') - currLine = wrappedLines[y] - Found = False - while(not Found): - if not currLine[x] in string.whitespace: - if x == 0: - Found = True - else: - if currLine[x - 1] in string.whitespace: - Found = True - if not Found: - if x - 1 < 0: - if y - 1 < 0: - lineBreak = False - endOfScreen = True - return currX, currY, '', endOfScreen, lineBreak - else: - y -= 1 - currLine = wrappedLines[y] - x = len( currLine) - 1 - lineBreak = True - else: - x -= 1 - if Found: - currWord = currLine[x:] - for d in string.whitespace: - delimiterPos = currWord.find(d) - if delimiterPos != -1: - currWord = currWord[:delimiterPos] - return x, y, currWord, endOfScreen, lineBreak - return currX, currY, '', False, False - -def getPrevWord(currX,currY, currText): - lineBreak = False - endOfScreen = False - if currText == '': - return -1, -1, '', endOfScreen, lineBreak - if currText.strip( string.whitespace) == '': - return currX, currY, '', endOfScreen, lineBreak - x, y, currWord, endOfScreen, lineBreakCurrWord = getCurrentWord(currX,currY,currText) - if endOfScreen: - return x, y, currWord, endOfScreen, lineBreak - wrappedLines = currText.split('\n') - currLine = wrappedLines[y] - if x - 1 < 0: - if y - 1 < 0: - lineBreak = False - endOfScreen = True - return currX, currY, '', endOfScreen, lineBreak - else: - y -= 1 - currLine = wrappedLines[y] - x = len( currLine) - 1 - lineBreak = True - else: - x -= 1 - lineBreakCurrWord = lineBreak or lineBreakCurrWord - x, y, currWord, endOfScreen, lineBreak = getCurrentWord(x,y,currText) - lineBreak = lineBreak or lineBreakCurrWord - return x, y, currWord, endOfScreen, lineBreak - -def getNextWord(currX,currY, currText): - lineBreak = False - endOfScreen = False - if currText == '': - return -1, -1, '', endOfScreen, lineBreak - if currText.strip( string.whitespace) == '': - return currX, currY, '', endOfScreen, lineBreak - x = currX - y = currY - currWord = '' - wrappedLines = currText.split('\n') - currLine = wrappedLines[y] - Found = False - while(not Found): - if not Found: - if x + 1 > len( currLine ) - 1: - if y + 1 > len( wrappedLines ) - 1: - lineBreak = False - endOfScreen = True - return currX, currY, '', endOfScreen, lineBreak - else: - y += 1 - currLine = wrappedLines[y] - x = 0 - lineBreak = True - else: - x += 1 - if not currLine[x] in string.whitespace: - if x == 0: - Found = True - else: - if currLine[x - 1] in string.whitespace: - Found = True - if Found: - currWord = currLine[x:] - for d in string.whitespace: - delimiterPos = currWord.find(d) - if delimiterPos != -1: - currWord = currWord[:delimiterPos] - return x, y, currWord, endOfScreen, lineBreak - return currX, currY, '', False, False - diff --git a/uninstall.sh b/uninstall.sh index 8b820fec..17a8724f 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -11,10 +11,10 @@ read -p "This will remove Fenrir and its settings from your system,, press ctrl+ # do it unlink /usr/bin/fenrir unlink /usr/bin/fenrir-daemon -rm -rf /opt/fenrir -rm -rf /usr/share/fenrir -rm -rf /etc/fenrir -rm -rf /usr/share/sounds/fenrir +rm -rf /opt/fenrirscreenreader +rm -rf /usr/share/fenrirscreenreader +rm -rf /etc/fenrirscreenreader +rm -rf /usr/share/sounds/fenrirscreenreader rm -f /usr/lib/systemd/system/fenrir.service # success message