Compare commits
40 Commits
2025.06.06
...
testing
Author | SHA1 | Date | |
---|---|---|---|
bab7c1a552 | |||
848844aae4 | |||
4c1bddbbd3 | |||
21bb9c6083 | |||
7408951152 | |||
4bcf82178e | |||
beae1866bb | |||
40b88efa34 | |||
b1edc53362 | |||
dda84b9905 | |||
64e79f6945 | |||
f4ed8da4c3 | |||
a5ca1d28e8 | |||
4e193f133f | |||
27dcff23bb | |||
d81d563bb6 | |||
43871cea3c | |||
72bd334d65 | |||
e76b914d6e | |||
83cb330d34 | |||
b0ac6e1409 | |||
6998706934 | |||
62e1001679 | |||
d935ef2e3c | |||
e2fb28d92f | |||
8a223282df | |||
91c97dd1dd | |||
5cc719a6f3 | |||
ddc1b43304 | |||
6ad11effc6 | |||
ca0e3b5987 | |||
0009d90a68 | |||
2c2efc56f0 | |||
27c35939b1 | |||
7e87ebf04b | |||
ec6c135581 | |||
998c63cc71 | |||
26c6e32c59 | |||
97e2da614b | |||
0930a86ce7 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,3 +6,4 @@ dist/
|
|||||||
build/
|
build/
|
||||||
*.kate-swp
|
*.kate-swp
|
||||||
.directory
|
.directory
|
||||||
|
CLAUDE.md
|
||||||
|
@ -511,6 +511,7 @@ fenrir [OPTIONS]
|
|||||||
- `-e, --emulated-pty` - Use PTY emulation with escape sequences for input (enables desktop/X/Wayland usage)
|
- `-e, --emulated-pty` - Use PTY emulation with escape sequences for input (enables desktop/X/Wayland usage)
|
||||||
- `-E, --emulated-evdev` - Use PTY emulation with evdev for input (single instance)
|
- `-E, --emulated-evdev` - Use PTY emulation with evdev for input (single instance)
|
||||||
- `-F, --force-all-screens` - Force Fenrir to respond on all screens, ignoring ignoreScreen setting
|
- `-F, --force-all-screens` - Force Fenrir to respond on all screens, ignoring ignoreScreen setting
|
||||||
|
- `-i, -I, --ignore-screen SCREEN` - Ignore specific screen(s). Can be used multiple times. Combines with existing ignore settings.
|
||||||
|
|
||||||
### Examples:
|
### Examples:
|
||||||
```bash
|
```bash
|
||||||
@ -525,6 +526,10 @@ sudo fenrir -o "speech#rate=0.8;sound#volume=0.5"
|
|||||||
|
|
||||||
# Force Fenrir to work on all screens (ignore ignoreScreen setting)
|
# Force Fenrir to work on all screens (ignore ignoreScreen setting)
|
||||||
sudo fenrir -F
|
sudo fenrir -F
|
||||||
|
|
||||||
|
# Ignore specific screens
|
||||||
|
sudo fenrir --ignore-screen 1
|
||||||
|
sudo fenrir -i 1 -i 2 # Ignore screens 1 and 2
|
||||||
```
|
```
|
||||||
|
|
||||||
## Localization
|
## Localization
|
||||||
|
@ -73,7 +73,8 @@ KEY_FENRIR,KEY_SHIFT,KEY_0=set_bookmark_10
|
|||||||
KEY_FENRIR,KEY_0=bookmark_10
|
KEY_FENRIR,KEY_0=bookmark_10
|
||||||
KEY_FENRIR,KEY_KPSLASH=set_window_application
|
KEY_FENRIR,KEY_KPSLASH=set_window_application
|
||||||
2,KEY_FENRIR,KEY_KPSLASH=clear_window_application
|
2,KEY_FENRIR,KEY_KPSLASH=clear_window_application
|
||||||
KEY_KPPLUS=last_incoming
|
KEY_KPPLUS=progress_bar_monitor
|
||||||
|
#KEY_FENRIR,KEY_KPPLUS=silence_until_prompt
|
||||||
KEY_FENRIR,KEY_F2=toggle_braille
|
KEY_FENRIR,KEY_F2=toggle_braille
|
||||||
KEY_FENRIR,KEY_F3=toggle_sound
|
KEY_FENRIR,KEY_F3=toggle_sound
|
||||||
KEY_FENRIR,KEY_F4=toggle_speech
|
KEY_FENRIR,KEY_F4=toggle_speech
|
||||||
@ -113,6 +114,8 @@ KEY_FENRIR,KEY_CTRL,KEY_SHIFT,KEY_X=remove_marks
|
|||||||
KEY_FENRIR,KEY_X=set_mark
|
KEY_FENRIR,KEY_X=set_mark
|
||||||
KEY_FENRIR,KEY_SHIFT,KEY_X=marked_text
|
KEY_FENRIR,KEY_SHIFT,KEY_X=marked_text
|
||||||
KEY_FENRIR,KEY_F10=toggle_vmenu_mode
|
KEY_FENRIR,KEY_F10=toggle_vmenu_mode
|
||||||
|
KEY_FENRIR,KEY_SHIFT,KEY_F10=voice_browser_safe
|
||||||
|
KEY_FENRIR,KEY_CTRL,KEY_SHIFT,KEY_F10=apply_tested_voice
|
||||||
KEY_FENRIR,KEY_SPACE=current_quick_menu_entry
|
KEY_FENRIR,KEY_SPACE=current_quick_menu_entry
|
||||||
KEY_FENRIR,KEY_CTRL,KEY_SPACE=current_quick_menu_value
|
KEY_FENRIR,KEY_CTRL,KEY_SPACE=current_quick_menu_value
|
||||||
KEY_FENRIR,KEY_RIGHT=next_quick_menu_entry
|
KEY_FENRIR,KEY_RIGHT=next_quick_menu_entry
|
||||||
|
@ -75,11 +75,12 @@ KEY_FENRIR,KEY_F2=toggle_braille
|
|||||||
KEY_FENRIR,KEY_F3=toggle_sound
|
KEY_FENRIR,KEY_F3=toggle_sound
|
||||||
KEY_FENRIR,KEY_F4=toggle_speech
|
KEY_FENRIR,KEY_F4=toggle_speech
|
||||||
KEY_FENRIR,KEY_ENTER=temp_disable_speech
|
KEY_FENRIR,KEY_ENTER=temp_disable_speech
|
||||||
|
KEY_FENRIR,KEY_SHIFT,KEY_P=progress_bar_monitor
|
||||||
|
KEY_FENRIR,KEY_SHIFT,KEY_ENTER=toggle_auto_read
|
||||||
KEY_FENRIR,KEY_SHIFT,KEY_CTRL,KEY_P=toggle_punctuation_level
|
KEY_FENRIR,KEY_SHIFT,KEY_CTRL,KEY_P=toggle_punctuation_level
|
||||||
KEY_FENRIR,KEY_RIGHTBRACE=toggle_auto_spell_check
|
KEY_FENRIR,KEY_RIGHTBRACE=toggle_auto_spell_check
|
||||||
KEY_FENRIR,KEY_SHIFT,KEY_ENTER=toggle_output
|
KEY_FENRIR,KEY_CTRL,KEY_SHIFT,KEY_ENTER=toggle_output
|
||||||
KEY_FENRIR,KEY_SHIFT,KEY_E=toggle_emoticons
|
KEY_FENRIR,KEY_SHIFT,KEY_E=toggle_emoticons
|
||||||
KEY_FENRIR,KEY_ENTER=toggle_auto_read
|
|
||||||
KEY_FENRIR,KEY_CTRL,KEY_T=toggle_auto_time
|
KEY_FENRIR,KEY_CTRL,KEY_T=toggle_auto_time
|
||||||
KEY_FENRIR,KEY_Y=toggle_highlight_tracking
|
KEY_FENRIR,KEY_Y=toggle_highlight_tracking
|
||||||
#=toggle_barrier
|
#=toggle_barrier
|
||||||
@ -111,6 +112,8 @@ KEY_FENRIR,KEY_CTRL,KEY_SHIFT,KEY_X=remove_marks
|
|||||||
KEY_FENRIR,KEY_X=set_mark
|
KEY_FENRIR,KEY_X=set_mark
|
||||||
KEY_FENRIR,KEY_SHIFT,KEY_X=marked_text
|
KEY_FENRIR,KEY_SHIFT,KEY_X=marked_text
|
||||||
KEY_FENRIR,KEY_F10=toggle_vmenu_mode
|
KEY_FENRIR,KEY_F10=toggle_vmenu_mode
|
||||||
|
KEY_FENRIR,KEY_SHIFT,KEY_F10=voice_browser_safe
|
||||||
|
KEY_FENRIR,KEY_CTRL,KEY_SHIFT,KEY_F10=apply_tested_voice
|
||||||
KEY_FENRIR,KEY_SPACE=current_quick_menu_entry
|
KEY_FENRIR,KEY_SPACE=current_quick_menu_entry
|
||||||
KEY_FENRIR,KEY_CTRL,KEY_SPACE=current_quick_menu_value
|
KEY_FENRIR,KEY_CTRL,KEY_SPACE=current_quick_menu_value
|
||||||
KEY_FENRIR,KEY_RIGHT=next_quick_menu_entry
|
KEY_FENRIR,KEY_RIGHT=next_quick_menu_entry
|
||||||
|
@ -72,7 +72,8 @@ KEY_FENRIR,KEY_SHIFT,KEY_0=set_bookmark_10
|
|||||||
KEY_FENRIR,KEY_0=bookmark_10
|
KEY_FENRIR,KEY_0=bookmark_10
|
||||||
KEY_FENRIR,KEY_KPSLASH=set_window_application
|
KEY_FENRIR,KEY_KPSLASH=set_window_application
|
||||||
2,KEY_FENRIR,KEY_KPSLASH=clear_window_application
|
2,KEY_FENRIR,KEY_KPSLASH=clear_window_application
|
||||||
KEY_KPPLUS=last_incoming
|
KEY_KPPLUS=progress_bar_monitor
|
||||||
|
KEY_FENRIR,KEY_KPPLUS=silence_until_prompt
|
||||||
#=toggle_braille
|
#=toggle_braille
|
||||||
KEY_FENRIR,KEY_F3=toggle_sound
|
KEY_FENRIR,KEY_F3=toggle_sound
|
||||||
KEY_FENRIR,KEY_F4=toggle_speech
|
KEY_FENRIR,KEY_F4=toggle_speech
|
||||||
|
@ -28,6 +28,9 @@ genericPlayFileCommand=play -q -v fenrirVolume fenrirSoundFile
|
|||||||
#the following command is used to generate a frequency beep
|
#the following command is used to generate a frequency beep
|
||||||
genericFrequencyCommand=play -q -v fenrirVolume -n -c1 synth fenrirDuration sine fenrirFrequence
|
genericFrequencyCommand=play -q -v fenrirVolume -n -c1 synth fenrirDuration sine fenrirFrequence
|
||||||
|
|
||||||
|
# Enable progress bar monitoring with ascending tones by default
|
||||||
|
progressMonitoring=True
|
||||||
|
|
||||||
[speech]
|
[speech]
|
||||||
# Turn speech on or off:
|
# Turn speech on or off:
|
||||||
enabled=True
|
enabled=True
|
||||||
@ -92,7 +95,7 @@ fenrirMaxRate=450
|
|||||||
driver=vcsaDriver
|
driver=vcsaDriver
|
||||||
encoding=auto
|
encoding=auto
|
||||||
screenUpdateDelay=0.05
|
screenUpdateDelay=0.05
|
||||||
ignoreScreen=
|
ignoreScreen=7
|
||||||
autodetectIgnoreScreen=True
|
autodetectIgnoreScreen=True
|
||||||
|
|
||||||
[keyboard]
|
[keyboard]
|
||||||
@ -121,7 +124,9 @@ interruptOnKeyPressFilter=
|
|||||||
doubleTapTimeout=0.2
|
doubleTapTimeout=0.2
|
||||||
|
|
||||||
[general]
|
[general]
|
||||||
debugLevel=0
|
# Debug levels: 0=DEACTIVE, 1=ERROR, 2=WARNING, 3=INFO (most verbose)
|
||||||
|
# For production use, WARNING (2) provides good balance of useful info without spam
|
||||||
|
debugLevel=2
|
||||||
# debugMode sets where the debug output should send to:
|
# debugMode sets where the debug output should send to:
|
||||||
# debugMode=File writes to debugFile (Default:/tmp/fenrir-PID.log)
|
# debugMode=File writes to debugFile (Default:/tmp/fenrir-PID.log)
|
||||||
# debugMode=Print just prints on the screen
|
# debugMode=Print just prints on the screen
|
||||||
@ -140,8 +145,8 @@ emoticons=True
|
|||||||
# define the current Fenrir key
|
# define the current Fenrir key
|
||||||
fenrirKeys=KEY_KP0,KEY_META,KEY_INSERT
|
fenrirKeys=KEY_KP0,KEY_META,KEY_INSERT
|
||||||
scriptKeys=KEY_COMPOSE
|
scriptKeys=KEY_COMPOSE
|
||||||
timeFormat=%H:%M:%P
|
timeFormat=%%I:%%M%%P
|
||||||
dateFormat=%A, %B %d, %Y
|
dateFormat=%%A, %%B %%d, %%Y
|
||||||
autoSpellCheck=True
|
autoSpellCheck=True
|
||||||
spellCheckLanguage=en_US
|
spellCheckLanguage=en_US
|
||||||
# path for your scripts "scriptKeys" functionality
|
# path for your scripts "scriptKeys" functionality
|
||||||
@ -163,7 +168,7 @@ autoPresentIndent=False
|
|||||||
# 1 = sound only
|
# 1 = sound only
|
||||||
# 2 = speak only
|
# 2 = speak only
|
||||||
autoPresentIndentMode=1
|
autoPresentIndentMode=1
|
||||||
# play a sound when attributes are changeing
|
# play a sound when attributes change
|
||||||
hasAttributes=True
|
hasAttributes=True
|
||||||
# shell for PTY emulatiun (empty = default shell)
|
# shell for PTY emulatiun (empty = default shell)
|
||||||
shell=
|
shell=
|
||||||
@ -211,8 +216,32 @@ list=
|
|||||||
vmenuPath=
|
vmenuPath=
|
||||||
quickMenu=speech#rate;speech#pitch;speech#volume
|
quickMenu=speech#rate;speech#pitch;speech#volume
|
||||||
|
|
||||||
|
[prompt]
|
||||||
|
# Custom prompt patterns for silence until prompt feature
|
||||||
|
# You can add your own shell prompt patterns as regular expressions
|
||||||
|
# Each pattern should be on a separate line, format: customPatterns=pattern1,pattern2,pattern3
|
||||||
|
#
|
||||||
|
# Built-in patterns include:
|
||||||
|
# - Shell prompts: $, #, >, user@host$, [user@host]$, bash-5.1$
|
||||||
|
# - Package manager prompts: [Y/n], [y/N], [Yes/No], (Y/n), (y/N)
|
||||||
|
# - sudo prompts: [sudo] password for user:, Password:, user's password:
|
||||||
|
# - Confirmation prompts: Press any key, Are you sure?, Please confirm
|
||||||
|
#
|
||||||
|
# Custom pattern examples:
|
||||||
|
# For PS1='[\u@\h \W] \$ ' use: \[.*@.*\s.*\]\s*[$#>]\s*
|
||||||
|
# For "[user@hostname ~] $" use: \[.*@.*\s.*\]\s*[$#>]\s*
|
||||||
|
# For custom prompts ending with specific strings, use patterns like: .*your_prompt_ending$
|
||||||
|
# For custom package manager prompts: .*your_package_manager.*\[[YyNn]/[YyNn]\].*
|
||||||
|
customPatterns=
|
||||||
|
|
||||||
|
# Specific prompt strings to match exactly (useful for very specific custom prompts)
|
||||||
|
# Format: exactMatches=prompt1,prompt2,prompt3
|
||||||
|
# Examples:
|
||||||
|
# exactMatches=[storm@fenrir ~] $,[root@fenrir ~] #,Continue installation? [Y/n]
|
||||||
|
exactMatches=
|
||||||
|
|
||||||
[time]
|
[time]
|
||||||
# automatic time anouncement
|
# automatic time announcement
|
||||||
enabled=False
|
enabled=False
|
||||||
# present time
|
# present time
|
||||||
presentTime=True
|
presentTime=True
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -30,9 +30,6 @@ ContentChanged='ContentChanged.wav'
|
|||||||
# Speech has turned On or Off
|
# Speech has turned On or Off
|
||||||
SpeechOn='SpeechOn.wav'
|
SpeechOn='SpeechOn.wav'
|
||||||
SpeechOff='SpeechOff.wav'
|
SpeechOff='SpeechOff.wav'
|
||||||
# Braille has turned On or Off
|
|
||||||
BrailleOn='BrailleOn.wav'
|
|
||||||
BrailleOff='BrailleOff.wav'
|
|
||||||
# SoundIcons has turned On or Off
|
# SoundIcons has turned On or Off
|
||||||
SoundOn='SoundOn.wav'
|
SoundOn='SoundOn.wav'
|
||||||
SoundOff='SoundOff.wav'
|
SoundOff='SoundOff.wav'
|
||||||
@ -44,9 +41,8 @@ PlaceEndMark='PlaceEndMark.wav'
|
|||||||
CopyToClipboard='CopyToClipboard.wav'
|
CopyToClipboard='CopyToClipboard.wav'
|
||||||
# Pasted on the screen
|
# Pasted on the screen
|
||||||
PasteClipboardOnScreen='PasteClipboardOnScreen.wav'
|
PasteClipboardOnScreen='PasteClipboardOnScreen.wav'
|
||||||
# An error accoured while speech or braille output or reading the screen
|
# An error accoured while speech output or reading the screen
|
||||||
ErrorSpeech='ErrorSpeech.wav'
|
ErrorSpeech='ErrorSpeech.wav'
|
||||||
ErrorBraille='ErrorBraille.wav'
|
|
||||||
ErrorScreen='ErrorScreen.wav'
|
ErrorScreen='ErrorScreen.wav'
|
||||||
# If you cursor over an text that has attributs (like color)
|
# If you cursor over an text that has attributs (like color)
|
||||||
HasAttributes='has_attribute.wav'
|
HasAttributes='has_attribute.wav'
|
||||||
|
@ -65,6 +65,10 @@ Use PTY emulation with evdev for input (single instance mode).
|
|||||||
.BR \-F ", " \-\-force-all-screens
|
.BR \-F ", " \-\-force-all-screens
|
||||||
Force Fenrir to respond on all screens, ignoring the ignoreScreen setting. This temporarily overrides screen filtering for the current session.
|
Force Fenrir to respond on all screens, ignoring the ignoreScreen setting. This temporarily overrides screen filtering for the current session.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.BR \-i ", " \-I ", " \-\-ignore-screen " \fISCREEN\fR"
|
||||||
|
Ignore specific screen(s). Can be used multiple times to ignore multiple screens. This is equivalent to setting ignoreScreen in the configuration file and will be combined with any existing ignore settings.
|
||||||
|
|
||||||
.SH KEY CONCEPTS
|
.SH KEY CONCEPTS
|
||||||
|
|
||||||
.SS Fenrir Key
|
.SS Fenrir Key
|
||||||
|
@ -1240,6 +1240,9 @@ Use PTY emulation with evdev for input (single instance mode).
|
|||||||
`+-F, --force-all-screens+`::
|
`+-F, --force-all-screens+`::
|
||||||
Force Fenrir to respond on all screens, ignoring the ignoreScreen setting. This temporarily overrides screen filtering for the current session.
|
Force Fenrir to respond on all screens, ignoring the ignoreScreen setting. This temporarily overrides screen filtering for the current session.
|
||||||
|
|
||||||
|
`+-i, -I, --ignore-screen <SCREEN>+`::
|
||||||
|
Ignore specific screen(s). Can be used multiple times to ignore multiple screens. This is equivalent to setting ignoreScreen in the configuration file and will be combined with any existing ignore settings.
|
||||||
|
|
||||||
==== Set settings options
|
==== Set settings options
|
||||||
|
|
||||||
You can specify options that overwrite the setting.conf. This is done
|
You can specify options that overwrite the setting.conf. This is done
|
||||||
|
@ -297,6 +297,7 @@ fenrir [OPTIONS]
|
|||||||
- `-e, --emulated-pty` - PTY emulation for desktop use
|
- `-e, --emulated-pty` - PTY emulation for desktop use
|
||||||
- `-E, --emulated-evdev` - PTY + evdev emulation
|
- `-E, --emulated-evdev` - PTY + evdev emulation
|
||||||
- `-F, --force-all-screens` - Ignore ignoreScreen setting
|
- `-F, --force-all-screens` - Ignore ignoreScreen setting
|
||||||
|
- `-i, -I, --ignore-screen SCREEN` - Ignore specific screen(s), can be used multiple times
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
daemonize
|
daemonize
|
||||||
|
dbus-python
|
||||||
evdev
|
evdev
|
||||||
pexpect
|
pexpect
|
||||||
pyenchant
|
pyenchant
|
||||||
|
2
setup.py
2
setup.py
@ -37,7 +37,7 @@ for directory in directories:
|
|||||||
if not forceSettingsFlag:
|
if not forceSettingsFlag:
|
||||||
try:
|
try:
|
||||||
files = [f for f in files if not f.endswith('settings.conf')]
|
files = [f for f in files if not f.endswith('settings.conf')]
|
||||||
except:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
elif 'config/scripts' in directory:
|
elif 'config/scripts' in directory:
|
||||||
destDir = '/usr/share/fenrirscreenreader/scripts'
|
destDir = '/usr/share/fenrirscreenreader/scripts'
|
||||||
|
10
src/fenrir
10
src/fenrir
@ -27,7 +27,7 @@ def create_argument_parser():
|
|||||||
argumentParser.add_argument(
|
argumentParser.add_argument(
|
||||||
'-v', '--version',
|
'-v', '--version',
|
||||||
action='version',
|
action='version',
|
||||||
version=f'Fenrir screen reader version {fenrirVersion.version}-{fenrirVersion.codeName}',
|
version=f'Fenrir screen reader version {fenrirVersion.version}-{fenrirVersion.code_name}',
|
||||||
help='Show version information and exit'
|
help='Show version information and exit'
|
||||||
)
|
)
|
||||||
argumentParser.add_argument(
|
argumentParser.add_argument(
|
||||||
@ -72,6 +72,12 @@ def create_argument_parser():
|
|||||||
action='store_true',
|
action='store_true',
|
||||||
help='Force Fenrir to respond on all screens, ignoring ignoreScreen setting'
|
help='Force Fenrir to respond on all screens, ignoring ignoreScreen setting'
|
||||||
)
|
)
|
||||||
|
argumentParser.add_argument(
|
||||||
|
'-i', '-I', '--ignore-screen',
|
||||||
|
metavar='SCREEN',
|
||||||
|
action='append',
|
||||||
|
help='Ignore specific screen(s). Can be used multiple times. Same as ignoreScreen setting.'
|
||||||
|
)
|
||||||
return argumentParser
|
return argumentParser
|
||||||
|
|
||||||
def validate_arguments(cliArgs):
|
def validate_arguments(cliArgs):
|
||||||
@ -88,7 +94,7 @@ def validate_arguments(cliArgs):
|
|||||||
|
|
||||||
def run_fenrir():
|
def run_fenrir():
|
||||||
"""Main function that runs Fenrir"""
|
"""Main function that runs Fenrir"""
|
||||||
fenrirApp = fenrirManager.fenrirManager(cliArgs)
|
fenrirApp = fenrirManager.FenrirManager(cliArgs)
|
||||||
fenrirApp.proceed()
|
fenrirApp.proceed()
|
||||||
del fenrirApp
|
del fenrirApp
|
||||||
|
|
||||||
|
@ -4,18 +4,25 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
|
||||||
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return 'No description found'
|
return 'No description found'
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
pass
|
pass
|
||||||
def setCallback(self, callback):
|
|
||||||
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,23 +4,33 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
|
||||||
|
|
||||||
# this command is just to initialize stuff.
|
# this command is just to initialize stuff.
|
||||||
# like init index lists in memoryManager
|
# like init index lists in MemoryManager
|
||||||
# it is not useful to execute it
|
# it is not useful to execute it
|
||||||
|
|
||||||
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
# clipboard
|
# clipboard
|
||||||
self.env['runtime']['memoryManager'].addIndexList('clipboardHistory', self.env['runtime']['settingsManager'].getSettingAsInt('general', 'numberOfClipboards'))
|
self.env['runtime']['MemoryManager'].add_index_list(
|
||||||
|
'clipboardHistory', self.env['runtime']['SettingsManager'].get_setting_as_int(
|
||||||
|
'general', 'numberOfClipboards'))
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return 'No description found'
|
return 'No description found'
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
pass
|
pass
|
||||||
def setCallback(self, callback):
|
|
||||||
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,51 +4,69 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
from fenrirscreenreader.utils import word_utils
|
from fenrirscreenreader.utils import word_utils
|
||||||
import string
|
import string
|
||||||
initialized = False
|
initialized = False
|
||||||
try:
|
try:
|
||||||
import enchant
|
import enchant
|
||||||
initialized = True
|
initialized = True
|
||||||
except:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.language = ''
|
self.language = ''
|
||||||
self.spellChecker = None
|
self.spellChecker = None
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
self.updateSpellLanguage()
|
self.update_spell_language()
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('adds the current word to the exceptions dictionary')
|
return _('adds the current word to the exceptions dictionary')
|
||||||
def updateSpellLanguage(self):
|
|
||||||
self.spellChecker = enchant.Dict(self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage'))
|
def update_spell_language(self):
|
||||||
self.language = self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage')
|
self.spellChecker = enchant.Dict(
|
||||||
|
self.env['runtime']['SettingsManager'].get_setting(
|
||||||
|
'general', 'spellCheckLanguage'))
|
||||||
|
self.language = self.env['runtime']['SettingsManager'].get_setting(
|
||||||
|
'general', 'spellCheckLanguage')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if not initialized:
|
if not initialized:
|
||||||
return
|
return
|
||||||
if self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage') != self.language:
|
if self.env['runtime']['SettingsManager'].get_setting(
|
||||||
|
'general', 'spellCheckLanguage') != self.language:
|
||||||
try:
|
try:
|
||||||
self.updateSpellLanguage()
|
self.update_spell_language()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return
|
return
|
||||||
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
|
cursor_pos = self.env['runtime']['CursorManager'].get_review_or_text_cursor()
|
||||||
# get the word
|
# get the word
|
||||||
newContent = self.env['screen']['newContentText'].split('\n')[cursorPos['y']]
|
new_content = self.env['screen']['new_content_text'].split('\n')[
|
||||||
x, y, currWord, endOfScreen, lineBreak = word_utils.getCurrentWord(cursorPos['x'], 0, newContent)
|
cursor_pos['y']]
|
||||||
currWord = currWord.strip(string.whitespace + r'!"#$%&\()*+,-./:;<=Â?@[\\]^_{|}~')
|
x, y, curr_word, end_of_screen, line_break = word_utils.get_current_word(
|
||||||
|
cursor_pos['x'], 0, new_content)
|
||||||
|
curr_word = curr_word.strip(
|
||||||
|
string.whitespace +
|
||||||
|
r'!"#$%&\()*+,-./:;<=Â?@[\\]^_{|}~')
|
||||||
|
|
||||||
if currWord != '':
|
if curr_word != '':
|
||||||
if self.spellChecker.is_added(currWord):
|
if self.spellChecker.is_added(curr_word):
|
||||||
self.env['runtime']['outputManager'].presentText(_('{0} is already in dictionary').format(currWord,), soundIcon='Cancel', interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_('{0} is already in dictionary').format(
|
||||||
|
curr_word,), sound_icon ='Cancel', interrupt=True)
|
||||||
else:
|
else:
|
||||||
self.spellChecker.add(currWord)
|
self.spellChecker.add(curr_word)
|
||||||
self.env['runtime']['outputManager'].presentText(_('{0} added to dictionary').format(currWord,), soundIcon='Accept', interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_('{0} added to dictionary').format(
|
||||||
|
curr_word,), sound_icon ='Accept', interrupt=True)
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
100
src/fenrirscreenreader/commands/commands/adjustment_base.py
Normal file
100
src/fenrirscreenreader/commands/commands/adjustment_base.py
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Fenrir TTY screen reader
|
||||||
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
|
import math
|
||||||
|
|
||||||
|
|
||||||
|
class adjustment_command():
|
||||||
|
"""Base class for speech and sound adjustment commands"""
|
||||||
|
|
||||||
|
def __init__(self, section, setting, direction, step=0.1):
|
||||||
|
self.section = section # 'speech' or 'sound'
|
||||||
|
self.setting = setting # 'rate', 'pitch', 'volume'
|
||||||
|
self.direction = direction # 'inc' or 'dec'
|
||||||
|
self.step = step
|
||||||
|
|
||||||
|
def initialize(self, environment):
|
||||||
|
self.env = environment
|
||||||
|
|
||||||
|
def shutdown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def get_description(self):
|
||||||
|
action = "Increase" if self.direction == 'inc' else "Decrease"
|
||||||
|
if self.section == 'speech':
|
||||||
|
return _(f'{action} the speech {self.setting}')
|
||||||
|
else:
|
||||||
|
return _(f'{action} the {self.section} {self.setting}')
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
if self.section == 'sound' and self.setting == 'volume':
|
||||||
|
# Sound volume uses different method
|
||||||
|
self._adjust_sound_volume()
|
||||||
|
else:
|
||||||
|
# Speech rate, pitch, volume use standard method
|
||||||
|
self._adjust_speech_setting()
|
||||||
|
|
||||||
|
def _adjust_speech_setting(self):
|
||||||
|
"""Adjust speech settings (rate, pitch, volume)"""
|
||||||
|
value = self.env['runtime']['SettingsManager'].get_setting_as_float(
|
||||||
|
self.section, self.setting)
|
||||||
|
|
||||||
|
# Apply adjustment with rounding
|
||||||
|
if self.direction == 'inc':
|
||||||
|
value = round((math.ceil(10 * value) / 10) + self.step, 2)
|
||||||
|
if value > 1.0:
|
||||||
|
value = 1.0
|
||||||
|
else: # dec
|
||||||
|
value = round((math.ceil(10 * value) / 10) - self.step, 2)
|
||||||
|
if value < 0.0:
|
||||||
|
value = 0.0
|
||||||
|
|
||||||
|
# Set the new value
|
||||||
|
self.env['runtime']['SettingsManager'].set_setting(
|
||||||
|
self.section, self.setting, str(value))
|
||||||
|
|
||||||
|
# Present feedback
|
||||||
|
percentage = int(value * 100)
|
||||||
|
if self.section == 'speech':
|
||||||
|
feedback = _("{0} percent speech {1}").format(
|
||||||
|
percentage, self.setting)
|
||||||
|
else:
|
||||||
|
feedback = _("{0} percent {1} {2}").format(
|
||||||
|
percentage, self.section, self.setting)
|
||||||
|
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
feedback, sound_icon ='', interrupt=True)
|
||||||
|
|
||||||
|
def _adjust_sound_volume(self):
|
||||||
|
"""Adjust sound volume using same logic as speech"""
|
||||||
|
value = self.env['runtime']['SettingsManager'].get_setting_as_float(
|
||||||
|
self.section, self.setting)
|
||||||
|
|
||||||
|
# Sound volume uses same math as speech settings
|
||||||
|
if self.direction == 'inc':
|
||||||
|
value = round((math.ceil(10 * value) / 10) + self.step, 2)
|
||||||
|
if value > 1.0:
|
||||||
|
value = 1.0
|
||||||
|
else: # dec
|
||||||
|
value = round((math.ceil(10 * value) / 10) - self.step, 2)
|
||||||
|
if value < 0.0:
|
||||||
|
value = 0.0
|
||||||
|
|
||||||
|
# Set the new value
|
||||||
|
self.env['runtime']['SettingsManager'].set_setting(
|
||||||
|
self.section, self.setting, str(value))
|
||||||
|
|
||||||
|
# Present feedback with appropriate sound icon
|
||||||
|
percentage = int(value * 100)
|
||||||
|
sound_icon = 'SoundOn' if self.direction == 'inc' else 'SoundOff'
|
||||||
|
feedback = _("{0} percent sound volume").format(percentage)
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
feedback, sound_icon =sound_icon, interrupt=True)
|
||||||
|
|
||||||
|
def set_callback(self, callback):
|
||||||
|
pass
|
@ -4,24 +4,33 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
from fenrirscreenreader import fenrirVersion
|
from fenrirscreenreader import fenrirVersion
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
return _('Present the version of Fenrir currrrently in use.')
|
def get_description(self):
|
||||||
|
return _('Present the version of Fenrir currently in use.')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
try:
|
try:
|
||||||
self.env['runtime']['outputManager'].presentText(f'Fenrir screen reader version {fenrirVersion.version}-{fenrirVersion.codeName}', interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
except exception as e:
|
f'Fenrir screen reader version {
|
||||||
self.env['runtime']['outputManager'].presentText(_('Version information is unavailable.'), interrupt=True)
|
fenrirVersion.version}-{
|
||||||
|
fenrirVersion.code_name}', interrupt=True)
|
||||||
|
except Exception as e:
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_('Version information is unavailable.'), interrupt=True)
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -0,0 +1,82 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
|
|
||||||
|
class command():
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def initialize(self, environment):
|
||||||
|
self.env = environment
|
||||||
|
|
||||||
|
def shutdown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def get_description(self):
|
||||||
|
return "Apply the last tested voice from safe voice browser"
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
try:
|
||||||
|
# Check if we have a tested voice
|
||||||
|
if ('commandBuffer' not in self.env or
|
||||||
|
'lastTestedModule' not in self.env['commandBuffer'] or
|
||||||
|
'lastTestedVoice' not in self.env['commandBuffer']):
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
"No voice has been tested yet", interrupt=True)
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
"Use voice browser first", interrupt=True)
|
||||||
|
return
|
||||||
|
|
||||||
|
module = self.env['commandBuffer']['lastTestedModule']
|
||||||
|
voice = self.env['commandBuffer']['lastTestedVoice']
|
||||||
|
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
f"Applying {voice} from {module}", interrupt=True)
|
||||||
|
|
||||||
|
# Apply to runtime settings only (temporary until saved)
|
||||||
|
SettingsManager = self.env['runtime']['SettingsManager']
|
||||||
|
|
||||||
|
# Store old values for safety
|
||||||
|
old_driver = SettingsManager.get_setting('speech', 'driver')
|
||||||
|
old_module = SettingsManager.get_setting('speech', 'module')
|
||||||
|
old_voice = SettingsManager.get_setting('speech', 'voice')
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Apply new settings to runtime only (use set_setting to update
|
||||||
|
# settingArgDict)
|
||||||
|
SettingsManager.set_setting('speech', 'driver', 'speechdDriver')
|
||||||
|
SettingsManager.set_setting('speech', 'module', module)
|
||||||
|
SettingsManager.set_setting('speech', 'voice', voice)
|
||||||
|
|
||||||
|
# Apply to speech driver instance directly
|
||||||
|
if 'SpeechDriver' in self.env['runtime']:
|
||||||
|
SpeechDriver = self.env['runtime']['SpeechDriver']
|
||||||
|
|
||||||
|
# Set the module and voice on the driver instance
|
||||||
|
SpeechDriver.set_module(module)
|
||||||
|
SpeechDriver.set_voice(voice)
|
||||||
|
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
"Voice applied successfully!", interrupt=True)
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
"Use save settings to make permanent", interrupt=True)
|
||||||
|
self.env['runtime']['OutputManager'].play_sound('Accept')
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
# Revert on failure
|
||||||
|
SettingsManager.set_setting('speech', 'driver', old_driver)
|
||||||
|
SettingsManager.set_setting('speech', 'module', old_module)
|
||||||
|
SettingsManager.set_setting('speech', 'voice', old_voice)
|
||||||
|
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
f"Failed to apply voice, reverted: {str(e)}", interrupt=True)
|
||||||
|
self.env['runtime']['OutputManager'].play_sound('Error')
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
f"Apply voice error: {str(e)}", interrupt=True)
|
||||||
|
self.env['runtime']['OutputManager'].play_sound('Error')
|
||||||
|
|
||||||
|
def set_callback(self, callback):
|
||||||
|
pass
|
@ -4,27 +4,38 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
from fenrirscreenreader.utils import screen_utils
|
from fenrirscreenreader.utils import screen_utils
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('Reads attributes of current cursor position')
|
return _('Reads attributes of current cursor position')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
|
cursor_pos = self.env['runtime']['CursorManager'].get_review_or_text_cursor()
|
||||||
try:
|
try:
|
||||||
attributes = self.env['runtime']['attributeManager'].getAttributeByXY( cursorPos['x'], cursorPos['y'])
|
attributes = self.env['runtime']['AttributeManager'].get_attribute_by_xy(
|
||||||
|
cursor_pos['x'], cursor_pos['y'])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
attributeFormatString = self.env['runtime']['settingsManager'].getSetting('general', 'attributeFormatString')
|
attribute_format_string = self.env['runtime']['SettingsManager'].get_setting(
|
||||||
attributeFormatString = self.env['runtime']['attributeManager'].formatAttributes(attributes, attributeFormatString)
|
'general', 'attribute_format_string')
|
||||||
|
attribute_format_string = self.env['runtime']['AttributeManager'].format_attributes(
|
||||||
|
attributes, attribute_format_string)
|
||||||
|
|
||||||
self.env['runtime']['outputManager'].presentText(attributeFormatString, soundIcon='', interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
def setCallback(self, callback):
|
attribute_format_string, sound_icon ='', interrupt=True)
|
||||||
|
|
||||||
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,45 +4,17 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
from fenrirscreenreader.utils import mark_utils
|
|
||||||
from fenrirscreenreader.utils import line_utils
|
|
||||||
|
|
||||||
class command():
|
import os
|
||||||
|
import importlib.util
|
||||||
|
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||||
|
_spec = importlib.util.spec_from_file_location("bookmark_base", _base_path)
|
||||||
|
_module = importlib.util.module_from_spec(_spec)
|
||||||
|
_spec.loader.exec_module(_module)
|
||||||
|
bookmark_command = _module.bookmark_command
|
||||||
|
|
||||||
|
|
||||||
|
class command(bookmark_command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.ID = '1'
|
super().__init__(1, 'read')
|
||||||
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
|
|
||||||
|
@ -4,45 +4,17 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
from fenrirscreenreader.utils import mark_utils
|
|
||||||
from fenrirscreenreader.utils import line_utils
|
|
||||||
|
|
||||||
class command():
|
import os
|
||||||
|
import importlib.util
|
||||||
|
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||||
|
_spec = importlib.util.spec_from_file_location("bookmark_base", _base_path)
|
||||||
|
_module = importlib.util.module_from_spec(_spec)
|
||||||
|
_spec.loader.exec_module(_module)
|
||||||
|
bookmark_command = _module.bookmark_command
|
||||||
|
|
||||||
|
|
||||||
|
class command(bookmark_command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.ID = '10'
|
super().__init__(10, 'read')
|
||||||
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
|
|
||||||
|
@ -4,45 +4,17 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
from fenrirscreenreader.utils import mark_utils
|
|
||||||
from fenrirscreenreader.utils import line_utils
|
|
||||||
|
|
||||||
class command():
|
import os
|
||||||
|
import importlib.util
|
||||||
|
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||||
|
_spec = importlib.util.spec_from_file_location("bookmark_base", _base_path)
|
||||||
|
_module = importlib.util.module_from_spec(_spec)
|
||||||
|
_spec.loader.exec_module(_module)
|
||||||
|
bookmark_command = _module.bookmark_command
|
||||||
|
|
||||||
|
|
||||||
|
class command(bookmark_command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.ID = '2'
|
super().__init__(2, 'read')
|
||||||
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
|
|
||||||
|
@ -4,45 +4,17 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
from fenrirscreenreader.utils import mark_utils
|
|
||||||
from fenrirscreenreader.utils import line_utils
|
|
||||||
|
|
||||||
class command():
|
import os
|
||||||
|
import importlib.util
|
||||||
|
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||||
|
_spec = importlib.util.spec_from_file_location("bookmark_base", _base_path)
|
||||||
|
_module = importlib.util.module_from_spec(_spec)
|
||||||
|
_spec.loader.exec_module(_module)
|
||||||
|
bookmark_command = _module.bookmark_command
|
||||||
|
|
||||||
|
|
||||||
|
class command(bookmark_command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.ID = '3'
|
super().__init__(3, 'read')
|
||||||
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
|
|
||||||
|
@ -4,45 +4,17 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
from fenrirscreenreader.utils import mark_utils
|
|
||||||
from fenrirscreenreader.utils import line_utils
|
|
||||||
|
|
||||||
class command():
|
import os
|
||||||
|
import importlib.util
|
||||||
|
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||||
|
_spec = importlib.util.spec_from_file_location("bookmark_base", _base_path)
|
||||||
|
_module = importlib.util.module_from_spec(_spec)
|
||||||
|
_spec.loader.exec_module(_module)
|
||||||
|
bookmark_command = _module.bookmark_command
|
||||||
|
|
||||||
|
|
||||||
|
class command(bookmark_command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.ID = '4'
|
super().__init__(4, 'read')
|
||||||
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
|
|
||||||
|
@ -4,45 +4,17 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
from fenrirscreenreader.utils import mark_utils
|
|
||||||
from fenrirscreenreader.utils import line_utils
|
|
||||||
|
|
||||||
class command():
|
import os
|
||||||
|
import importlib.util
|
||||||
|
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||||
|
_spec = importlib.util.spec_from_file_location("bookmark_base", _base_path)
|
||||||
|
_module = importlib.util.module_from_spec(_spec)
|
||||||
|
_spec.loader.exec_module(_module)
|
||||||
|
bookmark_command = _module.bookmark_command
|
||||||
|
|
||||||
|
|
||||||
|
class command(bookmark_command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.ID = '5'
|
super().__init__(5, 'read')
|
||||||
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
|
|
||||||
|
@ -4,45 +4,17 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
from fenrirscreenreader.utils import mark_utils
|
|
||||||
from fenrirscreenreader.utils import line_utils
|
|
||||||
|
|
||||||
class command():
|
import os
|
||||||
|
import importlib.util
|
||||||
|
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||||
|
_spec = importlib.util.spec_from_file_location("bookmark_base", _base_path)
|
||||||
|
_module = importlib.util.module_from_spec(_spec)
|
||||||
|
_spec.loader.exec_module(_module)
|
||||||
|
bookmark_command = _module.bookmark_command
|
||||||
|
|
||||||
|
|
||||||
|
class command(bookmark_command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.ID = '6'
|
super().__init__(6, 'read')
|
||||||
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
|
|
||||||
|
@ -4,45 +4,17 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
from fenrirscreenreader.utils import mark_utils
|
|
||||||
from fenrirscreenreader.utils import line_utils
|
|
||||||
|
|
||||||
class command():
|
import os
|
||||||
|
import importlib.util
|
||||||
|
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||||
|
_spec = importlib.util.spec_from_file_location("bookmark_base", _base_path)
|
||||||
|
_module = importlib.util.module_from_spec(_spec)
|
||||||
|
_spec.loader.exec_module(_module)
|
||||||
|
bookmark_command = _module.bookmark_command
|
||||||
|
|
||||||
|
|
||||||
|
class command(bookmark_command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.ID = '7'
|
super().__init__(7, 'read')
|
||||||
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
|
|
||||||
|
@ -4,45 +4,17 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
from fenrirscreenreader.utils import mark_utils
|
|
||||||
from fenrirscreenreader.utils import line_utils
|
|
||||||
|
|
||||||
class command():
|
import os
|
||||||
|
import importlib.util
|
||||||
|
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||||
|
_spec = importlib.util.spec_from_file_location("bookmark_base", _base_path)
|
||||||
|
_module = importlib.util.module_from_spec(_spec)
|
||||||
|
_spec.loader.exec_module(_module)
|
||||||
|
bookmark_command = _module.bookmark_command
|
||||||
|
|
||||||
|
|
||||||
|
class command(bookmark_command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.ID = '8'
|
super().__init__(8, 'read')
|
||||||
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
|
|
||||||
|
@ -4,45 +4,17 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
from fenrirscreenreader.utils import mark_utils
|
|
||||||
from fenrirscreenreader.utils import line_utils
|
|
||||||
|
|
||||||
class command():
|
import os
|
||||||
|
import importlib.util
|
||||||
|
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||||
|
_spec = importlib.util.spec_from_file_location("bookmark_base", _base_path)
|
||||||
|
_module = importlib.util.module_from_spec(_spec)
|
||||||
|
_spec.loader.exec_module(_module)
|
||||||
|
bookmark_command = _module.bookmark_command
|
||||||
|
|
||||||
|
|
||||||
|
class command(bookmark_command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.ID = '9'
|
super().__init__(9, 'read')
|
||||||
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
|
|
||||||
|
176
src/fenrirscreenreader/commands/commands/bookmark_base.py
Normal file
176
src/fenrirscreenreader/commands/commands/bookmark_base.py
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Fenrir TTY screen reader
|
||||||
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
|
from fenrirscreenreader.utils import line_utils
|
||||||
|
from fenrirscreenreader.utils import mark_utils
|
||||||
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
|
import gettext
|
||||||
|
_ = gettext.gettext
|
||||||
|
|
||||||
|
|
||||||
|
class bookmark_command():
|
||||||
|
"""Base class for bookmark operations - read, set, clear"""
|
||||||
|
|
||||||
|
def __init__(self, bookmark_id, action='read'):
|
||||||
|
self.ID = str(bookmark_id)
|
||||||
|
self.action = action
|
||||||
|
|
||||||
|
def initialize(self, environment):
|
||||||
|
self.env = environment
|
||||||
|
# Always initialize bookmark structure - all commands need this
|
||||||
|
if self.ID not in self.env['commandBuffer']['bookMarks']:
|
||||||
|
self.env['commandBuffer']['bookMarks'][self.ID] = {}
|
||||||
|
|
||||||
|
def shutdown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def get_description(self):
|
||||||
|
if self.action == 'read':
|
||||||
|
return _('read Bookmark {0}').format(self.ID)
|
||||||
|
elif self.action == 'set':
|
||||||
|
return _('set Bookmark {0}').format(self.ID)
|
||||||
|
elif self.action == 'clear':
|
||||||
|
return _('remove Bookmark {0}').format(self.ID)
|
||||||
|
return f'{self.action} Bookmark {self.ID}'
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
if self.action == 'read':
|
||||||
|
self._read_bookmark()
|
||||||
|
elif self.action == 'set':
|
||||||
|
self._set_bookmark()
|
||||||
|
elif self.action == 'clear':
|
||||||
|
self._clear_bookmark()
|
||||||
|
|
||||||
|
def _read_bookmark(self):
|
||||||
|
curr_app = self.env['runtime']['ApplicationManager'].get_current_application()
|
||||||
|
|
||||||
|
if not self.env['commandBuffer']['bookMarks'][self.ID]:
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
'Bookmark {0} not set'.format(self.ID), interrupt=True)
|
||||||
|
return
|
||||||
|
|
||||||
|
if curr_app not in self.env['commandBuffer']['bookMarks'][self.ID]:
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
'Bookmark for application {0} not set'.format(curr_app), interrupt=True)
|
||||||
|
return
|
||||||
|
|
||||||
|
if not self.env['commandBuffer']['bookMarks'][self.ID][curr_app].get(
|
||||||
|
'1'):
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
'Bookmark for application {0} not set'.format(curr_app), interrupt=True)
|
||||||
|
return
|
||||||
|
|
||||||
|
# Get bookmarked text
|
||||||
|
marked = ''
|
||||||
|
start_mark = self.env['commandBuffer']['bookMarks'][self.ID][curr_app]['1'].copy(
|
||||||
|
)
|
||||||
|
|
||||||
|
if self.env['commandBuffer']['bookMarks'][self.ID][curr_app]['2']:
|
||||||
|
end_mark = self.env['commandBuffer']['bookMarks'][self.ID][curr_app]['2'].copy(
|
||||||
|
)
|
||||||
|
marked = mark_utils.get_text_between_marks(
|
||||||
|
start_mark, end_mark, self.env['screen']['new_content_text'])
|
||||||
|
else:
|
||||||
|
x, y, marked = line_utils.get_current_line(
|
||||||
|
start_mark['x'], start_mark['y'], self.env['screen']['new_content_text'])
|
||||||
|
|
||||||
|
if marked.isspace():
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_('blank'), sound_icon ='EmptyLine', interrupt=True)
|
||||||
|
else:
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
marked, interrupt=True)
|
||||||
|
|
||||||
|
def _set_bookmark(self):
|
||||||
|
if not self.env['commandBuffer']['Marks']['1']:
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_("No mark found"), interrupt=True)
|
||||||
|
return
|
||||||
|
|
||||||
|
curr_app = self.env['runtime']['ApplicationManager'].get_current_application()
|
||||||
|
self.env['commandBuffer']['bookMarks'][self.ID][curr_app] = {}
|
||||||
|
|
||||||
|
self.env['commandBuffer']['bookMarks'][self.ID][curr_app]['1'] = self.env['commandBuffer']['Marks']['1'].copy()
|
||||||
|
|
||||||
|
if self.env['commandBuffer']['Marks']['2']:
|
||||||
|
self.env['commandBuffer']['bookMarks'][self.ID][curr_app]['2'] = self.env['commandBuffer']['Marks']['2'].copy()
|
||||||
|
else:
|
||||||
|
self.env['commandBuffer']['bookMarks'][self.ID][curr_app]['2'] = None
|
||||||
|
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_('Bookmark {0} set for application {1}').format(
|
||||||
|
self.ID, curr_app), interrupt=True)
|
||||||
|
|
||||||
|
# Clear marks after setting bookmark
|
||||||
|
self.env['commandBuffer']['Marks']['1'] = None
|
||||||
|
self.env['commandBuffer']['Marks']['2'] = None
|
||||||
|
|
||||||
|
def _clear_bookmark(self):
|
||||||
|
curr_app = self.env['runtime']['ApplicationManager'].get_current_application()
|
||||||
|
|
||||||
|
if self.ID in self.env['commandBuffer']['bookMarks'] and curr_app in self.env['commandBuffer']['bookMarks'][self.ID]:
|
||||||
|
del self.env['commandBuffer']['bookMarks'][self.ID][curr_app]
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_('Bookmark {0} removed for application {1}').format(
|
||||||
|
self.ID, curr_app), interrupt=True)
|
||||||
|
else:
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_('Bookmark {0} not set for application {1}').format(
|
||||||
|
self.ID, curr_app), interrupt=True)
|
||||||
|
|
||||||
|
def set_callback(self, callback):
|
||||||
|
pass
|
||||||
|
|
||||||
|
# Factory function to create bookmark command instances
|
||||||
|
|
||||||
|
|
||||||
|
def create_bookmark_commands():
|
||||||
|
"""Create all bookmark command instances"""
|
||||||
|
commands = {}
|
||||||
|
|
||||||
|
# Create read bookmark commands (bookmark_1 through bookmark_10)
|
||||||
|
for i in range(1, 11):
|
||||||
|
commands[f'bookmark_{i}'] = lambda i=i: bookmark_command(i, 'read')
|
||||||
|
|
||||||
|
# Create set bookmark commands (set_bookmark_1 through set_bookmark_10)
|
||||||
|
for i in range(1, 11):
|
||||||
|
commands[f'set_bookmark_{i}'] = lambda i=i: bookmark_command(i, 'set')
|
||||||
|
|
||||||
|
# Create clear bookmark commands (clear_bookmark_1 through
|
||||||
|
# clear_bookmark_10)
|
||||||
|
for i in range(1, 11):
|
||||||
|
commands[f'clear_bookmark_{i}'] = lambda i=i: bookmark_command(
|
||||||
|
i, 'clear')
|
||||||
|
|
||||||
|
return commands
|
||||||
|
|
||||||
|
# For backwards compatibility, provide individual command classes
|
||||||
|
# This allows the existing command loading system to work unchanged
|
||||||
|
|
||||||
|
|
||||||
|
def _make_command_class(bookmark_id, action):
|
||||||
|
"""Create a command class for a specific bookmark and action"""
|
||||||
|
class command(bookmark_command):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__(bookmark_id, action)
|
||||||
|
return command
|
||||||
|
|
||||||
|
# Generate individual command classes for each bookmark operation
|
||||||
|
# These will be used by the existing command loading system
|
||||||
|
|
||||||
|
|
||||||
|
# Read bookmarks (bookmark_1.py style)
|
||||||
|
for i in range(1, 11):
|
||||||
|
globals()[f'bookmark_{i}_command'] = _make_command_class(i, 'read')
|
||||||
|
|
||||||
|
# Set bookmarks (set_bookmark_1.py style)
|
||||||
|
for i in range(1, 11):
|
||||||
|
globals()[f'set_bookmark_{i}_command'] = _make_command_class(i, 'set')
|
||||||
|
|
||||||
|
# Clear bookmarks (clear_bookmark_1.py style)
|
||||||
|
for i in range(1, 11):
|
||||||
|
globals()[f'clear_bookmark_{i}_command'] = _make_command_class(i, 'clear')
|
@ -4,24 +4,17 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
class command():
|
import os
|
||||||
|
import importlib.util
|
||||||
|
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||||
|
_spec = importlib.util.spec_from_file_location("bookmark_base", _base_path)
|
||||||
|
_module = importlib.util.module_from_spec(_spec)
|
||||||
|
_spec.loader.exec_module(_module)
|
||||||
|
bookmark_command = _module.bookmark_command
|
||||||
|
|
||||||
|
|
||||||
|
class command(bookmark_command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.ID = '1'
|
super().__init__(1, 'clear')
|
||||||
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
|
|
||||||
|
@ -4,24 +4,17 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
class command():
|
import os
|
||||||
|
import importlib.util
|
||||||
|
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||||
|
_spec = importlib.util.spec_from_file_location("bookmark_base", _base_path)
|
||||||
|
_module = importlib.util.module_from_spec(_spec)
|
||||||
|
_spec.loader.exec_module(_module)
|
||||||
|
bookmark_command = _module.bookmark_command
|
||||||
|
|
||||||
|
|
||||||
|
class command(bookmark_command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.ID = '10'
|
super().__init__(10, 'clear')
|
||||||
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
|
|
||||||
|
@ -4,24 +4,17 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
class command():
|
import os
|
||||||
|
import importlib.util
|
||||||
|
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||||
|
_spec = importlib.util.spec_from_file_location("bookmark_base", _base_path)
|
||||||
|
_module = importlib.util.module_from_spec(_spec)
|
||||||
|
_spec.loader.exec_module(_module)
|
||||||
|
bookmark_command = _module.bookmark_command
|
||||||
|
|
||||||
|
|
||||||
|
class command(bookmark_command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.ID = '2'
|
super().__init__(2, 'clear')
|
||||||
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
|
|
||||||
|
@ -4,24 +4,17 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
class command():
|
import os
|
||||||
|
import importlib.util
|
||||||
|
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||||
|
_spec = importlib.util.spec_from_file_location("bookmark_base", _base_path)
|
||||||
|
_module = importlib.util.module_from_spec(_spec)
|
||||||
|
_spec.loader.exec_module(_module)
|
||||||
|
bookmark_command = _module.bookmark_command
|
||||||
|
|
||||||
|
|
||||||
|
class command(bookmark_command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.ID = '3'
|
super().__init__(3, 'clear')
|
||||||
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
|
|
||||||
|
@ -4,24 +4,17 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
class command():
|
import os
|
||||||
|
import importlib.util
|
||||||
|
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||||
|
_spec = importlib.util.spec_from_file_location("bookmark_base", _base_path)
|
||||||
|
_module = importlib.util.module_from_spec(_spec)
|
||||||
|
_spec.loader.exec_module(_module)
|
||||||
|
bookmark_command = _module.bookmark_command
|
||||||
|
|
||||||
|
|
||||||
|
class command(bookmark_command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.ID = '4'
|
super().__init__(4, 'clear')
|
||||||
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
|
|
||||||
|
@ -4,24 +4,17 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
class command():
|
import os
|
||||||
|
import importlib.util
|
||||||
|
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||||
|
_spec = importlib.util.spec_from_file_location("bookmark_base", _base_path)
|
||||||
|
_module = importlib.util.module_from_spec(_spec)
|
||||||
|
_spec.loader.exec_module(_module)
|
||||||
|
bookmark_command = _module.bookmark_command
|
||||||
|
|
||||||
|
|
||||||
|
class command(bookmark_command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.ID = '5'
|
super().__init__(5, 'clear')
|
||||||
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
|
|
||||||
|
@ -4,24 +4,17 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
class command():
|
import os
|
||||||
|
import importlib.util
|
||||||
|
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||||
|
_spec = importlib.util.spec_from_file_location("bookmark_base", _base_path)
|
||||||
|
_module = importlib.util.module_from_spec(_spec)
|
||||||
|
_spec.loader.exec_module(_module)
|
||||||
|
bookmark_command = _module.bookmark_command
|
||||||
|
|
||||||
|
|
||||||
|
class command(bookmark_command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.ID = '6'
|
super().__init__(6, 'clear')
|
||||||
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
|
|
||||||
|
@ -4,24 +4,17 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
class command():
|
import os
|
||||||
|
import importlib.util
|
||||||
|
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||||
|
_spec = importlib.util.spec_from_file_location("bookmark_base", _base_path)
|
||||||
|
_module = importlib.util.module_from_spec(_spec)
|
||||||
|
_spec.loader.exec_module(_module)
|
||||||
|
bookmark_command = _module.bookmark_command
|
||||||
|
|
||||||
|
|
||||||
|
class command(bookmark_command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.ID = '7'
|
super().__init__(7, 'clear')
|
||||||
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
|
|
||||||
|
@ -4,24 +4,17 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
class command():
|
import os
|
||||||
|
import importlib.util
|
||||||
|
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||||
|
_spec = importlib.util.spec_from_file_location("bookmark_base", _base_path)
|
||||||
|
_module = importlib.util.module_from_spec(_spec)
|
||||||
|
_spec.loader.exec_module(_module)
|
||||||
|
bookmark_command = _module.bookmark_command
|
||||||
|
|
||||||
|
|
||||||
|
class command(bookmark_command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.ID = '8'
|
super().__init__(8, 'clear')
|
||||||
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
|
|
||||||
|
@ -4,24 +4,17 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
class command():
|
import os
|
||||||
|
import importlib.util
|
||||||
|
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||||
|
_spec = importlib.util.spec_from_file_location("bookmark_base", _base_path)
|
||||||
|
_module = importlib.util.module_from_spec(_spec)
|
||||||
|
_spec.loader.exec_module(_module)
|
||||||
|
bookmark_command = _module.bookmark_command
|
||||||
|
|
||||||
|
|
||||||
|
class command(bookmark_command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.ID = '9'
|
super().__init__(9, 'clear')
|
||||||
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
|
|
||||||
|
@ -4,21 +4,29 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
|
||||||
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('clears the currently selected clipboard')
|
return _('clears the currently selected clipboard')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.env['runtime']['memoryManager'].clearCurrentIndexList('clipboardHistory')
|
self.env['runtime']['MemoryManager'].clear_current_index_list(
|
||||||
self.env['runtime']['outputManager'].presentText(_('clipboard cleared'), interrupt=True)
|
'clipboardHistory')
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_('clipboard cleared'), interrupt=True)
|
||||||
return
|
return
|
||||||
def setCallback(self, callback):
|
|
||||||
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,24 +4,33 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
|
||||||
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('Turn off window mode for application')
|
return _('Turn off window mode for application')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if self.env['runtime']['cursorManager'].clearWindowForApplication():
|
if self.env['runtime']['CursorManager'].clear_window_for_application():
|
||||||
currApp = self.env['runtime']['applicationManager'].getCurrentApplication()
|
curr_app = self.env['runtime']['ApplicationManager'].get_current_application(
|
||||||
self.env['runtime']['outputManager'].presentText(_('Window Mode off for application {0}').format(currApp,), interrupt=True)
|
)
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_('Window Mode off for application {0}').format(
|
||||||
|
curr_app,), interrupt=True)
|
||||||
else:
|
else:
|
||||||
self.env['runtime']['outputManager'].presentText(_("Not in window Mode"), interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_("Not in window Mode"), interrupt=True)
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,25 +4,32 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
from fenrirscreenreader.utils import mark_utils
|
from fenrirscreenreader.utils import mark_utils
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('copies last presented text to the clipboard')
|
return _('copies last presented text to the clipboard')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
lastEcho = self.env['runtime']['outputManager'].getLastEcho()
|
last_echo = self.env['runtime']['OutputManager'].get_last_echo()
|
||||||
if lastEcho.rstrip() != "":
|
if last_echo.rstrip() != "":
|
||||||
lastEcho = lastEcho.rstrip()
|
last_echo = last_echo.rstrip()
|
||||||
self.env['runtime']['memoryManager'].addValueToFirstIndex('clipboardHistory', lastEcho)
|
self.env['runtime']['MemoryManager'].add_value_to_first_index(
|
||||||
self.env['runtime']['outputManager'].presentText(lastEcho, soundIcon='CopyToClipboard', interrupt=True)
|
'clipboardHistory', last_echo)
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
last_echo, sound_icon ='CopyToClipboard', interrupt=True)
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -2,8 +2,11 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
from fenrirscreenreader.utils import mark_utils
|
from fenrirscreenreader.utils import mark_utils
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
@ -14,61 +17,64 @@ class command():
|
|||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def getDescription(self):
|
def get_description(self):
|
||||||
return _('copies marked text to the currently selected clipboard')
|
return _('copies marked text to the currently selected clipboard')
|
||||||
|
|
||||||
def getTextFromScreen(self, startMark, endMark):
|
def get_text_from_screen(self, start_mark, end_mark):
|
||||||
screenContent = self.env['screen']['newContentText']
|
screen_content = self.env['screen']['new_content_text']
|
||||||
screenLines = screenContent.split('\n')
|
screen_lines = screen_content.split('\n')
|
||||||
|
|
||||||
startY = min(startMark['y'], len(screenLines) - 1)
|
start_y = min(start_mark['y'], len(screen_lines) - 1)
|
||||||
endY = min(endMark['y'], len(screenLines) - 1)
|
end_y = min(end_mark['y'], len(screen_lines) - 1)
|
||||||
|
|
||||||
# If marks are on the same line
|
# If marks are on the same line
|
||||||
if startY == endY:
|
if start_y == end_y:
|
||||||
line = screenLines[startY]
|
line = screen_lines[start_y]
|
||||||
startX = min(startMark['x'], len(line))
|
start_x = min(start_mark['x'], len(line))
|
||||||
endX = min(endMark['x'], len(line)) + 1
|
end_x = min(end_mark['x'], len(line)) + 1
|
||||||
return line[startX:endX]
|
return line[start_x:end_x]
|
||||||
|
|
||||||
# Handle multi-line selection
|
# Handle multi-line selection
|
||||||
result = []
|
result = []
|
||||||
|
|
||||||
# First line (from start mark to end of line)
|
# First line (from start mark to end of line)
|
||||||
firstLine = screenLines[startY]
|
first_line = screen_lines[start_y]
|
||||||
startX = min(startMark['x'], len(firstLine))
|
start_x = min(start_mark['x'], len(first_line))
|
||||||
result.append(firstLine[startX:].rstrip())
|
result.append(first_line[start_x:].rstrip())
|
||||||
|
|
||||||
# Middle lines (complete lines)
|
# Middle lines (complete lines)
|
||||||
for lineNum in range(startY + 1, endY):
|
for lineNum in range(start_y + 1, end_y):
|
||||||
result.append(screenLines[lineNum].rstrip())
|
result.append(screen_lines[lineNum].rstrip())
|
||||||
|
|
||||||
# Last line (from start to end mark)
|
# Last line (from start to end mark)
|
||||||
if endY > startY:
|
if end_y > start_y:
|
||||||
lastLine = screenLines[endY]
|
last_line = screen_lines[end_y]
|
||||||
endX = min(endMark['x'], len(lastLine)) + 1
|
end_x = min(end_mark['x'], len(last_line)) + 1
|
||||||
result.append(lastLine[:endX].rstrip())
|
result.append(last_line[:end_x].rstrip())
|
||||||
|
|
||||||
return '\n'.join(result)
|
return '\n'.join(result)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if not self.env['commandBuffer']['Marks']['1']:
|
if not self.env['commandBuffer']['Marks']['1']:
|
||||||
self.env['runtime']['outputManager'].presentText(_("One or two marks are needed"), interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_("One or two marks are needed"), interrupt=True)
|
||||||
return
|
return
|
||||||
if not self.env['commandBuffer']['Marks']['2']:
|
if not self.env['commandBuffer']['Marks']['2']:
|
||||||
self.env['runtime']['cursorManager'].setMark()
|
self.env['runtime']['CursorManager'].set_mark()
|
||||||
|
|
||||||
# use the last first and the last setted mark as range
|
# use the last first and the last setted mark as range
|
||||||
startMark = self.env['commandBuffer']['Marks']['1'].copy()
|
start_mark = self.env['commandBuffer']['Marks']['1'].copy()
|
||||||
endMark = self.env['commandBuffer']['Marks']['2'].copy()
|
end_mark = self.env['commandBuffer']['Marks']['2'].copy()
|
||||||
|
|
||||||
# Replace mark_utils.getTextBetweenMarks with our new method
|
# Replace mark_utils.get_text_between_marks with our new method
|
||||||
marked = self.getTextFromScreen(startMark, endMark)
|
marked = self.get_text_from_screen(start_mark, end_mark)
|
||||||
|
|
||||||
self.env['runtime']['memoryManager'].addValueToFirstIndex('clipboardHistory', marked)
|
self.env['runtime']['MemoryManager'].add_value_to_first_index(
|
||||||
|
'clipboardHistory', marked)
|
||||||
# reset marks
|
# reset marks
|
||||||
self.env['runtime']['cursorManager'].clearMarks()
|
self.env['runtime']['CursorManager'].clear_marks()
|
||||||
self.env['runtime']['outputManager'].presentText(marked, soundIcon='CopyToClipboard', interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
marked, sound_icon ='CopyToClipboard', interrupt=True)
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,24 +4,33 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
|
||||||
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('speaks the contents of the currently selected clipboard')
|
return _('speaks the contents of the currently selected clipboard')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'):
|
if self.env['runtime']['MemoryManager'].is_index_list_empty(
|
||||||
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
|
'clipboardHistory'):
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_('clipboard empty'), interrupt=True)
|
||||||
return
|
return
|
||||||
clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory')
|
clipboard = self.env['runtime']['MemoryManager'].get_index_list_element(
|
||||||
self.env['runtime']['outputManager'].presentText(clipboard , interrupt=True)
|
'clipboardHistory')
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
clipboard, interrupt=True)
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,23 +4,30 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
|
||||||
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('reads the contents of the current screen')
|
return _('reads the contents of the current screen')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if self.env['screen']['newContentText'].isspace():
|
if self.env['screen']['new_content_text'].isspace():
|
||||||
self.env['runtime']['outputManager'].presentText(_("screen is empty"), soundIcon='EmptyLine', interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_("screen is empty"), sound_icon ='EmptyLine', interrupt=True)
|
||||||
else:
|
else:
|
||||||
self.env['runtime']['outputManager'].presentText(self.env['screen']['newContentText'],interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
self.env['screen']['new_content_text'], interrupt=True)
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,29 +4,37 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
from fenrirscreenreader.utils import mark_utils
|
from fenrirscreenreader.utils import mark_utils
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('reads from the cursor to the bottom of the screen')
|
return _('reads from the cursor to the bottom of the screen')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
# Prefer review cursor over text cursor
|
# Prefer review cursor over text cursor
|
||||||
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
|
cursor_pos = self.env['runtime']['CursorManager'].get_review_or_text_cursor()
|
||||||
|
|
||||||
textAfterCursor = mark_utils.getTextAfterMark(cursorPos, self.env['screen']['newContentText'])
|
text_after_cursor = mark_utils.get_text_after_mark(
|
||||||
|
cursor_pos, self.env['screen']['new_content_text'])
|
||||||
|
|
||||||
if textAfterCursor.isspace():
|
if text_after_cursor.isspace():
|
||||||
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_("blank"), sound_icon ='EmptyLine', interrupt=True)
|
||||||
else:
|
else:
|
||||||
self.env['runtime']['outputManager'].presentText(textAfterCursor, interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
text_after_cursor, interrupt=True)
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,33 +4,40 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
from fenrirscreenreader.utils import mark_utils
|
from fenrirscreenreader.utils import mark_utils
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('Reads from the top of the screen to the cursor position')
|
return _('Reads from the top of the screen to the cursor position')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
# Prefer review cursor over text cursor
|
# Prefer review cursor over text cursor
|
||||||
if self.env['screen']['newCursorReview']:
|
if self.env['screen']['newCursorReview']:
|
||||||
cursorPos = self.env['screen']['newCursorReview'].copy()
|
cursor_pos = self.env['screen']['newCursorReview'].copy()
|
||||||
else:
|
else:
|
||||||
cursorPos = self.env['screen']['newCursor'].copy()
|
cursor_pos = self.env['screen']['new_cursor'].copy()
|
||||||
|
|
||||||
textBeforeCursor = mark_utils.getTextBeforeMark(cursorPos, self.env['screen']['newContentText'])
|
text_before_cursor = mark_utils.get_text_before_mark(
|
||||||
|
cursor_pos, self.env['screen']['new_content_text'])
|
||||||
|
|
||||||
if textBeforeCursor.isspace():
|
if text_before_cursor.isspace():
|
||||||
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_("blank"), sound_icon ='EmptyLine', interrupt=True)
|
||||||
else:
|
else:
|
||||||
self.env['runtime']['outputManager'].presentText(textBeforeCursor, interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
text_before_cursor, interrupt=True)
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -4,23 +4,31 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
|
||||||
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('get current quick menu entry')
|
return _('get current quick menu entry')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
menu = ''
|
menu = ''
|
||||||
value = ''
|
value = ''
|
||||||
menu = self.env['runtime']['quickMenuManager'].getCurrentEntry()
|
menu = self.env['runtime']['QuickMenuManager'].get_current_entry()
|
||||||
if menu != '':
|
if menu != '':
|
||||||
value = self.env['runtime']['quickMenuManager'].getCurrentValue()
|
value = self.env['runtime']['QuickMenuManager'].get_current_value()
|
||||||
self.env['runtime']['outputManager'].presentText(menu + ' ' + value, interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
def setCallback(self, callback):
|
menu + ' ' + value, interrupt=True)
|
||||||
|
|
||||||
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,19 +4,26 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
|
||||||
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('get current quick menu value')
|
return _('get current quick menu value')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
value = self.env['runtime']['quickMenuManager'].getCurrentValue()
|
value = self.env['runtime']['QuickMenuManager'].get_current_value()
|
||||||
self.env['runtime']['outputManager'].presentText(value, interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(value, interrupt=True)
|
||||||
def setCallback(self, callback):
|
|
||||||
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,22 +4,30 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
|
||||||
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
return _('Column number for cursor')
|
|
||||||
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):
|
def get_description(self):
|
||||||
|
return _('Column number for cursor')
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
cursor_pos = self.env['runtime']['CursorManager'].get_review_or_text_cursor()
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
str(cursor_pos['x'] + 1), interrupt=True)
|
||||||
|
self.env['runtime']['OutputManager'].announce_active_cursor()
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
' column number', interrupt=False)
|
||||||
|
|
||||||
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,22 +4,30 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
|
||||||
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
return _('Line number for cursor')
|
|
||||||
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):
|
def get_description(self):
|
||||||
|
return _('Line number for cursor')
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
cursor_pos = self.env['runtime']['CursorManager'].get_review_or_text_cursor()
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
str(cursor_pos['y'] + 1), interrupt=True)
|
||||||
|
self.env['runtime']['OutputManager'].announce_active_cursor()
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
' line number', interrupt=False)
|
||||||
|
|
||||||
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,23 +4,33 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
|
||||||
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('displays the position of the review cursor')
|
return _('displays the position of the review cursor')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
# Prefer review cursor over text cursor
|
# Prefer review cursor over text cursor
|
||||||
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
|
cursor_pos = self.env['runtime']['CursorManager'].get_review_or_text_cursor()
|
||||||
|
|
||||||
self.env['runtime']['outputManager'].presentText(_("line {0}, column {1}, Terminal {2}").format(cursorPos['y']+1, cursorPos['x']+1, self.env['screen']['newTTY']), interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_("line {0}, column {1}, Terminal {2}").format(
|
||||||
|
cursor_pos['y'] + 1,
|
||||||
|
cursor_pos['x'] + 1,
|
||||||
|
self.env['screen']['newTTY']),
|
||||||
|
interrupt=True)
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,30 +4,38 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
from fenrirscreenreader.utils import line_utils
|
from fenrirscreenreader.utils import line_utils
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
return _('read line to cursor pos, use review cursor if you are in review mode, otherwhise use text cursor')
|
def get_description(self):
|
||||||
|
return _(
|
||||||
|
'read line to cursor pos, use review cursor if you are in review mode, otherwhise use text cursor')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
|
cursor_pos = self.env['runtime']['CursorManager'].get_review_or_text_cursor()
|
||||||
|
|
||||||
x, y, currLine = \
|
x, y, curr_line = line_utils.get_current_line(
|
||||||
line_utils.getCurrentLine(cursorPos['x'], cursorPos['y'], self.env['screen']['newContentText'])
|
cursor_pos['x'], cursor_pos['y'], self.env['screen']['new_content_text'])
|
||||||
|
|
||||||
if currLine.isspace():
|
if curr_line.isspace():
|
||||||
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_("blank"), sound_icon ='EmptyLine', interrupt=True)
|
||||||
else:
|
else:
|
||||||
self.env['runtime']['outputManager'].presentText(currLine[:cursorPos['x']], interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
self.env['runtime']['outputManager'].announceActiveCursor()
|
curr_line[:cursor_pos['x']], interrupt=True)
|
||||||
def setCallback(self, callback):
|
self.env['runtime']['OutputManager'].announce_active_cursor()
|
||||||
pass
|
|
||||||
|
|
||||||
|
def set_callback(self, callback):
|
||||||
|
pass
|
||||||
|
@ -4,30 +4,38 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
from fenrirscreenreader.utils import line_utils
|
from fenrirscreenreader.utils import line_utils
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
return _('read to end of line, use review cursor if you are in review mode, otherwhise use text cursor')
|
def get_description(self):
|
||||||
|
return _(
|
||||||
|
'read to end of line, use review cursor if you are in review mode, otherwhise use text cursor')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
|
cursor_pos = self.env['runtime']['CursorManager'].get_review_or_text_cursor()
|
||||||
|
|
||||||
x, y, currLine = \
|
x, y, curr_line = line_utils.get_current_line(
|
||||||
line_utils.getCurrentLine(cursorPos['x'], cursorPos['y'], self.env['screen']['newContentText'])
|
cursor_pos['x'], cursor_pos['y'], self.env['screen']['new_content_text'])
|
||||||
|
|
||||||
if currLine.isspace():
|
if curr_line.isspace():
|
||||||
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_("blank"), sound_icon ='EmptyLine', interrupt=True)
|
||||||
else:
|
else:
|
||||||
self.env['runtime']['outputManager'].presentText(currLine[cursorPos['x']:], interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
self.env['runtime']['outputManager'].announceActiveCursor()
|
curr_line[cursor_pos['x']:], interrupt=True)
|
||||||
def setCallback(self, callback):
|
self.env['runtime']['OutputManager'].announce_active_cursor()
|
||||||
pass
|
|
||||||
|
|
||||||
|
def set_callback(self, callback):
|
||||||
|
pass
|
||||||
|
@ -4,36 +4,43 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core import debug
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('cycles between available keyboard layouts')
|
return _('cycles between available keyboard layouts')
|
||||||
|
|
||||||
def getAvailableLayouts(self):
|
def get_available_layouts(self):
|
||||||
"""Get list of available keyboard layout files"""
|
"""Get list of available keyboard layout files"""
|
||||||
layouts = []
|
layouts = []
|
||||||
|
|
||||||
# Check standard locations for keyboard layouts
|
# Check standard locations for keyboard layouts
|
||||||
settingsRoot = '/etc/fenrirscreenreader/'
|
settings_root = '/etc/fenrirscreenreader/'
|
||||||
if not os.path.exists(settingsRoot):
|
if not os.path.exists(settings_root):
|
||||||
# Fallback to source directory
|
# Fallback to source directory
|
||||||
import fenrirscreenreader
|
import fenrirscreenreader
|
||||||
fenrirPath = os.path.dirname(fenrirscreenreader.__file__)
|
fenrir_path = os.path.dirname(fenrirscreenreader.__file__)
|
||||||
settingsRoot = fenrirPath + '/../../config/'
|
settings_root = fenrir_path + '/../../config/'
|
||||||
|
|
||||||
keyboardPath = settingsRoot + 'keyboard/'
|
keyboard_path = settings_root + 'keyboard/'
|
||||||
|
|
||||||
if os.path.exists(keyboardPath):
|
if os.path.exists(keyboard_path):
|
||||||
for file in os.listdir(keyboardPath):
|
for file in os.listdir(keyboard_path):
|
||||||
if file.endswith('.conf') and not file.startswith('__') and not file.lower().startswith('pty'):
|
if file.endswith('.conf') and not file.startswith(
|
||||||
|
'__') and not file.lower().startswith('pty'):
|
||||||
layout_name = file.replace('.conf', '')
|
layout_name = file.replace('.conf', '')
|
||||||
if layout_name not in layouts:
|
if layout_name not in layouts:
|
||||||
layouts.append(layout_name)
|
layouts.append(layout_name)
|
||||||
@ -47,14 +54,16 @@ class command():
|
|||||||
return layouts
|
return layouts
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
current_layout = self.env['runtime']['settingsManager'].getSetting('keyboard', 'keyboardLayout')
|
current_layout = self.env['runtime']['SettingsManager'].get_setting(
|
||||||
|
'keyboard', 'keyboardLayout')
|
||||||
|
|
||||||
# Extract layout name from full path if needed
|
# Extract layout name from full path if needed
|
||||||
if '/' in current_layout:
|
if '/' in current_layout:
|
||||||
current_layout = os.path.basename(current_layout).replace('.conf', '')
|
current_layout = os.path.basename(
|
||||||
|
current_layout).replace('.conf', '')
|
||||||
|
|
||||||
# Get available layouts
|
# Get available layouts
|
||||||
available_layouts = self.getAvailableLayouts()
|
available_layouts = self.get_available_layouts()
|
||||||
|
|
||||||
# Find next layout in cycle
|
# Find next layout in cycle
|
||||||
try:
|
try:
|
||||||
@ -67,24 +76,25 @@ class command():
|
|||||||
next_layout = available_layouts[next_index]
|
next_layout = available_layouts[next_index]
|
||||||
|
|
||||||
# Update setting and reload shortcuts
|
# Update setting and reload shortcuts
|
||||||
self.env['runtime']['settingsManager'].setSetting('keyboard', 'keyboardLayout', next_layout)
|
self.env['runtime']['SettingsManager'].set_setting(
|
||||||
|
'keyboard', 'keyboardLayout', next_layout)
|
||||||
|
|
||||||
# Reload shortcuts with new layout
|
# Reload shortcuts with new layout
|
||||||
try:
|
try:
|
||||||
self.env['runtime']['inputManager'].reloadShortcuts()
|
self.env['runtime']['InputManager'].reload_shortcuts()
|
||||||
self.env['runtime']['outputManager'].presentText(
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
_('Switched to {} keyboard layout').format(next_layout),
|
_('Switched to {} keyboard layout').format(next_layout),
|
||||||
interrupt=True
|
interrupt=True
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.env['runtime']['debug'].writeDebugOut(
|
self.env['runtime']['DebugManager'].write_debug_out(
|
||||||
"Error reloading shortcuts: " + str(e),
|
"Error reloading shortcuts: " + str(e),
|
||||||
debug.debugLevel.ERROR
|
debug.DebugLevel.ERROR
|
||||||
)
|
)
|
||||||
self.env['runtime']['outputManager'].presentText(
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
_('Error switching keyboard layout'),
|
_('Error switching keyboard layout'),
|
||||||
interrupt=True
|
interrupt=True
|
||||||
)
|
)
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
@ -4,27 +4,36 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('presents the date')
|
return _('presents the date')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
dateFormat = self.env['runtime']['settingsManager'].getSetting('general', 'dateFormat')
|
date_format = self.env['runtime']['SettingsManager'].get_setting(
|
||||||
|
'general', 'date_format')
|
||||||
|
|
||||||
# get the time formatted
|
# get the time formatted
|
||||||
dateString = datetime.datetime.strftime(datetime.datetime.now(), dateFormat)
|
date_string = datetime.datetime.strftime(
|
||||||
|
datetime.datetime.now(), date_format)
|
||||||
|
|
||||||
# present the time via speak and braile, there is no soundicon, interrupt the current speech
|
# present the time via speak and braile, there is no soundicon,
|
||||||
self.env['runtime']['outputManager'].presentText(dateString , soundIcon='', interrupt=True)
|
# interrupt the current speech
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
date_string, sound_icon ='', interrupt=True)
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,36 +4,17 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
initialized = False
|
from fenrirscreenreader.core.i18n import _
|
||||||
try:
|
|
||||||
import alsaaudio
|
|
||||||
initialized = True
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
import os
|
||||||
|
import importlib.util
|
||||||
|
_base_path = os.path.join(os.path.dirname(__file__), 'adjustment_base.py')
|
||||||
|
_spec = importlib.util.spec_from_file_location("adjustment_base", _base_path)
|
||||||
|
_module = importlib.util.module_from_spec(_spec)
|
||||||
|
_spec.loader.exec_module(_module)
|
||||||
|
adjustment_command = _module.adjustment_command
|
||||||
|
|
||||||
class command():
|
|
||||||
|
class command(adjustment_command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
super().__init__('alsa', 'volume', 'dec')
|
||||||
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
|
|
||||||
|
@ -4,30 +4,17 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
import math
|
|
||||||
|
|
||||||
class command():
|
import os
|
||||||
|
import importlib.util
|
||||||
|
_base_path = os.path.join(os.path.dirname(__file__), 'adjustment_base.py')
|
||||||
|
_spec = importlib.util.spec_from_file_location("adjustment_base", _base_path)
|
||||||
|
_module = importlib.util.module_from_spec(_spec)
|
||||||
|
_spec.loader.exec_module(_module)
|
||||||
|
adjustment_command = _module.adjustment_command
|
||||||
|
|
||||||
|
|
||||||
|
class command(adjustment_command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
super().__init__('sound', 'volume', 'dec')
|
||||||
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
|
|
||||||
|
|
||||||
|
@ -4,26 +4,17 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
import math
|
|
||||||
|
|
||||||
class command():
|
import os
|
||||||
|
import importlib.util
|
||||||
|
_base_path = os.path.join(os.path.dirname(__file__), 'adjustment_base.py')
|
||||||
|
_spec = importlib.util.spec_from_file_location("adjustment_base", _base_path)
|
||||||
|
_module = importlib.util.module_from_spec(_spec)
|
||||||
|
_spec.loader.exec_module(_module)
|
||||||
|
adjustment_command = _module.adjustment_command
|
||||||
|
|
||||||
|
|
||||||
|
class command(adjustment_command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
super().__init__('speech', 'pitch', 'dec')
|
||||||
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
|
|
||||||
|
@ -4,27 +4,17 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
import math
|
|
||||||
|
|
||||||
class command():
|
import os
|
||||||
|
import importlib.util
|
||||||
|
_base_path = os.path.join(os.path.dirname(__file__), 'adjustment_base.py')
|
||||||
|
_spec = importlib.util.spec_from_file_location("adjustment_base", _base_path)
|
||||||
|
_module = importlib.util.module_from_spec(_spec)
|
||||||
|
_spec.loader.exec_module(_module)
|
||||||
|
adjustment_command = _module.adjustment_command
|
||||||
|
|
||||||
|
|
||||||
|
class command(adjustment_command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
super().__init__('speech', 'rate', 'dec')
|
||||||
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
|
|
||||||
|
@ -4,28 +4,17 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
import math
|
|
||||||
|
|
||||||
class command():
|
import os
|
||||||
|
import importlib.util
|
||||||
|
_base_path = os.path.join(os.path.dirname(__file__), 'adjustment_base.py')
|
||||||
|
_spec = importlib.util.spec_from_file_location("adjustment_base", _base_path)
|
||||||
|
_module = importlib.util.module_from_spec(_spec)
|
||||||
|
_spec.loader.exec_module(_module)
|
||||||
|
adjustment_command = _module.adjustment_command
|
||||||
|
|
||||||
|
|
||||||
|
class command(adjustment_command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
super().__init__('speech', 'volume', 'dec')
|
||||||
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
|
|
||||||
|
|
||||||
|
@ -4,25 +4,32 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
|
||||||
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('exits review mode')
|
return _('exits review mode')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if not self.env['runtime']['cursorManager'].isReviewMode():
|
if not self.env['runtime']['CursorManager'].is_review_mode():
|
||||||
self.env['runtime']['outputManager'].presentText(_("Not in Review Mode"), interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_("Not in Review Mode"), interrupt=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
self.env['runtime']['cursorManager'].clearReviewCursor()
|
self.env['runtime']['CursorManager'].clear_review_cursor()
|
||||||
self.env['runtime']['outputManager'].presentText(_("Exiting Review Mode"), interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_("Exiting Review Mode"), interrupt=True)
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,36 +4,55 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core import debug
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
def initialize(self, environment, scriptPath=''):
|
|
||||||
|
def initialize(self, environment, script_path=''):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
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):
|
def get_description(self):
|
||||||
|
return _('export the current fenrir clipboard to a file')
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
clipboard_file_path = self.env['runtime']['SettingsManager'].get_setting(
|
||||||
|
'general', 'clipboardExportPath')
|
||||||
|
clipboard_file_path = clipboard_file_path.replace(
|
||||||
|
'$user', self.env['general']['curr_user'])
|
||||||
|
clipboard_file_path = clipboard_file_path.replace(
|
||||||
|
'$USER', self.env['general']['curr_user'])
|
||||||
|
clipboard_file_path = clipboard_file_path.replace(
|
||||||
|
'$User', self.env['general']['curr_user'])
|
||||||
|
clipboard_file = open(clipboard_file_path, 'w')
|
||||||
|
try:
|
||||||
|
if self.env['runtime']['MemoryManager'].is_index_list_empty(
|
||||||
|
'clipboardHistory'):
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_('clipboard empty'), interrupt=True)
|
||||||
|
return
|
||||||
|
clipboard = self.env['runtime']['MemoryManager'].get_index_list_element(
|
||||||
|
'clipboardHistory')
|
||||||
|
clipboard_file.write(clipboard)
|
||||||
|
clipboard_file.close()
|
||||||
|
os.chmod(clipboard_file_path, 0o644)
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_('clipboard exported to file'), interrupt=True)
|
||||||
|
except Exception as e:
|
||||||
|
self.env['runtime']['DebugManager'].write_debug_out(
|
||||||
|
'export_clipboard_to_file:run: Filepath:' +
|
||||||
|
clipboard_file +
|
||||||
|
' trace:' +
|
||||||
|
str(e),
|
||||||
|
debug.DebugLevel.ERROR)
|
||||||
|
|
||||||
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,36 +4,46 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import importlib
|
import importlib
|
||||||
import _thread
|
import _thread
|
||||||
import pyperclip
|
import pyperclip
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
def initialize(self, environment, scriptPath=''):
|
|
||||||
|
def initialize(self, environment, script_path=''):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
self.scriptPath = scriptPath
|
self.script_path = script_path
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('Export current fenrir clipboard to X or GUI clipboard')
|
return _('Export current fenrir clipboard to X or GUI clipboard')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
_thread.start_new_thread(self._threadRun , ())
|
_thread.start_new_thread(self._thread_run, ())
|
||||||
def _threadRun(self):
|
|
||||||
|
def _thread_run(self):
|
||||||
try:
|
try:
|
||||||
# Check if clipboard is empty
|
# Check if clipboard is empty
|
||||||
if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'):
|
if self.env['runtime']['MemoryManager'].is_index_list_empty(
|
||||||
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
|
'clipboardHistory'):
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_('clipboard empty'), interrupt=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
# Get current clipboard content
|
# Get current clipboard content
|
||||||
clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory')
|
clipboard = self.env['runtime']['MemoryManager'].get_index_list_element(
|
||||||
|
'clipboardHistory')
|
||||||
|
|
||||||
# Remember original display environment variable if it exists
|
# Remember original display environment variable if it exists
|
||||||
originalDisplay = os.environ.get('DISPLAY', '')
|
original_display = os.environ.get('DISPLAY', '')
|
||||||
success = False
|
success = False
|
||||||
|
|
||||||
# Try different display options
|
# Try different display options
|
||||||
@ -43,9 +53,11 @@ class command():
|
|||||||
# Set display environment variable
|
# Set display environment variable
|
||||||
os.environ['DISPLAY'] = display
|
os.environ['DISPLAY'] = display
|
||||||
# Attempt to set clipboard content
|
# Attempt to set clipboard content
|
||||||
importlib.reload(pyperclip) # Weird workaround for some distros
|
# Weird workaround for some distros
|
||||||
|
importlib.reload(pyperclip)
|
||||||
pyperclip.copy(clipboard)
|
pyperclip.copy(clipboard)
|
||||||
# If we get here without exception, we found a working display
|
# If we get here without exception, we found a working
|
||||||
|
# display
|
||||||
success = True
|
success = True
|
||||||
break
|
break
|
||||||
except Exception:
|
except Exception:
|
||||||
@ -53,19 +65,22 @@ class command():
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# Restore original display setting
|
# Restore original display setting
|
||||||
if originalDisplay:
|
if original_display:
|
||||||
os.environ['DISPLAY'] = originalDisplay
|
os.environ['DISPLAY'] = original_display
|
||||||
else:
|
else:
|
||||||
os.environ.pop('DISPLAY', None)
|
os.environ.pop('DISPLAY', None)
|
||||||
|
|
||||||
# Notify the user of the result
|
# Notify the user of the result
|
||||||
if success:
|
if success:
|
||||||
self.env['runtime']['outputManager'].presentText(_('exported to the X session.'), interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_('exported to the X session.'), interrupt=True)
|
||||||
else:
|
else:
|
||||||
self.env['runtime']['outputManager'].presentText(_('failed to export to X clipboard. No available display found.'), interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_('failed to export to X clipboard. No available display found.'), interrupt=True)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.env['runtime']['outputManager'].presentText(str(e), soundIcon='', interrupt=False)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
str(e), sound_icon ='', interrupt=False)
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,25 +4,34 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
|
||||||
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('selects the first clipboard')
|
return _('selects the first clipboard')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'):
|
if self.env['runtime']['MemoryManager'].is_index_list_empty(
|
||||||
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
|
'clipboardHistory'):
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_('clipboard empty'), interrupt=True)
|
||||||
return
|
return
|
||||||
self.env['runtime']['memoryManager'].setFirstIndex('clipboardHistory')
|
self.env['runtime']['MemoryManager'].set_first_index('clipboardHistory')
|
||||||
clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory')
|
clipboard = self.env['runtime']['MemoryManager'].get_index_list_element(
|
||||||
self.env['runtime']['outputManager'].presentText(clipboard, interrupt=True)
|
'clipboardHistory')
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
clipboard, interrupt=True)
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,21 +4,27 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
|
||||||
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('sends the following keypress to the terminal or application')
|
return _('sends the following keypress to the terminal or application')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.env['input']['keyForeward'] = 3
|
self.env['input']['keyForeward'] = 3
|
||||||
self.env['runtime']['outputManager'].presentText(_('Forward next keypress'), interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_('Forward next keypress'), interrupt=True)
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,36 +4,48 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
from fenrirscreenreader.utils import mark_utils
|
from fenrirscreenreader.utils import mark_utils
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('imports text from clipboard file to the clipboard')
|
return _('imports text from clipboard file to the clipboard')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
clipboardFilePath = self.env['runtime']['settingsManager'].getSetting('general', 'clipboardExportPath')
|
clipboard_file_path = self.env['runtime']['SettingsManager'].get_setting(
|
||||||
clipboardFilePath = clipboardFilePath.replace('$user',self.env['general']['currUser'])
|
'general', 'clipboardExportPath')
|
||||||
clipboardFilePath = clipboardFilePath.replace('$USER',self.env['general']['currUser'])
|
clipboard_file_path = clipboard_file_path.replace(
|
||||||
clipboardFilePath = clipboardFilePath.replace('$User',self.env['general']['currUser'])
|
'$user', self.env['general']['curr_user'])
|
||||||
if not os.path.exists(clipboardFilePath):
|
clipboard_file_path = clipboard_file_path.replace(
|
||||||
self.env['runtime']['outputManager'].presentText(_('File does not exist'), soundIcon='', interrupt=True)
|
'$USER', self.env['general']['curr_user'])
|
||||||
|
clipboard_file_path = clipboard_file_path.replace(
|
||||||
|
'$User', self.env['general']['curr_user'])
|
||||||
|
if not os.path.exists(clipboard_file_path):
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_('File does not exist'), sound_icon ='', interrupt=True)
|
||||||
return
|
return
|
||||||
clipboardFile = open(clipboardFilePath,'r')
|
clipboard_file = open(clipboard_file_path, 'r')
|
||||||
imported = clipboardFile.read()
|
imported = clipboard_file.read()
|
||||||
clipboardFile.close()
|
clipboard_file.close()
|
||||||
self.env['runtime']['memoryManager'].addValueToFirstIndex('clipboardHistory', imported)
|
self.env['runtime']['MemoryManager'].add_value_to_first_index(
|
||||||
|
'clipboardHistory', imported)
|
||||||
|
|
||||||
self.env['runtime']['outputManager'].presentText('Import to Clipboard', soundIcon='CopyToClipboard', interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
self.env['runtime']['outputManager'].presentText(imported, soundIcon='', interrupt=False)
|
'Import to Clipboard', sound_icon ='CopyToClipboard', interrupt=True)
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
imported, sound_icon ='', interrupt=False)
|
||||||
|
|
||||||
|
def set_callback(self, callback):
|
||||||
def setCallback(self, callback):
|
|
||||||
pass
|
pass
|
||||||
|
@ -4,29 +4,36 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
import importlib
|
import importlib
|
||||||
import _thread
|
import _thread
|
||||||
import pyperclip
|
import pyperclip
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
def initialize(self, environment, scriptPath=''):
|
|
||||||
|
def initialize(self, environment, script_path=''):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
self.scriptPath = scriptPath
|
self.script_path = script_path
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _("imports the graphical clipboard to Fenrir's clipboard")
|
return _("imports the graphical clipboard to Fenrir's clipboard")
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
_thread.start_new_thread(self._threadRun , ())
|
_thread.start_new_thread(self._thread_run, ())
|
||||||
def _threadRun(self):
|
|
||||||
|
def _thread_run(self):
|
||||||
try:
|
try:
|
||||||
# Remember original display environment variable if it exists
|
# Remember original display environment variable if it exists
|
||||||
originalDisplay = os.environ.get('DISPLAY', '')
|
original_display = os.environ.get('DISPLAY', '')
|
||||||
clipboardContent = None
|
clipboard_content = None
|
||||||
|
|
||||||
# Try different display options
|
# Try different display options
|
||||||
for i in range(10):
|
for i in range(10):
|
||||||
@ -35,30 +42,37 @@ class command():
|
|||||||
# Set display environment variable
|
# Set display environment variable
|
||||||
os.environ['DISPLAY'] = display
|
os.environ['DISPLAY'] = display
|
||||||
# Attempt to get clipboard content
|
# Attempt to get clipboard content
|
||||||
importlib.reload(pyperclip) # Weird workaround for some distros
|
# Weird workaround for some distros
|
||||||
clipboardContent = pyperclip.paste()
|
importlib.reload(pyperclip)
|
||||||
# If we get here without exception, we found a working display
|
clipboard_content = pyperclip.paste()
|
||||||
if clipboardContent:
|
# If we get here without exception, we found a working
|
||||||
|
# display
|
||||||
|
if clipboard_content:
|
||||||
break
|
break
|
||||||
except Exception:
|
except Exception:
|
||||||
# Failed for this display, try next one
|
# Failed for this display, try next one
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Restore original display setting
|
# Restore original display setting
|
||||||
if originalDisplay:
|
if original_display:
|
||||||
os.environ['DISPLAY'] = originalDisplay
|
os.environ['DISPLAY'] = original_display
|
||||||
else:
|
else:
|
||||||
os.environ.pop('DISPLAY', None)
|
os.environ.pop('DISPLAY', None)
|
||||||
|
|
||||||
# Process the clipboard content if we found any
|
# Process the clipboard content if we found any
|
||||||
if clipboardContent and isinstance(clipboardContent, str):
|
if clipboard_content and isinstance(clipboard_content, str):
|
||||||
self.env['runtime']['memoryManager'].addValueToFirstIndex('clipboardHistory', clipboardContent)
|
self.env['runtime']['MemoryManager'].add_value_to_first_index(
|
||||||
self.env['runtime']['outputManager'].presentText('Import to Clipboard', soundIcon='CopyToClipboard', interrupt=True)
|
'clipboardHistory', clipboard_content)
|
||||||
self.env['runtime']['outputManager'].presentText(clipboardContent, soundIcon='', interrupt=False)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
'Import to Clipboard', sound_icon ='CopyToClipboard', interrupt=True)
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
clipboard_content, sound_icon ='', interrupt=False)
|
||||||
else:
|
else:
|
||||||
self.env['runtime']['outputManager'].presentText('No text found in clipboard or no accessible display', interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
'No text found in clipboard or no accessible display', interrupt=True)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.env['runtime']['outputManager'].presentText(str(e), soundIcon='', interrupt=False)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
str(e), sound_icon ='', interrupt=False)
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,36 +4,17 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
initialized = False
|
from fenrirscreenreader.core.i18n import _
|
||||||
try:
|
|
||||||
import alsaaudio
|
|
||||||
initialized = True
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
import os
|
||||||
|
import importlib.util
|
||||||
|
_base_path = os.path.join(os.path.dirname(__file__), 'adjustment_base.py')
|
||||||
|
_spec = importlib.util.spec_from_file_location("adjustment_base", _base_path)
|
||||||
|
_module = importlib.util.module_from_spec(_spec)
|
||||||
|
_spec.loader.exec_module(_module)
|
||||||
|
adjustment_command = _module.adjustment_command
|
||||||
|
|
||||||
class command():
|
|
||||||
|
class command(adjustment_command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
super().__init__('alsa', 'volume', 'inc')
|
||||||
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
|
|
||||||
|
@ -4,29 +4,17 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
import math
|
|
||||||
|
|
||||||
class command():
|
import os
|
||||||
|
import importlib.util
|
||||||
|
_base_path = os.path.join(os.path.dirname(__file__), 'adjustment_base.py')
|
||||||
|
_spec = importlib.util.spec_from_file_location("adjustment_base", _base_path)
|
||||||
|
_module = importlib.util.module_from_spec(_spec)
|
||||||
|
_spec.loader.exec_module(_module)
|
||||||
|
adjustment_command = _module.adjustment_command
|
||||||
|
|
||||||
|
|
||||||
|
class command(adjustment_command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
super().__init__('sound', 'volume', 'inc')
|
||||||
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
|
|
||||||
|
@ -4,27 +4,17 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
import math
|
|
||||||
|
|
||||||
class command():
|
import os
|
||||||
|
import importlib.util
|
||||||
|
_base_path = os.path.join(os.path.dirname(__file__), 'adjustment_base.py')
|
||||||
|
_spec = importlib.util.spec_from_file_location("adjustment_base", _base_path)
|
||||||
|
_module = importlib.util.module_from_spec(_spec)
|
||||||
|
_spec.loader.exec_module(_module)
|
||||||
|
adjustment_command = _module.adjustment_command
|
||||||
|
|
||||||
|
|
||||||
|
class command(adjustment_command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
super().__init__('speech', 'pitch', 'inc')
|
||||||
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
|
|
||||||
|
@ -4,27 +4,17 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
import math
|
|
||||||
|
|
||||||
class command():
|
import os
|
||||||
|
import importlib.util
|
||||||
|
_base_path = os.path.join(os.path.dirname(__file__), 'adjustment_base.py')
|
||||||
|
_spec = importlib.util.spec_from_file_location("adjustment_base", _base_path)
|
||||||
|
_module = importlib.util.module_from_spec(_spec)
|
||||||
|
_spec.loader.exec_module(_module)
|
||||||
|
adjustment_command = _module.adjustment_command
|
||||||
|
|
||||||
|
|
||||||
|
class command(adjustment_command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
super().__init__('speech', 'rate', 'inc')
|
||||||
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
|
|
||||||
|
@ -4,27 +4,17 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
import math
|
|
||||||
|
|
||||||
class command():
|
import os
|
||||||
|
import importlib.util
|
||||||
|
_base_path = os.path.join(os.path.dirname(__file__), 'adjustment_base.py')
|
||||||
|
_spec = importlib.util.spec_from_file_location("adjustment_base", _base_path)
|
||||||
|
_module = importlib.util.module_from_spec(_spec)
|
||||||
|
_spec.loader.exec_module(_module)
|
||||||
|
adjustment_command = _module.adjustment_command
|
||||||
|
|
||||||
|
|
||||||
|
class command(adjustment_command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
super().__init__('speech', 'volume', 'inc')
|
||||||
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
|
|
||||||
|
@ -4,33 +4,40 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
from fenrirscreenreader.utils import line_utils
|
from fenrirscreenreader.utils import line_utils
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('Presents the indentation level for the current line')
|
return _('Presents the indentation level for the current line')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
# Prefer review cursor over text cursor
|
# Prefer review cursor over text cursor
|
||||||
|
|
||||||
if self.env['screen']['newCursorReview']:
|
if self.env['screen']['newCursorReview']:
|
||||||
cursorPos = self.env['screen']['newCursorReview'].copy()
|
cursor_pos = self.env['screen']['newCursorReview'].copy()
|
||||||
else:
|
else:
|
||||||
cursorPos = self.env['screen']['newCursor'].copy()
|
cursor_pos = self.env['screen']['new_cursor'].copy()
|
||||||
x, y, currLine = \
|
x, y, curr_line = line_utils.get_current_line(
|
||||||
line_utils.getCurrentLine(cursorPos['x'], cursorPos['y'], self.env['screen']['newContentText'])
|
cursor_pos['x'], cursor_pos['y'], self.env['screen']['new_content_text'])
|
||||||
|
|
||||||
if currLine.isspace():
|
if curr_line.isspace():
|
||||||
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_("blank"), sound_icon ='EmptyLine', interrupt=True)
|
||||||
else:
|
else:
|
||||||
self.env['runtime']['outputManager'].presentText(_("indent {0}").format(len(currLine) - len(currLine.lstrip())), interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(_("indent {0}").format(
|
||||||
|
len(curr_line) - len(curr_line.lstrip())), interrupt=True)
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,25 +4,34 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
|
||||||
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('selects the last clipboard')
|
return _('selects the last clipboard')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'):
|
if self.env['runtime']['MemoryManager'].is_index_list_empty(
|
||||||
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
|
'clipboardHistory'):
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_('clipboard empty'), interrupt=True)
|
||||||
return
|
return
|
||||||
self.env['runtime']['memoryManager'].setLastIndex('clipboardHistory')
|
self.env['runtime']['MemoryManager'].set_last_index('clipboardHistory')
|
||||||
clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory')
|
clipboard = self.env['runtime']['MemoryManager'].get_index_list_element(
|
||||||
self.env['runtime']['outputManager'].presentText(clipboard, interrupt=True)
|
'clipboardHistory')
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
clipboard, interrupt=True)
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
# Fenrir TTY screen reader
|
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
|
||||||
|
|
||||||
from fenrirscreenreader.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 text which was last received')
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
self.env['runtime']['outputManager'].presentText(self.env['screen']['newDelta'], interrupt=True)
|
|
||||||
|
|
||||||
def setCallback(self, callback):
|
|
||||||
pass
|
|
@ -4,35 +4,45 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
from fenrirscreenreader.utils import mark_utils
|
from fenrirscreenreader.utils import mark_utils
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
return _('Presents the currently selected text that will be copied to the clipboard')
|
def get_description(self):
|
||||||
|
return _(
|
||||||
|
'Presents the currently selected text that will be copied to the clipboard')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if not (self.env['commandBuffer']['Marks']['1'] and \
|
if not (self.env['commandBuffer']['Marks']['1'] and
|
||||||
self.env['commandBuffer']['Marks']['2']):
|
self.env['commandBuffer']['Marks']['2']):
|
||||||
self.env['runtime']['outputManager'].presentText(_("please set begin and endmark"), interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_("please set begin and endmark"), interrupt=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
# use the last first and the last setted mark as range
|
# use the last first and the last setted mark as range
|
||||||
startMark = self.env['commandBuffer']['Marks']['1'].copy()
|
start_mark = self.env['commandBuffer']['Marks']['1'].copy()
|
||||||
endMark = self.env['commandBuffer']['Marks']['2'].copy()
|
end_mark = self.env['commandBuffer']['Marks']['2'].copy()
|
||||||
|
|
||||||
marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screen']['newContentText'])
|
marked = mark_utils.get_text_between_marks(
|
||||||
|
start_mark, end_mark, self.env['screen']['new_content_text'])
|
||||||
|
|
||||||
if marked.isspace():
|
if marked.isspace():
|
||||||
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_("blank"), sound_icon ='EmptyLine', interrupt=True)
|
||||||
else:
|
else:
|
||||||
self.env['runtime']['outputManager'].presentText(marked, interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
marked, interrupt=True)
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,33 +4,46 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
|
||||||
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('selects the next clipboard')
|
return _('selects the next clipboard')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'):
|
if self.env['runtime']['MemoryManager'].is_index_list_empty(
|
||||||
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
|
'clipboardHistory'):
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_('clipboard empty'), interrupt=True)
|
||||||
return
|
return
|
||||||
self.env['runtime']['memoryManager'].getNextIndex('clipboardHistory')
|
self.env['runtime']['MemoryManager'].get_next_index('clipboardHistory')
|
||||||
isFirst = self.env['runtime']['memoryManager'].isFirstIndex('clipboardHistory')
|
is_first = self.env['runtime']['MemoryManager'].is_first_index(
|
||||||
isLast = self.env['runtime']['memoryManager'].isLastIndex('clipboardHistory')
|
'clipboardHistory')
|
||||||
clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory')
|
is_last = self.env['runtime']['MemoryManager'].is_last_index(
|
||||||
if isFirst:
|
'clipboardHistory')
|
||||||
self.env['runtime']['outputManager'].presentText(_('First clipboard '), interrupt=True)
|
clipboard = self.env['runtime']['MemoryManager'].get_index_list_element(
|
||||||
if isLast:
|
'clipboardHistory')
|
||||||
self.env['runtime']['outputManager'].presentText(_('Last clipboard '), interrupt=True)
|
if is_first:
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_('First clipboard '), interrupt=True)
|
||||||
|
if is_last:
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_('Last clipboard '), interrupt=True)
|
||||||
|
|
||||||
speechInterrupt = not(isLast or isFirst)
|
speech_interrupt = not (is_last or is_first)
|
||||||
self.env['runtime']['outputManager'].presentText(clipboard, interrupt = speechInterrupt)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
clipboard, interrupt=speech_interrupt)
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,26 +4,35 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
|
||||||
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('get next quick menu entry')
|
return _('get next quick menu entry')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
menu = ''
|
menu = ''
|
||||||
value = ''
|
value = ''
|
||||||
if self.env['runtime']['quickMenuManager'].nextEntry():
|
if self.env['runtime']['QuickMenuManager'].next_entry():
|
||||||
menu = self.env['runtime']['quickMenuManager'].getCurrentEntry()
|
menu = self.env['runtime']['QuickMenuManager'].get_current_entry()
|
||||||
if menu != '':
|
if menu != '':
|
||||||
value = self.env['runtime']['quickMenuManager'].getCurrentValue()
|
value = self.env['runtime']['QuickMenuManager'].get_current_value()
|
||||||
self.env['runtime']['outputManager'].presentText(menu + ' ' + value, interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
menu + ' ' + value, interrupt=True)
|
||||||
else:
|
else:
|
||||||
self.env['runtime']['outputManager'].presentText(_('Quick menu not available'), interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
def setCallback(self, callback):
|
_('Quick menu not available'), interrupt=True)
|
||||||
|
|
||||||
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,20 +4,28 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
|
||||||
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('get next quick menu value')
|
return _('get next quick menu value')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if self.env['runtime']['quickMenuManager'].nextValue():
|
if self.env['runtime']['QuickMenuManager'].next_value():
|
||||||
value = self.env['runtime']['quickMenuManager'].getCurrentValue()
|
value = self.env['runtime']['QuickMenuManager'].get_current_value()
|
||||||
self.env['runtime']['outputManager'].presentText(value, interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
def setCallback(self, callback):
|
value, interrupt=True)
|
||||||
|
|
||||||
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,27 +4,38 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
self.env['runtime']['memoryManager'].addIndexList('clipboardHistory', self.env['runtime']['settingsManager'].getSettingAsInt('general', 'numberOfClipboards'))
|
self.env['runtime']['MemoryManager'].add_index_list(
|
||||||
|
'clipboardHistory', self.env['runtime']['SettingsManager'].get_setting_as_int(
|
||||||
|
'general', 'numberOfClipboards'))
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('pastes the text from the currently selected clipboard')
|
return _('pastes the text from the currently selected clipboard')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'):
|
if self.env['runtime']['MemoryManager'].is_index_list_empty(
|
||||||
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
|
'clipboardHistory'):
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_('clipboard empty'), interrupt=True)
|
||||||
return
|
return
|
||||||
self.env['runtime']['outputManager'].presentText('paste clipboard', soundIcon='PasteClipboardOnScreen', interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory')
|
'paste clipboard', sound_icon ='PasteClipboardOnScreen', interrupt=True)
|
||||||
self.env['runtime']['screenManager'].injectTextToScreen(clipboard)
|
clipboard = self.env['runtime']['MemoryManager'].get_index_list_element(
|
||||||
|
'clipboardHistory')
|
||||||
|
self.env['runtime']['ScreenManager'].inject_text_to_screen(clipboard)
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,27 +4,34 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
from fenrirscreenreader.utils import line_utils
|
from fenrirscreenreader.utils import line_utils
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('present first line')
|
return _('present first line')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
x, y, firstLine = \
|
x, y, first_line = line_utils.get_current_line(
|
||||||
line_utils.getCurrentLine(0, 0, self.env['screen']['newContentText'])
|
0, 0, self.env['screen']['new_content_text'])
|
||||||
|
|
||||||
if firstLine.isspace():
|
if first_line.isspace():
|
||||||
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_("blank"), sound_icon ='EmptyLine', interrupt=True)
|
||||||
else:
|
else:
|
||||||
self.env['runtime']['outputManager'].presentText(firstLine, interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
def setCallback(self, callback):
|
first_line, interrupt=True)
|
||||||
pass
|
|
||||||
|
|
||||||
|
def set_callback(self, callback):
|
||||||
|
pass
|
||||||
|
@ -4,27 +4,34 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
from fenrirscreenreader.utils import line_utils
|
from fenrirscreenreader.utils import line_utils
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('current line')
|
return _('current line')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
x, y, lastLine = \
|
x, y, last_line = line_utils.get_current_line(
|
||||||
line_utils.getCurrentLine(0, self.env['screen']['lines'] -1, self.env['screen']['newContentText'])
|
0, self.env['screen']['lines'] - 1, self.env['screen']['new_content_text'])
|
||||||
|
|
||||||
if lastLine.isspace():
|
if last_line.isspace():
|
||||||
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_("blank"), sound_icon ='EmptyLine', interrupt=True)
|
||||||
else:
|
else:
|
||||||
self.env['runtime']['outputManager'].presentText(lastLine, interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
def setCallback(self, callback):
|
last_line, interrupt=True)
|
||||||
pass
|
|
||||||
|
|
||||||
|
def set_callback(self, callback):
|
||||||
|
pass
|
||||||
|
@ -4,32 +4,45 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
|
||||||
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('selects the previous clipboard')
|
return _('selects the previous clipboard')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'):
|
if self.env['runtime']['MemoryManager'].is_index_list_empty(
|
||||||
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
|
'clipboardHistory'):
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_('clipboard empty'), interrupt=True)
|
||||||
return
|
return
|
||||||
self.env['runtime']['memoryManager'].setPrefIndex('clipboardHistory')
|
self.env['runtime']['MemoryManager'].set_pref_index('clipboardHistory')
|
||||||
isFirst = self.env['runtime']['memoryManager'].isFirstIndex('clipboardHistory')
|
is_first = self.env['runtime']['MemoryManager'].is_first_index(
|
||||||
isLast = self.env['runtime']['memoryManager'].isLastIndex('clipboardHistory')
|
'clipboardHistory')
|
||||||
clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory')
|
is_last = self.env['runtime']['MemoryManager'].is_last_index(
|
||||||
if isFirst:
|
'clipboardHistory')
|
||||||
self.env['runtime']['outputManager'].presentText(_('First clipboard '), interrupt=True)
|
clipboard = self.env['runtime']['MemoryManager'].get_index_list_element(
|
||||||
if isLast:
|
'clipboardHistory')
|
||||||
self.env['runtime']['outputManager'].presentText(_('Last clipboard '), interrupt=True)
|
if is_first:
|
||||||
speechInterrupt = not(isLast or isFirst)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
self.env['runtime']['outputManager'].presentText(clipboard, interrupt = speechInterrupt)
|
_('First clipboard '), interrupt=True)
|
||||||
|
if is_last:
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_('Last clipboard '), interrupt=True)
|
||||||
|
speech_interrupt = not (is_last or is_first)
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
clipboard, interrupt=speech_interrupt)
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,26 +4,35 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
|
||||||
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('get previous quick menu entry')
|
return _('get previous quick menu entry')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
menu = ''
|
menu = ''
|
||||||
value = ''
|
value = ''
|
||||||
if self.env['runtime']['quickMenuManager'].prevEntry():
|
if self.env['runtime']['QuickMenuManager'].prev_entry():
|
||||||
menu = self.env['runtime']['quickMenuManager'].getCurrentEntry()
|
menu = self.env['runtime']['QuickMenuManager'].get_current_entry()
|
||||||
if menu != '':
|
if menu != '':
|
||||||
value = self.env['runtime']['quickMenuManager'].getCurrentValue()
|
value = self.env['runtime']['QuickMenuManager'].get_current_value()
|
||||||
self.env['runtime']['outputManager'].presentText(menu + ' ' + value, interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
menu + ' ' + value, interrupt=True)
|
||||||
else:
|
else:
|
||||||
self.env['runtime']['outputManager'].presentText(_('Quick menu not available'), interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
def setCallback(self, callback):
|
_('Quick menu not available'), interrupt=True)
|
||||||
|
|
||||||
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,20 +4,28 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
|
||||||
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('get previous quick menu value')
|
return _('get previous quick menu value')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if self.env['runtime']['quickMenuManager'].prevValue():
|
if self.env['runtime']['QuickMenuManager'].prev_value():
|
||||||
value = self.env['runtime']['quickMenuManager'].getCurrentValue()
|
value = self.env['runtime']['QuickMenuManager'].get_current_value()
|
||||||
self.env['runtime']['outputManager'].presentText(value, interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
def setCallback(self, callback):
|
value, interrupt=True)
|
||||||
|
|
||||||
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
235
src/fenrirscreenreader/commands/commands/progress_bar_monitor.py
Normal file
235
src/fenrirscreenreader/commands/commands/progress_bar_monitor.py
Normal file
@ -0,0 +1,235 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Fenrir TTY screen reader
|
||||||
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
|
import re
|
||||||
|
import time
|
||||||
|
import threading
|
||||||
|
|
||||||
|
|
||||||
|
class command():
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def initialize(self, environment):
|
||||||
|
self.env = environment
|
||||||
|
# Use commandBuffer like other commands
|
||||||
|
if 'progressMonitoring' not in self.env['commandBuffer']:
|
||||||
|
# Check if progress monitoring should be enabled by default from
|
||||||
|
# settings
|
||||||
|
try:
|
||||||
|
default_enabled = self.env['runtime']['SettingsManager'].get_setting_as_bool(
|
||||||
|
'sound', 'progressMonitoring')
|
||||||
|
except Exception as e:
|
||||||
|
# If setting doesn't exist, default to False
|
||||||
|
default_enabled = False
|
||||||
|
self.env['commandBuffer']['progressMonitoring'] = default_enabled
|
||||||
|
self.env['commandBuffer']['lastProgressTime'] = 0
|
||||||
|
self.env['commandBuffer']['lastProgressValue'] = -1
|
||||||
|
|
||||||
|
def shutdown(self):
|
||||||
|
self.stop_progress_monitoring()
|
||||||
|
|
||||||
|
def get_description(self):
|
||||||
|
return _('Toggle progress bar monitoring with ascending tones')
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
# Check if commandBuffer exists
|
||||||
|
if 'progressMonitoring' not in self.env['commandBuffer']:
|
||||||
|
self.env['commandBuffer']['progressMonitoring'] = False
|
||||||
|
self.env['commandBuffer']['lastProgressTime'] = 0
|
||||||
|
self.env['commandBuffer']['lastProgressValue'] = -1
|
||||||
|
|
||||||
|
if self.env['commandBuffer']['progressMonitoring']:
|
||||||
|
self.stop_progress_monitoring()
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_("Progress monitoring disabled"), interrupt=True)
|
||||||
|
else:
|
||||||
|
self.start_progress_monitoring()
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_("Progress monitoring enabled"), interrupt=True)
|
||||||
|
|
||||||
|
def start_progress_monitoring(self):
|
||||||
|
self.env['commandBuffer']['progressMonitoring'] = True
|
||||||
|
self.env['commandBuffer']['lastProgressTime'] = time.time()
|
||||||
|
self.env['commandBuffer']['lastProgressValue'] = -1
|
||||||
|
# Don't control speech - let user decide with silence_until_prompt
|
||||||
|
|
||||||
|
def stop_progress_monitoring(self):
|
||||||
|
self.env['commandBuffer']['progressMonitoring'] = False
|
||||||
|
# Don't control speech - progress monitor is beep-only
|
||||||
|
|
||||||
|
def detect_progress(self, text):
|
||||||
|
if not self.env['commandBuffer']['progressMonitoring']:
|
||||||
|
return
|
||||||
|
|
||||||
|
# Skip progress detection if current screen looks like a prompt
|
||||||
|
if self.is_current_line_prompt():
|
||||||
|
return
|
||||||
|
|
||||||
|
current_time = time.time()
|
||||||
|
|
||||||
|
# Pattern 1: Percentage (50%, 25.5%, etc.)
|
||||||
|
percent_match = re.search(r'(\d+(?:\.\d+)?)\s*%', text)
|
||||||
|
if percent_match:
|
||||||
|
percentage = float(percent_match.group(1))
|
||||||
|
if percentage != self.env['commandBuffer']['lastProgressValue']:
|
||||||
|
self.play_progress_tone(percentage)
|
||||||
|
self.env['commandBuffer']['lastProgressValue'] = percentage
|
||||||
|
self.env['commandBuffer']['lastProgressTime'] = current_time
|
||||||
|
return
|
||||||
|
|
||||||
|
# Pattern 2: Fraction (15/100, 3 of 10, etc.)
|
||||||
|
fraction_match = re.search(r'(\d+)\s*(?:of|/)\s*(\d+)', text)
|
||||||
|
if fraction_match:
|
||||||
|
current = int(fraction_match.group(1))
|
||||||
|
total = int(fraction_match.group(2))
|
||||||
|
if total > 0:
|
||||||
|
percentage = (current / total) * 100
|
||||||
|
if percentage != self.env['commandBuffer']['lastProgressValue']:
|
||||||
|
self.play_progress_tone(percentage)
|
||||||
|
self.env['commandBuffer']['lastProgressValue'] = percentage
|
||||||
|
self.env['commandBuffer']['lastProgressTime'] = current_time
|
||||||
|
return
|
||||||
|
|
||||||
|
# Pattern 3: Progress bars ([#### ], [====> ], etc.)
|
||||||
|
# Improved pattern to avoid matching IRC channels like [#channel]
|
||||||
|
bar_match = re.search(r'\[([#=\-\*]+)([\s\.]*)\]', text)
|
||||||
|
if bar_match:
|
||||||
|
filled = len(bar_match.group(1))
|
||||||
|
unfilled = len(bar_match.group(2))
|
||||||
|
total = filled + unfilled
|
||||||
|
# Require at least 2 progress chars total and unfilled portion must
|
||||||
|
# be spaces/dots
|
||||||
|
if total >= 2 and (
|
||||||
|
not bar_match.group(2) or re.match(
|
||||||
|
r'^[\s\.]*$',
|
||||||
|
bar_match.group(2))):
|
||||||
|
percentage = (filled / total) * 100
|
||||||
|
if percentage != self.env['commandBuffer']['lastProgressValue']:
|
||||||
|
self.play_progress_tone(percentage)
|
||||||
|
self.env['commandBuffer']['lastProgressValue'] = percentage
|
||||||
|
self.env['commandBuffer']['lastProgressTime'] = current_time
|
||||||
|
return
|
||||||
|
|
||||||
|
# Pattern 4: Generic activity indicators (Loading..., Working..., etc.)
|
||||||
|
activity_pattern = re.search(
|
||||||
|
r'(loading|processing|working|installing|downloading|compiling|building).*\.{2,}',
|
||||||
|
text,
|
||||||
|
re.IGNORECASE)
|
||||||
|
if activity_pattern:
|
||||||
|
# Play a steady beep every 2 seconds for ongoing activity
|
||||||
|
if current_time - \
|
||||||
|
self.env['commandBuffer']['lastProgressTime'] >= 2.0:
|
||||||
|
self.play_activity_beep()
|
||||||
|
self.env['commandBuffer']['lastProgressTime'] = current_time
|
||||||
|
|
||||||
|
def play_progress_tone(self, percentage):
|
||||||
|
# Map 0-100% to 400-1200Hz frequency range
|
||||||
|
frequency = 400 + (percentage * 8)
|
||||||
|
frequency = max(400, min(1200, frequency)) # Clamp to safe range
|
||||||
|
self.env['runtime']['OutputManager'].play_frequence(
|
||||||
|
frequency, 0.15, interrupt=False)
|
||||||
|
|
||||||
|
def play_activity_beep(self):
|
||||||
|
# Single tone for generic activity
|
||||||
|
self.env['runtime']['OutputManager'].play_frequence(
|
||||||
|
800, 0.1, interrupt=False)
|
||||||
|
|
||||||
|
def is_current_line_prompt(self):
|
||||||
|
"""Check if the current line looks like a standalone prompt (not command with progress)"""
|
||||||
|
import re
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Get the current screen content
|
||||||
|
if not self.env['screen']['new_content_text']:
|
||||||
|
return False
|
||||||
|
|
||||||
|
lines = self.env['screen']['new_content_text'].split('\n')
|
||||||
|
if not lines:
|
||||||
|
return False
|
||||||
|
|
||||||
|
# Check the last line (most common) and current cursor line for
|
||||||
|
# prompt patterns
|
||||||
|
lines_to_check = []
|
||||||
|
|
||||||
|
# Add last line (most common for prompts)
|
||||||
|
if lines:
|
||||||
|
lines_to_check.append(lines[-1])
|
||||||
|
|
||||||
|
# Add current cursor line if different from last line
|
||||||
|
if (self.env['screen']['new_cursor']['y'] < len(lines) and
|
||||||
|
self.env['screen']['new_cursor']['y'] != len(lines) - 1):
|
||||||
|
lines_to_check.append(
|
||||||
|
lines[self.env['screen']['new_cursor']['y']])
|
||||||
|
|
||||||
|
# Standalone prompt patterns (no commands mixed in)
|
||||||
|
standalone_prompt_patterns = [
|
||||||
|
r'^\s*\$\s*$', # Just $ (with whitespace)
|
||||||
|
r'^\s*#\s*$', # Just # (with whitespace)
|
||||||
|
r'^\s*>\s*$', # Just > (with whitespace)
|
||||||
|
r'^\[.*\]\s*[\\\$#>]\s*$', # [path]$ without commands
|
||||||
|
r'^[a-zA-Z0-9._-]+[\\\$#>]\s*$', # bash-5.1$ without commands
|
||||||
|
|
||||||
|
# Interactive prompt patterns (these ARE standalone)
|
||||||
|
r'.*\?\s*\[[YyNn]/[YyNn]\]\s*$', # ? [Y/n] or ? [y/N] style
|
||||||
|
r'.*\?\s*\[[Yy]es/[Nn]o\]\s*$', # ? [Yes/No] style
|
||||||
|
# "continue? [Y/n]" style
|
||||||
|
r'.*continue\?\s*\[[YyNn]/[YyNn]\].*$',
|
||||||
|
r'^::.*\?\s*\[[YyNn]/[YyNn]\].*$', # pacman style prompts
|
||||||
|
|
||||||
|
# Authentication prompts (these ARE standalone)
|
||||||
|
r'^\[[Ss]udo\]\s*[Pp]assword\s*for\s+.*:\s*$', # [sudo] password
|
||||||
|
r'^[Pp]assword\s*:\s*$', # Password:
|
||||||
|
r'.*[Pp]assword\s*:\s*$', # general password prompts
|
||||||
|
|
||||||
|
# Continuation prompts (these ARE standalone)
|
||||||
|
r'^[Pp]ress\s+any\s+key\s+to\s+continue.*$', # Press any key
|
||||||
|
r'^[Aa]re\s+you\s+sure\?\s*.*$', # Are you sure?
|
||||||
|
]
|
||||||
|
|
||||||
|
for line in lines_to_check:
|
||||||
|
line = line.strip()
|
||||||
|
if not line:
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Check if this line contains both a prompt AND other content (like commands)
|
||||||
|
# If so, don't treat it as a standalone prompt
|
||||||
|
has_prompt_marker = bool(
|
||||||
|
re.search(
|
||||||
|
r'.*@.*[\\\$#>]',
|
||||||
|
line) or re.search(
|
||||||
|
r'^\[.*\]\s*[\\\$#>]',
|
||||||
|
line))
|
||||||
|
if has_prompt_marker:
|
||||||
|
# If line has prompt marker but also has significant content after it,
|
||||||
|
# it's a command line, not a standalone prompt
|
||||||
|
prompt_end = max(
|
||||||
|
line.rfind('$'),
|
||||||
|
line.rfind('#'),
|
||||||
|
line.rfind('>'),
|
||||||
|
line.rfind('\\')
|
||||||
|
)
|
||||||
|
if prompt_end >= 0 and prompt_end < len(
|
||||||
|
line) - 5: # More than just whitespace after prompt
|
||||||
|
continue # This is a command line, not a standalone prompt
|
||||||
|
|
||||||
|
for pattern in standalone_prompt_patterns:
|
||||||
|
try:
|
||||||
|
if re.search(pattern, line):
|
||||||
|
return True
|
||||||
|
except re.error:
|
||||||
|
continue
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
# If anything fails, assume it's not a prompt to be safe
|
||||||
|
return False
|
||||||
|
|
||||||
|
def set_callback(self, callback):
|
||||||
|
pass
|
@ -4,21 +4,25 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
|
||||||
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('exits Fenrir')
|
return _('exits Fenrir')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.env['runtime']['eventManager'].stopMainEventLoop()
|
self.env['runtime']['EventManager'].stop_main_event_loop()
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -4,21 +4,27 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
|
||||||
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('Removes marks from selected text')
|
return _('Removes marks from selected text')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.env['runtime']['cursorManager'].clearMarks()
|
self.env['runtime']['CursorManager'].clear_marks()
|
||||||
self.env['runtime']['outputManager'].presentText(_('Remove marks'), interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_('Remove marks'), interrupt=True)
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,52 +4,71 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
from fenrirscreenreader.utils import word_utils
|
from fenrirscreenreader.utils import word_utils
|
||||||
import string
|
import string
|
||||||
initialized = False
|
initialized = False
|
||||||
try:
|
try:
|
||||||
import enchant
|
import enchant
|
||||||
initialized = True
|
initialized = True
|
||||||
except:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.language = ''
|
self.language = ''
|
||||||
self.spellChecker = None
|
self.spellChecker = None
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
self.updateSpellLanguage()
|
self.update_spell_language()
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('removes the current word from the exceptions dictionary')
|
return _('removes the current word from the exceptions dictionary')
|
||||||
def updateSpellLanguage(self):
|
|
||||||
self.spellChecker = enchant.Dict(self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage'))
|
def update_spell_language(self):
|
||||||
self.language = self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage')
|
self.spellChecker = enchant.Dict(
|
||||||
|
self.env['runtime']['SettingsManager'].get_setting(
|
||||||
|
'general', 'spellCheckLanguage'))
|
||||||
|
self.language = self.env['runtime']['SettingsManager'].get_setting(
|
||||||
|
'general', 'spellCheckLanguage')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if not initialized:
|
if not initialized:
|
||||||
self.env['runtime']['outputManager'].presentText(_('pyenchant is not installed'), interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
return
|
_('pyenchant is not installed'), interrupt=True)
|
||||||
if self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage') != self.language:
|
return
|
||||||
|
if self.env['runtime']['SettingsManager'].get_setting(
|
||||||
|
'general', 'spellCheckLanguage') != self.language:
|
||||||
try:
|
try:
|
||||||
self.updateSpellLanguage()
|
self.update_spell_language()
|
||||||
except:
|
except Exception as e:
|
||||||
return
|
return
|
||||||
|
|
||||||
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
|
cursor_pos = self.env['runtime']['CursorManager'].get_review_or_text_cursor()
|
||||||
|
|
||||||
# get the word
|
# get the word
|
||||||
newContent = self.env['screen']['newContentText'].split('\n')[cursorPos['y']]
|
new_content = self.env['screen']['new_content_text'].split('\n')[
|
||||||
x, y, currWord, endOfScreen, lineBreak = word_utils.getCurrentWord(cursorPos['x'], 0, newContent)
|
cursor_pos['y']]
|
||||||
currWord = currWord.strip(string.whitespace + r'!"#$%&()*+,-./:;<=Â?@[\\]^_{|}~')
|
x, y, curr_word, end_of_screen, line_break = word_utils.get_current_word(
|
||||||
if not currWord.isspace():
|
cursor_pos['x'], 0, new_content)
|
||||||
if self.spellChecker.is_removed(currWord):
|
curr_word = curr_word.strip(
|
||||||
self.env['runtime']['outputManager'].presentText(_('{0} is not in the dictionary').format(currWord,), soundIcon='Cancel', interrupt=True)
|
string.whitespace +
|
||||||
|
r'!"#$%&()*+,-./:;<=Â?@[\\]^_{|}~')
|
||||||
|
if not curr_word.isspace():
|
||||||
|
if self.spellChecker.is_removed(curr_word):
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_('{0} is not in the dictionary').format(
|
||||||
|
curr_word,), sound_icon ='Cancel', interrupt=True)
|
||||||
else:
|
else:
|
||||||
self.spellChecker.remove(currWord)
|
self.spellChecker.remove(curr_word)
|
||||||
self.env['runtime']['outputManager'].presentText(_('{0} removed').format(currWord,), soundIcon='Accept', interrupt=True)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
def setCallback(self, callback):
|
_('{0} removed').format(curr_word,), sound_icon ='Accept', interrupt=True)
|
||||||
|
|
||||||
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,21 +4,28 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
|
||||||
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('Move review to the bottom of the screen')
|
return _('Move review to the bottom of the screen')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.env['screen']['newCursorReview'] = { 'x': 0, 'y':self.env['screen']['lines'] -1}
|
self.env['screen']['newCursorReview'] = {
|
||||||
self.env['runtime']['outputManager'].presentText(_("Bottom"), interrupt=True, flush=False)
|
'x': 0, 'y': self.env['screen']['lines'] - 1}
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_("Bottom"), interrupt=True, flush=False)
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,33 +4,46 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
from fenrirscreenreader.utils import char_utils
|
from fenrirscreenreader.utils import char_utils
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('presents the current character.')
|
return _('presents the current character.')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
|
self.env['runtime']['CursorManager'].enter_review_mode_curr_text_cursor()
|
||||||
|
|
||||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currChar = \
|
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], curr_char = char_utils.get_current_char(
|
||||||
char_utils.getCurrentChar(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
|
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['new_content_text'])
|
||||||
|
|
||||||
self.env['runtime']['outputManager'].presentText(currChar ,interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False)
|
char_utils.present_char_for_review(
|
||||||
|
self.env,
|
||||||
|
curr_char,
|
||||||
|
interrupt=True,
|
||||||
|
announce_capital=True,
|
||||||
|
flush=False)
|
||||||
# is has attribute it enabled?
|
# is has attribute it enabled?
|
||||||
if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'hasAttributes'):
|
if self.env['runtime']['SettingsManager'].get_setting_as_bool(
|
||||||
cursorPos = self.env['screen']['newCursorReview']
|
'general', 'hasattributes'):
|
||||||
|
cursor_pos = self.env['screen']['newCursorReview']
|
||||||
|
|
||||||
if not self.env['runtime']['attributeManager'].hasAttributes(cursorPos):
|
if not self.env['runtime']['AttributeManager'].has_attributes(
|
||||||
|
cursor_pos):
|
||||||
return
|
return
|
||||||
self.env['runtime']['outputManager'].presentText('has attribute', soundIcon='HasAttributes', interrupt=False)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
'has attribute', sound_icon ='HasAttributes', interrupt=False)
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,30 +4,37 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
from fenrirscreenreader.utils import char_utils
|
from fenrirscreenreader.utils import char_utils
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('set review and phonetically presents the current character')
|
return _('set review and phonetically presents the current character')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
|
self.env['runtime']['CursorManager'].enter_review_mode_curr_text_cursor()
|
||||||
|
|
||||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currChar = \
|
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], curr_char = char_utils.get_current_char(
|
||||||
char_utils.getCurrentChar(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
|
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['new_content_text'])
|
||||||
|
|
||||||
if currChar.isspace():
|
if curr_char.isspace():
|
||||||
self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_("blank"), interrupt=True, flush=False)
|
||||||
else:
|
else:
|
||||||
currChar = char_utils.getPhonetic(currChar)
|
curr_char = char_utils.get_phonetic(curr_char)
|
||||||
self.env['runtime']['outputManager'].presentText(currChar ,interrupt=True, announceCapital=True, flush=False)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
curr_char, interrupt=True, announce_capital=True, flush=False)
|
||||||
|
|
||||||
def setCallback(self, callback):
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
@ -4,29 +4,36 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
from fenrirscreenreader.utils import line_utils
|
from fenrirscreenreader.utils import line_utils
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
|
def get_description(self):
|
||||||
return _('current line')
|
return _('current line')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
|
self.env['runtime']['CursorManager'].enter_review_mode_curr_text_cursor()
|
||||||
|
|
||||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currLine = \
|
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], curr_line = line_utils.get_current_line(
|
||||||
line_utils.getCurrentLine(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
|
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['new_content_text'])
|
||||||
|
|
||||||
if currLine.isspace():
|
if curr_line.isspace():
|
||||||
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_("blank"), sound_icon ='EmptyLine', interrupt=True, flush=False)
|
||||||
else:
|
else:
|
||||||
self.env['runtime']['outputManager'].presentText(currLine, interrupt=True, flush=False)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
def setCallback(self, callback):
|
curr_line, interrupt=True, flush=False)
|
||||||
pass
|
|
||||||
|
|
||||||
|
def set_callback(self, callback):
|
||||||
|
pass
|
||||||
|
@ -4,34 +4,46 @@
|
|||||||
# Fenrir TTY screen reader
|
# Fenrir TTY screen reader
|
||||||
# By Chrys, Storm Dragon, and contributers.
|
# By Chrys, Storm Dragon, and contributers.
|
||||||
|
|
||||||
from fenrirscreenreader.core import debug
|
from fenrirscreenreader.core.i18n import _
|
||||||
|
|
||||||
from fenrirscreenreader.utils import word_utils
|
from fenrirscreenreader.utils import word_utils
|
||||||
|
|
||||||
|
|
||||||
class command():
|
class command():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
pass
|
pass
|
||||||
def getDescription(self):
|
|
||||||
return _('current word.')
|
def get_description(self):
|
||||||
|
return _('current word.')
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
|
self.env['runtime']['CursorManager'].enter_review_mode_curr_text_cursor()
|
||||||
|
|
||||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currWord, endOfScreen, lineBreak = \
|
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], curr_word, end_of_screen, line_break = word_utils.get_current_word(
|
||||||
word_utils.getCurrentWord(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
|
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['new_content_text'])
|
||||||
|
|
||||||
if currWord.isspace():
|
if curr_word.isspace():
|
||||||
self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_("blank"), interrupt=True, flush=False)
|
||||||
else:
|
else:
|
||||||
self.env['runtime']['outputManager'].presentText(currWord, interrupt=True, flush=False)
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
if endOfScreen:
|
curr_word, interrupt=True, flush=False)
|
||||||
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'):
|
if end_of_screen:
|
||||||
self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen')
|
if self.env['runtime']['SettingsManager'].get_setting_as_bool(
|
||||||
if lineBreak:
|
'review', 'end_of_screen'):
|
||||||
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'):
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine')
|
_('end of screen'), interrupt=True, sound_icon ='EndOfScreen')
|
||||||
def setCallback(self, callback):
|
if line_break:
|
||||||
|
if self.env['runtime']['SettingsManager'].get_setting_as_bool(
|
||||||
|
'review', 'line_break'):
|
||||||
|
self.env['runtime']['OutputManager'].present_text(
|
||||||
|
_('line break'), interrupt=False, sound_icon ='EndOfLine')
|
||||||
|
|
||||||
|
def set_callback(self, callback):
|
||||||
pass
|
pass
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user