To make Fenrir easier to approach for new developer, start code migration to be pep8 compliant.

This commit is contained in:
Storm Dragon committed 2025-07-01 22:23:50 -04:00
1 parent 4bcf82178e
commit 7408951152
345 files changed
+8688 -3852

No files matched your search

@@ -5,16 +5,24 @@
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
def getDescription(self):
return 'No description found'
return 'No description found'
def run(self):
pass
def setCallback(self, callback):
pass
@@ -8,18 +8,29 @@
# this command is just to initialize stuff.
# like init index lists in memoryManager
# it is not useful to execute it
from fenrirscreenreader.core.i18n import _
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
# clipboard
self.env['runtime']['memoryManager'].addIndexList('clipboardHistory', self.env['runtime']['settingsManager'].getSettingAsInt('general', 'numberOfClipboards'))
self.env['runtime']['memoryManager'].addIndexList(
'clipboardHistory', self.env['runtime']['settingsManager'].getSettingAsInt(
'general', 'numberOfClipboards'))
def shutdown(self):
pass
def getDescription(self):
return 'No description found'
return 'No description found'
def run(self):
pass
def setCallback(self, callback):
pass
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import word_utils
import string
initialized = False
@@ -12,42 +14,59 @@ try:
initialized = True
except Exception as e:
pass
class command():
def __init__(self):
self.language = ''
self.spellChecker = None
def initialize(self, environment):
self.env = environment
self.updateSpellLanguage()
def shutdown(self):
pass
pass
def getDescription(self):
return _('adds the current word to the exceptions dictionary')
def updateSpellLanguage(self):
self.spellChecker = enchant.Dict(self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage'))
self.language = self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage')
return _('adds the current word to the exceptions dictionary')
def updateSpellLanguage(self):
self.spellChecker = enchant.Dict(
self.env['runtime']['settingsManager'].getSetting(
'general', 'spellCheckLanguage'))
self.language = self.env['runtime']['settingsManager'].getSetting(
'general', 'spellCheckLanguage')
def run(self):
if not initialized:
return
if self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage') != self.language:
return
if self.env['runtime']['settingsManager'].getSetting(
'general', 'spellCheckLanguage') != self.language:
try:
self.updateSpellLanguage()
except Exception as e:
return
return
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
# get the word
newContent = self.env['screen']['newContentText'].split('\n')[cursorPos['y']]
x, y, currWord, endOfScreen, lineBreak = word_utils.getCurrentWord(cursorPos['x'], 0, newContent)
currWord = currWord.strip(string.whitespace + r'!"#$%&\()*+,-./:;<=Â?@[\\]^_{|}~')
newContent = self.env['screen']['newContentText'].split('\n')[
cursorPos['y']]
x, y, currWord, endOfScreen, lineBreak = word_utils.getCurrentWord(
cursorPos['x'], 0, newContent)
currWord = currWord.strip(
string.whitespace +
r'!"#$%&\()*+,-./:;<=Â?@[\\]^_{|}~')
if currWord != '':
if self.spellChecker.is_added(currWord):
self.env['runtime']['outputManager'].presentText(_('{0} is already in dictionary').format(currWord,), soundIcon='Cancel', interrupt=True)
self.env['runtime']['outputManager'].presentText(
_('{0} is already in dictionary').format(
currWord,), soundIcon='Cancel', interrupt=True)
else:
self.spellChecker.add(currWord)
self.env['runtime']['outputManager'].presentText(_('{0} added to dictionary').format(currWord,), soundIcon='Accept', interrupt=True)
self.spellChecker.add(currWord)
self.env['runtime']['outputManager'].presentText(
_('{0} added to dictionary').format(
currWord,), soundIcon='Accept', interrupt=True)
def setCallback(self, callback):
pass
@@ -4,29 +4,33 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import math
class AdjustmentCommand():
"""Base class for speech and sound adjustment commands"""
def __init__(self, section, setting, direction, step=0.1):
self.section = section # 'speech' or 'sound'
self.setting = setting # 'rate', 'pitch', 'volume'
self.direction = direction # 'inc' or 'dec'
self.step = step
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
def getDescription(self):
action = "Increase" if self.direction == 'inc' else "Decrease"
if self.section == 'speech':
return _(f'{action} the speech {self.setting}')
else:
return _(f'{action} the {self.section} {self.setting}')
def run(self):
if self.section == 'sound' and self.setting == 'volume':
# Sound volume uses different method
@@ -34,11 +38,12 @@ class AdjustmentCommand():
else:
# Speech rate, pitch, volume use standard method
self._adjust_speech_setting()
def _adjust_speech_setting(self):
"""Adjust speech settings (rate, pitch, volume)"""
value = self.env['runtime']['settingsManager'].getSettingAsFloat(self.section, self.setting)
value = self.env['runtime']['settingsManager'].getSettingAsFloat(
self.section, self.setting)
# Apply adjustment with rounding
if self.direction == 'inc':
value = round((math.ceil(10 * value) / 10) + self.step, 2)
@@ -48,23 +53,28 @@ class AdjustmentCommand():
value = round((math.ceil(10 * value) / 10) - self.step, 2)
if value < 0.0:
value = 0.0
# Set the new value
self.env['runtime']['settingsManager'].setSetting(self.section, self.setting, str(value))
self.env['runtime']['settingsManager'].setSetting(
self.section, self.setting, str(value))
# Present feedback
percentage = int(value * 100)
if self.section == 'speech':
feedback = _("{0} percent speech {1}").format(percentage, self.setting)
feedback = _("{0} percent speech {1}").format(
percentage, self.setting)
else:
feedback = _("{0} percent {1} {2}").format(percentage, self.section, self.setting)
self.env['runtime']['outputManager'].presentText(feedback, soundIcon='', interrupt=True)
feedback = _("{0} percent {1} {2}").format(
percentage, self.section, self.setting)
self.env['runtime']['outputManager'].presentText(
feedback, soundIcon='', interrupt=True)
def _adjust_sound_volume(self):
"""Adjust sound volume using same logic as speech"""
value = self.env['runtime']['settingsManager'].getSettingAsFloat(self.section, self.setting)
value = self.env['runtime']['settingsManager'].getSettingAsFloat(
self.section, self.setting)
# Sound volume uses same math as speech settings
if self.direction == 'inc':
value = round((math.ceil(10 * value) / 10) + self.step, 2)
@@ -74,15 +84,17 @@ class AdjustmentCommand():
value = round((math.ceil(10 * value) / 10) - self.step, 2)
if value < 0.0:
value = 0.0
# Set the new value
self.env['runtime']['settingsManager'].setSetting(self.section, self.setting, str(value))
self.env['runtime']['settingsManager'].setSetting(
self.section, self.setting, str(value))
# Present feedback with appropriate sound icon
percentage = int(value * 100)
sound_icon = 'SoundOn' if self.direction == 'inc' else 'SoundOff'
feedback = _("{0} percent sound volume").format(percentage)
self.env['runtime']['outputManager'].presentText(feedback, soundIcon=sound_icon, interrupt=True)
self.env['runtime']['outputManager'].presentText(
feedback, soundIcon=sound_icon, interrupt=True)
def setCallback(self, callback):
pass
pass
@@ -4,23 +4,33 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader import fenrirVersion
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
def getDescription(self):
return _('Present the version of Fenrir currrrently in use.')
def run(self):
try:
self.env['runtime']['outputManager'].presentText(f'Fenrir screen reader version {fenrirVersion.version}-{fenrirVersion.codeName}', interrupt=True)
except exception as e:
self.env['runtime']['outputManager'].presentText(_('Version information is unavailable.'), interrupt=True)
self.env['runtime']['outputManager'].presentText(
f'Fenrir screen reader version {
fenrirVersion.version}-{
fenrirVersion.codeName}', interrupt=True)
except Exception as e:
self.env['runtime']['outputManager'].presentText(
_('Version information is unavailable.'), interrupt=True)
def setCallback(self, callback):
pass
@@ -1,71 +1,82 @@
#!/usr/bin/env python3
from fenrirscreenreader.core.i18n import _
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
def getDescription(self):
return "Apply the last tested voice from safe voice browser"
def run(self):
try:
# Check if we have a tested voice
if ('commandBuffer' not in self.env or
if ('commandBuffer' not in self.env or
'lastTestedModule' not in self.env['commandBuffer'] or
'lastTestedVoice' not in self.env['commandBuffer']):
self.env['runtime']['outputManager'].presentText("No voice has been tested yet", interrupt=True)
self.env['runtime']['outputManager'].presentText("Use voice browser first", interrupt=True)
'lastTestedVoice' not in self.env['commandBuffer']):
self.env['runtime']['outputManager'].presentText(
"No voice has been tested yet", interrupt=True)
self.env['runtime']['outputManager'].presentText(
"Use voice browser first", interrupt=True)
return
module = self.env['commandBuffer']['lastTestedModule']
voice = self.env['commandBuffer']['lastTestedVoice']
self.env['runtime']['outputManager'].presentText(f"Applying {voice} from {module}", interrupt=True)
self.env['runtime']['outputManager'].presentText(
f"Applying {voice} from {module}", interrupt=True)
# Apply to runtime settings only (temporary until saved)
settingsManager = self.env['runtime']['settingsManager']
# Store old values for safety
oldDriver = settingsManager.getSetting('speech', 'driver')
oldModule = settingsManager.getSetting('speech', 'module')
oldVoice = settingsManager.getSetting('speech', 'voice')
try:
# Apply new settings to runtime only (use setSetting to update settingArgDict)
# Apply new settings to runtime only (use setSetting to update
# settingArgDict)
settingsManager.setSetting('speech', 'driver', 'speechdDriver')
settingsManager.setSetting('speech', 'module', module)
settingsManager.setSetting('speech', 'voice', voice)
# Apply to speech driver instance directly
if 'speechDriver' in self.env['runtime']:
speechDriver = self.env['runtime']['speechDriver']
# Set the module and voice on the driver instance
speechDriver.setModule(module)
speechDriver.setVoice(voice)
self.env['runtime']['outputManager'].presentText("Voice applied successfully!", interrupt=True)
self.env['runtime']['outputManager'].presentText("Use save settings to make permanent", interrupt=True)
self.env['runtime']['outputManager'].presentText(
"Voice applied successfully!", interrupt=True)
self.env['runtime']['outputManager'].presentText(
"Use save settings to make permanent", interrupt=True)
self.env['runtime']['outputManager'].playSound('Accept')
except Exception as e:
# Revert on failure
settingsManager.setSetting('speech', 'driver', oldDriver)
settingsManager.setSetting('speech', 'module', oldModule)
settingsManager.setSetting('speech', 'voice', oldVoice)
self.env['runtime']['outputManager'].presentText(f"Failed to apply voice, reverted: {str(e)}", interrupt=True)
self.env['runtime']['outputManager'].presentText(
f"Failed to apply voice, reverted: {str(e)}", interrupt=True)
self.env['runtime']['outputManager'].playSound('Error')
except Exception as e:
self.env['runtime']['outputManager'].presentText(f"Apply voice error: {str(e)}", interrupt=True)
self.env['runtime']['outputManager'].presentText(
f"Apply voice error: {str(e)}", interrupt=True)
self.env['runtime']['outputManager'].playSound('Error')
def setCallback(self, callback):
pass
pass
@@ -4,26 +4,38 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import screen_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
def getDescription(self):
return _('Reads attributes of current cursor position')
return _('Reads attributes of current cursor position')
def run(self):
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
try:
attributes = self.env['runtime']['attributeManager'].getAttributeByXY( cursorPos['x'], cursorPos['y'])
attributes = self.env['runtime']['attributeManager'].getAttributeByXY(
cursorPos['x'], cursorPos['y'])
except Exception as e:
print(e)
attributeFormatString = self.env['runtime']['settingsManager'].getSetting('general', 'attributeFormatString')
attributeFormatString = self.env['runtime']['attributeManager'].formatAttributes(attributes, attributeFormatString)
self.env['runtime']['outputManager'].presentText(attributeFormatString, soundIcon='', interrupt=True)
print(e)
attributeFormatString = self.env['runtime']['settingsManager'].getSetting(
'general', 'attributeFormatString')
attributeFormatString = self.env['runtime']['attributeManager'].formatAttributes(
attributes, attributeFormatString)
self.env['runtime']['outputManager'].presentText(
attributeFormatString, soundIcon='', interrupt=True)
def setCallback(self, callback):
pass
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import os
import importlib.util
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
@@ -12,6 +14,7 @@ _module = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_module)
BookmarkCommand = _module.BookmarkCommand
class command(BookmarkCommand):
def __init__(self):
super().__init__(1, 'read')
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import os
import importlib.util
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
@@ -12,6 +14,7 @@ _module = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_module)
BookmarkCommand = _module.BookmarkCommand
class command(BookmarkCommand):
def __init__(self):
super().__init__(10, 'read')
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import os
import importlib.util
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
@@ -12,6 +14,7 @@ _module = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_module)
BookmarkCommand = _module.BookmarkCommand
class command(BookmarkCommand):
def __init__(self):
super().__init__(2, 'read')
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import os
import importlib.util
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
@@ -12,6 +14,7 @@ _module = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_module)
BookmarkCommand = _module.BookmarkCommand
class command(BookmarkCommand):
def __init__(self):
super().__init__(3, 'read')
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import os
import importlib.util
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
@@ -12,6 +14,7 @@ _module = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_module)
BookmarkCommand = _module.BookmarkCommand
class command(BookmarkCommand):
def __init__(self):
super().__init__(4, 'read')
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import os
import importlib.util
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
@@ -12,6 +14,7 @@ _module = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_module)
BookmarkCommand = _module.BookmarkCommand
class command(BookmarkCommand):
def __init__(self):
super().__init__(5, 'read')
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import os
import importlib.util
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
@@ -12,6 +14,7 @@ _module = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_module)
BookmarkCommand = _module.BookmarkCommand
class command(BookmarkCommand):
def __init__(self):
super().__init__(6, 'read')
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import os
import importlib.util
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
@@ -12,6 +14,7 @@ _module = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_module)
BookmarkCommand = _module.BookmarkCommand
class command(BookmarkCommand):
def __init__(self):
super().__init__(7, 'read')
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import os
import importlib.util
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
@@ -12,6 +14,7 @@ _module = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_module)
BookmarkCommand = _module.BookmarkCommand
class command(BookmarkCommand):
def __init__(self):
super().__init__(8, 'read')
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import os
import importlib.util
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
@@ -12,6 +14,7 @@ _module = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_module)
BookmarkCommand = _module.BookmarkCommand
class command(BookmarkCommand):
def __init__(self):
super().__init__(9, 'read')
@@ -4,27 +4,30 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.utils import line_utils
from fenrirscreenreader.utils import mark_utils
from fenrirscreenreader.core.i18n import _
import gettext
_ = gettext.gettext
from fenrirscreenreader.utils import mark_utils
from fenrirscreenreader.utils import line_utils
class BookmarkCommand():
"""Base class for bookmark operations - read, set, clear"""
def __init__(self, bookmark_id, action='read'):
self.ID = str(bookmark_id)
self.action = action
def initialize(self, environment):
self.env = environment
# Always initialize bookmark structure - all commands need this
if self.ID not in self.env['commandBuffer']['bookMarks']:
self.env['commandBuffer']['bookMarks'][self.ID] = {}
def shutdown(self):
pass
def getDescription(self):
if self.action == 'read':
return _('read Bookmark {0}').format(self.ID)
@@ -33,7 +36,7 @@ class BookmarkCommand():
elif self.action == 'clear':
return _('remove Bookmark {0}').format(self.ID)
return f'{self.action} Bookmark {self.ID}'
def run(self):
if self.action == 'read':
self._read_bookmark()
@@ -41,92 +44,114 @@ class BookmarkCommand():
self._set_bookmark()
elif self.action == 'clear':
self._clear_bookmark()
def _read_bookmark(self):
currApp = self.env['runtime']['applicationManager'].getCurrentApplication()
if not self.env['commandBuffer']['bookMarks'][self.ID]:
self.env['runtime']['outputManager'].presentText('Bookmark {0} not set'.format(self.ID), interrupt=True)
self.env['runtime']['outputManager'].presentText(
'Bookmark {0} not set'.format(self.ID), interrupt=True)
return
if currApp not in self.env['commandBuffer']['bookMarks'][self.ID]:
self.env['runtime']['outputManager'].presentText('Bookmark for application {0} not set'.format(currApp), interrupt=True)
self.env['runtime']['outputManager'].presentText(
'Bookmark for application {0} not set'.format(currApp), interrupt=True)
return
if not self.env['commandBuffer']['bookMarks'][self.ID][currApp].get('1'):
self.env['runtime']['outputManager'].presentText('Bookmark for application {0} not set'.format(currApp), interrupt=True)
if not self.env['commandBuffer']['bookMarks'][self.ID][currApp].get(
'1'):
self.env['runtime']['outputManager'].presentText(
'Bookmark for application {0} not set'.format(currApp), interrupt=True)
return
# Get bookmarked text
marked = ''
startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy()
startMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'].copy(
)
if self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2']:
endMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'].copy()
marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screen']['newContentText'])
endMark = self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'].copy(
)
marked = mark_utils.getTextBetweenMarks(
startMark, endMark, self.env['screen']['newContentText'])
else:
x, y, marked = line_utils.getCurrentLine(startMark['x'], startMark['y'], self.env['screen']['newContentText'])
x, y, marked = line_utils.getCurrentLine(
startMark['x'], startMark['y'], self.env['screen']['newContentText'])
if marked.isspace():
self.env['runtime']['outputManager'].presentText(_('blank'), soundIcon='EmptyLine', interrupt=True)
self.env['runtime']['outputManager'].presentText(
_('blank'), soundIcon='EmptyLine', interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(marked, interrupt=True)
self.env['runtime']['outputManager'].presentText(
marked, interrupt=True)
def _set_bookmark(self):
if not self.env['commandBuffer']['Marks']['1']:
self.env['runtime']['outputManager'].presentText(_("No mark found"), interrupt=True)
self.env['runtime']['outputManager'].presentText(
_("No mark found"), interrupt=True)
return
currApp = self.env['runtime']['applicationManager'].getCurrentApplication()
self.env['commandBuffer']['bookMarks'][self.ID][currApp] = {}
self.env['commandBuffer']['bookMarks'][self.ID][currApp]['1'] = self.env['commandBuffer']['Marks']['1'].copy()
if self.env['commandBuffer']['Marks']['2']:
self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'] = self.env['commandBuffer']['Marks']['2'].copy()
else:
self.env['commandBuffer']['bookMarks'][self.ID][currApp]['2'] = None
self.env['runtime']['outputManager'].presentText(_('Bookmark {0} set for application {1}').format(self.ID, currApp), interrupt=True)
self.env['runtime']['outputManager'].presentText(
_('Bookmark {0} set for application {1}').format(
self.ID, currApp), interrupt=True)
# Clear marks after setting bookmark
self.env['commandBuffer']['Marks']['1'] = None
self.env['commandBuffer']['Marks']['2'] = None
def _clear_bookmark(self):
currApp = self.env['runtime']['applicationManager'].getCurrentApplication()
if self.ID in self.env['commandBuffer']['bookMarks'] and currApp in self.env['commandBuffer']['bookMarks'][self.ID]:
del self.env['commandBuffer']['bookMarks'][self.ID][currApp]
self.env['runtime']['outputManager'].presentText(_('Bookmark {0} removed for application {1}').format(self.ID, currApp), interrupt=True)
self.env['runtime']['outputManager'].presentText(
_('Bookmark {0} removed for application {1}').format(
self.ID, currApp), interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(_('Bookmark {0} not set for application {1}').format(self.ID, currApp), interrupt=True)
self.env['runtime']['outputManager'].presentText(
_('Bookmark {0} not set for application {1}').format(
self.ID, currApp), interrupt=True)
def setCallback(self, callback):
pass
# Factory function to create bookmark command instances
def create_bookmark_commands():
"""Create all bookmark command instances"""
commands = {}
# Create read bookmark commands (bookmark_1 through bookmark_10)
for i in range(1, 11):
commands[f'bookmark_{i}'] = lambda i=i: BookmarkCommand(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: BookmarkCommand(i, 'set')
# Create clear bookmark commands (clear_bookmark_1 through clear_bookmark_10)
# 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: BookmarkCommand(i, 'clear')
commands[f'clear_bookmark_{i}'] = lambda i=i: BookmarkCommand(
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(BookmarkCommand):
@@ -137,14 +162,15 @@ def _make_command_class(bookmark_id, action):
# Generate individual command classes for each bookmark operation
# These will be used by the existing command loading system
# Read bookmarks (bookmark_1.py style)
for i in range(1, 11):
globals()[f'bookmark_{i}_command'] = _make_command_class(i, 'read')
# Set bookmarks (set_bookmark_1.py style)
# Set bookmarks (set_bookmark_1.py style)
for i in range(1, 11):
globals()[f'set_bookmark_{i}_command'] = _make_command_class(i, 'set')
# Clear bookmarks (clear_bookmark_1.py style)
for i in range(1, 11):
globals()[f'clear_bookmark_{i}_command'] = _make_command_class(i, 'clear')
globals()[f'clear_bookmark_{i}_command'] = _make_command_class(i, 'clear')
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import os
import importlib.util
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
@@ -12,6 +14,7 @@ _module = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_module)
BookmarkCommand = _module.BookmarkCommand
class command(BookmarkCommand):
def __init__(self):
super().__init__(1, 'clear')
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import os
import importlib.util
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
@@ -12,6 +14,7 @@ _module = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_module)
BookmarkCommand = _module.BookmarkCommand
class command(BookmarkCommand):
def __init__(self):
super().__init__(10, 'clear')
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import os
import importlib.util
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
@@ -12,6 +14,7 @@ _module = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_module)
BookmarkCommand = _module.BookmarkCommand
class command(BookmarkCommand):
def __init__(self):
super().__init__(2, 'clear')
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import os
import importlib.util
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
@@ -12,6 +14,7 @@ _module = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_module)
BookmarkCommand = _module.BookmarkCommand
class command(BookmarkCommand):
def __init__(self):
super().__init__(3, 'clear')
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import os
import importlib.util
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
@@ -12,6 +14,7 @@ _module = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_module)
BookmarkCommand = _module.BookmarkCommand
class command(BookmarkCommand):
def __init__(self):
super().__init__(4, 'clear')
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import os
import importlib.util
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
@@ -12,6 +14,7 @@ _module = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_module)
BookmarkCommand = _module.BookmarkCommand
class command(BookmarkCommand):
def __init__(self):
super().__init__(5, 'clear')
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import os
import importlib.util
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
@@ -12,6 +14,7 @@ _module = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_module)
BookmarkCommand = _module.BookmarkCommand
class command(BookmarkCommand):
def __init__(self):
super().__init__(6, 'clear')
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import os
import importlib.util
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
@@ -12,6 +14,7 @@ _module = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_module)
BookmarkCommand = _module.BookmarkCommand
class command(BookmarkCommand):
def __init__(self):
super().__init__(7, 'clear')
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import os
import importlib.util
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
@@ -12,6 +14,7 @@ _module = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_module)
BookmarkCommand = _module.BookmarkCommand
class command(BookmarkCommand):
def __init__(self):
super().__init__(8, 'clear')
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import os
import importlib.util
_base_path = os.path.join(os.path.dirname(__file__), 'bookmark_base.py')
@@ -12,6 +14,7 @@ _module = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_module)
BookmarkCommand = _module.BookmarkCommand
class command(BookmarkCommand):
def __init__(self):
super().__init__(9, 'clear')
@@ -5,19 +5,28 @@
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('clears the currently selected clipboard')
return _('clears the currently selected clipboard')
def run(self):
self.env['runtime']['memoryManager'].clearCurrentIndexList('clipboardHistory')
self.env['runtime']['outputManager'].presentText(_('clipboard cleared'), interrupt=True)
return
self.env['runtime']['memoryManager'].clearCurrentIndexList(
'clipboardHistory')
self.env['runtime']['outputManager'].presentText(
_('clipboard cleared'), interrupt=True)
return
def setCallback(self, callback):
pass
@@ -5,22 +5,32 @@
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('Turn off window mode for application')
def run(self):
if self.env['runtime']['cursorManager'].clearWindowForApplication():
currApp = self.env['runtime']['applicationManager'].getCurrentApplication()
self.env['runtime']['outputManager'].presentText(_('Window Mode off for application {0}').format(currApp,), interrupt=True)
currApp = self.env['runtime']['applicationManager'].getCurrentApplication(
)
self.env['runtime']['outputManager'].presentText(
_('Window Mode off for application {0}').format(
currApp,), interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(_("Not in window Mode"), interrupt=True)
self.env['runtime']['outputManager'].presentText(
_("Not in window Mode"), interrupt=True)
def setCallback(self, callback):
pass
@@ -4,24 +4,32 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import mark_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('copies last presented text to the clipboard')
return _('copies last presented text to the clipboard')
def run(self):
lastEcho = self.env['runtime']['outputManager'].getLastEcho()
if lastEcho.rstrip() != "":
lastEcho = lastEcho.rstrip()
self.env['runtime']['memoryManager'].addValueToFirstIndex('clipboardHistory', lastEcho)
self.env['runtime']['outputManager'].presentText(lastEcho, soundIcon='CopyToClipboard', interrupt=True)
self.env['runtime']['memoryManager'].addValueToFirstIndex(
'clipboardHistory', lastEcho)
self.env['runtime']['outputManager'].presentText(
lastEcho, soundIcon='CopyToClipboard', interrupt=True)
def setCallback(self, callback):
pass
@@ -2,72 +2,79 @@
# -*- coding: utf-8 -*-
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import mark_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('copies marked text to the currently selected clipboard')
return _('copies marked text to the currently selected clipboard')
def getTextFromScreen(self, startMark, endMark):
screenContent = self.env['screen']['newContentText']
screenLines = screenContent.split('\n')
startY = min(startMark['y'], len(screenLines) - 1)
endY = min(endMark['y'], len(screenLines) - 1)
# If marks are on the same line
if startY == endY:
line = screenLines[startY]
startX = min(startMark['x'], len(line))
endX = min(endMark['x'], len(line)) + 1
return line[startX:endX]
# Handle multi-line selection
result = []
# First line (from start mark to end of line)
firstLine = screenLines[startY]
startX = min(startMark['x'], len(firstLine))
result.append(firstLine[startX:].rstrip())
# Middle lines (complete lines)
for lineNum in range(startY + 1, endY):
result.append(screenLines[lineNum].rstrip())
# Last line (from start to end mark)
if endY > startY:
lastLine = screenLines[endY]
endX = min(endMark['x'], len(lastLine)) + 1
result.append(lastLine[:endX].rstrip())
return '\n'.join(result)
def run(self):
if not self.env['commandBuffer']['Marks']['1']:
self.env['runtime']['outputManager'].presentText(_("One or two marks are needed"), interrupt=True)
self.env['runtime']['outputManager'].presentText(
_("One or two marks are needed"), interrupt=True)
return
if not self.env['commandBuffer']['Marks']['2']:
self.env['runtime']['cursorManager'].setMark()
# use the last first and the last setted mark as range
startMark = self.env['commandBuffer']['Marks']['1'].copy()
endMark = self.env['commandBuffer']['Marks']['2'].copy()
endMark = self.env['commandBuffer']['Marks']['2'].copy()
# Replace mark_utils.getTextBetweenMarks with our new method
marked = self.getTextFromScreen(startMark, endMark)
self.env['runtime']['memoryManager'].addValueToFirstIndex('clipboardHistory', marked)
self.env['runtime']['memoryManager'].addValueToFirstIndex(
'clipboardHistory', marked)
# reset marks
self.env['runtime']['cursorManager'].clearMarks()
self.env['runtime']['outputManager'].presentText(marked, soundIcon='CopyToClipboard', interrupt=True)
self.env['runtime']['cursorManager'].clearMarks()
self.env['runtime']['outputManager'].presentText(
marked, soundIcon='CopyToClipboard', interrupt=True)
def setCallback(self, callback):
pass
@@ -5,22 +5,32 @@
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(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'].isIndexListEmpty('clipboardHistory'):
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
return
clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory')
self.env['runtime']['outputManager'].presentText(clipboard , interrupt=True)
if self.env['runtime']['memoryManager'].isIndexListEmpty(
'clipboardHistory'):
self.env['runtime']['outputManager'].presentText(
_('clipboard empty'), interrupt=True)
return
clipboard = self.env['runtime']['memoryManager'].getIndexListElement(
'clipboardHistory')
self.env['runtime']['outputManager'].presentText(
clipboard, interrupt=True)
def setCallback(self, callback):
pass
@@ -5,21 +5,29 @@
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('reads the contents of the current screen')
return _('reads the contents of the current screen')
def run(self):
if self.env['screen']['newContentText'].isspace():
self.env['runtime']['outputManager'].presentText(_("screen is empty"), soundIcon='EmptyLine', interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(self.env['screen']['newContentText'],interrupt=True)
self.env['runtime']['outputManager'].presentText(
_("screen is empty"), soundIcon='EmptyLine', interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(
self.env['screen']['newContentText'], interrupt=True)
def setCallback(self, callback):
pass
@@ -4,28 +4,37 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import mark_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(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
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
textAfterCursor = mark_utils.getTextAfterMark(cursorPos, self.env['screen']['newContentText'])
textAfterCursor = mark_utils.getTextAfterMark(
cursorPos, self.env['screen']['newContentText'])
if textAfterCursor.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True)
self.env['runtime']['outputManager'].presentText(
_("blank"), soundIcon='EmptyLine', interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(textAfterCursor, interrupt=True)
self.env['runtime']['outputManager'].presentText(
textAfterCursor, interrupt=True)
def setCallback(self, callback):
pass
@@ -4,17 +4,23 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import mark_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(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
@@ -23,13 +29,15 @@ class command():
else:
cursorPos = self.env['screen']['newCursor'].copy()
textBeforeCursor = mark_utils.getTextBeforeMark(cursorPos, self.env['screen']['newContentText'])
textBeforeCursor = mark_utils.getTextBeforeMark(
cursorPos, self.env['screen']['newContentText'])
if textBeforeCursor.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True)
self.env['runtime']['outputManager'].presentText(
_("blank"), soundIcon='EmptyLine', interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(textBeforeCursor, interrupt=True)
self.env['runtime']['outputManager'].presentText(
textBeforeCursor, interrupt=True)
def setCallback(self, callback):
pass
@@ -5,21 +5,30 @@
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('get current quick menu entry')
def run(self):
menu = ''
value = ''
menu = self.env['runtime']['quickMenuManager'].getCurrentEntry()
if menu != '':
value = self.env['runtime']['quickMenuManager'].getCurrentValue()
self.env['runtime']['outputManager'].presentText(menu + ' ' + value, interrupt=True)
self.env['runtime']['outputManager'].presentText(
menu + ' ' + value, interrupt=True)
def setCallback(self, callback):
pass
@@ -5,17 +5,25 @@
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('get current quick menu value')
def run(self):
value = self.env['runtime']['quickMenuManager'].getCurrentValue()
self.env['runtime']['outputManager'].presentText(value, interrupt=True)
def setCallback(self, callback):
pass
@@ -5,20 +5,29 @@
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
def getDescription(self):
return _('Column number for cursor')
return _('Column number for cursor')
def run(self):
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
self.env['runtime']['outputManager'].presentText(str(cursorPos['x'] + 1) , interrupt=True)
self.env['runtime']['outputManager'].presentText(
str(cursorPos['x'] + 1), interrupt=True)
self.env['runtime']['outputManager'].announceActiveCursor()
self.env['runtime']['outputManager'].presentText(' column number' , interrupt=False)
self.env['runtime']['outputManager'].presentText(
' column number', interrupt=False)
def setCallback(self, callback):
pass
@@ -5,20 +5,29 @@
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
def getDescription(self):
return _('Line number for cursor')
return _('Line number for cursor')
def run(self):
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
self.env['runtime']['outputManager'].presentText(str(cursorPos['y'] + 1), interrupt=True)
self.env['runtime']['outputManager'].presentText(
str(cursorPos['y'] + 1), interrupt=True)
self.env['runtime']['outputManager'].announceActiveCursor()
self.env['runtime']['outputManager'].presentText(' line number' , interrupt=False)
self.env['runtime']['outputManager'].presentText(
' line number', interrupt=False)
def setCallback(self, callback):
pass
@@ -5,21 +5,32 @@
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(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
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
self.env['runtime']['outputManager'].presentText(_("line {0}, column {1}, Terminal {2}").format(cursorPos['y']+1, cursorPos['x']+1, self.env['screen']['newTTY']), interrupt=True)
self.env['runtime']['outputManager'].presentText(
_("line {0}, column {1}, Terminal {2}").format(
cursorPos['y'] + 1,
cursorPos['x'] + 1,
self.env['screen']['newTTY']),
interrupt=True)
def setCallback(self, callback):
pass
@@ -4,29 +4,38 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import line_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('read line to cursor pos, use review cursor if you are in review mode, otherwhise use text cursor')
return _(
'read line to cursor pos, use review cursor if you are in review mode, otherwhise use text cursor')
def run(self):
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
x, y, currLine = \
line_utils.getCurrentLine(cursorPos['x'], cursorPos['y'], self.env['screen']['newContentText'])
x, y, currLine = line_utils.getCurrentLine(
cursorPos['x'], cursorPos['y'], self.env['screen']['newContentText'])
if currLine.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True)
self.env['runtime']['outputManager'].presentText(
_("blank"), soundIcon='EmptyLine', interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(currLine[:cursorPos['x']], interrupt=True)
self.env['runtime']['outputManager'].presentText(
currLine[:cursorPos['x']], interrupt=True)
self.env['runtime']['outputManager'].announceActiveCursor()
def setCallback(self, callback):
pass
@@ -4,29 +4,38 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import line_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('read to end of line, use review cursor if you are in review mode, otherwhise use text cursor')
return _(
'read to end of line, use review cursor if you are in review mode, otherwhise use text cursor')
def run(self):
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
x, y, currLine = \
line_utils.getCurrentLine(cursorPos['x'], cursorPos['y'], self.env['screen']['newContentText'])
x, y, currLine = line_utils.getCurrentLine(
cursorPos['x'], cursorPos['y'], self.env['screen']['newContentText'])
if currLine.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True)
self.env['runtime']['outputManager'].presentText(
_("blank"), soundIcon='EmptyLine', interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(currLine[cursorPos['x']:], interrupt=True)
self.env['runtime']['outputManager'].presentText(
currLine[cursorPos['x']:], interrupt=True)
self.env['runtime']['outputManager'].announceActiveCursor()
def setCallback(self, callback):
pass
@@ -4,23 +4,29 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.core import debug
import os
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('cycles between available keyboard layouts')
def getAvailableLayouts(self):
"""Get list of available keyboard layout files"""
layouts = []
# Check standard locations for keyboard layouts
settingsRoot = '/etc/fenrirscreenreader/'
if not os.path.exists(settingsRoot):
@@ -28,34 +34,37 @@ class command():
import fenrirscreenreader
fenrirPath = os.path.dirname(fenrirscreenreader.__file__)
settingsRoot = fenrirPath + '/../../config/'
keyboardPath = settingsRoot + 'keyboard/'
if os.path.exists(keyboardPath):
for file in os.listdir(keyboardPath):
if file.endswith('.conf') and not file.startswith('__') and not file.lower().startswith('pty'):
if file.endswith('.conf') and not file.startswith(
'__') and not file.lower().startswith('pty'):
layout_name = file.replace('.conf', '')
if layout_name not in layouts:
layouts.append(layout_name)
# Ensure we have at least basic layouts
if not layouts:
layouts = ['desktop', 'laptop']
else:
layouts.sort()
return layouts
def run(self):
current_layout = self.env['runtime']['settingsManager'].getSetting('keyboard', 'keyboardLayout')
current_layout = self.env['runtime']['settingsManager'].getSetting(
'keyboard', 'keyboardLayout')
# Extract layout name from full path if needed
if '/' in current_layout:
current_layout = os.path.basename(current_layout).replace('.conf', '')
current_layout = os.path.basename(
current_layout).replace('.conf', '')
# Get available layouts
available_layouts = self.getAvailableLayouts()
# Find next layout in cycle
try:
current_index = available_layouts.index(current_layout)
@@ -63,28 +72,29 @@ class command():
except ValueError:
# If current layout not found, start from beginning
next_index = 0
next_layout = available_layouts[next_index]
# Update setting and reload shortcuts
self.env['runtime']['settingsManager'].setSetting('keyboard', 'keyboardLayout', next_layout)
self.env['runtime']['settingsManager'].setSetting(
'keyboard', 'keyboardLayout', next_layout)
# Reload shortcuts with new layout
try:
self.env['runtime']['inputManager'].reloadShortcuts()
self.env['runtime']['outputManager'].presentText(
_('Switched to {} keyboard layout').format(next_layout),
_('Switched to {} keyboard layout').format(next_layout),
interrupt=True
)
except Exception as e:
self.env['runtime']['debug'].writeDebugOut(
"Error reloading shortcuts: " + str(e),
"Error reloading shortcuts: " + str(e),
debug.debugLevel.ERROR
)
self.env['runtime']['outputManager'].presentText(
_('Error switching keyboard layout'),
_('Error switching keyboard layout'),
interrupt=True
)
def setCallback(self, callback):
pass
pass
@@ -4,26 +4,36 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import datetime
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('presents the date')
return _('presents the date')
def run(self):
dateFormat = self.env['runtime']['settingsManager'].getSetting('general', 'dateFormat')
dateFormat = self.env['runtime']['settingsManager'].getSetting(
'general', 'dateFormat')
# get the time formatted
dateString = datetime.datetime.strftime(datetime.datetime.now(), dateFormat)
dateString = datetime.datetime.strftime(
datetime.datetime.now(), dateFormat)
# present the time via speak and braile, there is no soundicon, interrupt the current speech
self.env['runtime']['outputManager'].presentText(dateString , soundIcon='', interrupt=True)
# present the time via speak and braile, there is no soundicon,
# interrupt the current speech
self.env['runtime']['outputManager'].presentText(
dateString, soundIcon='', interrupt=True)
def setCallback(self, callback):
pass
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import os
import importlib.util
_base_path = os.path.join(os.path.dirname(__file__), 'adjustment_base.py')
@@ -12,6 +14,7 @@ _module = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_module)
AdjustmentCommand = _module.AdjustmentCommand
class command(AdjustmentCommand):
def __init__(self):
super().__init__('alsa', 'volume', 'dec')
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import os
import importlib.util
_base_path = os.path.join(os.path.dirname(__file__), 'adjustment_base.py')
@@ -12,6 +14,7 @@ _module = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_module)
AdjustmentCommand = _module.AdjustmentCommand
class command(AdjustmentCommand):
def __init__(self):
super().__init__('sound', 'volume', 'dec')
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import os
import importlib.util
_base_path = os.path.join(os.path.dirname(__file__), 'adjustment_base.py')
@@ -12,6 +14,7 @@ _module = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_module)
AdjustmentCommand = _module.AdjustmentCommand
class command(AdjustmentCommand):
def __init__(self):
super().__init__('speech', 'pitch', 'dec')
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import os
import importlib.util
_base_path = os.path.join(os.path.dirname(__file__), 'adjustment_base.py')
@@ -12,6 +14,7 @@ _module = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_module)
AdjustmentCommand = _module.AdjustmentCommand
class command(AdjustmentCommand):
def __init__(self):
super().__init__('speech', 'rate', 'dec')
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import os
import importlib.util
_base_path = os.path.join(os.path.dirname(__file__), 'adjustment_base.py')
@@ -12,6 +14,7 @@ _module = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_module)
AdjustmentCommand = _module.AdjustmentCommand
class command(AdjustmentCommand):
def __init__(self):
super().__init__('speech', 'volume', 'dec')
@@ -5,23 +5,31 @@
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('exits review mode')
return _('exits review mode')
def run(self):
if not self.env['runtime']['cursorManager'].isReviewMode():
self.env['runtime']['outputManager'].presentText(_("Not in Review Mode"), interrupt=True)
return
self.env['runtime']['outputManager'].presentText(
_("Not in Review Mode"), interrupt=True)
return
self.env['runtime']['cursorManager'].clearReviewCursor()
self.env['runtime']['outputManager'].presentText(_("Exiting Review Mode"), interrupt=True)
self.env['runtime']['outputManager'].presentText(
_("Exiting Review Mode"), interrupt=True)
def setCallback(self, callback):
pass
@@ -4,36 +4,55 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.core import debug
import os
class command():
def __init__(self):
pass
def initialize(self, environment, scriptPath=''):
self.env = environment
def shutdown(self):
pass
def getDescription(self):
return _('export the current fenrir clipboard to a file')
def run(self):
clipboardFilePath = self.env['runtime']['settingsManager'].getSetting('general', 'clipboardExportPath')
clipboardFilePath = clipboardFilePath.replace('$user',self.env['general']['currUser'])
clipboardFilePath = clipboardFilePath.replace('$USER',self.env['general']['currUser'])
clipboardFilePath = clipboardFilePath.replace('$User',self.env['general']['currUser'])
clipboardFile = open(clipboardFilePath,'w')
def run(self):
clipboardFilePath = self.env['runtime']['settingsManager'].getSetting(
'general', 'clipboardExportPath')
clipboardFilePath = clipboardFilePath.replace(
'$user', self.env['general']['currUser'])
clipboardFilePath = clipboardFilePath.replace(
'$USER', self.env['general']['currUser'])
clipboardFilePath = clipboardFilePath.replace(
'$User', self.env['general']['currUser'])
clipboardFile = open(clipboardFilePath, 'w')
try:
if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'):
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
return
clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory')
if self.env['runtime']['memoryManager'].isIndexListEmpty(
'clipboardHistory'):
self.env['runtime']['outputManager'].presentText(
_('clipboard empty'), interrupt=True)
return
clipboard = self.env['runtime']['memoryManager'].getIndexListElement(
'clipboardHistory')
clipboardFile.write(clipboard)
clipboardFile.close()
os.chmod(clipboardFilePath, 0o644)
self.env['runtime']['outputManager'].presentText(_('clipboard exported to file'), interrupt=True)
self.env['runtime']['outputManager'].presentText(
_('clipboard exported to file'), interrupt=True)
except Exception as e:
self.env['runtime']['debug'].writeDebugOut('export_clipboard_to_file:run: Filepath:'+ clipboardFile +' trace:' + str(e),debug.debugLevel.ERROR)
self.env['runtime']['debug'].writeDebugOut(
'export_clipboard_to_file:run: Filepath:' +
clipboardFile +
' trace:' +
str(e),
debug.debugLevel.ERROR)
def setCallback(self, callback):
pass
@@ -4,37 +4,48 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import os
import importlib
import _thread
import pyperclip
class command():
def __init__(self):
pass
def initialize(self, environment, scriptPath=''):
self.env = environment
self.scriptPath = scriptPath
def shutdown(self):
pass
def getDescription(self):
return _('Export current fenrir clipboard to X or GUI clipboard')
def run(self):
_thread.start_new_thread(self._threadRun , ())
def run(self):
_thread.start_new_thread(self._threadRun, ())
def _threadRun(self):
try:
# Check if clipboard is empty
if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'):
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
if self.env['runtime']['memoryManager'].isIndexListEmpty(
'clipboardHistory'):
self.env['runtime']['outputManager'].presentText(
_('clipboard empty'), interrupt=True)
return
# Get current clipboard content
clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory')
clipboard = self.env['runtime']['memoryManager'].getIndexListElement(
'clipboardHistory')
# Remember original display environment variable if it exists
originalDisplay = os.environ.get('DISPLAY', '')
success = False
# Try different display options
for i in range(10):
display = f":{i}"
@@ -42,29 +53,34 @@ class command():
# Set display environment variable
os.environ['DISPLAY'] = display
# Attempt to set clipboard content
importlib.reload(pyperclip) # Weird workaround for some distros
# Weird workaround for some distros
importlib.reload(pyperclip)
pyperclip.copy(clipboard)
# If we get here without exception, we found a working display
# If we get here without exception, we found a working
# display
success = True
break
except Exception:
# Failed for this display, try next one
continue
# Restore original display setting
if originalDisplay:
os.environ['DISPLAY'] = originalDisplay
else:
os.environ.pop('DISPLAY', None)
# Notify the user of the result
if success:
self.env['runtime']['outputManager'].presentText(_('exported to the X session.'), interrupt=True)
self.env['runtime']['outputManager'].presentText(
_('exported to the X session.'), interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(_('failed to export to X clipboard. No available display found.'), interrupt=True)
self.env['runtime']['outputManager'].presentText(
_('failed to export to X clipboard. No available display found.'), interrupt=True)
except Exception as e:
self.env['runtime']['outputManager'].presentText(str(e), soundIcon='', interrupt=False)
self.env['runtime']['outputManager'].presentText(
str(e), soundIcon='', interrupt=False)
def setCallback(self, callback):
pass
@@ -5,23 +5,33 @@
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('selects the first clipboard')
return _('selects the first clipboard')
def run(self):
if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'):
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
if self.env['runtime']['memoryManager'].isIndexListEmpty(
'clipboardHistory'):
self.env['runtime']['outputManager'].presentText(
_('clipboard empty'), interrupt=True)
return
self.env['runtime']['memoryManager'].setFirstIndex('clipboardHistory')
clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory')
self.env['runtime']['outputManager'].presentText(clipboard, interrupt=True)
self.env['runtime']['memoryManager'].setFirstIndex('clipboardHistory')
clipboard = self.env['runtime']['memoryManager'].getIndexListElement(
'clipboardHistory')
self.env['runtime']['outputManager'].presentText(
clipboard, interrupt=True)
def setCallback(self, callback):
pass
@@ -5,19 +5,26 @@
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(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'].presentText(_('Forward next keypress'), interrupt=True)
self.env['runtime']['outputManager'].presentText(
_('Forward next keypress'), interrupt=True)
def setCallback(self, callback):
pass
@@ -4,35 +4,48 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import mark_utils
import os
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('imports text from clipboard file to the clipboard')
return _('imports text from clipboard file to the clipboard')
def run(self):
clipboardFilePath = self.env['runtime']['settingsManager'].getSetting('general', 'clipboardExportPath')
clipboardFilePath = clipboardFilePath.replace('$user',self.env['general']['currUser'])
clipboardFilePath = clipboardFilePath.replace('$USER',self.env['general']['currUser'])
clipboardFilePath = clipboardFilePath.replace('$User',self.env['general']['currUser'])
clipboardFilePath = self.env['runtime']['settingsManager'].getSetting(
'general', 'clipboardExportPath')
clipboardFilePath = clipboardFilePath.replace(
'$user', self.env['general']['currUser'])
clipboardFilePath = clipboardFilePath.replace(
'$USER', self.env['general']['currUser'])
clipboardFilePath = clipboardFilePath.replace(
'$User', self.env['general']['currUser'])
if not os.path.exists(clipboardFilePath):
self.env['runtime']['outputManager'].presentText(_('File does not exist'), soundIcon='', interrupt=True)
self.env['runtime']['outputManager'].presentText(
_('File does not exist'), soundIcon='', interrupt=True)
return
clipboardFile = open(clipboardFilePath,'r')
clipboardFile = open(clipboardFilePath, 'r')
imported = clipboardFile.read()
clipboardFile.close()
self.env['runtime']['memoryManager'].addValueToFirstIndex('clipboardHistory', imported)
self.env['runtime']['memoryManager'].addValueToFirstIndex(
'clipboardHistory', imported)
self.env['runtime']['outputManager'].presentText('Import to Clipboard', soundIcon='CopyToClipboard', interrupt=True)
self.env['runtime']['outputManager'].presentText(imported, soundIcon='', interrupt=False)
self.env['runtime']['outputManager'].presentText(
'Import to Clipboard', soundIcon='CopyToClipboard', interrupt=True)
self.env['runtime']['outputManager'].presentText(
imported, soundIcon='', interrupt=False)
def setCallback(self, callback):
pass
@@ -4,29 +4,37 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import importlib
import _thread
import pyperclip
import os
class command():
def __init__(self):
pass
def initialize(self, environment, scriptPath=''):
self.env = environment
self.scriptPath = scriptPath
def shutdown(self):
pass
def getDescription(self):
return _("imports the graphical clipboard to Fenrir's clipboard")
def run(self):
_thread.start_new_thread(self._threadRun , ())
def run(self):
_thread.start_new_thread(self._threadRun, ())
def _threadRun(self):
try:
# Remember original display environment variable if it exists
originalDisplay = os.environ.get('DISPLAY', '')
clipboardContent = None
# Try different display options
for i in range(10):
display = f":{i}"
@@ -34,30 +42,37 @@ class command():
# Set display environment variable
os.environ['DISPLAY'] = display
# Attempt to get clipboard content
importlib.reload(pyperclip) # Weird workaround for some distros
# Weird workaround for some distros
importlib.reload(pyperclip)
clipboardContent = pyperclip.paste()
# If we get here without exception, we found a working display
# If we get here without exception, we found a working
# display
if clipboardContent:
break
except Exception:
# Failed for this display, try next one
continue
# Restore original display setting
if originalDisplay:
os.environ['DISPLAY'] = originalDisplay
else:
os.environ.pop('DISPLAY', None)
# Process the clipboard content if we found any
if clipboardContent and isinstance(clipboardContent, str):
self.env['runtime']['memoryManager'].addValueToFirstIndex('clipboardHistory', clipboardContent)
self.env['runtime']['outputManager'].presentText('Import to Clipboard', soundIcon='CopyToClipboard', interrupt=True)
self.env['runtime']['outputManager'].presentText(clipboardContent, soundIcon='', interrupt=False)
self.env['runtime']['memoryManager'].addValueToFirstIndex(
'clipboardHistory', clipboardContent)
self.env['runtime']['outputManager'].presentText(
'Import to Clipboard', soundIcon='CopyToClipboard', interrupt=True)
self.env['runtime']['outputManager'].presentText(
clipboardContent, soundIcon='', interrupt=False)
else:
self.env['runtime']['outputManager'].presentText('No text found in clipboard or no accessible display', interrupt=True)
self.env['runtime']['outputManager'].presentText(
'No text found in clipboard or no accessible display', interrupt=True)
except Exception as e:
self.env['runtime']['outputManager'].presentText(str(e), soundIcon='', interrupt=False)
self.env['runtime']['outputManager'].presentText(
str(e), soundIcon='', interrupt=False)
def setCallback(self, callback):
pass
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import os
import importlib.util
_base_path = os.path.join(os.path.dirname(__file__), 'adjustment_base.py')
@@ -12,6 +14,7 @@ _module = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_module)
AdjustmentCommand = _module.AdjustmentCommand
class command(AdjustmentCommand):
def __init__(self):
super().__init__('alsa', 'volume', 'inc')
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import os
import importlib.util
_base_path = os.path.join(os.path.dirname(__file__), 'adjustment_base.py')
@@ -12,6 +14,7 @@ _module = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_module)
AdjustmentCommand = _module.AdjustmentCommand
class command(AdjustmentCommand):
def __init__(self):
super().__init__('sound', 'volume', 'inc')
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import os
import importlib.util
_base_path = os.path.join(os.path.dirname(__file__), 'adjustment_base.py')
@@ -12,6 +14,7 @@ _module = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_module)
AdjustmentCommand = _module.AdjustmentCommand
class command(AdjustmentCommand):
def __init__(self):
super().__init__('speech', 'pitch', 'inc')
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import os
import importlib.util
_base_path = os.path.join(os.path.dirname(__file__), 'adjustment_base.py')
@@ -12,6 +14,7 @@ _module = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_module)
AdjustmentCommand = _module.AdjustmentCommand
class command(AdjustmentCommand):
def __init__(self):
super().__init__('speech', 'rate', 'inc')
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import os
import importlib.util
_base_path = os.path.join(os.path.dirname(__file__), 'adjustment_base.py')
@@ -12,6 +14,7 @@ _module = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_module)
AdjustmentCommand = _module.AdjustmentCommand
class command(AdjustmentCommand):
def __init__(self):
super().__init__('speech', 'volume', 'inc')
@@ -4,17 +4,23 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import line_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(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
@@ -23,13 +29,15 @@ class command():
cursorPos = self.env['screen']['newCursorReview'].copy()
else:
cursorPos = self.env['screen']['newCursor'].copy()
x, y, currLine = \
line_utils.getCurrentLine(cursorPos['x'], cursorPos['y'], self.env['screen']['newContentText'])
x, y, currLine = line_utils.getCurrentLine(
cursorPos['x'], cursorPos['y'], self.env['screen']['newContentText'])
if currLine.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(_("indent {0}").format(len(currLine) - len(currLine.lstrip())), interrupt=True)
self.env['runtime']['outputManager'].presentText(
_("blank"), soundIcon='EmptyLine', interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(_("indent {0}").format(
len(currLine) - len(currLine.lstrip())), interrupt=True)
def setCallback(self, callback):
pass
@@ -5,23 +5,33 @@
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('selects the last clipboard')
return _('selects the last clipboard')
def run(self):
if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'):
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
if self.env['runtime']['memoryManager'].isIndexListEmpty(
'clipboardHistory'):
self.env['runtime']['outputManager'].presentText(
_('clipboard empty'), interrupt=True)
return
self.env['runtime']['memoryManager'].setLastIndex('clipboardHistory')
clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory')
self.env['runtime']['outputManager'].presentText(clipboard, interrupt=True)
self.env['runtime']['memoryManager'].setLastIndex('clipboardHistory')
clipboard = self.env['runtime']['memoryManager'].getIndexListElement(
'clipboardHistory')
self.env['runtime']['outputManager'].presentText(
clipboard, interrupt=True)
def setCallback(self, callback):
pass
@@ -4,34 +4,45 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import mark_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('Presents the currently selected text that will be copied to the clipboard')
return _(
'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'].presentText(_("please set begin and endmark"), interrupt=True)
if not (self.env['commandBuffer']['Marks']['1'] and
self.env['commandBuffer']['Marks']['2']):
self.env['runtime']['outputManager'].presentText(
_("please set begin and endmark"), interrupt=True)
return
# use the last first and the last setted mark as range
startMark = self.env['commandBuffer']['Marks']['1'].copy()
endMark = self.env['commandBuffer']['Marks']['2'].copy()
endMark = self.env['commandBuffer']['Marks']['2'].copy()
marked = mark_utils.getTextBetweenMarks(startMark, endMark, self.env['screen']['newContentText'])
marked = mark_utils.getTextBetweenMarks(
startMark, endMark, self.env['screen']['newContentText'])
if marked.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True)
self.env['runtime']['outputManager'].presentText(
_("blank"), soundIcon='EmptyLine', interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(marked, interrupt=True)
self.env['runtime']['outputManager'].presentText(
marked, interrupt=True)
def setCallback(self, callback):
pass
@@ -5,31 +5,45 @@
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('selects the next clipboard')
return _('selects the next clipboard')
def run(self):
if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'):
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
return
self.env['runtime']['memoryManager'].getNextIndex('clipboardHistory')
isFirst = self.env['runtime']['memoryManager'].isFirstIndex('clipboardHistory')
isLast = self.env['runtime']['memoryManager'].isLastIndex('clipboardHistory')
clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory')
if self.env['runtime']['memoryManager'].isIndexListEmpty(
'clipboardHistory'):
self.env['runtime']['outputManager'].presentText(
_('clipboard empty'), interrupt=True)
return
self.env['runtime']['memoryManager'].getNextIndex('clipboardHistory')
isFirst = self.env['runtime']['memoryManager'].isFirstIndex(
'clipboardHistory')
isLast = self.env['runtime']['memoryManager'].isLastIndex(
'clipboardHistory')
clipboard = self.env['runtime']['memoryManager'].getIndexListElement(
'clipboardHistory')
if isFirst:
self.env['runtime']['outputManager'].presentText(_('First clipboard '), interrupt=True)
self.env['runtime']['outputManager'].presentText(
_('First clipboard '), interrupt=True)
if isLast:
self.env['runtime']['outputManager'].presentText(_('Last clipboard '), interrupt=True)
speechInterrupt = not(isLast or isFirst)
self.env['runtime']['outputManager'].presentText(clipboard, interrupt = speechInterrupt)
self.env['runtime']['outputManager'].presentText(
_('Last clipboard '), interrupt=True)
speechInterrupt = not (isLast or isFirst)
self.env['runtime']['outputManager'].presentText(
clipboard, interrupt=speechInterrupt)
def setCallback(self, callback):
pass
@@ -5,15 +5,22 @@
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('get next quick menu entry')
def run(self):
menu = ''
value = ''
@@ -21,8 +28,11 @@ class command():
menu = self.env['runtime']['quickMenuManager'].getCurrentEntry()
if menu != '':
value = self.env['runtime']['quickMenuManager'].getCurrentValue()
self.env['runtime']['outputManager'].presentText(menu + ' ' + value, interrupt=True)
self.env['runtime']['outputManager'].presentText(
menu + ' ' + value, interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(_('Quick menu not available'), interrupt=True)
self.env['runtime']['outputManager'].presentText(
_('Quick menu not available'), interrupt=True)
def setCallback(self, callback):
pass
@@ -5,18 +5,27 @@
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('get next quick menu value')
def run(self):
if self.env['runtime']['quickMenuManager'].nextValue():
value = self.env['runtime']['quickMenuManager'].getCurrentValue()
self.env['runtime']['outputManager'].presentText(value, interrupt=True)
self.env['runtime']['outputManager'].presentText(
value, interrupt=True)
def setCallback(self, callback):
pass
@@ -4,26 +4,38 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import time
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
self.env['runtime']['memoryManager'].addIndexList('clipboardHistory', self.env['runtime']['settingsManager'].getSettingAsInt('general', 'numberOfClipboards'))
self.env['runtime']['memoryManager'].addIndexList(
'clipboardHistory', self.env['runtime']['settingsManager'].getSettingAsInt(
'general', 'numberOfClipboards'))
def shutdown(self):
pass
pass
def getDescription(self):
return _('pastes the text from the currently selected clipboard')
def run(self):
if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'):
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
return
self.env['runtime']['outputManager'].presentText('paste clipboard', soundIcon='PasteClipboardOnScreen', interrupt=True)
clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory')
return _('pastes the text from the currently selected clipboard')
def run(self):
if self.env['runtime']['memoryManager'].isIndexListEmpty(
'clipboardHistory'):
self.env['runtime']['outputManager'].presentText(
_('clipboard empty'), interrupt=True)
return
self.env['runtime']['outputManager'].presentText(
'paste clipboard', soundIcon='PasteClipboardOnScreen', interrupt=True)
clipboard = self.env['runtime']['memoryManager'].getIndexListElement(
'clipboardHistory')
self.env['runtime']['screenManager'].injectTextToScreen(clipboard)
def setCallback(self, callback):
pass
@@ -4,26 +4,34 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import line_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
def getDescription(self):
return _('present first line')
def run(self):
x, y, firstLine = \
line_utils.getCurrentLine(0, 0, self.env['screen']['newContentText'])
if firstLine.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(firstLine, interrupt=True)
def setCallback(self, callback):
pass
def getDescription(self):
return _('present first line')
def run(self):
x, y, firstLine = line_utils.getCurrentLine(
0, 0, self.env['screen']['newContentText'])
if firstLine.isspace():
self.env['runtime']['outputManager'].presentText(
_("blank"), soundIcon='EmptyLine', interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(
firstLine, interrupt=True)
def setCallback(self, callback):
pass
@@ -4,26 +4,34 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import line_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
def getDescription(self):
return _('current line')
def run(self):
x, y, lastLine = \
line_utils.getCurrentLine(0, self.env['screen']['lines'] -1, self.env['screen']['newContentText'])
if lastLine.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(lastLine, interrupt=True)
def setCallback(self, callback):
def shutdown(self):
pass
def getDescription(self):
return _('current line')
def run(self):
x, y, lastLine = line_utils.getCurrentLine(
0, self.env['screen']['lines'] - 1, self.env['screen']['newContentText'])
if lastLine.isspace():
self.env['runtime']['outputManager'].presentText(
_("blank"), soundIcon='EmptyLine', interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(
lastLine, interrupt=True)
def setCallback(self, callback):
pass
@@ -5,30 +5,44 @@
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('selects the previous clipboard')
return _('selects the previous clipboard')
def run(self):
if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'):
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
return
self.env['runtime']['memoryManager'].setPrefIndex('clipboardHistory')
isFirst = self.env['runtime']['memoryManager'].isFirstIndex('clipboardHistory')
isLast = self.env['runtime']['memoryManager'].isLastIndex('clipboardHistory')
clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory')
if self.env['runtime']['memoryManager'].isIndexListEmpty(
'clipboardHistory'):
self.env['runtime']['outputManager'].presentText(
_('clipboard empty'), interrupt=True)
return
self.env['runtime']['memoryManager'].setPrefIndex('clipboardHistory')
isFirst = self.env['runtime']['memoryManager'].isFirstIndex(
'clipboardHistory')
isLast = self.env['runtime']['memoryManager'].isLastIndex(
'clipboardHistory')
clipboard = self.env['runtime']['memoryManager'].getIndexListElement(
'clipboardHistory')
if isFirst:
self.env['runtime']['outputManager'].presentText(_('First clipboard '), interrupt=True)
self.env['runtime']['outputManager'].presentText(
_('First clipboard '), interrupt=True)
if isLast:
self.env['runtime']['outputManager'].presentText(_('Last clipboard '), interrupt=True)
speechInterrupt = not(isLast or isFirst)
self.env['runtime']['outputManager'].presentText(clipboard, interrupt = speechInterrupt)
self.env['runtime']['outputManager'].presentText(
_('Last clipboard '), interrupt=True)
speechInterrupt = not (isLast or isFirst)
self.env['runtime']['outputManager'].presentText(
clipboard, interrupt=speechInterrupt)
def setCallback(self, callback):
pass
@@ -5,15 +5,22 @@
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('get previous quick menu entry')
def run(self):
menu = ''
value = ''
@@ -21,8 +28,11 @@ class command():
menu = self.env['runtime']['quickMenuManager'].getCurrentEntry()
if menu != '':
value = self.env['runtime']['quickMenuManager'].getCurrentValue()
self.env['runtime']['outputManager'].presentText(menu + ' ' + value, interrupt=True)
self.env['runtime']['outputManager'].presentText(
menu + ' ' + value, interrupt=True)
else:
self.env['runtime']['outputManager'].presentText(_('Quick menu not available'), interrupt=True)
self.env['runtime']['outputManager'].presentText(
_('Quick menu not available'), interrupt=True)
def setCallback(self, callback):
pass
@@ -5,18 +5,27 @@
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('get previous quick menu value')
def run(self):
if self.env['runtime']['quickMenuManager'].prevValue():
value = self.env['runtime']['quickMenuManager'].getCurrentValue()
self.env['runtime']['outputManager'].presentText(value, interrupt=True)
self.env['runtime']['outputManager'].presentText(
value, interrupt=True)
def setCallback(self, callback):
pass
@@ -4,68 +4,75 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
import re
import time
import threading
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
# Use commandBuffer like other commands
if 'progressMonitoring' not in self.env['commandBuffer']:
# Check if progress monitoring should be enabled by default from settings
# Check if progress monitoring should be enabled by default from
# settings
try:
defaultEnabled = self.env['runtime']['settingsManager'].getSettingAsBool('sound', 'progressMonitoring')
defaultEnabled = self.env['runtime']['settingsManager'].getSettingAsBool(
'sound', 'progressMonitoring')
except Exception as e:
# If setting doesn't exist, default to False
defaultEnabled = False
self.env['commandBuffer']['progressMonitoring'] = defaultEnabled
self.env['commandBuffer']['lastProgressTime'] = 0
self.env['commandBuffer']['lastProgressValue'] = -1
def shutdown(self):
self.stopProgressMonitoring()
def getDescription(self):
return _('Toggle progress bar monitoring with ascending tones')
def run(self):
# Check if commandBuffer exists
if 'progressMonitoring' not in self.env['commandBuffer']:
self.env['commandBuffer']['progressMonitoring'] = False
self.env['commandBuffer']['lastProgressTime'] = 0
self.env['commandBuffer']['lastProgressValue'] = -1
if self.env['commandBuffer']['progressMonitoring']:
self.stopProgressMonitoring()
self.env['runtime']['outputManager'].presentText(_("Progress monitoring disabled"), interrupt=True)
self.env['runtime']['outputManager'].presentText(
_("Progress monitoring disabled"), interrupt=True)
else:
self.startProgressMonitoring()
self.env['runtime']['outputManager'].presentText(_("Progress monitoring enabled"), interrupt=True)
self.env['runtime']['outputManager'].presentText(
_("Progress monitoring enabled"), interrupt=True)
def startProgressMonitoring(self):
self.env['commandBuffer']['progressMonitoring'] = True
self.env['commandBuffer']['lastProgressTime'] = time.time()
self.env['commandBuffer']['lastProgressValue'] = -1
# Don't control speech - let user decide with silence_until_prompt
def stopProgressMonitoring(self):
self.env['commandBuffer']['progressMonitoring'] = False
# Don't control speech - progress monitor is beep-only
def detectProgress(self, text):
if not self.env['commandBuffer']['progressMonitoring']:
return
# Skip progress detection if current screen looks like a prompt
if self.isCurrentLinePrompt():
return
currentTime = time.time()
# Pattern 1: Percentage (50%, 25.5%, etc.)
percentMatch = re.search(r'(\d+(?:\.\d+)?)\s*%', text)
if percentMatch:
@@ -75,7 +82,7 @@ class command():
self.env['commandBuffer']['lastProgressValue'] = percentage
self.env['commandBuffer']['lastProgressTime'] = currentTime
return
# Pattern 2: Fraction (15/100, 3 of 10, etc.)
fractionMatch = re.search(r'(\d+)\s*(?:of|/)\s*(\d+)', text)
if fractionMatch:
@@ -88,7 +95,7 @@ class command():
self.env['commandBuffer']['lastProgressValue'] = percentage
self.env['commandBuffer']['lastProgressTime'] = currentTime
return
# Pattern 3: Progress bars ([#### ], [====> ], etc.)
# Improved pattern to avoid matching IRC channels like [#channel]
barMatch = re.search(r'\[([#=\-\*]+)([\s\.]*)\]', text)
@@ -96,114 +103,133 @@ class command():
filled = len(barMatch.group(1))
unfilled = len(barMatch.group(2))
total = filled + unfilled
# Require at least 2 progress chars total and unfilled portion must be spaces/dots
if total >= 2 and (not barMatch.group(2) or re.match(r'^[\s\.]*$', barMatch.group(2))):
# Require at least 2 progress chars total and unfilled portion must
# be spaces/dots
if total >= 2 and (
not barMatch.group(2) or re.match(
r'^[\s\.]*$',
barMatch.group(2))):
percentage = (filled / total) * 100
if percentage != self.env['commandBuffer']['lastProgressValue']:
self.playProgressTone(percentage)
self.env['commandBuffer']['lastProgressValue'] = percentage
self.env['commandBuffer']['lastProgressTime'] = currentTime
return
# Pattern 4: Generic activity indicators (Loading..., Working..., etc.)
activityPattern = re.search(r'(loading|processing|working|installing|downloading|compiling|building).*\.{2,}', text, re.IGNORECASE)
activityPattern = re.search(
r'(loading|processing|working|installing|downloading|compiling|building).*\.{2,}',
text,
re.IGNORECASE)
if activityPattern:
# Play a steady beep every 2 seconds for ongoing activity
if currentTime - self.env['commandBuffer']['lastProgressTime'] >= 2.0:
if currentTime - \
self.env['commandBuffer']['lastProgressTime'] >= 2.0:
self.playActivityBeep()
self.env['commandBuffer']['lastProgressTime'] = currentTime
def playProgressTone(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'].playFrequence(frequency, 0.15, interrupt=False)
self.env['runtime']['outputManager'].playFrequence(
frequency, 0.15, interrupt=False)
def playActivityBeep(self):
# Single tone for generic activity
self.env['runtime']['outputManager'].playFrequence(800, 0.1, interrupt=False)
self.env['runtime']['outputManager'].playFrequence(
800, 0.1, interrupt=False)
def isCurrentLinePrompt(self):
"""Check if the current line looks like a standalone prompt (not command with progress)"""
import re
try:
# Get the current screen content
if not self.env['screen']['newContentText']:
return False
lines = self.env['screen']['newContentText'].split('\n')
if not lines:
return False
# Check the last line (most common) and current cursor line for prompt patterns
# Check the last line (most common) and current cursor line for
# prompt patterns
linesToCheck = []
# Add last line (most common for prompts)
if lines:
linesToCheck.append(lines[-1])
# Add current cursor line if different from last line
if (self.env['screen']['newCursor']['y'] < len(lines) and
self.env['screen']['newCursor']['y'] != len(lines) - 1):
linesToCheck.append(lines[self.env['screen']['newCursor']['y']])
if (self.env['screen']['newCursor']['y'] < len(lines) and
self.env['screen']['newCursor']['y'] != len(lines) - 1):
linesToCheck.append(
lines[self.env['screen']['newCursor']['y']])
# Standalone prompt patterns (no commands mixed in)
standalonePromptPatterns = [
r'^\s*\$\s*$', # Just $ (with whitespace)
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'.*continue\?\s*\[[YyNn]/[YyNn]\].*$', # "continue? [Y/n]" style
# "continue? [Y/n]" style
r'.*continue\?\s*\[[YyNn]/[YyNn]\].*$',
r'^::.*\?\s*\[[YyNn]/[YyNn]\].*$', # pacman style prompts
# Authentication prompts (these ARE standalone)
r'^\[[Ss]udo\]\s*[Pp]assword\s*for\s+.*:\s*$', # [sudo] password
r'^[Pp]assword\s*:\s*$', # Password:
r'.*[Pp]assword\s*:\s*$', # general password prompts
# Continuation prompts (these ARE standalone)
r'^[Pp]ress\s+any\s+key\s+to\s+continue.*$', # Press any key
r'^[Aa]re\s+you\s+sure\?\s*.*$', # Are you sure?
]
for line in linesToCheck:
line = line.strip()
if not line:
continue
# Check if this line contains both a prompt AND other content (like commands)
# If so, don't treat it as a standalone prompt
hasPromptMarker = bool(re.search(r'.*@.*[\\\$#>]', line) or re.search(r'^\[.*\]\s*[\\\$#>]', line))
hasPromptMarker = bool(
re.search(
r'.*@.*[\\\$#>]',
line) or re.search(
r'^\[.*\]\s*[\\\$#>]',
line))
if hasPromptMarker:
# If line has prompt marker but also has significant content after it,
# If line has prompt marker but also has significant content after it,
# it's a command line, not a standalone prompt
promptEnd = max(
line.rfind('$'),
line.rfind('#'),
line.rfind('$'),
line.rfind('#'),
line.rfind('>'),
line.rfind('\\')
)
if promptEnd >= 0 and promptEnd < len(line) - 5: # More than just whitespace after prompt
if promptEnd >= 0 and promptEnd < len(
line) - 5: # More than just whitespace after prompt
continue # This is a command line, not a standalone prompt
for pattern in standalonePromptPatterns:
try:
if re.search(pattern, line):
return True
except re.error:
continue
return False
except Exception as e:
# If anything fails, assume it's not a prompt to be safe
return False
def setCallback(self, callback):
pass
pass
@@ -5,19 +5,24 @@
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('exits Fenrir')
return _('exits Fenrir')
def run(self):
self.env['runtime']['eventManager'].stopMainEventLoop()
self.env['runtime']['eventManager'].stopMainEventLoop()
def setCallback(self, callback):
pass
@@ -5,19 +5,26 @@
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('Removes marks from selected text')
return _('Removes marks from selected text')
def run(self):
self.env['runtime']['cursorManager'].clearMarks()
self.env['runtime']['outputManager'].presentText(_('Remove marks'), interrupt=True)
self.env['runtime']['outputManager'].presentText(
_('Remove marks'), interrupt=True)
def setCallback(self, callback):
pass
@@ -4,6 +4,8 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import word_utils
import string
initialized = False
@@ -12,43 +14,61 @@ try:
initialized = True
except Exception as e:
pass
class command():
def __init__(self):
self.language = ''
self.spellChecker = None
def initialize(self, environment):
self.env = environment
self.updateSpellLanguage()
def shutdown(self):
pass
def getDescription(self):
return _('removes the current word from the exceptions dictionary')
def updateSpellLanguage(self):
self.spellChecker = enchant.Dict(self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage'))
self.language = self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage')
return _('removes the current word from the exceptions dictionary')
def updateSpellLanguage(self):
self.spellChecker = enchant.Dict(
self.env['runtime']['settingsManager'].getSetting(
'general', 'spellCheckLanguage'))
self.language = self.env['runtime']['settingsManager'].getSetting(
'general', 'spellCheckLanguage')
def run(self):
if not initialized:
self.env['runtime']['outputManager'].presentText(_('pyenchant is not installed'), interrupt=True)
return
if self.env['runtime']['settingsManager'].getSetting('general', 'spellCheckLanguage') != self.language:
self.env['runtime']['outputManager'].presentText(
_('pyenchant is not installed'), interrupt=True)
return
if self.env['runtime']['settingsManager'].getSetting(
'general', 'spellCheckLanguage') != self.language:
try:
self.updateSpellLanguage()
except Exception as e:
return
return
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
# get the word
newContent = self.env['screen']['newContentText'].split('\n')[cursorPos['y']]
x, y, currWord, endOfScreen, lineBreak = word_utils.getCurrentWord(cursorPos['x'], 0, newContent)
currWord = currWord.strip(string.whitespace + r'!"#$%&()*+,-./:;<=Â?@[\\]^_{|}~')
newContent = self.env['screen']['newContentText'].split('\n')[
cursorPos['y']]
x, y, currWord, endOfScreen, lineBreak = word_utils.getCurrentWord(
cursorPos['x'], 0, newContent)
currWord = currWord.strip(
string.whitespace +
r'!"#$%&()*+,-./:;<=Â?@[\\]^_{|}~')
if not currWord.isspace():
if self.spellChecker.is_removed(currWord):
self.env['runtime']['outputManager'].presentText(_('{0} is not in the dictionary').format(currWord,), soundIcon='Cancel', interrupt=True)
self.env['runtime']['outputManager'].presentText(
_('{0} is not in the dictionary').format(
currWord,), soundIcon='Cancel', interrupt=True)
else:
self.spellChecker.remove(currWord)
self.env['runtime']['outputManager'].presentText(_('{0} removed').format(currWord,), soundIcon='Accept', interrupt=True)
self.spellChecker.remove(currWord)
self.env['runtime']['outputManager'].presentText(
_('{0} removed').format(currWord,), soundIcon='Accept', interrupt=True)
def setCallback(self, callback):
pass
@@ -5,19 +5,27 @@
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
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'].presentText(_("Bottom"), interrupt=True, flush=False)
self.env['screen']['newCursorReview'] = {
'x': 0, 'y': self.env['screen']['lines'] - 1}
self.env['runtime']['outputManager'].presentText(
_("Bottom"), interrupt=True, flush=False)
def setCallback(self, callback):
pass
@@ -4,32 +4,46 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import char_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('presents the current character.')
return _('presents the current character.')
def run(self):
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currChar = \
char_utils.getCurrentChar(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
char_utils.presentCharForReview(self.env, currChar, interrupt=True, announceCapital=True, flush=False)
# is has attribute it enabled?
if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'hasAttributes'):
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currChar = char_utils.getCurrentChar(
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
char_utils.presentCharForReview(
self.env,
currChar,
interrupt=True,
announceCapital=True,
flush=False)
# is has attribute it enabled?
if self.env['runtime']['settingsManager'].getSettingAsBool(
'general', 'hasAttributes'):
cursorPos = self.env['screen']['newCursorReview']
if not self.env['runtime']['attributeManager'].hasAttributes(cursorPos):
if not self.env['runtime']['attributeManager'].hasAttributes(
cursorPos):
return
self.env['runtime']['outputManager'].presentText('has attribute', soundIcon='HasAttributes', interrupt=False)
self.env['runtime']['outputManager'].presentText(
'has attribute', soundIcon='HasAttributes', interrupt=False)
def setCallback(self, callback):
pass
@@ -4,29 +4,37 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import char_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(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'].enterReviewModeCurrTextCursor()
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currChar = \
char_utils.getCurrentChar(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currChar = char_utils.getCurrentChar(
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
if currChar.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False)
self.env['runtime']['outputManager'].presentText(
_("blank"), interrupt=True, flush=False)
else:
currChar = char_utils.getPhonetic(currChar)
self.env['runtime']['outputManager'].presentText(currChar ,interrupt=True, announceCapital=True, flush=False)
self.env['runtime']['outputManager'].presentText(
currChar, interrupt=True, announceCapital=True, flush=False)
def setCallback(self, callback):
pass
@@ -4,28 +4,36 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import line_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('current line')
return _('current line')
def run(self):
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currLine = \
line_utils.getCurrentLine(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currLine = line_utils.getCurrentLine(
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
if currLine.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False)
self.env['runtime']['outputManager'].presentText(
_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False)
else:
self.env['runtime']['outputManager'].presentText(currLine, interrupt=True, flush=False)
self.env['runtime']['outputManager'].presentText(
currLine, interrupt=True, flush=False)
def setCallback(self, callback):
pass
@@ -4,33 +4,46 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import word_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('current word.')
return _('current word.')
def run(self):
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currWord, endOfScreen, lineBreak = \
word_utils.getCurrentWord(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currWord, endOfScreen, lineBreak = word_utils.getCurrentWord(
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
if currWord.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False)
self.env['runtime']['outputManager'].presentText(
_("blank"), interrupt=True, flush=False)
else:
self.env['runtime']['outputManager'].presentText(currWord, interrupt=True, flush=False)
self.env['runtime']['outputManager'].presentText(
currWord, interrupt=True, flush=False)
if endOfScreen:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen')
if self.env['runtime']['settingsManager'].getSettingAsBool(
'review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText(
_('end of screen'), interrupt=True, soundIcon='EndOfScreen')
if lineBreak:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'):
self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine')
if self.env['runtime']['settingsManager'].getSettingAsBool(
'review', 'lineBreak'):
self.env['runtime']['outputManager'].presentText(
_('line break'), interrupt=False, soundIcon='EndOfLine')
def setCallback(self, callback):
pass
@@ -4,37 +4,50 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import word_utils
from fenrirscreenreader.utils import char_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('Phonetically spells the current word')
return _('Phonetically spells the current word')
def run(self):
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currWord, endOfScreen, lineBreak = \
word_utils.getCurrentWord(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currWord, endOfScreen, lineBreak = word_utils.getCurrentWord(
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
if currWord.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False)
self.env['runtime']['outputManager'].presentText(
_("blank"), interrupt=True, flush=False)
else:
firstSequence = True
for c in currWord:
currChar = char_utils.getPhonetic(c)
self.env['runtime']['outputManager'].presentText(currChar, interrupt=firstSequence, announceCapital=True, flush=False)
currChar = char_utils.getPhonetic(c)
self.env['runtime']['outputManager'].presentText(
currChar, interrupt=firstSequence, announceCapital=True, flush=False)
firstSequence = False
if endOfScreen:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen')
if self.env['runtime']['settingsManager'].getSettingAsBool(
'review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText(
_('end of screen'), interrupt=True, soundIcon='EndOfScreen')
if lineBreak:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'):
self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine')
if self.env['runtime']['settingsManager'].getSettingAsBool(
'review', 'lineBreak'):
self.env['runtime']['outputManager'].presentText(
_('line break'), interrupt=False, soundIcon='EndOfLine')
def setCallback(self, callback):
pass
@@ -4,25 +4,39 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import char_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('Move review to the character below the current position')
return _('Move review to the character below the current position')
def run(self):
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], downChar, endOfScreen = \
char_utils.getDownChar(self.env['screen']['newCursorReview']['x'],self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
self.env['runtime']['outputManager'].presentText(downChar ,interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False)
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], downChar, endOfScreen = char_utils.getDownChar(
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
self.env['runtime']['outputManager'].presentText(
downChar,
interrupt=True,
ignorePunctuation=True,
announceCapital=True,
flush=False)
if endOfScreen:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen')
if self.env['runtime']['settingsManager'].getSettingAsBool(
'review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText(
_('end of screen'), interrupt=True, soundIcon='EndOfScreen')
def setCallback(self, callback):
pass
@@ -4,29 +4,43 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import char_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('set review cursor to begin of current line and display the content')
def run(self):
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
self.env['runtime']['cursorManager'].setReviewCursorPosition(0 ,cursorPos['y'])
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currChar = \
char_utils.getCurrentChar(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
self.env['runtime']['cursorManager'].setReviewCursorPosition(
0, cursorPos['y'])
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currChar = char_utils.getCurrentChar(
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
if currChar.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False)
self.env['runtime']['outputManager'].presentText(
_("blank"), interrupt=True, flush=False)
else:
self.env['runtime']['outputManager'].presentText(currChar ,interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False)
self.env['runtime']['outputManager'].presentText(_("beginning of line"), interrupt=False)
self.env['runtime']['outputManager'].presentText(
currChar,
interrupt=True,
ignorePunctuation=True,
announceCapital=True,
flush=False)
self.env['runtime']['outputManager'].presentText(
_("beginning of line"), interrupt=False)
def setCallback(self, callback):
pass
@@ -4,26 +4,39 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import char_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(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):
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
self.env['runtime']['cursorManager'].setReviewCursorPosition(self.env['screen']['columns']-1 ,cursorPos['y'])
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currChar = \
char_utils.getCurrentChar(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
self.env['runtime']['outputManager'].presentText(currChar ,interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False)
self.env['runtime']['outputManager'].presentText(_("end of line"), interrupt=False)
self.env['runtime']['cursorManager'].setReviewCursorPosition(
self.env['screen']['columns'] - 1, cursorPos['y'])
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currChar = char_utils.getCurrentChar(
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
self.env['runtime']['outputManager'].presentText(
currChar,
interrupt=True,
ignorePunctuation=True,
announceCapital=True,
flush=False)
self.env['runtime']['outputManager'].presentText(
_("end of line"), interrupt=False)
def setCallback(self, callback):
pass
@@ -4,32 +4,46 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import line_utils
from fenrirscreenreader.utils import char_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('Move Review to the first character on the line')
def run(self):
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
x, y, currLine = \
line_utils.getCurrentLine(cursorPos['x'], cursorPos['y'], self.env['screen']['newContentText'])
x, y, currLine = line_utils.getCurrentLine(
cursorPos['x'], cursorPos['y'], self.env['screen']['newContentText'])
if currLine.isspace():
self.env['runtime']['outputManager'].presentText(_("line is empty"), interrupt=True)
return
self.env['runtime']['cursorManager'].setReviewCursorPosition((len(currLine) - len(currLine.lstrip())), cursorPos['y'])
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currChar = \
char_utils.getCurrentChar(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
self.env['runtime']['outputManager'].presentText(
_("line is empty"), interrupt=True)
return
self.env['runtime']['cursorManager'].setReviewCursorPosition(
(len(currLine) - len(currLine.lstrip())), cursorPos['y'])
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currChar = char_utils.getCurrentChar(
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
char_utils.presentCharForReview(
self.env,
currChar,
interrupt=True,
announceCapital=True,
flush=False)
self.env['runtime']['outputManager'].presentText(_("first character in line indent {0}").format(
str(len(currLine) - len(currLine.lstrip()))), interrupt=False)
char_utils.presentCharForReview(self.env, currChar, interrupt=True, announceCapital=True, flush=False)
self.env['runtime']['outputManager'].presentText(_("first character in line indent {0}").format(str(len(currLine) - len(currLine.lstrip()))), interrupt=False)
def setCallback(self, callback):
pass
@@ -4,26 +4,39 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import char_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('Move Review to the last character on the line')
def run(self):
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
self.env['runtime']['cursorManager'].setReviewCursorPosition(self.env['screen']['columns']-1 ,cursorPos['y'])
self.env['runtime']['cursorManager'].setReviewCursorPosition(
self.env['screen']['columns'] - 1, cursorPos['y'])
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], lastChar = \
char_utils.getLastCharInLine(self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
char_utils.presentCharForReview(self.env, lastChar, interrupt=True, announceCapital=True, flush=False)
self.env['runtime']['outputManager'].presentText(_("last character in line"), interrupt=False)
char_utils.getLastCharInLine(self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
char_utils.presentCharForReview(
self.env,
lastChar,
interrupt=True,
announceCapital=True,
flush=False)
self.env['runtime']['outputManager'].presentText(
_("last character in line"), interrupt=False)
def setCallback(self, callback):
pass
@@ -4,36 +4,55 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import char_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('Moves review to the next character ')
return _('Moves review to the next character ')
def run(self):
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], nextChar, endOfScreen, lineBreak = \
char_utils.getNextChar(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], nextChar, endOfScreen, lineBreak = char_utils.getNextChar(
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
char_utils.presentCharForReview(self.env, nextChar, interrupt=True, announceCapital=True, flush=False)
char_utils.presentCharForReview(
self.env,
nextChar,
interrupt=True,
announceCapital=True,
flush=False)
if endOfScreen:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen')
if self.env['runtime']['settingsManager'].getSettingAsBool(
'review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText(
_('end of screen'), interrupt=True, soundIcon='EndOfScreen')
if lineBreak:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'):
self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine')
# is has attribute it enabled?
if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'hasAttributes'):
if self.env['runtime']['settingsManager'].getSettingAsBool(
'review', 'lineBreak'):
self.env['runtime']['outputManager'].presentText(
_('line break'), interrupt=False, soundIcon='EndOfLine')
# is has attribute it enabled?
if self.env['runtime']['settingsManager'].getSettingAsBool(
'general', 'hasAttributes'):
cursorPos = self.env['screen']['newCursorReview']
if not self.env['runtime']['attributeManager'].hasAttributes(cursorPos):
if not self.env['runtime']['attributeManager'].hasAttributes(
cursorPos):
return
self.env['runtime']['outputManager'].presentText('has attribute', soundIcon='HasAttributes', interrupt=False)
self.env['runtime']['outputManager'].presentText(
'has attribute', soundIcon='HasAttributes', interrupt=False)
def setCallback(self, callback):
pass
@@ -4,31 +4,43 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import char_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(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'].enterReviewModeCurrTextCursor()
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], nextChar, endOfScreen, lineBreak = \
char_utils.getNextChar(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], nextChar, endOfScreen, lineBreak = char_utils.getNextChar(
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
nextChar = char_utils.getPhonetic(nextChar)
self.env['runtime']['outputManager'].presentText(nextChar ,interrupt=True, announceCapital=True, flush=False)
self.env['runtime']['outputManager'].presentText(
nextChar, interrupt=True, announceCapital=True, flush=False)
if endOfScreen:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen')
if self.env['runtime']['settingsManager'].getSettingAsBool(
'review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText(
_('end of screen'), interrupt=True, soundIcon='EndOfScreen')
if lineBreak:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'):
self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine')
if self.env['runtime']['settingsManager'].getSettingAsBool(
'review', 'lineBreak'):
self.env['runtime']['outputManager'].presentText(
_('line break'), interrupt=False, soundIcon='EndOfLine')
def setCallback(self, callback):
pass
@@ -4,32 +4,43 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import line_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(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']['newCursor'].copy()
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], nextLine, endOfScreen = \
line_utils.getNextLine(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], nextLine, endOfScreen = line_utils.getNextLine(
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
if nextLine.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False)
self.env['runtime']['outputManager'].presentText(
_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False)
else:
self.env['runtime']['outputManager'].presentText(nextLine, interrupt=True, flush=False)
self.env['runtime']['outputManager'].presentText(
nextLine, interrupt=True, flush=False)
if endOfScreen:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen')
if self.env['runtime']['settingsManager'].getSettingAsBool(
'review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText(
_('end of screen'), interrupt=True, soundIcon='EndOfScreen')
def setCallback(self, callback):
pass
@@ -4,35 +4,48 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import word_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(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'] == None:
if self.env['screen']['newCursorReview'] is None:
self.env['screen']['newCursorReview'] = self.env['screen']['newCursor'].copy()
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], nextWord, endOfScreen, lineBreak = \
word_utils.getNextWord(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], nextWord, endOfScreen, lineBreak = word_utils.getNextWord(
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
if nextWord.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False)
self.env['runtime']['outputManager'].presentText(
_("blank"), interrupt=True, flush=False)
else:
self.env['runtime']['outputManager'].presentText(nextWord, interrupt=True, flush=False)
self.env['runtime']['outputManager'].presentText(
nextWord, interrupt=True, flush=False)
if endOfScreen:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen')
if self.env['runtime']['settingsManager'].getSettingAsBool(
'review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText(
_('end of screen'), interrupt=True, soundIcon='EndOfScreen')
if lineBreak:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'):
self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine')
if self.env['runtime']['settingsManager'].getSettingAsBool(
'review', 'lineBreak'):
self.env['runtime']['outputManager'].presentText(
_('line break'), interrupt=False, soundIcon='EndOfLine')
def setCallback(self, callback):
pass
@@ -4,37 +4,50 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import word_utils
from fenrirscreenreader.utils import char_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(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'].enterReviewModeCurrTextCursor()
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], nextWord, endOfScreen, lineBreak = \
word_utils.getNextWord(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], nextWord, endOfScreen, lineBreak = word_utils.getNextWord(
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
if nextWord.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False)
self.env['runtime']['outputManager'].presentText(
_("blank"), interrupt=True, flush=False)
else:
firstSequence = True
for c in nextWord:
currChar = char_utils.getPhonetic(c)
self.env['runtime']['outputManager'].presentText(currChar, interrupt=firstSequence, announceCapital=True, flush=False)
currChar = char_utils.getPhonetic(c)
self.env['runtime']['outputManager'].presentText(
currChar, interrupt=firstSequence, announceCapital=True, flush=False)
firstSequence = False
if endOfScreen:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen')
if self.env['runtime']['settingsManager'].getSettingAsBool(
'review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText(
_('end of screen'), interrupt=True, soundIcon='EndOfScreen')
if lineBreak:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'):
self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine')
if self.env['runtime']['settingsManager'].getSettingAsBool(
'review', 'lineBreak'):
self.env['runtime']['outputManager'].presentText(
_('line break'), interrupt=False, soundIcon='EndOfLine')
def setCallback(self, callback):
pass
@@ -4,39 +4,58 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import char_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(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']['newCursor'].copy()
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], prevChar, endOfScreen, lineBreak = \
char_utils.getPrevChar(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
char_utils.presentCharForReview(self.env, prevChar, interrupt=True, announceCapital=True, flush=False)
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], prevChar, endOfScreen, lineBreak = char_utils.getPrevChar(
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
char_utils.presentCharForReview(
self.env,
prevChar,
interrupt=True,
announceCapital=True,
flush=False)
if endOfScreen:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen')
if self.env['runtime']['settingsManager'].getSettingAsBool(
'review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText(
_('end of screen'), interrupt=True, soundIcon='EndOfScreen')
if lineBreak:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'):
self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine')
# is has attribute it enabled?
if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'hasAttributes'):
if self.env['runtime']['settingsManager'].getSettingAsBool(
'review', 'lineBreak'):
self.env['runtime']['outputManager'].presentText(
_('line break'), interrupt=False, soundIcon='EndOfLine')
# is has attribute it enabled?
if self.env['runtime']['settingsManager'].getSettingAsBool(
'general', 'hasAttributes'):
cursorPos = self.env['screen']['newCursorReview']
if not self.env['runtime']['attributeManager'].hasAttributes(cursorPos):
if not self.env['runtime']['attributeManager'].hasAttributes(
cursorPos):
return
self.env['runtime']['outputManager'].presentText('has attribute', soundIcon='HasAttributes', interrupt=False)
self.env['runtime']['outputManager'].presentText(
'has attribute', soundIcon='HasAttributes', interrupt=False)
def setCallback(self, callback):
pass
@@ -4,31 +4,43 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import char_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(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'].enterReviewModeCurrTextCursor()
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], prevChar, endOfScreen, lineBreak = \
char_utils.getPrevChar(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], prevChar, endOfScreen, lineBreak = char_utils.getPrevChar(
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
prevChar = char_utils.getPhonetic(prevChar)
self.env['runtime']['outputManager'].presentText(prevChar ,interrupt=True, announceCapital=True, flush=False)
self.env['runtime']['outputManager'].presentText(
prevChar, interrupt=True, announceCapital=True, flush=False)
if endOfScreen:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen')
if self.env['runtime']['settingsManager'].getSettingAsBool(
'review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText(
_('end of screen'), interrupt=True, soundIcon='EndOfScreen')
if lineBreak:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'):
self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine')
if self.env['runtime']['settingsManager'].getSettingAsBool(
'review', 'lineBreak'):
self.env['runtime']['outputManager'].presentText(
_('line break'), interrupt=False, soundIcon='EndOfLine')
def setCallback(self, callback):
pass
@@ -4,31 +4,41 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import line_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('moves review to the previous line ')
return _('moves review to the previous line ')
def run(self):
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], prevLine, endOfScreen = \
line_utils.getPrevLine(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], prevLine, endOfScreen = line_utils.getPrevLine(
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
if prevLine.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False)
self.env['runtime']['outputManager'].presentText(
_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False)
else:
self.env['runtime']['outputManager'].presentText(prevLine, interrupt=True, flush=False)
self.env['runtime']['outputManager'].presentText(
prevLine, interrupt=True, flush=False)
if endOfScreen:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen')
if self.env['runtime']['settingsManager'].getSettingAsBool(
'review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText(
_('end of screen'), interrupt=True, soundIcon='EndOfScreen')
def setCallback(self, callback):
pass
@@ -4,33 +4,46 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import word_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('moves review focus to the previous word ')
return _('moves review focus to the previous word ')
def run(self):
self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor()
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], prevWord, endOfScreen, lineBreak = \
word_utils.getPrevWord(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], prevWord, endOfScreen, lineBreak = word_utils.getPrevWord(
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
if prevWord.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False)
self.env['runtime']['outputManager'].presentText(
_("blank"), interrupt=True, flush=False)
else:
self.env['runtime']['outputManager'].presentText(prevWord, interrupt=True, flush=False)
self.env['runtime']['outputManager'].presentText(
prevWord, interrupt=True, flush=False)
if endOfScreen:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=False, soundIcon='EndOfScreen')
if self.env['runtime']['settingsManager'].getSettingAsBool(
'review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText(
_('end of screen'), interrupt=False, soundIcon='EndOfScreen')
if lineBreak:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'):
self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine')
if self.env['runtime']['settingsManager'].getSettingAsBool(
'review', 'lineBreak'):
self.env['runtime']['outputManager'].presentText(
_('line break'), interrupt=False, soundIcon='EndOfLine')
def setCallback(self, callback):
pass
@@ -4,37 +4,50 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import word_utils
from fenrirscreenreader.utils import char_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(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'].enterReviewModeCurrTextCursor()
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], prevWord, endOfScreen, lineBreak = \
word_utils.getPrevWord(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], prevWord, endOfScreen, lineBreak = word_utils.getPrevWord(
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
if prevWord.isspace():
self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False)
self.env['runtime']['outputManager'].presentText(
_("blank"), interrupt=True, flush=False)
else:
firstSequence = True
for c in prevWord:
currChar = char_utils.getPhonetic(c)
self.env['runtime']['outputManager'].presentText(currChar, interrupt=firstSequence, announceCapital=True, flush=False)
currChar = char_utils.getPhonetic(c)
self.env['runtime']['outputManager'].presentText(
currChar, interrupt=firstSequence, announceCapital=True, flush=False)
firstSequence = False
if endOfScreen:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen')
if self.env['runtime']['settingsManager'].getSettingAsBool(
'review', 'endOfScreen'):
self.env['runtime']['outputManager'].presentText(
_('end of screen'), interrupt=True, soundIcon='EndOfScreen')
if lineBreak:
if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'):
self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine')
if self.env['runtime']['settingsManager'].getSettingAsBool(
'review', 'lineBreak'):
self.env['runtime']['outputManager'].presentText(
_('line break'), interrupt=False, soundIcon='EndOfLine')
def setCallback(self, callback):
pass
@@ -4,26 +4,38 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core.i18n import _
from fenrirscreenreader.utils import char_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
pass
def getDescription(self):
return _('Move Review to the first character on the screen (left top)')
def run(self):
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
self.env['runtime']['cursorManager'].setReviewCursorPosition(0 ,0)
self.env['runtime']['cursorManager'].setReviewCursorPosition(0, 0)
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], lastChar = \
char_utils.getLastCharInLine(self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
char_utils.presentCharForReview(self.env, lastChar, interrupt=True, announceCapital=True, flush=False)
self.env['runtime']['outputManager'].presentText(_("first character in screen"), interrupt=False)
char_utils.getLastCharInLine(self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
char_utils.presentCharForReview(
self.env,
lastChar,
interrupt=True,
announceCapital=True,
flush=False)
self.env['runtime']['outputManager'].presentText(
_("first character in screen"), interrupt=False)
def setCallback(self, callback):
pass
Loaded 100 of 345 files, more files were not shown because too many files have changed in this diff. Show more