Table mode fixes and improvements to application detection.
This commit is contained in:
@ -2,13 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -19,7 +19,7 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return 'No description found'
|
||||
return "No description found"
|
||||
|
||||
def run(self):
|
||||
pass
|
||||
|
@ -2,7 +2,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
|
||||
# this command is just to initialize stuff.
|
||||
@ -12,22 +12,25 @@
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
# clipboard
|
||||
self.env['runtime']['MemoryManager'].add_index_list(
|
||||
'clipboardHistory', self.env['runtime']['SettingsManager'].get_setting_as_int(
|
||||
'general', 'numberOfClipboards'))
|
||||
self.env["runtime"]["MemoryManager"].add_index_list(
|
||||
"clipboardHistory",
|
||||
self.env["runtime"]["SettingsManager"].get_setting_as_int(
|
||||
"general", "numberOfClipboards"
|
||||
),
|
||||
)
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return 'No description found'
|
||||
return "No description found"
|
||||
|
||||
def run(self):
|
||||
pass
|
||||
|
@ -2,23 +2,25 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import string
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import word_utils
|
||||
import string
|
||||
|
||||
initialized = False
|
||||
try:
|
||||
import enchant
|
||||
|
||||
initialized = True
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
self.language = ''
|
||||
self.language = ""
|
||||
self.spellChecker = None
|
||||
|
||||
def initialize(self, environment):
|
||||
@ -29,44 +31,63 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('adds the current word to the exceptions dictionary')
|
||||
return _("adds the current word to the exceptions dictionary")
|
||||
|
||||
def update_spell_language(self):
|
||||
self.spellChecker = enchant.Dict(
|
||||
self.env['runtime']['SettingsManager'].get_setting(
|
||||
'general', 'spellCheckLanguage'))
|
||||
self.language = self.env['runtime']['SettingsManager'].get_setting(
|
||||
'general', 'spellCheckLanguage')
|
||||
self.env["runtime"]["SettingsManager"].get_setting(
|
||||
"general", "spellCheckLanguage"
|
||||
)
|
||||
)
|
||||
self.language = self.env["runtime"]["SettingsManager"].get_setting(
|
||||
"general", "spellCheckLanguage"
|
||||
)
|
||||
|
||||
def run(self):
|
||||
if not initialized:
|
||||
return
|
||||
if self.env['runtime']['SettingsManager'].get_setting(
|
||||
'general', 'spellCheckLanguage') != self.language:
|
||||
if (
|
||||
self.env["runtime"]["SettingsManager"].get_setting(
|
||||
"general", "spellCheckLanguage"
|
||||
)
|
||||
!= self.language
|
||||
):
|
||||
try:
|
||||
self.update_spell_language()
|
||||
except Exception as e:
|
||||
return
|
||||
cursor_pos = self.env['runtime']['CursorManager'].get_review_or_text_cursor()
|
||||
cursor_pos = self.env["runtime"][
|
||||
"CursorManager"
|
||||
].get_review_or_text_cursor()
|
||||
# get the word
|
||||
new_content = self.env['screen']['new_content_text'].split('\n')[
|
||||
cursor_pos['y']]
|
||||
x, y, curr_word, end_of_screen, line_break = word_utils.get_current_word(
|
||||
cursor_pos['x'], 0, new_content)
|
||||
new_content = self.env["screen"]["new_content_text"].split("\n")[
|
||||
cursor_pos["y"]
|
||||
]
|
||||
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'!"#$%&\()*+,-./:;<=Â?@[\\]^_{|}~')
|
||||
string.whitespace + r'!"#$%&\()*+,-./:;<=Â?@[\\]^_{|}~'
|
||||
)
|
||||
|
||||
if curr_word != '':
|
||||
if curr_word != "":
|
||||
if self.spellChecker.is_added(curr_word):
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('{0} is already in dictionary').format(
|
||||
curr_word,), sound_icon ='Cancel', interrupt=True)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("{0} is already in dictionary").format(
|
||||
curr_word,
|
||||
),
|
||||
sound_icon="Cancel",
|
||||
interrupt=True,
|
||||
)
|
||||
else:
|
||||
self.spellChecker.add(curr_word)
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('{0} added to dictionary').format(
|
||||
curr_word,), sound_icon ='Accept', interrupt=True)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("{0} added to dictionary").format(
|
||||
curr_word,
|
||||
),
|
||||
sound_icon="Accept",
|
||||
interrupt=True,
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,14 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import math
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
class adjustment_command():
|
||||
|
||||
class adjustment_command:
|
||||
"""Base class for speech and sound adjustment commands"""
|
||||
|
||||
def __init__(self, section, setting, direction, step=0.1):
|
||||
@ -25,14 +25,14 @@ class adjustment_command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
action = "Increase" if self.direction == 'inc' else "Decrease"
|
||||
if self.section == 'speech':
|
||||
return _(f'{action} the speech {self.setting}')
|
||||
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}')
|
||||
return _(f"{action} the {self.section} {self.setting}")
|
||||
|
||||
def run(self):
|
||||
if self.section == 'sound' and self.setting == 'volume':
|
||||
if self.section == "sound" and self.setting == "volume":
|
||||
# Sound volume uses different method
|
||||
self._adjust_sound_volume()
|
||||
else:
|
||||
@ -41,11 +41,12 @@ class adjustment_command():
|
||||
|
||||
def _adjust_speech_setting(self):
|
||||
"""Adjust speech settings (rate, pitch, volume)"""
|
||||
value = self.env['runtime']['SettingsManager'].get_setting_as_float(
|
||||
self.section, self.setting)
|
||||
value = self.env["runtime"]["SettingsManager"].get_setting_as_float(
|
||||
self.section, self.setting
|
||||
)
|
||||
|
||||
# Apply adjustment with rounding
|
||||
if self.direction == 'inc':
|
||||
if self.direction == "inc":
|
||||
value = round((math.ceil(10 * value) / 10) + self.step, 2)
|
||||
if value > 1.0:
|
||||
value = 1.0
|
||||
@ -55,28 +56,33 @@ class adjustment_command():
|
||||
value = 0.0
|
||||
|
||||
# Set the new value
|
||||
self.env['runtime']['SettingsManager'].set_setting(
|
||||
self.section, self.setting, str(value))
|
||||
self.env["runtime"]["SettingsManager"].set_setting(
|
||||
self.section, self.setting, str(value)
|
||||
)
|
||||
|
||||
# Present feedback
|
||||
percentage = int(value * 100)
|
||||
if self.section == 'speech':
|
||||
if self.section == "speech":
|
||||
feedback = _("{0} percent speech {1}").format(
|
||||
percentage, self.setting)
|
||||
percentage, self.setting
|
||||
)
|
||||
else:
|
||||
feedback = _("{0} percent {1} {2}").format(
|
||||
percentage, self.section, self.setting)
|
||||
percentage, self.section, self.setting
|
||||
)
|
||||
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
feedback, sound_icon ='', interrupt=True)
|
||||
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)
|
||||
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':
|
||||
if self.direction == "inc":
|
||||
value = round((math.ceil(10 * value) / 10) + self.step, 2)
|
||||
if value > 1.0:
|
||||
value = 1.0
|
||||
@ -86,15 +92,17 @@ class adjustment_command():
|
||||
value = 0.0
|
||||
|
||||
# Set the new value
|
||||
self.env['runtime']['SettingsManager'].set_setting(
|
||||
self.section, self.setting, str(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'
|
||||
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)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
feedback, sound_icon=sound_icon, interrupt=True
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,14 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader import fenrirVersion
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -20,17 +19,20 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('Present the version of Fenrir currently in use.')
|
||||
return _("Present the version of Fenrir currently in use.")
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
f'Fenrir screen reader version {
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
f"Fenrir screen reader version {
|
||||
fenrirVersion.version}-{
|
||||
fenrirVersion.code_name}', interrupt=True)
|
||||
fenrirVersion.code_name}",
|
||||
interrupt=True,
|
||||
)
|
||||
except Exception as e:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('Version information is unavailable.'), interrupt=True)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("Version information is unavailable."), interrupt=True
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -3,7 +3,7 @@
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -19,64 +19,76 @@ class command():
|
||||
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)
|
||||
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']
|
||||
module = self.env["commandBuffer"]["lastTestedModule"]
|
||||
voice = self.env["commandBuffer"]["lastTestedVoice"]
|
||||
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
f"Applying {voice} from {module}", interrupt=True)
|
||||
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']
|
||||
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')
|
||||
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)
|
||||
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']
|
||||
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')
|
||||
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)
|
||||
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')
|
||||
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')
|
||||
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
|
||||
|
@ -2,14 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import screen_utils
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -20,22 +19,28 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('Reads attributes of current cursor position')
|
||||
return _("Reads attributes of current cursor position")
|
||||
|
||||
def run(self):
|
||||
cursor_pos = self.env['runtime']['CursorManager'].get_review_or_text_cursor()
|
||||
cursor_pos = self.env["runtime"][
|
||||
"CursorManager"
|
||||
].get_review_or_text_cursor()
|
||||
try:
|
||||
attributes = self.env['runtime']['AttributeManager'].get_attribute_by_xy(
|
||||
cursor_pos['x'], cursor_pos['y'])
|
||||
attributes = self.env["runtime"][
|
||||
"AttributeManager"
|
||||
].get_attribute_by_xy(cursor_pos["x"], cursor_pos["y"])
|
||||
except Exception as e:
|
||||
print(e)
|
||||
attribute_format_string = self.env['runtime']['SettingsManager'].get_setting(
|
||||
'general', 'attribute_format_string')
|
||||
attribute_format_string = self.env['runtime']['AttributeManager'].format_attributes(
|
||||
attributes, attribute_format_string)
|
||||
attribute_format_string = self.env["runtime"][
|
||||
"SettingsManager"
|
||||
].get_setting("general", "attribute_format_string")
|
||||
attribute_format_string = self.env["runtime"][
|
||||
"AttributeManager"
|
||||
].format_attributes(attributes, attribute_format_string)
|
||||
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
attribute_format_string, sound_icon ='', interrupt=True)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
attribute_format_string, sound_icon="", interrupt=True
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,13 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||
_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)
|
||||
@ -17,4 +18,4 @@ bookmark_command = _module.bookmark_command
|
||||
|
||||
class command(bookmark_command):
|
||||
def __init__(self):
|
||||
super().__init__(1, 'read')
|
||||
super().__init__(1, "read")
|
||||
|
@ -2,13 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||
_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)
|
||||
@ -17,4 +18,4 @@ bookmark_command = _module.bookmark_command
|
||||
|
||||
class command(bookmark_command):
|
||||
def __init__(self):
|
||||
super().__init__(10, 'read')
|
||||
super().__init__(10, "read")
|
||||
|
@ -2,13 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||
_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)
|
||||
@ -17,4 +18,4 @@ bookmark_command = _module.bookmark_command
|
||||
|
||||
class command(bookmark_command):
|
||||
def __init__(self):
|
||||
super().__init__(2, 'read')
|
||||
super().__init__(2, "read")
|
||||
|
@ -2,13 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||
_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)
|
||||
@ -17,4 +18,4 @@ bookmark_command = _module.bookmark_command
|
||||
|
||||
class command(bookmark_command):
|
||||
def __init__(self):
|
||||
super().__init__(3, 'read')
|
||||
super().__init__(3, "read")
|
||||
|
@ -2,13 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||
_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)
|
||||
@ -17,4 +18,4 @@ bookmark_command = _module.bookmark_command
|
||||
|
||||
class command(bookmark_command):
|
||||
def __init__(self):
|
||||
super().__init__(4, 'read')
|
||||
super().__init__(4, "read")
|
||||
|
@ -2,13 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||
_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)
|
||||
@ -17,4 +18,4 @@ bookmark_command = _module.bookmark_command
|
||||
|
||||
class command(bookmark_command):
|
||||
def __init__(self):
|
||||
super().__init__(5, 'read')
|
||||
super().__init__(5, "read")
|
||||
|
@ -2,13 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||
_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)
|
||||
@ -17,4 +18,4 @@ bookmark_command = _module.bookmark_command
|
||||
|
||||
class command(bookmark_command):
|
||||
def __init__(self):
|
||||
super().__init__(6, 'read')
|
||||
super().__init__(6, "read")
|
||||
|
@ -2,13 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||
_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)
|
||||
@ -17,4 +18,4 @@ bookmark_command = _module.bookmark_command
|
||||
|
||||
class command(bookmark_command):
|
||||
def __init__(self):
|
||||
super().__init__(7, 'read')
|
||||
super().__init__(7, "read")
|
||||
|
@ -2,13 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||
_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)
|
||||
@ -17,4 +18,4 @@ bookmark_command = _module.bookmark_command
|
||||
|
||||
class command(bookmark_command):
|
||||
def __init__(self):
|
||||
super().__init__(8, 'read')
|
||||
super().__init__(8, "read")
|
||||
|
@ -2,13 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||
_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)
|
||||
@ -17,4 +18,4 @@ bookmark_command = _module.bookmark_command
|
||||
|
||||
class command(bookmark_command):
|
||||
def __init__(self):
|
||||
super().__init__(9, 'read')
|
||||
super().__init__(9, "read")
|
||||
|
@ -2,129 +2,159 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
from fenrirscreenreader.utils import line_utils
|
||||
from fenrirscreenreader.utils import mark_utils
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import gettext
|
||||
_ = gettext.gettext
|
||||
|
||||
|
||||
class bookmark_command():
|
||||
class bookmark_command:
|
||||
"""Base class for bookmark operations - read, set, clear"""
|
||||
|
||||
def __init__(self, bookmark_id, action='read'):
|
||||
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] = {}
|
||||
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}'
|
||||
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':
|
||||
if self.action == "read":
|
||||
self._read_bookmark()
|
||||
elif self.action == 'set':
|
||||
elif self.action == "set":
|
||||
self._set_bookmark()
|
||||
elif self.action == 'clear':
|
||||
elif self.action == "clear":
|
||||
self._clear_bookmark()
|
||||
|
||||
def _read_bookmark(self):
|
||||
curr_app = self.env['runtime']['ApplicationManager'].get_current_application()
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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(
|
||||
)
|
||||
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(
|
||||
)
|
||||
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'])
|
||||
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'])
|
||||
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)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("blank"), sound_icon="EmptyLine", interrupt=True
|
||||
)
|
||||
else:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
marked, interrupt=True)
|
||||
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)
|
||||
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] = {}
|
||||
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()
|
||||
bookmarks = self.env["commandBuffer"]["bookMarks"][self.ID][curr_app]
|
||||
bookmarks["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()
|
||||
if self.env["commandBuffer"]["Marks"]["2"]:
|
||||
bookmarks["2"] = self.env["commandBuffer"]["Marks"]["2"].copy()
|
||||
else:
|
||||
self.env['commandBuffer']['bookMarks'][self.ID][curr_app]['2'] = None
|
||||
bookmarks["2"] = None
|
||||
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('Bookmark {0} set for application {1}').format(
|
||||
self.ID, curr_app), interrupt=True)
|
||||
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
|
||||
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()
|
||||
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)
|
||||
bookmarks = self.env["commandBuffer"]["bookMarks"]
|
||||
if self.ID in bookmarks and curr_app in 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)
|
||||
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
|
||||
|
||||
|
||||
@ -134,43 +164,48 @@ def create_bookmark_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')
|
||||
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')
|
||||
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')
|
||||
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')
|
||||
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')
|
||||
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')
|
||||
globals()[f"clear_bookmark_{i}_command"] = _make_command_class(i, "clear")
|
||||
|
@ -2,13 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||
_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)
|
||||
@ -17,4 +18,4 @@ bookmark_command = _module.bookmark_command
|
||||
|
||||
class command(bookmark_command):
|
||||
def __init__(self):
|
||||
super().__init__(1, 'clear')
|
||||
super().__init__(1, "clear")
|
||||
|
@ -2,13 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||
_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)
|
||||
@ -17,4 +18,4 @@ bookmark_command = _module.bookmark_command
|
||||
|
||||
class command(bookmark_command):
|
||||
def __init__(self):
|
||||
super().__init__(10, 'clear')
|
||||
super().__init__(10, "clear")
|
||||
|
@ -2,13 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||
_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)
|
||||
@ -17,4 +18,4 @@ bookmark_command = _module.bookmark_command
|
||||
|
||||
class command(bookmark_command):
|
||||
def __init__(self):
|
||||
super().__init__(2, 'clear')
|
||||
super().__init__(2, "clear")
|
||||
|
@ -2,13 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||
_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)
|
||||
@ -17,4 +18,4 @@ bookmark_command = _module.bookmark_command
|
||||
|
||||
class command(bookmark_command):
|
||||
def __init__(self):
|
||||
super().__init__(3, 'clear')
|
||||
super().__init__(3, "clear")
|
||||
|
@ -2,13 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||
_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)
|
||||
@ -17,4 +18,4 @@ bookmark_command = _module.bookmark_command
|
||||
|
||||
class command(bookmark_command):
|
||||
def __init__(self):
|
||||
super().__init__(4, 'clear')
|
||||
super().__init__(4, "clear")
|
||||
|
@ -2,13 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||
_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)
|
||||
@ -17,4 +18,4 @@ bookmark_command = _module.bookmark_command
|
||||
|
||||
class command(bookmark_command):
|
||||
def __init__(self):
|
||||
super().__init__(5, 'clear')
|
||||
super().__init__(5, "clear")
|
||||
|
@ -2,13 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||
_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)
|
||||
@ -17,4 +18,4 @@ bookmark_command = _module.bookmark_command
|
||||
|
||||
class command(bookmark_command):
|
||||
def __init__(self):
|
||||
super().__init__(6, 'clear')
|
||||
super().__init__(6, "clear")
|
||||
|
@ -2,13 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||
_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)
|
||||
@ -17,4 +18,4 @@ bookmark_command = _module.bookmark_command
|
||||
|
||||
class command(bookmark_command):
|
||||
def __init__(self):
|
||||
super().__init__(7, 'clear')
|
||||
super().__init__(7, "clear")
|
||||
|
@ -2,13 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||
_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)
|
||||
@ -17,4 +18,4 @@ bookmark_command = _module.bookmark_command
|
||||
|
||||
class command(bookmark_command):
|
||||
def __init__(self):
|
||||
super().__init__(8, 'clear')
|
||||
super().__init__(8, "clear")
|
||||
|
@ -2,13 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
|
||||
_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)
|
||||
@ -17,4 +18,4 @@ bookmark_command = _module.bookmark_command
|
||||
|
||||
class command(bookmark_command):
|
||||
def __init__(self):
|
||||
super().__init__(9, 'clear')
|
||||
super().__init__(9, "clear")
|
||||
|
@ -2,13 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -19,13 +19,15 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('clears the currently selected clipboard')
|
||||
return _("clears the currently selected clipboard")
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['MemoryManager'].clear_current_index_list(
|
||||
'clipboardHistory')
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('clipboard cleared'), interrupt=True)
|
||||
self.env["runtime"]["MemoryManager"].clear_current_index_list(
|
||||
"clipboardHistory"
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("clipboard cleared"), interrupt=True
|
||||
)
|
||||
return
|
||||
|
||||
def set_callback(self, callback):
|
||||
|
@ -2,13 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -19,18 +19,23 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('Turn off window mode for application')
|
||||
return _("Turn off window mode for application")
|
||||
|
||||
def run(self):
|
||||
if self.env['runtime']['CursorManager'].clear_window_for_application():
|
||||
curr_app = self.env['runtime']['ApplicationManager'].get_current_application(
|
||||
if self.env["runtime"]["CursorManager"].clear_window_for_application():
|
||||
curr_app = self.env["runtime"][
|
||||
"ApplicationManager"
|
||||
].get_current_application()
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("Window Mode off for application {0}").format(
|
||||
curr_app,
|
||||
),
|
||||
interrupt=True,
|
||||
)
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('Window Mode off for application {0}').format(
|
||||
curr_app,), interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("Not in window Mode"), interrupt=True)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("Not in window Mode"), interrupt=True
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,14 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import mark_utils
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -20,16 +19,18 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('copies last presented text to the clipboard')
|
||||
return _("copies last presented text to the clipboard")
|
||||
|
||||
def run(self):
|
||||
last_echo = self.env['runtime']['OutputManager'].get_last_echo()
|
||||
last_echo = self.env["runtime"]["OutputManager"].get_last_echo()
|
||||
if last_echo.rstrip() != "":
|
||||
last_echo = last_echo.rstrip()
|
||||
self.env['runtime']['MemoryManager'].add_value_to_first_index(
|
||||
'clipboardHistory', last_echo)
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
last_echo, sound_icon ='CopyToClipboard', interrupt=True)
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", last_echo
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
last_echo, sound_icon="CopyToClipboard", interrupt=True
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -3,11 +3,10 @@
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import mark_utils
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -18,20 +17,20 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('copies marked text to the currently selected clipboard')
|
||||
return _("copies marked text to the currently selected clipboard")
|
||||
|
||||
def get_text_from_screen(self, start_mark, end_mark):
|
||||
screen_content = self.env['screen']['new_content_text']
|
||||
screen_lines = screen_content.split('\n')
|
||||
screen_content = self.env["screen"]["new_content_text"]
|
||||
screen_lines = screen_content.split("\n")
|
||||
|
||||
start_y = min(start_mark['y'], len(screen_lines) - 1)
|
||||
end_y = min(end_mark['y'], len(screen_lines) - 1)
|
||||
start_y = min(start_mark["y"], len(screen_lines) - 1)
|
||||
end_y = min(end_mark["y"], len(screen_lines) - 1)
|
||||
|
||||
# If marks are on the same line
|
||||
if start_y == end_y:
|
||||
line = screen_lines[start_y]
|
||||
start_x = min(start_mark['x'], len(line))
|
||||
end_x = min(end_mark['x'], len(line)) + 1
|
||||
start_x = min(start_mark["x"], len(line))
|
||||
end_x = min(end_mark["x"], len(line)) + 1
|
||||
return line[start_x:end_x]
|
||||
|
||||
# Handle multi-line selection
|
||||
@ -39,7 +38,7 @@ class command():
|
||||
|
||||
# First line (from start mark to end of line)
|
||||
first_line = screen_lines[start_y]
|
||||
start_x = min(start_mark['x'], len(first_line))
|
||||
start_x = min(start_mark["x"], len(first_line))
|
||||
result.append(first_line[start_x:].rstrip())
|
||||
|
||||
# Middle lines (complete lines)
|
||||
@ -49,32 +48,35 @@ class command():
|
||||
# Last line (from start to end mark)
|
||||
if end_y > start_y:
|
||||
last_line = screen_lines[end_y]
|
||||
end_x = min(end_mark['x'], len(last_line)) + 1
|
||||
end_x = min(end_mark["x"], len(last_line)) + 1
|
||||
result.append(last_line[:end_x].rstrip())
|
||||
|
||||
return '\n'.join(result)
|
||||
return "\n".join(result)
|
||||
|
||||
def run(self):
|
||||
if not self.env['commandBuffer']['Marks']['1']:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("One or two marks are needed"), interrupt=True)
|
||||
if not self.env["commandBuffer"]["Marks"]["1"]:
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("One or two marks are needed"), interrupt=True
|
||||
)
|
||||
return
|
||||
if not self.env['commandBuffer']['Marks']['2']:
|
||||
self.env['runtime']['CursorManager'].set_mark()
|
||||
if not self.env["commandBuffer"]["Marks"]["2"]:
|
||||
self.env["runtime"]["CursorManager"].set_mark()
|
||||
|
||||
# use the last first and the last setted mark as range
|
||||
start_mark = self.env['commandBuffer']['Marks']['1'].copy()
|
||||
end_mark = self.env['commandBuffer']['Marks']['2'].copy()
|
||||
start_mark = self.env["commandBuffer"]["Marks"]["1"].copy()
|
||||
end_mark = self.env["commandBuffer"]["Marks"]["2"].copy()
|
||||
|
||||
# Replace mark_utils.get_text_between_marks with our new method
|
||||
marked = self.get_text_from_screen(start_mark, end_mark)
|
||||
|
||||
self.env['runtime']['MemoryManager'].add_value_to_first_index(
|
||||
'clipboardHistory', marked)
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", marked
|
||||
)
|
||||
# reset marks
|
||||
self.env['runtime']['CursorManager'].clear_marks()
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
marked, sound_icon ='CopyToClipboard', interrupt=True)
|
||||
self.env["runtime"]["CursorManager"].clear_marks()
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
marked, sound_icon="CopyToClipboard", interrupt=True
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,13 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -19,18 +19,22 @@ class command():
|
||||
pass
|
||||
|
||||
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):
|
||||
if self.env['runtime']['MemoryManager'].is_index_list_empty(
|
||||
'clipboardHistory'):
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('clipboard empty'), interrupt=True)
|
||||
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')
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
clipboard, interrupt=True)
|
||||
clipboard = self.env["runtime"][
|
||||
"MemoryManager"
|
||||
].get_index_list_element("clipboardHistory")
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
clipboard, interrupt=True
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,13 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -19,15 +19,17 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('reads the contents of the current screen')
|
||||
return _("reads the contents of the current screen")
|
||||
|
||||
def run(self):
|
||||
if self.env['screen']['new_content_text'].isspace():
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("screen is empty"), sound_icon ='EmptyLine', interrupt=True)
|
||||
if self.env["screen"]["new_content_text"].isspace():
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("screen is empty"), sound_icon="EmptyLine", interrupt=True
|
||||
)
|
||||
else:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
self.env['screen']['new_content_text'], interrupt=True)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
self.env["screen"]["new_content_text"], interrupt=True
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,14 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import mark_utils
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -20,21 +19,26 @@ class command():
|
||||
pass
|
||||
|
||||
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):
|
||||
# Prefer review cursor over text cursor
|
||||
cursor_pos = self.env['runtime']['CursorManager'].get_review_or_text_cursor()
|
||||
cursor_pos = self.env["runtime"][
|
||||
"CursorManager"
|
||||
].get_review_or_text_cursor()
|
||||
|
||||
text_after_cursor = mark_utils.get_text_after_mark(
|
||||
cursor_pos, self.env['screen']['new_content_text'])
|
||||
cursor_pos, self.env["screen"]["new_content_text"]
|
||||
)
|
||||
|
||||
if text_after_cursor.isspace():
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("blank"), sound_icon ='EmptyLine', interrupt=True)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("blank"), sound_icon="EmptyLine", interrupt=True
|
||||
)
|
||||
else:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
text_after_cursor, interrupt=True)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
text_after_cursor, interrupt=True
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,14 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import mark_utils
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -20,24 +19,27 @@ class command():
|
||||
pass
|
||||
|
||||
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):
|
||||
# Prefer review cursor over text cursor
|
||||
if self.env['screen']['newCursorReview']:
|
||||
cursor_pos = self.env['screen']['newCursorReview'].copy()
|
||||
if self.env["screen"]["newCursorReview"]:
|
||||
cursor_pos = self.env["screen"]["newCursorReview"].copy()
|
||||
else:
|
||||
cursor_pos = self.env['screen']['new_cursor'].copy()
|
||||
cursor_pos = self.env["screen"]["new_cursor"].copy()
|
||||
|
||||
text_before_cursor = mark_utils.get_text_before_mark(
|
||||
cursor_pos, self.env['screen']['new_content_text'])
|
||||
cursor_pos, self.env["screen"]["new_content_text"]
|
||||
)
|
||||
|
||||
if text_before_cursor.isspace():
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("blank"), sound_icon ='EmptyLine', interrupt=True)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("blank"), sound_icon="EmptyLine", interrupt=True
|
||||
)
|
||||
else:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
text_before_cursor, interrupt=True)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
text_before_cursor, interrupt=True
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,13 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -19,16 +19,17 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('get current quick menu entry')
|
||||
return _("get current quick menu entry")
|
||||
|
||||
def run(self):
|
||||
menu = ''
|
||||
value = ''
|
||||
menu = self.env['runtime']['QuickMenuManager'].get_current_entry()
|
||||
if menu != '':
|
||||
value = self.env['runtime']['QuickMenuManager'].get_current_value()
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
menu + ' ' + value, interrupt=True)
|
||||
menu = ""
|
||||
value = ""
|
||||
menu = self.env["runtime"]["QuickMenuManager"].get_current_entry()
|
||||
if menu != "":
|
||||
value = self.env["runtime"]["QuickMenuManager"].get_current_value()
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
menu + " " + value, interrupt=True
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,13 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -19,11 +19,13 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('get current quick menu value')
|
||||
return _("get current quick menu value")
|
||||
|
||||
def run(self):
|
||||
value = self.env['runtime']['QuickMenuManager'].get_current_value()
|
||||
self.env['runtime']['OutputManager'].present_text(value, interrupt=True)
|
||||
value = self.env["runtime"]["QuickMenuManager"].get_current_value()
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
value, interrupt=True
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,13 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -19,15 +19,19 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('Column number for cursor')
|
||||
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)
|
||||
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
|
||||
|
@ -2,13 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -19,15 +19,19 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('Line number for cursor')
|
||||
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)
|
||||
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
|
||||
|
@ -2,13 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -19,18 +19,22 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('displays the position of the review cursor')
|
||||
return _("displays the position of the review cursor")
|
||||
|
||||
def run(self):
|
||||
# Prefer review cursor over text cursor
|
||||
cursor_pos = self.env['runtime']['CursorManager'].get_review_or_text_cursor()
|
||||
cursor_pos = self.env["runtime"][
|
||||
"CursorManager"
|
||||
].get_review_or_text_cursor()
|
||||
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
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)
|
||||
cursor_pos["y"] + 1,
|
||||
cursor_pos["x"] + 1,
|
||||
self.env["screen"]["newTTY"],
|
||||
),
|
||||
interrupt=True,
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,14 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import line_utils
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -21,21 +20,29 @@ class command():
|
||||
|
||||
def get_description(self):
|
||||
return _(
|
||||
'read line to cursor pos, use review cursor if you are in review mode, otherwhise use text cursor')
|
||||
"read line to cursor pos, use review cursor if you are in review mode, otherwhise use text cursor"
|
||||
)
|
||||
|
||||
def run(self):
|
||||
cursor_pos = self.env['runtime']['CursorManager'].get_review_or_text_cursor()
|
||||
cursor_pos = self.env["runtime"][
|
||||
"CursorManager"
|
||||
].get_review_or_text_cursor()
|
||||
|
||||
x, y, curr_line = line_utils.get_current_line(
|
||||
cursor_pos['x'], cursor_pos['y'], self.env['screen']['new_content_text'])
|
||||
cursor_pos["x"],
|
||||
cursor_pos["y"],
|
||||
self.env["screen"]["new_content_text"],
|
||||
)
|
||||
|
||||
if curr_line.isspace():
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("blank"), sound_icon ='EmptyLine', interrupt=True)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("blank"), sound_icon="EmptyLine", interrupt=True
|
||||
)
|
||||
else:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
curr_line[:cursor_pos['x']], interrupt=True)
|
||||
self.env['runtime']['OutputManager'].announce_active_cursor()
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
curr_line[: cursor_pos["x"]], interrupt=True
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].announce_active_cursor()
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,14 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import line_utils
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -21,21 +20,29 @@ class command():
|
||||
|
||||
def get_description(self):
|
||||
return _(
|
||||
'read to end of line, use review cursor if you are in review mode, otherwhise use text cursor')
|
||||
"read to end of line, use review cursor if you are in review mode, otherwhise use text cursor"
|
||||
)
|
||||
|
||||
def run(self):
|
||||
cursor_pos = self.env['runtime']['CursorManager'].get_review_or_text_cursor()
|
||||
cursor_pos = self.env["runtime"][
|
||||
"CursorManager"
|
||||
].get_review_or_text_cursor()
|
||||
|
||||
x, y, curr_line = line_utils.get_current_line(
|
||||
cursor_pos['x'], cursor_pos['y'], self.env['screen']['new_content_text'])
|
||||
cursor_pos["x"],
|
||||
cursor_pos["y"],
|
||||
self.env["screen"]["new_content_text"],
|
||||
)
|
||||
|
||||
if curr_line.isspace():
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("blank"), sound_icon ='EmptyLine', interrupt=True)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("blank"), sound_icon="EmptyLine", interrupt=True
|
||||
)
|
||||
else:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
curr_line[cursor_pos['x']:], interrupt=True)
|
||||
self.env['runtime']['OutputManager'].announce_active_cursor()
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
curr_line[cursor_pos["x"] :], interrupt=True
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].announce_active_cursor()
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,15 +2,15 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.core import debug
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core import debug
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
class command():
|
||||
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -21,46 +21,52 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('cycles between available keyboard layouts')
|
||||
return _("cycles between available keyboard layouts")
|
||||
|
||||
def get_available_layouts(self):
|
||||
"""Get list of available keyboard layout files"""
|
||||
layouts = []
|
||||
|
||||
# Check standard locations for keyboard layouts
|
||||
settings_root = '/etc/fenrirscreenreader/'
|
||||
settings_root = "/etc/fenrirscreenreader/"
|
||||
if not os.path.exists(settings_root):
|
||||
# Fallback to source directory
|
||||
import fenrirscreenreader
|
||||
fenrir_path = os.path.dirname(fenrirscreenreader.__file__)
|
||||
settings_root = fenrir_path + '/../../config/'
|
||||
|
||||
keyboard_path = settings_root + 'keyboard/'
|
||||
fenrir_path = os.path.dirname(fenrirscreenreader.__file__)
|
||||
settings_root = fenrir_path + "/../../config/"
|
||||
|
||||
keyboard_path = settings_root + "keyboard/"
|
||||
|
||||
if os.path.exists(keyboard_path):
|
||||
for file in os.listdir(keyboard_path):
|
||||
if file.endswith('.conf') and not file.startswith(
|
||||
'__') and not file.lower().startswith('pty'):
|
||||
layout_name = file.replace('.conf', '')
|
||||
if (
|
||||
file.endswith(".conf")
|
||||
and not file.startswith("__")
|
||||
and not file.lower().startswith("pty")
|
||||
):
|
||||
layout_name = file.replace(".conf", "")
|
||||
if layout_name not in layouts:
|
||||
layouts.append(layout_name)
|
||||
|
||||
# Ensure we have at least basic layouts
|
||||
if not layouts:
|
||||
layouts = ['desktop', 'laptop']
|
||||
layouts = ["desktop", "laptop"]
|
||||
else:
|
||||
layouts.sort()
|
||||
|
||||
return layouts
|
||||
|
||||
def run(self):
|
||||
current_layout = self.env['runtime']['SettingsManager'].get_setting(
|
||||
'keyboard', 'keyboardLayout')
|
||||
current_layout = self.env["runtime"]["SettingsManager"].get_setting(
|
||||
"keyboard", "keyboardLayout"
|
||||
)
|
||||
|
||||
# Extract layout name from full path if needed
|
||||
if '/' in current_layout:
|
||||
current_layout = os.path.basename(
|
||||
current_layout).replace('.conf', '')
|
||||
if "/" in current_layout:
|
||||
current_layout = os.path.basename(current_layout).replace(
|
||||
".conf", ""
|
||||
)
|
||||
|
||||
# Get available layouts
|
||||
available_layouts = self.get_available_layouts()
|
||||
@ -76,24 +82,23 @@ class command():
|
||||
next_layout = available_layouts[next_index]
|
||||
|
||||
# Update setting and reload shortcuts
|
||||
self.env['runtime']['SettingsManager'].set_setting(
|
||||
'keyboard', 'keyboardLayout', next_layout)
|
||||
self.env["runtime"]["SettingsManager"].set_setting(
|
||||
"keyboard", "keyboardLayout", next_layout
|
||||
)
|
||||
|
||||
# Reload shortcuts with new layout
|
||||
try:
|
||||
self.env['runtime']['InputManager'].reload_shortcuts()
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('Switched to {} keyboard layout').format(next_layout),
|
||||
interrupt=True
|
||||
self.env["runtime"]["InputManager"].reload_shortcuts()
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("Switched to {} keyboard layout").format(next_layout),
|
||||
interrupt=True,
|
||||
)
|
||||
except Exception as e:
|
||||
self.env['runtime']['DebugManager'].write_debug_out(
|
||||
"Error reloading shortcuts: " + str(e),
|
||||
debug.DebugLevel.ERROR
|
||||
self.env["runtime"]["DebugManager"].write_debug_out(
|
||||
"Error reloading shortcuts: " + str(e), debug.DebugLevel.ERROR
|
||||
)
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('Error switching keyboard layout'),
|
||||
interrupt=True
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("Error switching keyboard layout"), interrupt=True
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
|
@ -2,14 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import datetime
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
class command():
|
||||
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -20,20 +20,23 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('presents the date')
|
||||
return _("presents the date")
|
||||
|
||||
def run(self):
|
||||
date_format = self.env['runtime']['SettingsManager'].get_setting(
|
||||
'general', 'date_format')
|
||||
date_format = self.env["runtime"]["SettingsManager"].get_setting(
|
||||
"general", "date_format"
|
||||
)
|
||||
|
||||
# get the time formatted
|
||||
date_string = datetime.datetime.strftime(
|
||||
datetime.datetime.now(), date_format)
|
||||
datetime.datetime.now(), date_format
|
||||
)
|
||||
|
||||
# present the time via speak and braile, there is no soundicon,
|
||||
# interrupt the current speech
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
date_string, sound_icon ='', interrupt=True)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
date_string, sound_icon="", interrupt=True
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,13 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
_base_path = os.path.join(os.path.dirname(__file__), 'adjustment_base.py')
|
||||
_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)
|
||||
@ -17,4 +18,4 @@ adjustment_command = _module.adjustment_command
|
||||
|
||||
class command(adjustment_command):
|
||||
def __init__(self):
|
||||
super().__init__('alsa', 'volume', 'dec')
|
||||
super().__init__("alsa", "volume", "dec")
|
||||
|
@ -2,13 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
_base_path = os.path.join(os.path.dirname(__file__), 'adjustment_base.py')
|
||||
_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)
|
||||
@ -17,4 +18,4 @@ adjustment_command = _module.adjustment_command
|
||||
|
||||
class command(adjustment_command):
|
||||
def __init__(self):
|
||||
super().__init__('sound', 'volume', 'dec')
|
||||
super().__init__("sound", "volume", "dec")
|
||||
|
@ -2,13 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
_base_path = os.path.join(os.path.dirname(__file__), 'adjustment_base.py')
|
||||
_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)
|
||||
@ -17,4 +18,4 @@ adjustment_command = _module.adjustment_command
|
||||
|
||||
class command(adjustment_command):
|
||||
def __init__(self):
|
||||
super().__init__('speech', 'pitch', 'dec')
|
||||
super().__init__("speech", "pitch", "dec")
|
||||
|
@ -2,13 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
_base_path = os.path.join(os.path.dirname(__file__), 'adjustment_base.py')
|
||||
_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)
|
||||
@ -17,4 +18,4 @@ adjustment_command = _module.adjustment_command
|
||||
|
||||
class command(adjustment_command):
|
||||
def __init__(self):
|
||||
super().__init__('speech', 'rate', 'dec')
|
||||
super().__init__("speech", "rate", "dec")
|
||||
|
@ -2,13 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
_base_path = os.path.join(os.path.dirname(__file__), 'adjustment_base.py')
|
||||
_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)
|
||||
@ -17,4 +18,4 @@ adjustment_command = _module.adjustment_command
|
||||
|
||||
class command(adjustment_command):
|
||||
def __init__(self):
|
||||
super().__init__('speech', 'volume', 'dec')
|
||||
super().__init__("speech", "volume", "dec")
|
||||
|
@ -2,13 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -19,17 +19,19 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('exits review mode')
|
||||
return _("exits review mode")
|
||||
|
||||
def run(self):
|
||||
if not self.env['runtime']['CursorManager'].is_review_mode():
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("Not in Review Mode"), interrupt=True)
|
||||
if not self.env["runtime"]["CursorManager"].is_review_mode():
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("Not in Review Mode"), interrupt=True
|
||||
)
|
||||
return
|
||||
|
||||
self.env['runtime']['CursorManager'].clear_review_cursor()
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("Exiting Review Mode"), interrupt=True)
|
||||
self.env["runtime"]["CursorManager"].clear_review_cursor()
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("Exiting Review Mode"), interrupt=True
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,57 +2,66 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.core import debug
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core import debug
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
class command():
|
||||
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def initialize(self, environment, script_path=''):
|
||||
def initialize(self, environment, script_path=""):
|
||||
self.env = environment
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('export the current fenrir clipboard to a file')
|
||||
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 = self.env["runtime"][
|
||||
"SettingsManager"
|
||||
].get_setting("general", "clipboardExportPath")
|
||||
clipboard_file_path = clipboard_file_path.replace(
|
||||
'$user', self.env['general']['curr_user'])
|
||||
"$user", self.env["general"]["curr_user"]
|
||||
)
|
||||
clipboard_file_path = clipboard_file_path.replace(
|
||||
'$USER', self.env['general']['curr_user'])
|
||||
"$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')
|
||||
"$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)
|
||||
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 = 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)
|
||||
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)
|
||||
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
|
||||
|
@ -2,21 +2,22 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import _thread
|
||||
import importlib
|
||||
import os
|
||||
|
||||
import pyperclip
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib
|
||||
import _thread
|
||||
import pyperclip
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def initialize(self, environment, script_path=''):
|
||||
def initialize(self, environment, script_path=""):
|
||||
self.env = environment
|
||||
self.script_path = script_path
|
||||
|
||||
@ -24,7 +25,7 @@ class command():
|
||||
pass
|
||||
|
||||
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):
|
||||
_thread.start_new_thread(self._thread_run, ())
|
||||
@ -32,18 +33,21 @@ class command():
|
||||
def _thread_run(self):
|
||||
try:
|
||||
# Check if clipboard is empty
|
||||
if self.env['runtime']['MemoryManager'].is_index_list_empty(
|
||||
'clipboardHistory'):
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('clipboard empty'), interrupt=True)
|
||||
if self.env["runtime"]["MemoryManager"].is_index_list_empty(
|
||||
"clipboardHistory"
|
||||
):
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("clipboard empty"), interrupt=True
|
||||
)
|
||||
return
|
||||
|
||||
# Get current clipboard content
|
||||
clipboard = self.env['runtime']['MemoryManager'].get_index_list_element(
|
||||
'clipboardHistory')
|
||||
clipboard = self.env["runtime"][
|
||||
"MemoryManager"
|
||||
].get_index_list_element("clipboardHistory")
|
||||
|
||||
# Remember original display environment variable if it exists
|
||||
original_display = os.environ.get('DISPLAY', '')
|
||||
original_display = os.environ.get("DISPLAY", "")
|
||||
success = False
|
||||
|
||||
# Try different display options
|
||||
@ -51,7 +55,7 @@ class command():
|
||||
display = f":{i}"
|
||||
try:
|
||||
# Set display environment variable
|
||||
os.environ['DISPLAY'] = display
|
||||
os.environ["DISPLAY"] = display
|
||||
# Attempt to set clipboard content
|
||||
# Weird workaround for some distros
|
||||
importlib.reload(pyperclip)
|
||||
@ -66,21 +70,27 @@ class command():
|
||||
|
||||
# Restore original display setting
|
||||
if original_display:
|
||||
os.environ['DISPLAY'] = original_display
|
||||
os.environ["DISPLAY"] = original_display
|
||||
else:
|
||||
os.environ.pop('DISPLAY', None)
|
||||
os.environ.pop("DISPLAY", None)
|
||||
|
||||
# Notify the user of the result
|
||||
if success:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('exported to the X session.'), interrupt=True)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("exported to the X session."), interrupt=True
|
||||
)
|
||||
else:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('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:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
str(e), sound_icon ='', interrupt=False)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
str(e), sound_icon="", interrupt=False
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,13 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -19,19 +19,25 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('selects the first clipboard')
|
||||
return _("selects the first clipboard")
|
||||
|
||||
def run(self):
|
||||
if self.env['runtime']['MemoryManager'].is_index_list_empty(
|
||||
'clipboardHistory'):
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('clipboard empty'), interrupt=True)
|
||||
if self.env["runtime"]["MemoryManager"].is_index_list_empty(
|
||||
"clipboardHistory"
|
||||
):
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("clipboard empty"), interrupt=True
|
||||
)
|
||||
return
|
||||
self.env['runtime']['MemoryManager'].set_first_index('clipboardHistory')
|
||||
clipboard = self.env['runtime']['MemoryManager'].get_index_list_element(
|
||||
'clipboardHistory')
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
clipboard, interrupt=True)
|
||||
self.env["runtime"]["MemoryManager"].set_first_index(
|
||||
"clipboardHistory"
|
||||
)
|
||||
clipboard = self.env["runtime"][
|
||||
"MemoryManager"
|
||||
].get_index_list_element("clipboardHistory")
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
clipboard, interrupt=True
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,13 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -19,12 +19,13 @@ class command():
|
||||
pass
|
||||
|
||||
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):
|
||||
self.env['input']['keyForeward'] = 3
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('Forward next keypress'), interrupt=True)
|
||||
self.env["input"]["keyForeward"] = 3
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("Forward next keypress"), interrupt=True
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,15 +2,15 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import mark_utils
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
from fenrirscreenreader.utils import mark_utils
|
||||
|
||||
class command():
|
||||
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -21,31 +21,39 @@ class command():
|
||||
pass
|
||||
|
||||
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):
|
||||
clipboard_file_path = self.env['runtime']['SettingsManager'].get_setting(
|
||||
'general', 'clipboardExportPath')
|
||||
clipboard_file_path = self.env["runtime"][
|
||||
"SettingsManager"
|
||||
].get_setting("general", "clipboardExportPath")
|
||||
clipboard_file_path = clipboard_file_path.replace(
|
||||
'$user', self.env['general']['curr_user'])
|
||||
"$user", self.env["general"]["curr_user"]
|
||||
)
|
||||
clipboard_file_path = clipboard_file_path.replace(
|
||||
'$USER', self.env['general']['curr_user'])
|
||||
"$USER", self.env["general"]["curr_user"]
|
||||
)
|
||||
clipboard_file_path = clipboard_file_path.replace(
|
||||
'$User', self.env['general']['curr_user'])
|
||||
"$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)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("File does not exist"), sound_icon="", interrupt=True
|
||||
)
|
||||
return
|
||||
clipboard_file = open(clipboard_file_path, 'r')
|
||||
clipboard_file = open(clipboard_file_path, "r")
|
||||
imported = clipboard_file.read()
|
||||
clipboard_file.close()
|
||||
self.env['runtime']['MemoryManager'].add_value_to_first_index(
|
||||
'clipboardHistory', imported)
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", imported
|
||||
)
|
||||
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
'Import to Clipboard', sound_icon ='CopyToClipboard', interrupt=True)
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
imported, sound_icon ='', interrupt=False)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Import to Clipboard", sound_icon="CopyToClipboard", interrupt=True
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
imported, sound_icon="", interrupt=False
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,21 +2,22 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import _thread
|
||||
import importlib
|
||||
import os
|
||||
|
||||
import pyperclip
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import importlib
|
||||
import _thread
|
||||
import pyperclip
|
||||
import os
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def initialize(self, environment, script_path=''):
|
||||
def initialize(self, environment, script_path=""):
|
||||
self.env = environment
|
||||
self.script_path = script_path
|
||||
|
||||
@ -32,7 +33,7 @@ class command():
|
||||
def _thread_run(self):
|
||||
try:
|
||||
# Remember original display environment variable if it exists
|
||||
original_display = os.environ.get('DISPLAY', '')
|
||||
original_display = os.environ.get("DISPLAY", "")
|
||||
clipboard_content = None
|
||||
|
||||
# Try different display options
|
||||
@ -40,7 +41,7 @@ class command():
|
||||
display = f":{i}"
|
||||
try:
|
||||
# Set display environment variable
|
||||
os.environ['DISPLAY'] = display
|
||||
os.environ["DISPLAY"] = display
|
||||
# Attempt to get clipboard content
|
||||
# Weird workaround for some distros
|
||||
importlib.reload(pyperclip)
|
||||
@ -55,24 +56,32 @@ class command():
|
||||
|
||||
# Restore original display setting
|
||||
if original_display:
|
||||
os.environ['DISPLAY'] = original_display
|
||||
os.environ["DISPLAY"] = original_display
|
||||
else:
|
||||
os.environ.pop('DISPLAY', None)
|
||||
os.environ.pop("DISPLAY", None)
|
||||
|
||||
# Process the clipboard content if we found any
|
||||
if clipboard_content and isinstance(clipboard_content, str):
|
||||
self.env['runtime']['MemoryManager'].add_value_to_first_index(
|
||||
'clipboardHistory', clipboard_content)
|
||||
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)
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", clipboard_content
|
||||
)
|
||||
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:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
'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:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
str(e), sound_icon ='', interrupt=False)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
str(e), sound_icon="", interrupt=False
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,13 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
_base_path = os.path.join(os.path.dirname(__file__), 'adjustment_base.py')
|
||||
_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)
|
||||
@ -17,4 +18,4 @@ adjustment_command = _module.adjustment_command
|
||||
|
||||
class command(adjustment_command):
|
||||
def __init__(self):
|
||||
super().__init__('alsa', 'volume', 'inc')
|
||||
super().__init__("alsa", "volume", "inc")
|
||||
|
@ -2,13 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
_base_path = os.path.join(os.path.dirname(__file__), 'adjustment_base.py')
|
||||
_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)
|
||||
@ -17,4 +18,4 @@ adjustment_command = _module.adjustment_command
|
||||
|
||||
class command(adjustment_command):
|
||||
def __init__(self):
|
||||
super().__init__('sound', 'volume', 'inc')
|
||||
super().__init__("sound", "volume", "inc")
|
||||
|
@ -2,13 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
_base_path = os.path.join(os.path.dirname(__file__), 'adjustment_base.py')
|
||||
_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)
|
||||
@ -17,4 +18,4 @@ adjustment_command = _module.adjustment_command
|
||||
|
||||
class command(adjustment_command):
|
||||
def __init__(self):
|
||||
super().__init__('speech', 'pitch', 'inc')
|
||||
super().__init__("speech", "pitch", "inc")
|
||||
|
@ -2,13 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
_base_path = os.path.join(os.path.dirname(__file__), 'adjustment_base.py')
|
||||
_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)
|
||||
@ -17,4 +18,4 @@ adjustment_command = _module.adjustment_command
|
||||
|
||||
class command(adjustment_command):
|
||||
def __init__(self):
|
||||
super().__init__('speech', 'rate', 'inc')
|
||||
super().__init__("speech", "rate", "inc")
|
||||
|
@ -2,13 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import os
|
||||
import importlib.util
|
||||
_base_path = os.path.join(os.path.dirname(__file__), 'adjustment_base.py')
|
||||
_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)
|
||||
@ -17,4 +18,4 @@ adjustment_command = _module.adjustment_command
|
||||
|
||||
class command(adjustment_command):
|
||||
def __init__(self):
|
||||
super().__init__('speech', 'volume', 'inc')
|
||||
super().__init__("speech", "volume", "inc")
|
||||
|
@ -2,14 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import line_utils
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -20,24 +19,32 @@ class command():
|
||||
pass
|
||||
|
||||
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):
|
||||
# Prefer review cursor over text cursor
|
||||
|
||||
if self.env['screen']['newCursorReview']:
|
||||
cursor_pos = self.env['screen']['newCursorReview'].copy()
|
||||
if self.env["screen"]["newCursorReview"]:
|
||||
cursor_pos = self.env["screen"]["newCursorReview"].copy()
|
||||
else:
|
||||
cursor_pos = self.env['screen']['new_cursor'].copy()
|
||||
cursor_pos = self.env["screen"]["new_cursor"].copy()
|
||||
x, y, curr_line = line_utils.get_current_line(
|
||||
cursor_pos['x'], cursor_pos['y'], self.env['screen']['new_content_text'])
|
||||
cursor_pos["x"],
|
||||
cursor_pos["y"],
|
||||
self.env["screen"]["new_content_text"],
|
||||
)
|
||||
|
||||
if curr_line.isspace():
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("blank"), sound_icon ='EmptyLine', interrupt=True)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("blank"), sound_icon="EmptyLine", interrupt=True
|
||||
)
|
||||
else:
|
||||
self.env['runtime']['OutputManager'].present_text(_("indent {0}").format(
|
||||
len(curr_line) - len(curr_line.lstrip())), interrupt=True)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("indent {0}").format(
|
||||
len(curr_line) - len(curr_line.lstrip())
|
||||
),
|
||||
interrupt=True,
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,13 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -19,19 +19,23 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('selects the last clipboard')
|
||||
return _("selects the last clipboard")
|
||||
|
||||
def run(self):
|
||||
if self.env['runtime']['MemoryManager'].is_index_list_empty(
|
||||
'clipboardHistory'):
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('clipboard empty'), interrupt=True)
|
||||
if self.env["runtime"]["MemoryManager"].is_index_list_empty(
|
||||
"clipboardHistory"
|
||||
):
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("clipboard empty"), interrupt=True
|
||||
)
|
||||
return
|
||||
self.env['runtime']['MemoryManager'].set_last_index('clipboardHistory')
|
||||
clipboard = self.env['runtime']['MemoryManager'].get_index_list_element(
|
||||
'clipboardHistory')
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
clipboard, interrupt=True)
|
||||
self.env["runtime"]["MemoryManager"].set_last_index("clipboardHistory")
|
||||
clipboard = self.env["runtime"][
|
||||
"MemoryManager"
|
||||
].get_index_list_element("clipboardHistory")
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
clipboard, interrupt=True
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,14 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import mark_utils
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -21,28 +20,35 @@ class command():
|
||||
|
||||
def get_description(self):
|
||||
return _(
|
||||
'Presents the currently selected text that will be copied to the clipboard')
|
||||
"Presents the currently selected text that will be copied to the clipboard"
|
||||
)
|
||||
|
||||
def run(self):
|
||||
if not (self.env['commandBuffer']['Marks']['1'] and
|
||||
self.env['commandBuffer']['Marks']['2']):
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("please set begin and endmark"), interrupt=True)
|
||||
if not (
|
||||
self.env["commandBuffer"]["Marks"]["1"]
|
||||
and self.env["commandBuffer"]["Marks"]["2"]
|
||||
):
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("please set begin and endmark"), interrupt=True
|
||||
)
|
||||
return
|
||||
|
||||
# use the last first and the last setted mark as range
|
||||
start_mark = self.env['commandBuffer']['Marks']['1'].copy()
|
||||
end_mark = self.env['commandBuffer']['Marks']['2'].copy()
|
||||
start_mark = self.env["commandBuffer"]["Marks"]["1"].copy()
|
||||
end_mark = self.env["commandBuffer"]["Marks"]["2"].copy()
|
||||
|
||||
marked = mark_utils.get_text_between_marks(
|
||||
start_mark, end_mark, self.env['screen']['new_content_text'])
|
||||
start_mark, end_mark, self.env["screen"]["new_content_text"]
|
||||
)
|
||||
|
||||
if marked.isspace():
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("blank"), sound_icon ='EmptyLine', interrupt=True)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("blank"), sound_icon="EmptyLine", interrupt=True
|
||||
)
|
||||
else:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
marked, interrupt=True)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
marked, interrupt=True
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,13 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -19,31 +19,39 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('selects the next clipboard')
|
||||
return _("selects the next clipboard")
|
||||
|
||||
def run(self):
|
||||
if self.env['runtime']['MemoryManager'].is_index_list_empty(
|
||||
'clipboardHistory'):
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('clipboard empty'), interrupt=True)
|
||||
if self.env["runtime"]["MemoryManager"].is_index_list_empty(
|
||||
"clipboardHistory"
|
||||
):
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("clipboard empty"), interrupt=True
|
||||
)
|
||||
return
|
||||
self.env['runtime']['MemoryManager'].get_next_index('clipboardHistory')
|
||||
is_first = self.env['runtime']['MemoryManager'].is_first_index(
|
||||
'clipboardHistory')
|
||||
is_last = self.env['runtime']['MemoryManager'].is_last_index(
|
||||
'clipboardHistory')
|
||||
clipboard = self.env['runtime']['MemoryManager'].get_index_list_element(
|
||||
'clipboardHistory')
|
||||
self.env["runtime"]["MemoryManager"].get_next_index("clipboardHistory")
|
||||
is_first = self.env["runtime"]["MemoryManager"].is_first_index(
|
||||
"clipboardHistory"
|
||||
)
|
||||
is_last = self.env["runtime"]["MemoryManager"].is_last_index(
|
||||
"clipboardHistory"
|
||||
)
|
||||
clipboard = self.env["runtime"][
|
||||
"MemoryManager"
|
||||
].get_index_list_element("clipboardHistory")
|
||||
if is_first:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('First clipboard '), interrupt=True)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("First clipboard "), interrupt=True
|
||||
)
|
||||
if is_last:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('Last clipboard '), interrupt=True)
|
||||
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)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
clipboard, interrupt=speech_interrupt
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,13 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -19,20 +19,24 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('get next quick menu entry')
|
||||
return _("get next quick menu entry")
|
||||
|
||||
def run(self):
|
||||
menu = ''
|
||||
value = ''
|
||||
if self.env['runtime']['QuickMenuManager'].next_entry():
|
||||
menu = self.env['runtime']['QuickMenuManager'].get_current_entry()
|
||||
if menu != '':
|
||||
value = self.env['runtime']['QuickMenuManager'].get_current_value()
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
menu + ' ' + value, interrupt=True)
|
||||
menu = ""
|
||||
value = ""
|
||||
if self.env["runtime"]["QuickMenuManager"].next_entry():
|
||||
menu = self.env["runtime"]["QuickMenuManager"].get_current_entry()
|
||||
if menu != "":
|
||||
value = self.env["runtime"][
|
||||
"QuickMenuManager"
|
||||
].get_current_value()
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
menu + " " + value, interrupt=True
|
||||
)
|
||||
else:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('Quick menu not available'), interrupt=True)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("Quick menu not available"), interrupt=True
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,13 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -19,13 +19,14 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('get next quick menu value')
|
||||
return _("get next quick menu value")
|
||||
|
||||
def run(self):
|
||||
if self.env['runtime']['QuickMenuManager'].next_value():
|
||||
value = self.env['runtime']['QuickMenuManager'].get_current_value()
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
value, interrupt=True)
|
||||
if self.env["runtime"]["QuickMenuManager"].next_value():
|
||||
value = self.env["runtime"]["QuickMenuManager"].get_current_value()
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
value, interrupt=True
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,40 +2,49 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import time
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
class command():
|
||||
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.env['runtime']['MemoryManager'].add_index_list(
|
||||
'clipboardHistory', self.env['runtime']['SettingsManager'].get_setting_as_int(
|
||||
'general', 'numberOfClipboards'))
|
||||
self.env["runtime"]["MemoryManager"].add_index_list(
|
||||
"clipboardHistory",
|
||||
self.env["runtime"]["SettingsManager"].get_setting_as_int(
|
||||
"general", "numberOfClipboards"
|
||||
),
|
||||
)
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
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):
|
||||
if self.env['runtime']['MemoryManager'].is_index_list_empty(
|
||||
'clipboardHistory'):
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('clipboard empty'), interrupt=True)
|
||||
if self.env["runtime"]["MemoryManager"].is_index_list_empty(
|
||||
"clipboardHistory"
|
||||
):
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("clipboard empty"), interrupt=True
|
||||
)
|
||||
return
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
'paste clipboard', sound_icon ='PasteClipboardOnScreen', interrupt=True)
|
||||
clipboard = self.env['runtime']['MemoryManager'].get_index_list_element(
|
||||
'clipboardHistory')
|
||||
self.env['runtime']['ScreenManager'].inject_text_to_screen(clipboard)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"paste clipboard",
|
||||
sound_icon="PasteClipboardOnScreen",
|
||||
interrupt=True,
|
||||
)
|
||||
clipboard = self.env["runtime"][
|
||||
"MemoryManager"
|
||||
].get_index_list_element("clipboardHistory")
|
||||
self.env["runtime"]["ScreenManager"].inject_text_to_screen(clipboard)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,14 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import line_utils
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -20,18 +19,21 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('present first line')
|
||||
return _("present first line")
|
||||
|
||||
def run(self):
|
||||
x, y, first_line = line_utils.get_current_line(
|
||||
0, 0, self.env['screen']['new_content_text'])
|
||||
0, 0, self.env["screen"]["new_content_text"]
|
||||
)
|
||||
|
||||
if first_line.isspace():
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("blank"), sound_icon ='EmptyLine', interrupt=True)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("blank"), sound_icon="EmptyLine", interrupt=True
|
||||
)
|
||||
else:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
first_line, interrupt=True)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
first_line, interrupt=True
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,14 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import line_utils
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -20,18 +19,23 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('current line')
|
||||
return _("current line")
|
||||
|
||||
def run(self):
|
||||
x, y, last_line = line_utils.get_current_line(
|
||||
0, self.env['screen']['lines'] - 1, self.env['screen']['new_content_text'])
|
||||
0,
|
||||
self.env["screen"]["lines"] - 1,
|
||||
self.env["screen"]["new_content_text"],
|
||||
)
|
||||
|
||||
if last_line.isspace():
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("blank"), sound_icon ='EmptyLine', interrupt=True)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("blank"), sound_icon="EmptyLine", interrupt=True
|
||||
)
|
||||
else:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
last_line, interrupt=True)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
last_line, interrupt=True
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,13 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -19,30 +19,38 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('selects the previous clipboard')
|
||||
return _("selects the previous clipboard")
|
||||
|
||||
def run(self):
|
||||
if self.env['runtime']['MemoryManager'].is_index_list_empty(
|
||||
'clipboardHistory'):
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('clipboard empty'), interrupt=True)
|
||||
if self.env["runtime"]["MemoryManager"].is_index_list_empty(
|
||||
"clipboardHistory"
|
||||
):
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("clipboard empty"), interrupt=True
|
||||
)
|
||||
return
|
||||
self.env['runtime']['MemoryManager'].set_pref_index('clipboardHistory')
|
||||
is_first = self.env['runtime']['MemoryManager'].is_first_index(
|
||||
'clipboardHistory')
|
||||
is_last = self.env['runtime']['MemoryManager'].is_last_index(
|
||||
'clipboardHistory')
|
||||
clipboard = self.env['runtime']['MemoryManager'].get_index_list_element(
|
||||
'clipboardHistory')
|
||||
self.env["runtime"]["MemoryManager"].set_pref_index("clipboardHistory")
|
||||
is_first = self.env["runtime"]["MemoryManager"].is_first_index(
|
||||
"clipboardHistory"
|
||||
)
|
||||
is_last = self.env["runtime"]["MemoryManager"].is_last_index(
|
||||
"clipboardHistory"
|
||||
)
|
||||
clipboard = self.env["runtime"][
|
||||
"MemoryManager"
|
||||
].get_index_list_element("clipboardHistory")
|
||||
if is_first:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('First clipboard '), interrupt=True)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("First clipboard "), interrupt=True
|
||||
)
|
||||
if is_last:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('Last clipboard '), interrupt=True)
|
||||
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)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
clipboard, interrupt=speech_interrupt
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,13 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -19,20 +19,24 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('get previous quick menu entry')
|
||||
return _("get previous quick menu entry")
|
||||
|
||||
def run(self):
|
||||
menu = ''
|
||||
value = ''
|
||||
if self.env['runtime']['QuickMenuManager'].prev_entry():
|
||||
menu = self.env['runtime']['QuickMenuManager'].get_current_entry()
|
||||
if menu != '':
|
||||
value = self.env['runtime']['QuickMenuManager'].get_current_value()
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
menu + ' ' + value, interrupt=True)
|
||||
menu = ""
|
||||
value = ""
|
||||
if self.env["runtime"]["QuickMenuManager"].prev_entry():
|
||||
menu = self.env["runtime"]["QuickMenuManager"].get_current_entry()
|
||||
if menu != "":
|
||||
value = self.env["runtime"][
|
||||
"QuickMenuManager"
|
||||
].get_current_value()
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
menu + " " + value, interrupt=True
|
||||
)
|
||||
else:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('Quick menu not available'), interrupt=True)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("Quick menu not available"), interrupt=True
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,13 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -19,13 +19,14 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('get previous quick menu value')
|
||||
return _("get previous quick menu value")
|
||||
|
||||
def run(self):
|
||||
if self.env['runtime']['QuickMenuManager'].prev_value():
|
||||
value = self.env['runtime']['QuickMenuManager'].get_current_value()
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
value, interrupt=True)
|
||||
if self.env["runtime"]["QuickMenuManager"].prev_value():
|
||||
value = self.env["runtime"]["QuickMenuManager"].get_current_value()
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
value, interrupt=True
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,69 +2,72 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import re
|
||||
import threading
|
||||
import time
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
import re
|
||||
import time
|
||||
import threading
|
||||
|
||||
|
||||
class command():
|
||||
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']:
|
||||
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')
|
||||
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
|
||||
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')
|
||||
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 "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']:
|
||||
if self.env["commandBuffer"]["progressMonitoring"]:
|
||||
self.stop_progress_monitoring()
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("Progress monitoring disabled"), interrupt=True)
|
||||
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)
|
||||
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
|
||||
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
|
||||
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']:
|
||||
if not self.env["commandBuffer"]["progressMonitoring"]:
|
||||
return
|
||||
|
||||
# Skip progress detection if current screen looks like a prompt
|
||||
@ -74,31 +77,36 @@ class command():
|
||||
current_time = time.time()
|
||||
|
||||
# Pattern 1: Percentage (50%, 25.5%, etc.)
|
||||
percent_match = re.search(r'(\d+(?:\.\d+)?)\s*%', text)
|
||||
percent_match = re.search(r"(\d+(?:\.\d+)?)\s*%", text)
|
||||
if percent_match:
|
||||
percentage = float(percent_match.group(1))
|
||||
if percentage != self.env['commandBuffer']['lastProgressValue']:
|
||||
if percentage != self.env["commandBuffer"]["lastProgressValue"]:
|
||||
self.play_progress_tone(percentage)
|
||||
self.env['commandBuffer']['lastProgressValue'] = percentage
|
||||
self.env['commandBuffer']['lastProgressTime'] = current_time
|
||||
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)
|
||||
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']:
|
||||
if (
|
||||
percentage
|
||||
!= self.env["commandBuffer"]["lastProgressValue"]
|
||||
):
|
||||
self.play_progress_tone(percentage)
|
||||
self.env['commandBuffer']['lastProgressValue'] = percentage
|
||||
self.env['commandBuffer']['lastProgressTime'] = current_time
|
||||
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)
|
||||
bar_match = re.search(r"\[([#=\-\*]+)([\s\.]*)\]", text)
|
||||
if bar_match:
|
||||
filled = len(bar_match.group(1))
|
||||
unfilled = len(bar_match.group(2))
|
||||
@ -106,39 +114,49 @@ class command():
|
||||
# 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))):
|
||||
not bar_match.group(2)
|
||||
or re.match(r"^[\s\.]*$", bar_match.group(2))
|
||||
):
|
||||
percentage = (filled / total) * 100
|
||||
if percentage != self.env['commandBuffer']['lastProgressValue']:
|
||||
if (
|
||||
percentage
|
||||
!= self.env["commandBuffer"]["lastProgressValue"]
|
||||
):
|
||||
self.play_progress_tone(percentage)
|
||||
self.env['commandBuffer']['lastProgressValue'] = percentage
|
||||
self.env['commandBuffer']['lastProgressTime'] = current_time
|
||||
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,}',
|
||||
r"(loading|processing|working|installing|downloading|compiling|building).*\.{2,}",
|
||||
text,
|
||||
re.IGNORECASE)
|
||||
re.IGNORECASE,
|
||||
)
|
||||
if activity_pattern:
|
||||
# Play a steady beep every 2 seconds for ongoing activity
|
||||
if current_time - \
|
||||
self.env['commandBuffer']['lastProgressTime'] >= 2.0:
|
||||
if (
|
||||
current_time - self.env["commandBuffer"]["lastProgressTime"]
|
||||
>= 2.0
|
||||
):
|
||||
self.play_activity_beep()
|
||||
self.env['commandBuffer']['lastProgressTime'] = current_time
|
||||
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)
|
||||
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)
|
||||
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)"""
|
||||
@ -146,10 +164,10 @@ class command():
|
||||
|
||||
try:
|
||||
# Get the current screen content
|
||||
if not self.env['screen']['new_content_text']:
|
||||
if not self.env["screen"]["new_content_text"]:
|
||||
return False
|
||||
|
||||
lines = self.env['screen']['new_content_text'].split('\n')
|
||||
lines = self.env["screen"]["new_content_text"].split("\n")
|
||||
if not lines:
|
||||
return False
|
||||
|
||||
@ -162,34 +180,34 @@ class command():
|
||||
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):
|
||||
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']])
|
||||
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
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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?
|
||||
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:
|
||||
@ -200,22 +218,21 @@ class command():
|
||||
# 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))
|
||||
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('\\')
|
||||
line.rfind("$"),
|
||||
line.rfind("#"),
|
||||
line.rfind(">"),
|
||||
line.rfind("\\"),
|
||||
)
|
||||
if prompt_end >= 0 and prompt_end < len(
|
||||
line) - 5: # More than just whitespace after prompt
|
||||
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:
|
||||
|
@ -2,13 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -19,10 +19,10 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('exits Fenrir')
|
||||
return _("exits Fenrir")
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['EventManager'].stop_main_event_loop()
|
||||
self.env["runtime"]["EventManager"].stop_main_event_loop()
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,13 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -19,12 +19,13 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('Removes marks from selected text')
|
||||
return _("Removes marks from selected text")
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['CursorManager'].clear_marks()
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('Remove marks'), interrupt=True)
|
||||
self.env["runtime"]["CursorManager"].clear_marks()
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("Remove marks"), interrupt=True
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,23 +2,25 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
import string
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import word_utils
|
||||
import string
|
||||
|
||||
initialized = False
|
||||
try:
|
||||
import enchant
|
||||
|
||||
initialized = True
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
self.language = ''
|
||||
self.language = ""
|
||||
self.spellChecker = None
|
||||
|
||||
def initialize(self, environment):
|
||||
@ -29,46 +31,67 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('removes the current word from the exceptions dictionary')
|
||||
return _("removes the current word from the exceptions dictionary")
|
||||
|
||||
def update_spell_language(self):
|
||||
self.spellChecker = enchant.Dict(
|
||||
self.env['runtime']['SettingsManager'].get_setting(
|
||||
'general', 'spellCheckLanguage'))
|
||||
self.language = self.env['runtime']['SettingsManager'].get_setting(
|
||||
'general', 'spellCheckLanguage')
|
||||
self.env["runtime"]["SettingsManager"].get_setting(
|
||||
"general", "spellCheckLanguage"
|
||||
)
|
||||
)
|
||||
self.language = self.env["runtime"]["SettingsManager"].get_setting(
|
||||
"general", "spellCheckLanguage"
|
||||
)
|
||||
|
||||
def run(self):
|
||||
if not initialized:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('pyenchant is not installed'), interrupt=True)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("pyenchant is not installed"), interrupt=True
|
||||
)
|
||||
return
|
||||
if self.env['runtime']['SettingsManager'].get_setting(
|
||||
'general', 'spellCheckLanguage') != self.language:
|
||||
if (
|
||||
self.env["runtime"]["SettingsManager"].get_setting(
|
||||
"general", "spellCheckLanguage"
|
||||
)
|
||||
!= self.language
|
||||
):
|
||||
try:
|
||||
self.update_spell_language()
|
||||
except Exception as e:
|
||||
return
|
||||
|
||||
cursor_pos = self.env['runtime']['CursorManager'].get_review_or_text_cursor()
|
||||
cursor_pos = self.env["runtime"][
|
||||
"CursorManager"
|
||||
].get_review_or_text_cursor()
|
||||
|
||||
# get the word
|
||||
new_content = self.env['screen']['new_content_text'].split('\n')[
|
||||
cursor_pos['y']]
|
||||
x, y, curr_word, end_of_screen, line_break = word_utils.get_current_word(
|
||||
cursor_pos['x'], 0, new_content)
|
||||
new_content = self.env["screen"]["new_content_text"].split("\n")[
|
||||
cursor_pos["y"]
|
||||
]
|
||||
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'!"#$%&()*+,-./:;<=Â?@[\\]^_{|}~')
|
||||
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)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("{0} is not in the dictionary").format(
|
||||
curr_word,
|
||||
),
|
||||
sound_icon="Cancel",
|
||||
interrupt=True,
|
||||
)
|
||||
else:
|
||||
self.spellChecker.remove(curr_word)
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('{0} removed').format(curr_word,), sound_icon ='Accept', interrupt=True)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("{0} removed").format(
|
||||
curr_word,
|
||||
),
|
||||
sound_icon="Accept",
|
||||
interrupt=True,
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,13 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -19,13 +19,16 @@ class command():
|
||||
pass
|
||||
|
||||
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):
|
||||
self.env['screen']['newCursorReview'] = {
|
||||
'x': 0, 'y': self.env['screen']['lines'] - 1}
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("Bottom"), interrupt=True, flush=False)
|
||||
self.env["screen"]["newCursorReview"] = {
|
||||
"x": 0,
|
||||
"y": self.env["screen"]["lines"] - 1,
|
||||
}
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("Bottom"), interrupt=True, flush=False
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,14 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import char_utils
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -20,30 +19,58 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('presents the current character.')
|
||||
return _("presents the current character.")
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['CursorManager'].enter_review_mode_curr_text_cursor()
|
||||
self.env["runtime"][
|
||||
"CursorManager"
|
||||
].enter_review_mode_curr_text_cursor()
|
||||
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], curr_char = char_utils.get_current_char(
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['new_content_text'])
|
||||
# In table mode, sync to cell start if cursor is outside current cell
|
||||
if self.env["runtime"]["TableManager"].is_table_mode():
|
||||
table_info = self.env["runtime"]["TableManager"].get_current_table_cell_info()
|
||||
if table_info:
|
||||
cursor_pos = self.env["screen"]["newCursorReview"]
|
||||
line_text = self.env["runtime"]["ScreenManager"].get_line_text(cursor_pos["y"])
|
||||
if line_text:
|
||||
column_start = self.env["runtime"]["TableManager"].get_column_start_position(line_text, table_info["column_index"])
|
||||
cell_content = table_info["cell_content"]
|
||||
cell_end = column_start + len(cell_content)
|
||||
|
||||
# If cursor is outside the current cell, move to cell start
|
||||
if cursor_pos["x"] < column_start or cursor_pos["x"] >= cell_end:
|
||||
self.env["screen"]["newCursorReview"]["x"] = column_start
|
||||
|
||||
(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
curr_char,
|
||||
) = char_utils.get_current_char(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
self.env["screen"]["new_content_text"],
|
||||
)
|
||||
|
||||
char_utils.present_char_for_review(
|
||||
self.env,
|
||||
curr_char,
|
||||
interrupt=True,
|
||||
announce_capital=True,
|
||||
flush=False)
|
||||
flush=False,
|
||||
)
|
||||
# is has attribute it enabled?
|
||||
if self.env['runtime']['SettingsManager'].get_setting_as_bool(
|
||||
'general', 'hasattributes'):
|
||||
cursor_pos = self.env['screen']['newCursorReview']
|
||||
if self.env["runtime"]["SettingsManager"].get_setting_as_bool(
|
||||
"general", "hasattributes"
|
||||
):
|
||||
cursor_pos = self.env["screen"]["newCursorReview"]
|
||||
|
||||
if not self.env['runtime']['AttributeManager'].has_attributes(
|
||||
cursor_pos):
|
||||
if not self.env["runtime"]["AttributeManager"].has_attributes(
|
||||
cursor_pos
|
||||
):
|
||||
return
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
'has attribute', sound_icon ='HasAttributes', interrupt=False)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"has attribute", sound_icon="HasAttributes", interrupt=False
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,14 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import char_utils
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -20,21 +19,32 @@ class command():
|
||||
pass
|
||||
|
||||
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):
|
||||
self.env['runtime']['CursorManager'].enter_review_mode_curr_text_cursor()
|
||||
self.env["runtime"][
|
||||
"CursorManager"
|
||||
].enter_review_mode_curr_text_cursor()
|
||||
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], curr_char = char_utils.get_current_char(
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['new_content_text'])
|
||||
(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
curr_char,
|
||||
) = char_utils.get_current_char(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
self.env["screen"]["new_content_text"],
|
||||
)
|
||||
|
||||
if curr_char.isspace():
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("blank"), interrupt=True, flush=False)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("blank"), interrupt=True, flush=False
|
||||
)
|
||||
else:
|
||||
curr_char = char_utils.get_phonetic(curr_char)
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
curr_char, interrupt=True, announce_capital=True, flush=False)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
curr_char, interrupt=True, announce_capital=True, flush=False
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,14 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import line_utils
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -20,20 +19,31 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('current line')
|
||||
return _("current line")
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['CursorManager'].enter_review_mode_curr_text_cursor()
|
||||
self.env["runtime"][
|
||||
"CursorManager"
|
||||
].enter_review_mode_curr_text_cursor()
|
||||
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], curr_line = line_utils.get_current_line(
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['new_content_text'])
|
||||
(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
curr_line,
|
||||
) = line_utils.get_current_line(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
self.env["screen"]["new_content_text"],
|
||||
)
|
||||
|
||||
if curr_line.isspace():
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("blank"), sound_icon ='EmptyLine', interrupt=True, flush=False)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("blank"), sound_icon="EmptyLine", interrupt=True, flush=False
|
||||
)
|
||||
else:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
curr_line, interrupt=True, flush=False)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
curr_line, interrupt=True, flush=False
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,14 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import word_utils
|
||||
from fenrirscreenreader.core import debug
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -20,30 +20,77 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('current word.')
|
||||
return _("current word.")
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['CursorManager'].enter_review_mode_curr_text_cursor()
|
||||
self.env["runtime"][
|
||||
"CursorManager"
|
||||
].enter_review_mode_curr_text_cursor()
|
||||
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], curr_word, end_of_screen, line_break = word_utils.get_current_word(
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['new_content_text'])
|
||||
(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
curr_word,
|
||||
end_of_screen,
|
||||
line_break,
|
||||
) = word_utils.get_current_word(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
self.env["screen"]["new_content_text"],
|
||||
)
|
||||
|
||||
if curr_word.isspace():
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("blank"), interrupt=True, flush=False)
|
||||
# Check if we're in table mode and provide table-aware output
|
||||
is_table_mode = self.env["runtime"]["TableManager"].is_table_mode()
|
||||
self.env["runtime"]["DebugManager"].write_debug_out(
|
||||
f"review_curr_word: is_table_mode={is_table_mode}",
|
||||
debug.DebugLevel.INFO
|
||||
)
|
||||
if is_table_mode:
|
||||
# Get current cell info using internal column tracking
|
||||
table_info = self.env["runtime"]["TableManager"].get_current_table_cell_info()
|
||||
if table_info:
|
||||
# Announce with table context - cell content first, then header
|
||||
output_text = f"{table_info['cell_content']} {table_info['column_header']}"
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
output_text, interrupt=True, flush=False
|
||||
)
|
||||
return # Exit early for table mode
|
||||
else:
|
||||
# Fallback to regular word announcement
|
||||
if curr_word.isspace():
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("blank"), interrupt=True, flush=False
|
||||
)
|
||||
else:
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
curr_word, interrupt=True, flush=False
|
||||
)
|
||||
else:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
curr_word, interrupt=True, flush=False)
|
||||
# Regular word announcement
|
||||
if curr_word.isspace():
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("blank"), interrupt=True, flush=False
|
||||
)
|
||||
else:
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
curr_word, interrupt=True, flush=False
|
||||
)
|
||||
if end_of_screen:
|
||||
if self.env['runtime']['SettingsManager'].get_setting_as_bool(
|
||||
'review', 'end_of_screen'):
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('end of screen'), interrupt=True, sound_icon ='EndOfScreen')
|
||||
if self.env["runtime"]["SettingsManager"].get_setting_as_bool(
|
||||
"review", "end_of_screen"
|
||||
):
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("end of screen"),
|
||||
interrupt=True,
|
||||
sound_icon="EndOfScreen",
|
||||
)
|
||||
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')
|
||||
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
|
||||
|
@ -2,15 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import word_utils
|
||||
from fenrirscreenreader.utils import char_utils
|
||||
from fenrirscreenreader.utils import word_utils
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -21,33 +20,55 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('Phonetically spells the current word')
|
||||
return _("Phonetically spells the current word")
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['CursorManager'].enter_review_mode_curr_text_cursor()
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], curr_word, end_of_screen, line_break = word_utils.get_current_word(
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['new_content_text'])
|
||||
self.env["runtime"][
|
||||
"CursorManager"
|
||||
].enter_review_mode_curr_text_cursor()
|
||||
(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
curr_word,
|
||||
end_of_screen,
|
||||
line_break,
|
||||
) = word_utils.get_current_word(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
self.env["screen"]["new_content_text"],
|
||||
)
|
||||
|
||||
if curr_word.isspace():
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("blank"), interrupt=True, flush=False)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("blank"), interrupt=True, flush=False
|
||||
)
|
||||
else:
|
||||
first_sequence = True
|
||||
for c in curr_word:
|
||||
curr_char = char_utils.get_phonetic(c)
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
curr_char, interrupt=first_sequence, announce_capital=True, flush=False)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
curr_char,
|
||||
interrupt=first_sequence,
|
||||
announce_capital=True,
|
||||
flush=False,
|
||||
)
|
||||
first_sequence = False
|
||||
if end_of_screen:
|
||||
if self.env['runtime']['SettingsManager'].get_setting_as_bool(
|
||||
'review', 'end_of_screen'):
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('end of screen'), interrupt=True, sound_icon ='EndOfScreen')
|
||||
if self.env["runtime"]["SettingsManager"].get_setting_as_bool(
|
||||
"review", "end_of_screen"
|
||||
):
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("end of screen"),
|
||||
interrupt=True,
|
||||
sound_icon="EndOfScreen",
|
||||
)
|
||||
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')
|
||||
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
|
||||
|
@ -2,14 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import char_utils
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -20,23 +19,38 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('Move review to the character below the current position')
|
||||
return _("Move review to the character below the current position")
|
||||
|
||||
def run(self):
|
||||
cursor_pos = self.env['runtime']['CursorManager'].get_review_or_text_cursor()
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], downChar, end_of_screen = char_utils.get_down_char(
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['new_content_text'])
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
cursor_pos = self.env["runtime"][
|
||||
"CursorManager"
|
||||
].get_review_or_text_cursor()
|
||||
(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
downChar,
|
||||
end_of_screen,
|
||||
) = char_utils.get_down_char(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
self.env["screen"]["new_content_text"],
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
downChar,
|
||||
interrupt=True,
|
||||
ignore_punctuation=True,
|
||||
announce_capital=True,
|
||||
flush=False)
|
||||
flush=False,
|
||||
)
|
||||
if end_of_screen:
|
||||
if self.env['runtime']['SettingsManager'].get_setting_as_bool(
|
||||
'review', 'end_of_screen'):
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('end of screen'), interrupt=True, sound_icon ='EndOfScreen')
|
||||
if self.env["runtime"]["SettingsManager"].get_setting_as_bool(
|
||||
"review", "end_of_screen"
|
||||
):
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("end of screen"),
|
||||
interrupt=True,
|
||||
sound_icon="EndOfScreen",
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,14 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import char_utils
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -20,27 +19,42 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('set review cursor to begin of current line and display the content')
|
||||
return _(
|
||||
"set review cursor to begin of current line and display the content"
|
||||
)
|
||||
|
||||
def run(self):
|
||||
cursor_pos = self.env['runtime']['CursorManager'].get_review_or_text_cursor()
|
||||
self.env['runtime']['CursorManager'].set_review_cursor_position(
|
||||
0, cursor_pos['y'])
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], curr_char = char_utils.get_current_char(
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['new_content_text'])
|
||||
cursor_pos = self.env["runtime"][
|
||||
"CursorManager"
|
||||
].get_review_or_text_cursor()
|
||||
self.env["runtime"]["CursorManager"].set_review_cursor_position(
|
||||
0, cursor_pos["y"]
|
||||
)
|
||||
(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
curr_char,
|
||||
) = char_utils.get_current_char(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
self.env["screen"]["new_content_text"],
|
||||
)
|
||||
|
||||
if curr_char.isspace():
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("blank"), interrupt=True, flush=False)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("blank"), interrupt=True, flush=False
|
||||
)
|
||||
else:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
curr_char,
|
||||
interrupt=True,
|
||||
ignore_punctuation=True,
|
||||
announce_capital=True,
|
||||
flush=False)
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("beginning of line"), interrupt=False)
|
||||
flush=False,
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("beginning of line"), interrupt=False
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,14 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import char_utils
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -20,23 +19,37 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('Move Review to the end of current line and display the content')
|
||||
return _(
|
||||
"Move Review to the end of current line and display the content"
|
||||
)
|
||||
|
||||
def run(self):
|
||||
cursor_pos = self.env['runtime']['CursorManager'].get_review_or_text_cursor()
|
||||
self.env['runtime']['CursorManager'].set_review_cursor_position(
|
||||
self.env['screen']['columns'] - 1, cursor_pos['y'])
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], curr_char = char_utils.get_current_char(
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['new_content_text'])
|
||||
cursor_pos = self.env["runtime"][
|
||||
"CursorManager"
|
||||
].get_review_or_text_cursor()
|
||||
self.env["runtime"]["CursorManager"].set_review_cursor_position(
|
||||
self.env["screen"]["columns"] - 1, cursor_pos["y"]
|
||||
)
|
||||
(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
curr_char,
|
||||
) = char_utils.get_current_char(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
self.env["screen"]["new_content_text"],
|
||||
)
|
||||
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
curr_char,
|
||||
interrupt=True,
|
||||
ignore_punctuation=True,
|
||||
announce_capital=True,
|
||||
flush=False)
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("end of line"), interrupt=False)
|
||||
flush=False,
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("end of line"), interrupt=False
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,15 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import line_utils
|
||||
from fenrirscreenreader.utils import char_utils
|
||||
from fenrirscreenreader.utils import line_utils
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -21,29 +20,48 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('Move Review to the first character on the line')
|
||||
return _("Move Review to the first character on the line")
|
||||
|
||||
def run(self):
|
||||
cursor_pos = self.env['runtime']['CursorManager'].get_review_or_text_cursor()
|
||||
cursor_pos = self.env["runtime"][
|
||||
"CursorManager"
|
||||
].get_review_or_text_cursor()
|
||||
x, y, curr_line = line_utils.get_current_line(
|
||||
cursor_pos['x'], cursor_pos['y'], self.env['screen']['new_content_text'])
|
||||
cursor_pos["x"],
|
||||
cursor_pos["y"],
|
||||
self.env["screen"]["new_content_text"],
|
||||
)
|
||||
if curr_line.isspace():
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("line is empty"), interrupt=True)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("line is empty"), interrupt=True
|
||||
)
|
||||
return
|
||||
self.env['runtime']['CursorManager'].set_review_cursor_position(
|
||||
(len(curr_line) - len(curr_line.lstrip())), cursor_pos['y'])
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], curr_char = char_utils.get_current_char(
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['new_content_text'])
|
||||
self.env["runtime"]["CursorManager"].set_review_cursor_position(
|
||||
(len(curr_line) - len(curr_line.lstrip())), cursor_pos["y"]
|
||||
)
|
||||
(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
curr_char,
|
||||
) = char_utils.get_current_char(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
self.env["screen"]["new_content_text"],
|
||||
)
|
||||
|
||||
char_utils.present_char_for_review(
|
||||
self.env,
|
||||
curr_char,
|
||||
interrupt=True,
|
||||
announce_capital=True,
|
||||
flush=False)
|
||||
self.env['runtime']['OutputManager'].present_text(_("first character in line indent {0}").format(
|
||||
str(len(curr_line) - len(curr_line.lstrip()))), interrupt=False)
|
||||
flush=False,
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("first character in line indent {0}").format(
|
||||
str(len(curr_line) - len(curr_line.lstrip()))
|
||||
),
|
||||
interrupt=False,
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,14 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import char_utils
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -20,23 +19,34 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('Move Review to the last character on the line')
|
||||
return _("Move Review to the last character on the line")
|
||||
|
||||
def run(self):
|
||||
cursor_pos = self.env['runtime']['CursorManager'].get_review_or_text_cursor()
|
||||
self.env['runtime']['CursorManager'].set_review_cursor_position(
|
||||
self.env['screen']['columns'] - 1, cursor_pos['y'])
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], lastChar = \
|
||||
char_utils.get_last_char_in_line(self.env['screen']['newCursorReview']['y'], self.env['screen']['new_content_text'])
|
||||
cursor_pos = self.env["runtime"][
|
||||
"CursorManager"
|
||||
].get_review_or_text_cursor()
|
||||
self.env["runtime"]["CursorManager"].set_review_cursor_position(
|
||||
self.env["screen"]["columns"] - 1, cursor_pos["y"]
|
||||
)
|
||||
(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
lastChar,
|
||||
) = char_utils.get_last_char_in_line(
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
self.env["screen"]["new_content_text"],
|
||||
)
|
||||
|
||||
char_utils.present_char_for_review(
|
||||
self.env,
|
||||
lastChar,
|
||||
interrupt=True,
|
||||
announce_capital=True,
|
||||
flush=False)
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("last character in line"), interrupt=False)
|
||||
flush=False,
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("last character in line"), interrupt=False
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,14 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import char_utils
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -20,39 +19,109 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('Moves review to the next character ')
|
||||
return _("Moves review to the next character")
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['CursorManager'].enter_review_mode_curr_text_cursor()
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], next_char, end_of_screen, line_break = char_utils.get_next_char(
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['new_content_text'])
|
||||
self.env["runtime"][
|
||||
"CursorManager"
|
||||
].enter_review_mode_curr_text_cursor()
|
||||
|
||||
# Check if we're in table mode for bounded navigation
|
||||
if self.env["runtime"]["TableManager"].is_table_mode():
|
||||
table_info = self.env["runtime"]["TableManager"].get_current_table_cell_info()
|
||||
if table_info:
|
||||
cursor_pos = self.env["screen"]["newCursorReview"]
|
||||
line_text = self.env["runtime"]["ScreenManager"].get_line_text(cursor_pos["y"])
|
||||
if line_text:
|
||||
column_start = self.env["runtime"]["TableManager"].get_column_start_position(line_text, table_info["column_index"])
|
||||
cell_content = table_info["cell_content"]
|
||||
cell_end = column_start + len(cell_content)
|
||||
|
||||
# Check if we're already at the end of the cell
|
||||
if cursor_pos["x"] >= cell_end - 1:
|
||||
# At cell boundary - announce end and don't move
|
||||
char_utils.present_char_for_review(
|
||||
self.env,
|
||||
cell_content[-1] if cell_content else "",
|
||||
interrupt=True,
|
||||
announce_capital=True,
|
||||
flush=False,
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("end of cell"), interrupt=False, sound_icon="EndOfLine"
|
||||
)
|
||||
return
|
||||
|
||||
# Move within cell bounds
|
||||
relative_pos = cursor_pos["x"] - column_start
|
||||
if relative_pos < len(cell_content) - 1:
|
||||
new_relative_pos = relative_pos + 1
|
||||
self.env["screen"]["newCursorReview"]["x"] = column_start + new_relative_pos
|
||||
|
||||
# Get character at new position
|
||||
if new_relative_pos < len(cell_content):
|
||||
next_char = cell_content[new_relative_pos]
|
||||
else:
|
||||
next_char = ""
|
||||
|
||||
char_utils.present_char_for_review(
|
||||
self.env,
|
||||
next_char,
|
||||
interrupt=True,
|
||||
announce_capital=True,
|
||||
flush=False,
|
||||
)
|
||||
return
|
||||
|
||||
# Regular navigation for non-table mode
|
||||
(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
next_char,
|
||||
end_of_screen,
|
||||
line_break,
|
||||
) = char_utils.get_next_char(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
self.env["screen"]["new_content_text"],
|
||||
)
|
||||
|
||||
char_utils.present_char_for_review(
|
||||
self.env,
|
||||
next_char,
|
||||
interrupt=True,
|
||||
announce_capital=True,
|
||||
flush=False)
|
||||
flush=False,
|
||||
)
|
||||
if end_of_screen:
|
||||
if self.env['runtime']['SettingsManager'].get_setting_as_bool(
|
||||
'review', 'end_of_screen'):
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('end of screen'), interrupt=True, sound_icon ='EndOfScreen')
|
||||
if self.env["runtime"]["SettingsManager"].get_setting_as_bool(
|
||||
"review", "end_of_screen"
|
||||
):
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("end of screen"),
|
||||
interrupt=True,
|
||||
sound_icon="EndOfScreen",
|
||||
)
|
||||
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')
|
||||
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"
|
||||
)
|
||||
# is has attribute it enabled?
|
||||
if self.env['runtime']['SettingsManager'].get_setting_as_bool(
|
||||
'general', 'hasattributes'):
|
||||
cursor_pos = self.env['screen']['newCursorReview']
|
||||
if self.env["runtime"]["SettingsManager"].get_setting_as_bool(
|
||||
"general", "hasattributes"
|
||||
):
|
||||
cursor_pos = self.env["screen"]["newCursorReview"]
|
||||
|
||||
if not self.env['runtime']['AttributeManager'].has_attributes(
|
||||
cursor_pos):
|
||||
if not self.env["runtime"]["AttributeManager"].has_attributes(
|
||||
cursor_pos
|
||||
):
|
||||
return
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
'has attribute', sound_icon ='HasAttributes', interrupt=False)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"has attribute", sound_icon="HasAttributes", interrupt=False
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,14 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import char_utils
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -20,27 +19,47 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('phonetically presents the next character and set review to it')
|
||||
return _(
|
||||
"phonetically presents the next character and set review to it"
|
||||
)
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['CursorManager'].enter_review_mode_curr_text_cursor()
|
||||
self.env["runtime"][
|
||||
"CursorManager"
|
||||
].enter_review_mode_curr_text_cursor()
|
||||
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], next_char, end_of_screen, line_break = char_utils.get_next_char(
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['new_content_text'])
|
||||
(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
next_char,
|
||||
end_of_screen,
|
||||
line_break,
|
||||
) = char_utils.get_next_char(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
self.env["screen"]["new_content_text"],
|
||||
)
|
||||
|
||||
next_char = char_utils.get_phonetic(next_char)
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
next_char, interrupt=True, announce_capital=True, flush=False)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
next_char, interrupt=True, announce_capital=True, flush=False
|
||||
)
|
||||
if end_of_screen:
|
||||
if self.env['runtime']['SettingsManager'].get_setting_as_bool(
|
||||
'review', 'end_of_screen'):
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('end of screen'), interrupt=True, sound_icon ='EndOfScreen')
|
||||
if self.env["runtime"]["SettingsManager"].get_setting_as_bool(
|
||||
"review", "end_of_screen"
|
||||
):
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("end of screen"),
|
||||
interrupt=True,
|
||||
sound_icon="EndOfScreen",
|
||||
)
|
||||
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')
|
||||
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
|
||||
|
@ -2,14 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import line_utils
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -20,27 +19,45 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('moves review to the next line ')
|
||||
return _("moves review to the next line ")
|
||||
|
||||
def run(self):
|
||||
self.env['screen']['oldCursorReview'] = self.env['screen']['newCursorReview']
|
||||
if not self.env['screen']['newCursorReview']:
|
||||
self.env['screen']['newCursorReview'] = self.env['screen']['new_cursor'].copy()
|
||||
self.env["screen"]["oldCursorReview"] = self.env["screen"][
|
||||
"newCursorReview"
|
||||
]
|
||||
if not self.env["screen"]["newCursorReview"]:
|
||||
self.env["screen"]["newCursorReview"] = self.env["screen"][
|
||||
"new_cursor"
|
||||
].copy()
|
||||
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], nextLine, end_of_screen = line_utils.get_next_line(
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['new_content_text'])
|
||||
(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
nextLine,
|
||||
end_of_screen,
|
||||
) = line_utils.get_next_line(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
self.env["screen"]["new_content_text"],
|
||||
)
|
||||
|
||||
if nextLine.isspace():
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("blank"), sound_icon ='EmptyLine', interrupt=True, flush=False)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("blank"), sound_icon="EmptyLine", interrupt=True, flush=False
|
||||
)
|
||||
else:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
nextLine, interrupt=True, flush=False)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
nextLine, interrupt=True, flush=False
|
||||
)
|
||||
if end_of_screen:
|
||||
if self.env['runtime']['SettingsManager'].get_setting_as_bool(
|
||||
'review', 'end_of_screen'):
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('end of screen'), interrupt=True, sound_icon ='EndOfScreen')
|
||||
if self.env["runtime"]["SettingsManager"].get_setting_as_bool(
|
||||
"review", "end_of_screen"
|
||||
):
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("end of screen"),
|
||||
interrupt=True,
|
||||
sound_icon="EndOfScreen",
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,14 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import word_utils
|
||||
from fenrirscreenreader.core import debug
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -20,32 +20,84 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('moves review to the next word ')
|
||||
return _("moves review to the next word ")
|
||||
|
||||
def run(self):
|
||||
self.env['screen']['oldCursorReview'] = self.env['screen']['newCursorReview']
|
||||
if self.env['screen']['newCursorReview'] is None:
|
||||
self.env['screen']['newCursorReview'] = self.env['screen']['new_cursor'].copy()
|
||||
# Check if we're in table mode FIRST - before any word navigation
|
||||
is_table_mode = self.env["runtime"]["TableManager"].is_table_mode()
|
||||
self.env["runtime"]["DebugManager"].write_debug_out(
|
||||
f"review_next_word: is_table_mode={is_table_mode}",
|
||||
debug.DebugLevel.INFO
|
||||
)
|
||||
if is_table_mode:
|
||||
table_info = self.env["runtime"]["TableManager"].move_to_next_column()
|
||||
if table_info and table_info.get("at_end"):
|
||||
# Stay on current cell and play end of line sound
|
||||
current_info = table_info["current_info"]
|
||||
if current_info:
|
||||
output_text = f"{current_info['cell_content']}"
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
output_text, interrupt=True, flush=False
|
||||
)
|
||||
# Play end of line sound
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("end of line"), interrupt=False, sound_icon="EndOfLine"
|
||||
)
|
||||
elif table_info:
|
||||
# Normal column navigation - announce cell content with column info
|
||||
output_text = f"{table_info['cell_content']} {table_info['column_header']}"
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
output_text, interrupt=True, flush=False
|
||||
)
|
||||
else:
|
||||
# No table info available, but still in table mode
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("no table data"), interrupt=True, flush=False
|
||||
)
|
||||
return # ALWAYS return in table mode to prevent regular word navigation
|
||||
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], next_word, end_of_screen, line_break = word_utils.get_next_word(
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['new_content_text'])
|
||||
# Regular word navigation (only when NOT in table mode)
|
||||
self.env["runtime"][
|
||||
"CursorManager"
|
||||
].enter_review_mode_curr_text_cursor()
|
||||
|
||||
(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
next_word,
|
||||
end_of_screen,
|
||||
line_break,
|
||||
) = word_utils.get_next_word(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
self.env["screen"]["new_content_text"],
|
||||
)
|
||||
|
||||
# Regular word announcement
|
||||
if next_word.isspace():
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("blank"), interrupt=True, flush=False)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("blank"), interrupt=True, flush=False
|
||||
)
|
||||
else:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
next_word, interrupt=True, flush=False)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
next_word, interrupt=True, flush=False
|
||||
)
|
||||
if end_of_screen:
|
||||
if self.env['runtime']['SettingsManager'].get_setting_as_bool(
|
||||
'review', 'end_of_screen'):
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('end of screen'), interrupt=True, sound_icon ='EndOfScreen')
|
||||
if self.env["runtime"]["SettingsManager"].get_setting_as_bool(
|
||||
"review", "end_of_screen"
|
||||
):
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("end of screen"),
|
||||
interrupt=True,
|
||||
sound_icon="EndOfScreen",
|
||||
)
|
||||
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')
|
||||
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
|
||||
|
@ -2,15 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import word_utils
|
||||
from fenrirscreenreader.utils import char_utils
|
||||
from fenrirscreenreader.utils import word_utils
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -21,33 +20,55 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('Phonetically spells the next word and moves review to it')
|
||||
return _("Phonetically spells the next word and moves review to it")
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['CursorManager'].enter_review_mode_curr_text_cursor()
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], next_word, end_of_screen, line_break = word_utils.get_next_word(
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['new_content_text'])
|
||||
self.env["runtime"][
|
||||
"CursorManager"
|
||||
].enter_review_mode_curr_text_cursor()
|
||||
(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
next_word,
|
||||
end_of_screen,
|
||||
line_break,
|
||||
) = word_utils.get_next_word(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
self.env["screen"]["new_content_text"],
|
||||
)
|
||||
|
||||
if next_word.isspace():
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("blank"), interrupt=True, flush=False)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("blank"), interrupt=True, flush=False
|
||||
)
|
||||
else:
|
||||
first_sequence = True
|
||||
for c in next_word:
|
||||
curr_char = char_utils.get_phonetic(c)
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
curr_char, interrupt=first_sequence, announce_capital=True, flush=False)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
curr_char,
|
||||
interrupt=first_sequence,
|
||||
announce_capital=True,
|
||||
flush=False,
|
||||
)
|
||||
first_sequence = False
|
||||
if end_of_screen:
|
||||
if self.env['runtime']['SettingsManager'].get_setting_as_bool(
|
||||
'review', 'end_of_screen'):
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('end of screen'), interrupt=True, sound_icon ='EndOfScreen')
|
||||
if self.env["runtime"]["SettingsManager"].get_setting_as_bool(
|
||||
"review", "end_of_screen"
|
||||
):
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("end of screen"),
|
||||
interrupt=True,
|
||||
sound_icon="EndOfScreen",
|
||||
)
|
||||
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')
|
||||
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
|
||||
|
@ -2,14 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import char_utils
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -20,42 +19,112 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('moves review to the previous character ')
|
||||
return _("moves review to the previous character")
|
||||
|
||||
def run(self):
|
||||
self.env['screen']['oldCursorReview'] = self.env['screen']['newCursorReview']
|
||||
if not self.env['screen']['newCursorReview']:
|
||||
self.env['screen']['newCursorReview'] = self.env['screen']['new_cursor'].copy()
|
||||
self.env["screen"]["oldCursorReview"] = self.env["screen"][
|
||||
"newCursorReview"
|
||||
]
|
||||
if not self.env["screen"]["newCursorReview"]:
|
||||
self.env["screen"]["newCursorReview"] = self.env["screen"][
|
||||
"new_cursor"
|
||||
].copy()
|
||||
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], prev_char, end_of_screen, line_break = char_utils.get_prev_char(
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['new_content_text'])
|
||||
# Check if we're in table mode for bounded navigation
|
||||
if self.env["runtime"]["TableManager"].is_table_mode():
|
||||
table_info = self.env["runtime"]["TableManager"].get_current_table_cell_info()
|
||||
if table_info:
|
||||
cursor_pos = self.env["screen"]["newCursorReview"]
|
||||
line_text = self.env["runtime"]["ScreenManager"].get_line_text(cursor_pos["y"])
|
||||
if line_text:
|
||||
column_start = self.env["runtime"]["TableManager"].get_column_start_position(line_text, table_info["column_index"])
|
||||
|
||||
# Check if we're already at the start of the cell
|
||||
if cursor_pos["x"] <= column_start:
|
||||
# At cell boundary - announce start and don't move
|
||||
char_utils.present_char_for_review(
|
||||
self.env,
|
||||
table_info["cell_content"][0] if table_info["cell_content"] else "",
|
||||
interrupt=True,
|
||||
announce_capital=True,
|
||||
flush=False,
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("start of cell"), interrupt=False, sound_icon="StartOfLine"
|
||||
)
|
||||
return
|
||||
|
||||
# Move within cell bounds
|
||||
cell_content = table_info["cell_content"]
|
||||
relative_pos = cursor_pos["x"] - column_start
|
||||
if relative_pos > 0:
|
||||
new_relative_pos = relative_pos - 1
|
||||
self.env["screen"]["newCursorReview"]["x"] = column_start + new_relative_pos
|
||||
|
||||
# Get character at new position
|
||||
if new_relative_pos < len(cell_content):
|
||||
prev_char = cell_content[new_relative_pos]
|
||||
else:
|
||||
prev_char = ""
|
||||
|
||||
char_utils.present_char_for_review(
|
||||
self.env,
|
||||
prev_char,
|
||||
interrupt=True,
|
||||
announce_capital=True,
|
||||
flush=False,
|
||||
)
|
||||
return
|
||||
|
||||
# Regular navigation for non-table mode
|
||||
(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
prev_char,
|
||||
end_of_screen,
|
||||
line_break,
|
||||
) = char_utils.get_prev_char(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
self.env["screen"]["new_content_text"],
|
||||
)
|
||||
|
||||
char_utils.present_char_for_review(
|
||||
self.env,
|
||||
prev_char,
|
||||
interrupt=True,
|
||||
announce_capital=True,
|
||||
flush=False)
|
||||
flush=False,
|
||||
)
|
||||
if end_of_screen:
|
||||
if self.env['runtime']['SettingsManager'].get_setting_as_bool(
|
||||
'review', 'end_of_screen'):
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('end of screen'), interrupt=True, sound_icon ='EndOfScreen')
|
||||
if self.env["runtime"]["SettingsManager"].get_setting_as_bool(
|
||||
"review", "end_of_screen"
|
||||
):
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("end of screen"),
|
||||
interrupt=True,
|
||||
sound_icon="EndOfScreen",
|
||||
)
|
||||
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')
|
||||
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"
|
||||
)
|
||||
# is has attribute it enabled?
|
||||
if self.env['runtime']['SettingsManager'].get_setting_as_bool(
|
||||
'general', 'hasattributes'):
|
||||
cursor_pos = self.env['screen']['newCursorReview']
|
||||
if self.env["runtime"]["SettingsManager"].get_setting_as_bool(
|
||||
"general", "hasattributes"
|
||||
):
|
||||
cursor_pos = self.env["screen"]["newCursorReview"]
|
||||
|
||||
if not self.env['runtime']['AttributeManager'].has_attributes(
|
||||
cursor_pos):
|
||||
if not self.env["runtime"]["AttributeManager"].has_attributes(
|
||||
cursor_pos
|
||||
):
|
||||
return
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
'has attribute', sound_icon ='HasAttributes', interrupt=False)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"has attribute", sound_icon="HasAttributes", interrupt=False
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,14 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import char_utils
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -20,27 +19,47 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('phonetically presents the previous character and set review to it')
|
||||
return _(
|
||||
"phonetically presents the previous character and set review to it"
|
||||
)
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['CursorManager'].enter_review_mode_curr_text_cursor()
|
||||
self.env["runtime"][
|
||||
"CursorManager"
|
||||
].enter_review_mode_curr_text_cursor()
|
||||
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], prev_char, end_of_screen, line_break = char_utils.get_prev_char(
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['new_content_text'])
|
||||
(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
prev_char,
|
||||
end_of_screen,
|
||||
line_break,
|
||||
) = char_utils.get_prev_char(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
self.env["screen"]["new_content_text"],
|
||||
)
|
||||
|
||||
prev_char = char_utils.get_phonetic(prev_char)
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
prev_char, interrupt=True, announce_capital=True, flush=False)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
prev_char, interrupt=True, announce_capital=True, flush=False
|
||||
)
|
||||
if end_of_screen:
|
||||
if self.env['runtime']['SettingsManager'].get_setting_as_bool(
|
||||
'review', 'end_of_screen'):
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('end of screen'), interrupt=True, sound_icon ='EndOfScreen')
|
||||
if self.env["runtime"]["SettingsManager"].get_setting_as_bool(
|
||||
"review", "end_of_screen"
|
||||
):
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("end of screen"),
|
||||
interrupt=True,
|
||||
sound_icon="EndOfScreen",
|
||||
)
|
||||
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')
|
||||
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
|
||||
|
@ -2,14 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import line_utils
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -20,25 +19,41 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('moves review to the previous line ')
|
||||
return _("moves review to the previous line ")
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['CursorManager'].enter_review_mode_curr_text_cursor()
|
||||
self.env["runtime"][
|
||||
"CursorManager"
|
||||
].enter_review_mode_curr_text_cursor()
|
||||
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], prev_line, end_of_screen = line_utils.get_prev_line(
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['new_content_text'])
|
||||
(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
prev_line,
|
||||
end_of_screen,
|
||||
) = line_utils.get_prev_line(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
self.env["screen"]["new_content_text"],
|
||||
)
|
||||
|
||||
if prev_line.isspace():
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("blank"), sound_icon ='EmptyLine', interrupt=True, flush=False)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("blank"), sound_icon="EmptyLine", interrupt=True, flush=False
|
||||
)
|
||||
else:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
prev_line, interrupt=True, flush=False)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
prev_line, interrupt=True, flush=False
|
||||
)
|
||||
if end_of_screen:
|
||||
if self.env['runtime']['SettingsManager'].get_setting_as_bool(
|
||||
'review', 'end_of_screen'):
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('end of screen'), interrupt=True, sound_icon ='EndOfScreen')
|
||||
if self.env["runtime"]["SettingsManager"].get_setting_as_bool(
|
||||
"review", "end_of_screen"
|
||||
):
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("end of screen"),
|
||||
interrupt=True,
|
||||
sound_icon="EndOfScreen",
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
@ -2,14 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import word_utils
|
||||
from fenrirscreenreader.core import debug
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -20,30 +20,84 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('moves review focus to the previous word ')
|
||||
return _("moves review focus to the previous word ")
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['CursorManager'].enter_review_mode_curr_text_cursor()
|
||||
# Check if we're in table mode FIRST - before any word navigation
|
||||
is_table_mode = self.env["runtime"]["TableManager"].is_table_mode()
|
||||
self.env["runtime"]["DebugManager"].write_debug_out(
|
||||
f"review_prev_word: is_table_mode={is_table_mode}",
|
||||
debug.DebugLevel.INFO
|
||||
)
|
||||
if is_table_mode:
|
||||
table_info = self.env["runtime"]["TableManager"].move_to_prev_column()
|
||||
if table_info and table_info.get("at_start"):
|
||||
# Stay on current cell at beginning of line
|
||||
current_info = table_info["current_info"]
|
||||
if current_info:
|
||||
output_text = f"{current_info['cell_content']} {current_info['column_header']}"
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
output_text, interrupt=True, flush=False
|
||||
)
|
||||
# Play start of line sound
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("start of line"), interrupt=False, sound_icon="StartOfLine"
|
||||
)
|
||||
elif table_info:
|
||||
# Normal column navigation - announce cell content with column info
|
||||
output_text = f"{table_info['cell_content']} {table_info['column_header']}"
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
output_text, interrupt=True, flush=False
|
||||
)
|
||||
else:
|
||||
# No table info available, but still in table mode
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("no table data"), interrupt=True, flush=False
|
||||
)
|
||||
return # ALWAYS return in table mode to prevent regular word navigation
|
||||
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], prev_word, end_of_screen, line_break = word_utils.get_prev_word(
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['new_content_text'])
|
||||
# Regular word navigation (only when NOT in table mode)
|
||||
self.env["runtime"][
|
||||
"CursorManager"
|
||||
].enter_review_mode_curr_text_cursor()
|
||||
|
||||
(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
prev_word,
|
||||
end_of_screen,
|
||||
line_break,
|
||||
) = word_utils.get_prev_word(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
self.env["screen"]["new_content_text"],
|
||||
)
|
||||
|
||||
# Regular word announcement
|
||||
if prev_word.isspace():
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("blank"), interrupt=True, flush=False)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("blank"), interrupt=True, flush=False
|
||||
)
|
||||
else:
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
prev_word, interrupt=True, flush=False)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
prev_word, interrupt=True, flush=False
|
||||
)
|
||||
if end_of_screen:
|
||||
if self.env['runtime']['SettingsManager'].get_setting_as_bool(
|
||||
'review', 'end_of_screen'):
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('end of screen'), interrupt=False, sound_icon ='EndOfScreen')
|
||||
if self.env["runtime"]["SettingsManager"].get_setting_as_bool(
|
||||
"review", "end_of_screen"
|
||||
):
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("end of screen"),
|
||||
interrupt=False,
|
||||
sound_icon="EndOfScreen",
|
||||
)
|
||||
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')
|
||||
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
|
||||
|
@ -2,15 +2,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import word_utils
|
||||
from fenrirscreenreader.utils import char_utils
|
||||
from fenrirscreenreader.utils import word_utils
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -21,33 +20,57 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('Phonetically spells the previous word and moves review to it')
|
||||
return _(
|
||||
"Phonetically spells the previous word and moves review to it"
|
||||
)
|
||||
|
||||
def run(self):
|
||||
self.env['runtime']['CursorManager'].enter_review_mode_curr_text_cursor()
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], prev_word, end_of_screen, line_break = word_utils.get_prev_word(
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['new_content_text'])
|
||||
self.env["runtime"][
|
||||
"CursorManager"
|
||||
].enter_review_mode_curr_text_cursor()
|
||||
(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
prev_word,
|
||||
end_of_screen,
|
||||
line_break,
|
||||
) = word_utils.get_prev_word(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
self.env["screen"]["new_content_text"],
|
||||
)
|
||||
|
||||
if prev_word.isspace():
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("blank"), interrupt=True, flush=False)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("blank"), interrupt=True, flush=False
|
||||
)
|
||||
else:
|
||||
first_sequence = True
|
||||
for c in prev_word:
|
||||
curr_char = char_utils.get_phonetic(c)
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
curr_char, interrupt=first_sequence, announce_capital=True, flush=False)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
curr_char,
|
||||
interrupt=first_sequence,
|
||||
announce_capital=True,
|
||||
flush=False,
|
||||
)
|
||||
first_sequence = False
|
||||
if end_of_screen:
|
||||
if self.env['runtime']['SettingsManager'].get_setting_as_bool(
|
||||
'review', 'end_of_screen'):
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_('end of screen'), interrupt=True, sound_icon ='EndOfScreen')
|
||||
if self.env["runtime"]["SettingsManager"].get_setting_as_bool(
|
||||
"review", "end_of_screen"
|
||||
):
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("end of screen"),
|
||||
interrupt=True,
|
||||
sound_icon="EndOfScreen",
|
||||
)
|
||||
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')
|
||||
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
|
||||
|
@ -2,14 +2,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
from fenrirscreenreader.core.i18n import _
|
||||
|
||||
from fenrirscreenreader.utils import char_utils
|
||||
|
||||
|
||||
class command():
|
||||
class command:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -20,22 +19,32 @@ class command():
|
||||
pass
|
||||
|
||||
def get_description(self):
|
||||
return _('Move Review to the first character on the screen (left top)')
|
||||
return _("Move Review to the first character on the screen (left top)")
|
||||
|
||||
def run(self):
|
||||
cursor_pos = self.env['runtime']['CursorManager'].get_review_or_text_cursor()
|
||||
self.env['runtime']['CursorManager'].set_review_cursor_position(0, 0)
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], lastChar = \
|
||||
char_utils.get_last_char_in_line(self.env['screen']['newCursorReview']['y'], self.env['screen']['new_content_text'])
|
||||
cursor_pos = self.env["runtime"][
|
||||
"CursorManager"
|
||||
].get_review_or_text_cursor()
|
||||
self.env["runtime"]["CursorManager"].set_review_cursor_position(0, 0)
|
||||
(
|
||||
self.env["screen"]["newCursorReview"]["x"],
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
lastChar,
|
||||
) = char_utils.get_last_char_in_line(
|
||||
self.env["screen"]["newCursorReview"]["y"],
|
||||
self.env["screen"]["new_content_text"],
|
||||
)
|
||||
|
||||
char_utils.present_char_for_review(
|
||||
self.env,
|
||||
lastChar,
|
||||
interrupt=True,
|
||||
announce_capital=True,
|
||||
flush=False)
|
||||
self.env['runtime']['OutputManager'].present_text(
|
||||
_("first character in screen"), interrupt=False)
|
||||
flush=False,
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
_("first character in screen"), interrupt=False
|
||||
)
|
||||
|
||||
def set_callback(self, callback):
|
||||
pass
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user