diff --git a/src/fenrirscreenreader/commands/command_template.py b/src/fenrirscreenreader/commands/command_template.py index b8078d84..4b8a1d90 100644 --- a/src/fenrirscreenreader/commands/command_template.py +++ b/src/fenrirscreenreader/commands/command_template.py @@ -1,21 +1,21 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No description found' - def run(self): - pass - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No description found' + def run(self): + pass + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/00_init_commands.py b/src/fenrirscreenreader/commands/commands/00_init_commands.py index 41b27203..a12b0d87 100644 --- a/src/fenrirscreenreader/commands/commands/00_init_commands.py +++ b/src/fenrirscreenreader/commands/commands/00_init_commands.py @@ -1,26 +1,26 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -# this command is just to initialize stuff. -# like init index lists in memoryManager -# it is not useful to execute it -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - # clipboard - self.env['runtime']['memoryManager'].addIndexList('clipboardHistory', self.env['runtime']['settingsManager'].getSettingAsInt('general', 'numberOfClipboards')) - def shutdown(self): - pass - def getDescription(self): - return 'No description found' - def run(self): - pass - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +# this command is just to initialize stuff. +# like init index lists in memoryManager +# it is not useful to execute it +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + # clipboard + self.env['runtime']['memoryManager'].addIndexList('clipboardHistory', self.env['runtime']['settingsManager'].getSettingAsInt('general', 'numberOfClipboards')) + def shutdown(self): + pass + def getDescription(self): + return 'No description found' + def run(self): + pass + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/attribute_cursor.py b/src/fenrirscreenreader/commands/commands/attribute_cursor.py index 90929814..72b66818 100644 --- a/src/fenrirscreenreader/commands/commands/attribute_cursor.py +++ b/src/fenrirscreenreader/commands/commands/attribute_cursor.py @@ -1,30 +1,30 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -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') - def run(self): - cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() - try: - 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) - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +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') + def run(self): + cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() + try: + 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) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/clear_clipboard.py b/src/fenrirscreenreader/commands/commands/clear_clipboard.py index e8b5ebc5..a8bb425b 100644 --- a/src/fenrirscreenreader/commands/commands/clear_clipboard.py +++ b/src/fenrirscreenreader/commands/commands/clear_clipboard.py @@ -1,24 +1,24 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('clears the currently selected clipboard') - - def run(self): - self.env['runtime']['memoryManager'].clearCurrentIndexList('clipboardHistory') - self.env['runtime']['outputManager'].presentText(_('clipboard cleared'), interrupt=True) - return - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('clears the currently selected clipboard') + + def run(self): + self.env['runtime']['memoryManager'].clearCurrentIndexList('clipboardHistory') + self.env['runtime']['outputManager'].presentText(_('clipboard cleared'), interrupt=True) + return + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/curr_clipboard.py b/src/fenrirscreenreader/commands/commands/curr_clipboard.py index 717fcf90..92d5cd37 100644 --- a/src/fenrirscreenreader/commands/commands/curr_clipboard.py +++ b/src/fenrirscreenreader/commands/commands/curr_clipboard.py @@ -1,27 +1,27 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('speaks the contents of the currently selected clipboard') - - def run(self): - if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'): - self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True) - return - clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') - self.env['runtime']['outputManager'].presentText(clipboard , interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('speaks the contents of the currently selected clipboard') + + def run(self): + if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'): + self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True) + return + clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') + self.env['runtime']['outputManager'].presentText(clipboard , interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/curr_screen.py b/src/fenrirscreenreader/commands/commands/curr_screen.py index edb33343..e4a66fe7 100644 --- a/src/fenrirscreenreader/commands/commands/curr_screen.py +++ b/src/fenrirscreenreader/commands/commands/curr_screen.py @@ -1,26 +1,26 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('reads the contents of the current screen') - - def run(self): - if self.env['screen']['newContentText'].isspace(): - self.env['runtime']['outputManager'].presentText(_("screen is empty"), soundIcon='EmptyLine', interrupt=True) - else: - self.env['runtime']['outputManager'].presentText(self.env['screen']['newContentText'],interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('reads the contents of the current screen') + + def run(self): + if self.env['screen']['newContentText'].isspace(): + self.env['runtime']['outputManager'].presentText(_("screen is empty"), soundIcon='EmptyLine', interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(self.env['screen']['newContentText'],interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/cursor_column.py b/src/fenrirscreenreader/commands/commands/cursor_column.py index 6f878a6a..9f4bb089 100644 --- a/src/fenrirscreenreader/commands/commands/cursor_column.py +++ b/src/fenrirscreenreader/commands/commands/cursor_column.py @@ -1,25 +1,25 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('Column number for cursor') - def run(self): - cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() - self.env['runtime']['outputManager'].presentText(str(cursorPos['x'] + 1) , interrupt=True) - self.env['runtime']['outputManager'].announceActiveCursor() - self.env['runtime']['outputManager'].presentText(' column number' , interrupt=False) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('Column number for cursor') + def run(self): + cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() + self.env['runtime']['outputManager'].presentText(str(cursorPos['x'] + 1) , interrupt=True) + self.env['runtime']['outputManager'].announceActiveCursor() + self.env['runtime']['outputManager'].presentText(' column number' , interrupt=False) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/cursor_lineno.py b/src/fenrirscreenreader/commands/commands/cursor_lineno.py index 591f0c5f..739e0b33 100644 --- a/src/fenrirscreenreader/commands/commands/cursor_lineno.py +++ b/src/fenrirscreenreader/commands/commands/cursor_lineno.py @@ -1,25 +1,25 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('Line number for cursor') - def run(self): - cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() - self.env['runtime']['outputManager'].presentText(str(cursorPos['y'] + 1), interrupt=True) - self.env['runtime']['outputManager'].announceActiveCursor() - self.env['runtime']['outputManager'].presentText(' line number' , interrupt=False) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('Line number for cursor') + def run(self): + cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() + self.env['runtime']['outputManager'].presentText(str(cursorPos['y'] + 1), interrupt=True) + self.env['runtime']['outputManager'].announceActiveCursor() + self.env['runtime']['outputManager'].presentText(' line number' , interrupt=False) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/date.py b/src/fenrirscreenreader/commands/commands/date.py index ed09c8f1..3275d2f0 100644 --- a/src/fenrirscreenreader/commands/commands/date.py +++ b/src/fenrirscreenreader/commands/commands/date.py @@ -1,30 +1,30 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -import datetime - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('presents the date') - - def run(self): - dateFormat = self.env['runtime']['settingsManager'].getSetting('general', 'dateFormat') - - # get the time formatted - dateString = datetime.datetime.strftime(datetime.datetime.now(), dateFormat) - - # present the time via speak and braile, there is no soundicon, interrupt the current speech - self.env['runtime']['outputManager'].presentText(dateString , soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +import datetime + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('presents the date') + + def run(self): + dateFormat = self.env['runtime']['settingsManager'].getSetting('general', 'dateFormat') + + # get the time formatted + dateString = datetime.datetime.strftime(datetime.datetime.now(), dateFormat) + + # present the time via speak and braile, there is no soundicon, interrupt the current speech + self.env['runtime']['outputManager'].presentText(dateString , soundIcon='', interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/dec_sound_volume.py b/src/fenrirscreenreader/commands/commands/dec_sound_volume.py index 6550de06..097359b8 100644 --- a/src/fenrirscreenreader/commands/commands/dec_sound_volume.py +++ b/src/fenrirscreenreader/commands/commands/dec_sound_volume.py @@ -1,33 +1,33 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -import math - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('decrease sound volume') - - def run(self): - - value = self.env['runtime']['settingsManager'].getSettingAsFloat('sound', 'volume') - - value = round((math.ceil(10 * value) / 10) - 0.1, 2) - if value < 0.1: - value = 0.1 - self.env['runtime']['settingsManager'].setSetting('sound', 'volume', str(value)) - - self.env['runtime']['outputManager'].presentText(_("{0} percent sound volume").format(int(value * 100)), soundIcon='SoundOff', interrupt=True) - - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +import math + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('decrease sound volume') + + def run(self): + + value = self.env['runtime']['settingsManager'].getSettingAsFloat('sound', 'volume') + + value = round((math.ceil(10 * value) / 10) - 0.1, 2) + if value < 0.1: + value = 0.1 + self.env['runtime']['settingsManager'].setSetting('sound', 'volume', str(value)) + + self.env['runtime']['outputManager'].presentText(_("{0} percent sound volume").format(int(value * 100)), soundIcon='SoundOff', interrupt=True) + + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/commands/dec_speech_pitch.py b/src/fenrirscreenreader/commands/commands/dec_speech_pitch.py index 2bfd12dd..5ca24a9a 100644 --- a/src/fenrirscreenreader/commands/commands/dec_speech_pitch.py +++ b/src/fenrirscreenreader/commands/commands/dec_speech_pitch.py @@ -1,29 +1,29 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -import math - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('Decreases the pitch of the speech') - - def run(self): - value = self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'pitch') - value = round((math.ceil(10 * value) / 10) - 0.1, 2) - if value < 0.0: - value = 0.0 - self.env['runtime']['settingsManager'].setSetting('speech', 'pitch', str(value)) - self.env['runtime']['outputManager'].presentText(_('{0} percent speech pitch').format(int(value * 100)), soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +import math + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('Decreases the pitch of the speech') + + def run(self): + value = self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'pitch') + value = round((math.ceil(10 * value) / 10) - 0.1, 2) + if value < 0.0: + value = 0.0 + self.env['runtime']['settingsManager'].setSetting('speech', 'pitch', str(value)) + self.env['runtime']['outputManager'].presentText(_('{0} percent speech pitch').format(int(value * 100)), soundIcon='', interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/dec_speech_rate.py b/src/fenrirscreenreader/commands/commands/dec_speech_rate.py index 8e23ba0e..1e4462b9 100644 --- a/src/fenrirscreenreader/commands/commands/dec_speech_rate.py +++ b/src/fenrirscreenreader/commands/commands/dec_speech_rate.py @@ -1,30 +1,30 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -import math - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('Decreases the rate of the speech') - - def run(self): - value = self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'rate') - value = round((math.ceil(10 * value) / 10) - 0.1, 2) - if value < 0.0: - value = 0.0 - self.env['runtime']['settingsManager'].setSetting('speech', 'rate', str(value)) - - self.env['runtime']['outputManager'].presentText(_("{0} percent speech rate").format(int(value * 100)), soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +import math + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('Decreases the rate of the speech') + + def run(self): + value = self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'rate') + value = round((math.ceil(10 * value) / 10) - 0.1, 2) + if value < 0.0: + value = 0.0 + self.env['runtime']['settingsManager'].setSetting('speech', 'rate', str(value)) + + self.env['runtime']['outputManager'].presentText(_("{0} percent speech rate").format(int(value * 100)), soundIcon='', interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/dec_speech_volume.py b/src/fenrirscreenreader/commands/commands/dec_speech_volume.py index 6775cb4a..6a87edc9 100644 --- a/src/fenrirscreenreader/commands/commands/dec_speech_volume.py +++ b/src/fenrirscreenreader/commands/commands/dec_speech_volume.py @@ -1,31 +1,31 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -import math - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('Decreases the volume of the speech') - - def run(self): - value = self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'volume') - value = round((math.ceil(10 * value) / 10) - 0.1, 2) - if value < 0.1: - value = 0.1 - self.env['runtime']['settingsManager'].setSetting('speech', 'volume', str(value)) - - self.env['runtime']['outputManager'].presentText(_("{0} percent speech volume").format(int(value * 100)), soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +import math + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('Decreases the volume of the speech') + + def run(self): + value = self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'volume') + value = round((math.ceil(10 * value) / 10) - 0.1, 2) + if value < 0.1: + value = 0.1 + self.env['runtime']['settingsManager'].setSetting('speech', 'volume', str(value)) + + self.env['runtime']['outputManager'].presentText(_("{0} percent speech volume").format(int(value * 100)), soundIcon='', interrupt=True) + + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/commands/exit_review.py b/src/fenrirscreenreader/commands/commands/exit_review.py index ab2e9da4..01898b14 100644 --- a/src/fenrirscreenreader/commands/commands/exit_review.py +++ b/src/fenrirscreenreader/commands/commands/exit_review.py @@ -1,28 +1,28 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('exits review mode') - - def run(self): - if not self.env['runtime']['cursorManager'].isReviewMode(): - self.env['runtime']['outputManager'].presentText(_("Not in Review Mode"), interrupt=True) - return - - self.env['runtime']['cursorManager'].clearReviewCursor() - self.env['runtime']['outputManager'].presentText(_("Exiting Review Mode"), interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('exits review mode') + + def run(self): + if not self.env['runtime']['cursorManager'].isReviewMode(): + self.env['runtime']['outputManager'].presentText(_("Not in Review Mode"), interrupt=True) + return + + self.env['runtime']['cursorManager'].clearReviewCursor() + self.env['runtime']['outputManager'].presentText(_("Exiting Review Mode"), interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/export_clipboard_to_file.py b/src/fenrirscreenreader/commands/commands/export_clipboard_to_file.py index 2e2d2258..d3cf7025 100644 --- a/src/fenrirscreenreader/commands/commands/export_clipboard_to_file.py +++ b/src/fenrirscreenreader/commands/commands/export_clipboard_to_file.py @@ -1,39 +1,39 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -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') - try: - if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'): - self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True) - return - clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') - clipboardFile.write(clipboard) - clipboardFile.close() - os.chmod(clipboardFilePath, 0o666) - self.env['runtime']['outputManager'].presentText(_('clipboard exported to file'), interrupt=True) - except Exception as e: - self.env['runtime']['debug'].writeDebugOut('export_clipboard_to_file:run: Filepath:'+ clipboardFile +' trace:' + str(e),debug.debugLevel.ERROR) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +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') + try: + if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'): + self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True) + return + clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') + clipboardFile.write(clipboard) + clipboardFile.close() + os.chmod(clipboardFilePath, 0o666) + self.env['runtime']['outputManager'].presentText(_('clipboard exported to file'), interrupt=True) + except Exception as e: + self.env['runtime']['debug'].writeDebugOut('export_clipboard_to_file:run: Filepath:'+ clipboardFile +' trace:' + str(e),debug.debugLevel.ERROR) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py b/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py index 450bb1be..203024df 100644 --- a/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py +++ b/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py @@ -1,77 +1,77 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -import subprocess, os -from subprocess import Popen, PIPE -import _thread - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - 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 _threadRun(self): - try: - if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'): - self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True) - return - - clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') - user = self.env['general']['currUser'] - - # First try to find xclip in common locations - xclip_paths = [ - '/usr/bin/xclip', - '/bin/xclip', - '/usr/local/bin/xclip' - ] - - xclip_path = None - for path in xclip_paths: - if os.path.isfile(path) and os.access(path, os.X_OK): - xclip_path = path - break - - if not xclip_path: - self.env['runtime']['outputManager'].presentText( - 'xclip not found in common locations', - interrupt=True - ) - return - - for display in range(10): - p = Popen( - ['su', user, '-p', '-c', f"{xclip_path} -d :{display} -selection clipboard"], - stdin=PIPE, stdout=PIPE, stderr=PIPE, preexec_fn=os.setpgrp - ) - stdout, stderr = p.communicate(input=clipboard.encode('utf-8')) - - self.env['runtime']['outputManager'].interruptOutput() - - stderr = stderr.decode('utf-8') - stdout = stdout.decode('utf-8') - - if stderr == '': - break - - if stderr != '': - self.env['runtime']['outputManager'].presentText(stderr, soundIcon='', interrupt=False) - else: - self.env['runtime']['outputManager'].presentText('exported to the X session.', interrupt=True) - - except Exception as e: - self.env['runtime']['outputManager'].presentText(str(e), soundIcon='', interrupt=False) - - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +import subprocess, os +from subprocess import Popen, PIPE +import _thread + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + 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 _threadRun(self): + try: + if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'): + self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True) + return + + clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') + user = self.env['general']['currUser'] + + # First try to find xclip in common locations + xclip_paths = [ + '/usr/bin/xclip', + '/bin/xclip', + '/usr/local/bin/xclip' + ] + + xclip_path = None + for path in xclip_paths: + if os.path.isfile(path) and os.access(path, os.X_OK): + xclip_path = path + break + + if not xclip_path: + self.env['runtime']['outputManager'].presentText( + 'xclip not found in common locations', + interrupt=True + ) + return + + for display in range(10): + p = Popen( + ['su', user, '-p', '-c', f"{xclip_path} -d :{display} -selection clipboard"], + stdin=PIPE, stdout=PIPE, stderr=PIPE, preexec_fn=os.setpgrp + ) + stdout, stderr = p.communicate(input=clipboard.encode('utf-8')) + + self.env['runtime']['outputManager'].interruptOutput() + + stderr = stderr.decode('utf-8') + stdout = stdout.decode('utf-8') + + if stderr == '': + break + + if stderr != '': + self.env['runtime']['outputManager'].presentText(stderr, soundIcon='', interrupt=False) + else: + self.env['runtime']['outputManager'].presentText('exported to the X session.', interrupt=True) + + except Exception as e: + self.env['runtime']['outputManager'].presentText(str(e), soundIcon='', interrupt=False) + + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/first_clipboard.py b/src/fenrirscreenreader/commands/commands/first_clipboard.py index d7c96858..0511b6da 100644 --- a/src/fenrirscreenreader/commands/commands/first_clipboard.py +++ b/src/fenrirscreenreader/commands/commands/first_clipboard.py @@ -1,28 +1,28 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('selects the first clipboard') - - def run(self): - if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'): - self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True) - return - self.env['runtime']['memoryManager'].setFirstIndex('clipboardHistory') - clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') - self.env['runtime']['outputManager'].presentText(clipboard, interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('selects the first clipboard') + + def run(self): + if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'): + self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True) + return + self.env['runtime']['memoryManager'].setFirstIndex('clipboardHistory') + clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') + self.env['runtime']['outputManager'].presentText(clipboard, interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/forward_keypress.py b/src/fenrirscreenreader/commands/commands/forward_keypress.py index 84566cd6..c8081254 100644 --- a/src/fenrirscreenreader/commands/commands/forward_keypress.py +++ b/src/fenrirscreenreader/commands/commands/forward_keypress.py @@ -1,24 +1,24 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('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) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('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) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/import_clipboard_from_x.py b/src/fenrirscreenreader/commands/commands/import_clipboard_from_x.py index 0f5c9431..6d5ba34d 100644 --- a/src/fenrirscreenreader/commands/commands/import_clipboard_from_x.py +++ b/src/fenrirscreenreader/commands/commands/import_clipboard_from_x.py @@ -1,54 +1,54 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -import subprocess, os -from subprocess import Popen, PIPE -import _thread -class command(): - def __init__(self): - pass - def initialize(self, environment, scriptPath=''): - self.env = environment - self.scriptPath = scriptPath - def shutdown(self): - pass - def getDescription(self): - return _("imports the graphical clipboard to Fenrir's clipboard") - def run(self): - _thread.start_new_thread(self._threadRun , ()) - def _threadRun(self): - try: - # Find xclip path - xclip_paths = ['/usr/bin/xclip', '/bin/xclip', '/usr/local/bin/xclip'] - xclip_path = None - for path in xclip_paths: - if os.path.isfile(path) and os.access(path, os.X_OK): - xclip_path = path - break - if not xclip_path: - self.env['runtime']['outputManager'].presentText('xclip not found in common locations', interrupt=True) - return - xClipboard = '' - for display in range(10): - p = Popen('su ' + self.env['general']['currUser'] + ' -p -c "' + xclip_path + ' -d :' + str(display) + ' -o"', stdout=PIPE, stderr=PIPE, shell=True) - stdout, stderr = p.communicate() - self.env['runtime']['outputManager'].interruptOutput() - stderr = stderr.decode('utf-8') - xClipboard = stdout.decode('utf-8') - if (stderr == ''): - break - if stderr != '': - self.env['runtime']['outputManager'].presentText(stderr , soundIcon='', interrupt=False) - else: - self.env['runtime']['memoryManager'].addValueToFirstIndex('clipboardHistory', xClipboard) - self.env['runtime']['outputManager'].presentText('Import to Clipboard', soundIcon='CopyToClipboard', interrupt=True) - self.env['runtime']['outputManager'].presentText(xClipboard, soundIcon='', interrupt=False) - except Exception as e: - self.env['runtime']['outputManager'].presentText(e , soundIcon='', interrupt=False) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +import subprocess, os +from subprocess import Popen, PIPE +import _thread +class command(): + def __init__(self): + pass + def initialize(self, environment, scriptPath=''): + self.env = environment + self.scriptPath = scriptPath + def shutdown(self): + pass + def getDescription(self): + return _("imports the graphical clipboard to Fenrir's clipboard") + def run(self): + _thread.start_new_thread(self._threadRun , ()) + def _threadRun(self): + try: + # Find xclip path + xclip_paths = ['/usr/bin/xclip', '/bin/xclip', '/usr/local/bin/xclip'] + xclip_path = None + for path in xclip_paths: + if os.path.isfile(path) and os.access(path, os.X_OK): + xclip_path = path + break + if not xclip_path: + self.env['runtime']['outputManager'].presentText('xclip not found in common locations', interrupt=True) + return + xClipboard = '' + for display in range(10): + p = Popen('su ' + self.env['general']['currUser'] + ' -p -c "' + xclip_path + ' -d :' + str(display) + ' -o"', stdout=PIPE, stderr=PIPE, shell=True) + stdout, stderr = p.communicate() + self.env['runtime']['outputManager'].interruptOutput() + stderr = stderr.decode('utf-8') + xClipboard = stdout.decode('utf-8') + if (stderr == ''): + break + if stderr != '': + self.env['runtime']['outputManager'].presentText(stderr , soundIcon='', interrupt=False) + else: + self.env['runtime']['memoryManager'].addValueToFirstIndex('clipboardHistory', xClipboard) + self.env['runtime']['outputManager'].presentText('Import to Clipboard', soundIcon='CopyToClipboard', interrupt=True) + self.env['runtime']['outputManager'].presentText(xClipboard, soundIcon='', interrupt=False) + except Exception as e: + self.env['runtime']['outputManager'].presentText(e , soundIcon='', interrupt=False) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/inc_sound_volume.py b/src/fenrirscreenreader/commands/commands/inc_sound_volume.py index 521294a0..9ce291e7 100644 --- a/src/fenrirscreenreader/commands/commands/inc_sound_volume.py +++ b/src/fenrirscreenreader/commands/commands/inc_sound_volume.py @@ -1,32 +1,32 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -import math - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('adjusts the volume for in coming sounds') - - def run(self): - - value = self.env['runtime']['settingsManager'].getSettingAsFloat('sound', 'volume') - - value = round((math.ceil(10 * value) / 10) + 0.1, 2) - if value > 1.0: - value = 1.0 - self.env['runtime']['settingsManager'].setSetting('sound', 'volume', str(value)) - - self.env['runtime']['outputManager'].presentText(_("{0} percent sound volume").format(int(value * 100)), soundIcon='SoundOn', interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +import math + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('adjusts the volume for in coming sounds') + + def run(self): + + value = self.env['runtime']['settingsManager'].getSettingAsFloat('sound', 'volume') + + value = round((math.ceil(10 * value) / 10) + 0.1, 2) + if value > 1.0: + value = 1.0 + self.env['runtime']['settingsManager'].setSetting('sound', 'volume', str(value)) + + self.env['runtime']['outputManager'].presentText(_("{0} percent sound volume").format(int(value * 100)), soundIcon='SoundOn', interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/inc_speech_pitch.py b/src/fenrirscreenreader/commands/commands/inc_speech_pitch.py index 735cd28e..735f7279 100644 --- a/src/fenrirscreenreader/commands/commands/inc_speech_pitch.py +++ b/src/fenrirscreenreader/commands/commands/inc_speech_pitch.py @@ -1,30 +1,30 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -import math - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('Increases the pitch of the speech') - - def run(self): - value = self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'pitch') - value = round((math.ceil(10 * value) / 10) + 0.1, 2) - if value > 1.0: - value = 1.0 - self.env['runtime']['settingsManager'].setSetting('speech', 'pitch', str(value)) - - self.env['runtime']['outputManager'].presentText(_("{0} percent speech pitch").format(int(value * 100)), soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +import math + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('Increases the pitch of the speech') + + def run(self): + value = self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'pitch') + value = round((math.ceil(10 * value) / 10) + 0.1, 2) + if value > 1.0: + value = 1.0 + self.env['runtime']['settingsManager'].setSetting('speech', 'pitch', str(value)) + + self.env['runtime']['outputManager'].presentText(_("{0} percent speech pitch").format(int(value * 100)), soundIcon='', interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/inc_speech_rate.py b/src/fenrirscreenreader/commands/commands/inc_speech_rate.py index f781f739..91265677 100644 --- a/src/fenrirscreenreader/commands/commands/inc_speech_rate.py +++ b/src/fenrirscreenreader/commands/commands/inc_speech_rate.py @@ -1,30 +1,30 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -import math - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('Increase the speech rate') - - def run(self): - value = self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'rate') - value = round((math.ceil(10 * value) / 10) + 0.1, 2) - if value > 1.0: - value = 1.0 - self.env['runtime']['settingsManager'].setSetting('speech', 'rate', str(value)) - - self.env['runtime']['outputManager'].presentText(_("{0} percent speech rate").format(int(value * 100)), soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +import math + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('Increase the speech rate') + + def run(self): + value = self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'rate') + value = round((math.ceil(10 * value) / 10) + 0.1, 2) + if value > 1.0: + value = 1.0 + self.env['runtime']['settingsManager'].setSetting('speech', 'rate', str(value)) + + self.env['runtime']['outputManager'].presentText(_("{0} percent speech rate").format(int(value * 100)), soundIcon='', interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/inc_speech_volume.py b/src/fenrirscreenreader/commands/commands/inc_speech_volume.py index d05bafa4..c4a91444 100644 --- a/src/fenrirscreenreader/commands/commands/inc_speech_volume.py +++ b/src/fenrirscreenreader/commands/commands/inc_speech_volume.py @@ -1,30 +1,30 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -import math - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('Increase the speech volume') - - def run(self): - value = self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'volume') - value = round((math.ceil(10 * value) / 10) + 0.1, 2) - if value > 1.0: - value = 1.0 - self.env['runtime']['settingsManager'].setSetting('speech', 'volume', str(value)) - - self.env['runtime']['outputManager'].presentText(_("{0} percent speech volume").format(int(value * 100)), soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +import math + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('Increase the speech volume') + + def run(self): + value = self.env['runtime']['settingsManager'].getSettingAsFloat('speech', 'volume') + value = round((math.ceil(10 * value) / 10) + 0.1, 2) + if value > 1.0: + value = 1.0 + self.env['runtime']['settingsManager'].setSetting('speech', 'volume', str(value)) + + self.env['runtime']['outputManager'].presentText(_("{0} percent speech volume").format(int(value * 100)), soundIcon='', interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/last_clipboard.py b/src/fenrirscreenreader/commands/commands/last_clipboard.py index 386380ab..a5c496ac 100644 --- a/src/fenrirscreenreader/commands/commands/last_clipboard.py +++ b/src/fenrirscreenreader/commands/commands/last_clipboard.py @@ -1,28 +1,28 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('selects the last clipboard') - - def run(self): - if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'): - self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True) - return - self.env['runtime']['memoryManager'].setLastIndex('clipboardHistory') - clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') - self.env['runtime']['outputManager'].presentText(clipboard, interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('selects the last clipboard') + + def run(self): + if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'): + self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True) + return + self.env['runtime']['memoryManager'].setLastIndex('clipboardHistory') + clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') + self.env['runtime']['outputManager'].presentText(clipboard, interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/last_incoming.py b/src/fenrirscreenreader/commands/commands/last_incoming.py index c4f19669..75cef645 100644 --- a/src/fenrirscreenreader/commands/commands/last_incoming.py +++ b/src/fenrirscreenreader/commands/commands/last_incoming.py @@ -1,23 +1,23 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('Presents the text which was last received') - - def run(self): - self.env['runtime']['outputManager'].presentText(self.env['screen']['newDelta'], interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('Presents the text which was last received') + + def run(self): + self.env['runtime']['outputManager'].presentText(self.env['screen']['newDelta'], interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/next_clipboard.py b/src/fenrirscreenreader/commands/commands/next_clipboard.py index c2d1e0ac..87320f03 100644 --- a/src/fenrirscreenreader/commands/commands/next_clipboard.py +++ b/src/fenrirscreenreader/commands/commands/next_clipboard.py @@ -1,36 +1,36 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('selects the next clipboard') - - def run(self): - if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'): - self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True) - return - self.env['runtime']['memoryManager'].getNextIndex('clipboardHistory') - isFirst = self.env['runtime']['memoryManager'].isFirstIndex('clipboardHistory') - isLast = self.env['runtime']['memoryManager'].isLastIndex('clipboardHistory') - clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') - if isFirst: - self.env['runtime']['outputManager'].presentText(_('First clipboard '), interrupt=True) - if isLast: - self.env['runtime']['outputManager'].presentText(_('Last clipboard '), interrupt=True) - - speechInterrupt = not(isLast or isFirst) - self.env['runtime']['outputManager'].presentText(clipboard, interrupt = speechInterrupt) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('selects the next clipboard') + + def run(self): + if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'): + self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True) + return + self.env['runtime']['memoryManager'].getNextIndex('clipboardHistory') + isFirst = self.env['runtime']['memoryManager'].isFirstIndex('clipboardHistory') + isLast = self.env['runtime']['memoryManager'].isLastIndex('clipboardHistory') + clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') + if isFirst: + self.env['runtime']['outputManager'].presentText(_('First clipboard '), interrupt=True) + if isLast: + self.env['runtime']['outputManager'].presentText(_('Last clipboard '), interrupt=True) + + speechInterrupt = not(isLast or isFirst) + self.env['runtime']['outputManager'].presentText(clipboard, interrupt = speechInterrupt) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/paste_clipboard.py b/src/fenrirscreenreader/commands/commands/paste_clipboard.py index 3f4253e2..60d620bc 100644 --- a/src/fenrirscreenreader/commands/commands/paste_clipboard.py +++ b/src/fenrirscreenreader/commands/commands/paste_clipboard.py @@ -1,30 +1,30 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -import time - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - self.env['runtime']['memoryManager'].addIndexList('clipboardHistory', self.env['runtime']['settingsManager'].getSettingAsInt('general', 'numberOfClipboards')) - def shutdown(self): - pass - def getDescription(self): - return _('pastes the text from the currently selected clipboard') - - def run(self): - if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'): - self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True) - return - self.env['runtime']['outputManager'].presentText('paste clipboard', soundIcon='PasteClipboardOnScreen', interrupt=True) - clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') - self.env['runtime']['screenManager'].injectTextToScreen(clipboard) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +import time + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + self.env['runtime']['memoryManager'].addIndexList('clipboardHistory', self.env['runtime']['settingsManager'].getSettingAsInt('general', 'numberOfClipboards')) + def shutdown(self): + pass + def getDescription(self): + return _('pastes the text from the currently selected clipboard') + + def run(self): + if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'): + self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True) + return + self.env['runtime']['outputManager'].presentText('paste clipboard', soundIcon='PasteClipboardOnScreen', interrupt=True) + clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') + self.env['runtime']['screenManager'].injectTextToScreen(clipboard) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/prev_clipboard.py b/src/fenrirscreenreader/commands/commands/prev_clipboard.py index e6219c0a..531bd2ee 100644 --- a/src/fenrirscreenreader/commands/commands/prev_clipboard.py +++ b/src/fenrirscreenreader/commands/commands/prev_clipboard.py @@ -1,35 +1,35 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('selects the previous clipboard') - - def run(self): - if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'): - self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True) - return - self.env['runtime']['memoryManager'].setPrefIndex('clipboardHistory') - isFirst = self.env['runtime']['memoryManager'].isFirstIndex('clipboardHistory') - isLast = self.env['runtime']['memoryManager'].isLastIndex('clipboardHistory') - clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') - if isFirst: - self.env['runtime']['outputManager'].presentText(_('First clipboard '), interrupt=True) - if isLast: - self.env['runtime']['outputManager'].presentText(_('Last clipboard '), interrupt=True) - speechInterrupt = not(isLast or isFirst) - self.env['runtime']['outputManager'].presentText(clipboard, interrupt = speechInterrupt) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('selects the previous clipboard') + + def run(self): + if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'): + self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True) + return + self.env['runtime']['memoryManager'].setPrefIndex('clipboardHistory') + isFirst = self.env['runtime']['memoryManager'].isFirstIndex('clipboardHistory') + isLast = self.env['runtime']['memoryManager'].isLastIndex('clipboardHistory') + clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') + if isFirst: + self.env['runtime']['outputManager'].presentText(_('First clipboard '), interrupt=True) + if isLast: + self.env['runtime']['outputManager'].presentText(_('Last clipboard '), interrupt=True) + speechInterrupt = not(isLast or isFirst) + self.env['runtime']['outputManager'].presentText(clipboard, interrupt = speechInterrupt) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/quit_fenrir.py b/src/fenrirscreenreader/commands/commands/quit_fenrir.py index b9409240..18fcdc8f 100644 --- a/src/fenrirscreenreader/commands/commands/quit_fenrir.py +++ b/src/fenrirscreenreader/commands/commands/quit_fenrir.py @@ -1,24 +1,24 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('exits Fenrir') - - def run(self): - self.env['runtime']['eventManager'].stopMainEventLoop() - - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('exits Fenrir') + + def run(self): + self.env['runtime']['eventManager'].stopMainEventLoop() + + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/commands/review_curr_line.py b/src/fenrirscreenreader/commands/commands/review_curr_line.py index 39898932..2f3be038 100644 --- a/src/fenrirscreenreader/commands/commands/review_curr_line.py +++ b/src/fenrirscreenreader/commands/commands/review_curr_line.py @@ -1,32 +1,32 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -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): - self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() - - self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currLine = \ - line_utils.getCurrentLine(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText']) - - if currLine.isspace(): - self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False) - else: - self.env['runtime']['outputManager'].presentText(currLine, interrupt=True, flush=False) - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +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): + self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() + + self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currLine = \ + line_utils.getCurrentLine(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText']) + + if currLine.isspace(): + self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False) + else: + self.env['runtime']['outputManager'].presentText(currLine, interrupt=True, flush=False) + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/commands/review_curr_word.py b/src/fenrirscreenreader/commands/commands/review_curr_word.py index 9e98f09b..c0a2cbab 100644 --- a/src/fenrirscreenreader/commands/commands/review_curr_word.py +++ b/src/fenrirscreenreader/commands/commands/review_curr_word.py @@ -1,37 +1,37 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -from fenrirscreenreader.utils import word_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('current word.') - - def run(self): - self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() - - self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currWord, endOfScreen, lineBreak = \ - word_utils.getCurrentWord(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText']) - - if currWord.isspace(): - self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False) - else: - self.env['runtime']['outputManager'].presentText(currWord, interrupt=True, flush=False) - if endOfScreen: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): - self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen') - if lineBreak: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'): - self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine') - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +from fenrirscreenreader.utils import word_utils + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('current word.') + + def run(self): + self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() + + self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], currWord, endOfScreen, lineBreak = \ + word_utils.getCurrentWord(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText']) + + if currWord.isspace(): + self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False) + else: + self.env['runtime']['outputManager'].presentText(currWord, interrupt=True, flush=False) + if endOfScreen: + if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): + self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen') + if lineBreak: + if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'): + self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine') + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/review_curr_word_phonetic.py b/src/fenrirscreenreader/commands/commands/review_curr_word_phonetic.py index 42ecc900..974112ba 100644 --- a/src/fenrirscreenreader/commands/commands/review_curr_word_phonetic.py +++ b/src/fenrirscreenreader/commands/commands/review_curr_word_phonetic.py @@ -1,41 +1,41 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -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 - def getDescription(self): - 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']) - - if currWord.isspace(): - self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False) - else: - firstSequence = True - for c in currWord: - currChar = char_utils.getPhonetic(c) - self.env['runtime']['outputManager'].presentText(currChar, interrupt=firstSequence, announceCapital=True, flush=False) - firstSequence = False - if endOfScreen: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): - self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen') - if lineBreak: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'): - self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine') - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +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 + def getDescription(self): + 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']) + + if currWord.isspace(): + self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False) + else: + firstSequence = True + for c in currWord: + currChar = char_utils.getPhonetic(c) + self.env['runtime']['outputManager'].presentText(currChar, interrupt=firstSequence, announceCapital=True, flush=False) + firstSequence = False + if endOfScreen: + if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): + self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen') + if lineBreak: + if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'): + self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine') + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/review_next_line.py b/src/fenrirscreenreader/commands/commands/review_next_line.py index 4a17c137..b17018e9 100644 --- a/src/fenrirscreenreader/commands/commands/review_next_line.py +++ b/src/fenrirscreenreader/commands/commands/review_next_line.py @@ -1,36 +1,36 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -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 _('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']) - - if nextLine.isspace(): - self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False) - else: - self.env['runtime']['outputManager'].presentText(nextLine, interrupt=True, flush=False) - if endOfScreen: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): - self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen') - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +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 _('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']) + + if nextLine.isspace(): + self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False) + else: + self.env['runtime']['outputManager'].presentText(nextLine, interrupt=True, flush=False) + if endOfScreen: + if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): + self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen') + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/review_next_word.py b/src/fenrirscreenreader/commands/commands/review_next_word.py index 1b6d59aa..6b6eb7cf 100644 --- a/src/fenrirscreenreader/commands/commands/review_next_word.py +++ b/src/fenrirscreenreader/commands/commands/review_next_word.py @@ -1,39 +1,39 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -from fenrirscreenreader.utils import word_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('moves review to the next word ') - - def run(self): - self.env['screen']['oldCursorReview'] = self.env['screen']['newCursorReview'] - if self.env['screen']['newCursorReview'] == None: - self.env['screen']['newCursorReview'] = self.env['screen']['newCursor'].copy() - - self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], nextWord, endOfScreen, lineBreak = \ - word_utils.getNextWord(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText']) - - if nextWord.isspace(): - self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False) - else: - self.env['runtime']['outputManager'].presentText(nextWord, interrupt=True, flush=False) - if endOfScreen: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): - self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen') - if lineBreak: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'): - self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine') - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +from fenrirscreenreader.utils import word_utils + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('moves review to the next word ') + + def run(self): + self.env['screen']['oldCursorReview'] = self.env['screen']['newCursorReview'] + if self.env['screen']['newCursorReview'] == None: + self.env['screen']['newCursorReview'] = self.env['screen']['newCursor'].copy() + + self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], nextWord, endOfScreen, lineBreak = \ + word_utils.getNextWord(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText']) + + if nextWord.isspace(): + self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False) + else: + self.env['runtime']['outputManager'].presentText(nextWord, interrupt=True, flush=False) + if endOfScreen: + if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): + self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen') + if lineBreak: + if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'): + self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine') + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/review_next_word_phonetic.py b/src/fenrirscreenreader/commands/commands/review_next_word_phonetic.py index a920fdd1..fe022ba4 100644 --- a/src/fenrirscreenreader/commands/commands/review_next_word_phonetic.py +++ b/src/fenrirscreenreader/commands/commands/review_next_word_phonetic.py @@ -1,41 +1,41 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -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 - def getDescription(self): - 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']) - - if nextWord.isspace(): - self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False) - else: - firstSequence = True - for c in nextWord: - currChar = char_utils.getPhonetic(c) - self.env['runtime']['outputManager'].presentText(currChar, interrupt=firstSequence, announceCapital=True, flush=False) - firstSequence = False - if endOfScreen: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): - self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen') - if lineBreak: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'): - self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine') - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +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 + def getDescription(self): + 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']) + + if nextWord.isspace(): + self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False) + else: + firstSequence = True + for c in nextWord: + currChar = char_utils.getPhonetic(c) + self.env['runtime']['outputManager'].presentText(currChar, interrupt=firstSequence, announceCapital=True, flush=False) + firstSequence = False + if endOfScreen: + if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): + self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen') + if lineBreak: + if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'): + self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine') + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/review_prev_line.py b/src/fenrirscreenreader/commands/commands/review_prev_line.py index 9b1332ec..ab25c35e 100644 --- a/src/fenrirscreenreader/commands/commands/review_prev_line.py +++ b/src/fenrirscreenreader/commands/commands/review_prev_line.py @@ -1,35 +1,35 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -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 _('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']) - - if prevLine.isspace(): - self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False) - else: - self.env['runtime']['outputManager'].presentText(prevLine, interrupt=True, flush=False) - if endOfScreen: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): - self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen') - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +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 _('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']) + + if prevLine.isspace(): + self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False) + else: + self.env['runtime']['outputManager'].presentText(prevLine, interrupt=True, flush=False) + if endOfScreen: + if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): + self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen') + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/review_prev_word.py b/src/fenrirscreenreader/commands/commands/review_prev_word.py index e0f370f6..54ca1dfb 100644 --- a/src/fenrirscreenreader/commands/commands/review_prev_word.py +++ b/src/fenrirscreenreader/commands/commands/review_prev_word.py @@ -1,37 +1,37 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -from fenrirscreenreader.utils import word_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('moves review focus to the previous word ') - - def run(self): - self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() - - self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], prevWord, endOfScreen, lineBreak = \ - word_utils.getPrevWord(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText']) - - if prevWord.isspace(): - self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False) - else: - self.env['runtime']['outputManager'].presentText(prevWord, interrupt=True, flush=False) - if endOfScreen: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): - self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=False, soundIcon='EndOfScreen') - if lineBreak: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'): - self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine') - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +from fenrirscreenreader.utils import word_utils + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('moves review focus to the previous word ') + + def run(self): + self.env['runtime']['cursorManager'].enterReviewModeCurrTextCursor() + + self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], prevWord, endOfScreen, lineBreak = \ + word_utils.getPrevWord(self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText']) + + if prevWord.isspace(): + self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False) + else: + self.env['runtime']['outputManager'].presentText(prevWord, interrupt=True, flush=False) + if endOfScreen: + if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): + self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=False, soundIcon='EndOfScreen') + if lineBreak: + if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'): + self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine') + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/review_prev_word_phonetic.py b/src/fenrirscreenreader/commands/commands/review_prev_word_phonetic.py index e122a3bd..d2222267 100644 --- a/src/fenrirscreenreader/commands/commands/review_prev_word_phonetic.py +++ b/src/fenrirscreenreader/commands/commands/review_prev_word_phonetic.py @@ -1,41 +1,41 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -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 - def getDescription(self): - 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']) - - if prevWord.isspace(): - self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False) - else: - firstSequence = True - for c in prevWord: - currChar = char_utils.getPhonetic(c) - self.env['runtime']['outputManager'].presentText(currChar, interrupt=firstSequence, announceCapital=True, flush=False) - firstSequence = False - if endOfScreen: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): - self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen') - if lineBreak: - if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'): - self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine') - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +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 + def getDescription(self): + 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']) + + if prevWord.isspace(): + self.env['runtime']['outputManager'].presentText(_("blank"), interrupt=True, flush=False) + else: + firstSequence = True + for c in prevWord: + currChar = char_utils.getPhonetic(c) + self.env['runtime']['outputManager'].presentText(currChar, interrupt=firstSequence, announceCapital=True, flush=False) + firstSequence = False + if endOfScreen: + if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'endOfScreen'): + self.env['runtime']['outputManager'].presentText(_('end of screen'), interrupt=True, soundIcon='EndOfScreen') + if lineBreak: + if self.env['runtime']['settingsManager'].getSettingAsBool('review', 'lineBreak'): + self.env['runtime']['outputManager'].presentText(_('line break'), interrupt=False, soundIcon='EndOfLine') + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/save_settings.py b/src/fenrirscreenreader/commands/commands/save_settings.py index e0e184c9..279128dc 100644 --- a/src/fenrirscreenreader/commands/commands/save_settings.py +++ b/src/fenrirscreenreader/commands/commands/save_settings.py @@ -1,24 +1,24 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -from fenrirscreenreader.core import settingsManager - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('Saves your current Fenrir settings so they are the default.') - def run(self): - settingsFile = self.env['runtime']['settingsManager'].getSettingsFile() - self.env['runtime']['settingsManager'].saveSettings(settingsFile) - self.env['runtime']['outputManager'].presentText(_("Settings saved."), interrupt=True) - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +from fenrirscreenreader.core import settingsManager + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('Saves your current Fenrir settings so they are the default.') + def run(self): + settingsFile = self.env['runtime']['settingsManager'].getSettingsFile() + self.env['runtime']['settingsManager'].saveSettings(settingsFile) + self.env['runtime']['outputManager'].presentText(_("Settings saved."), interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/shut_up.py b/src/fenrirscreenreader/commands/commands/shut_up.py index dcedc094..169db793 100644 --- a/src/fenrirscreenreader/commands/commands/shut_up.py +++ b/src/fenrirscreenreader/commands/commands/shut_up.py @@ -1,23 +1,23 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('Interrupts the current presentation') - def run(self): - if len(self.env['input']['prevDeepestInput']) > len(self.env['input']['currInput']): - return - self.env['runtime']['outputManager'].interruptOutput() - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('Interrupts the current presentation') + def run(self): + if len(self.env['input']['prevDeepestInput']) > len(self.env['input']['currInput']): + return + self.env['runtime']['outputManager'].interruptOutput() + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/subprocess.py b/src/fenrirscreenreader/commands/commands/subprocess.py index 1394f465..f23340ef 100644 --- a/src/fenrirscreenreader/commands/commands/subprocess.py +++ b/src/fenrirscreenreader/commands/commands/subprocess.py @@ -1,50 +1,50 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -import subprocess, os -from subprocess import Popen, PIPE -import _thread - -class command(): - def __init__(self): - pass - def initialize(self, environment, scriptPath=''): - self.env = environment - self.scriptPath = scriptPath - def shutdown(self): - pass - def getDescription(self): - return _('script: {0} fullpath: {1}').format(os.path.basename(self.scriptPath), self.scriptPath) - def run(self): - if not os.path.exists(self.scriptPath): - self.env['runtime']['outputManager'].presentText(_('Script file not found'), soundIcon='', interrupt=False) - return - if not os.path.isfile(self.scriptPath): - self.env['runtime']['outputManager'].presentText(_('Script source is not a valid file'), soundIcon='', interrupt=False) - return - if not os.access(self.scriptPath, os.X_OK): - self.env['runtime']['outputManager'].presentText(_('Script file is not executable'), soundIcon='', interrupt=False) - return - _thread.start_new_thread(self._threadRun , ()) - - def _threadRun(self): - try: - callstring = self.scriptPath + ' ' + self.env['general']['currUser'] - p = Popen(callstring , stdout=PIPE, stderr=PIPE, shell=True) - stdout, stderr = p.communicate() - stdout = stdout.decode('utf-8') - stderr = stderr.decode('utf-8') - self.env['runtime']['outputManager'].interruptOutput() - if stderr != '': - self.env['runtime']['outputManager'].presentText(str(stderr) , soundIcon='', interrupt=False) - if stdout != '': - self.env['runtime']['outputManager'].presentText(str(stdout) , soundIcon='', interrupt=False) - except Exception as e: - self.env['runtime']['outputManager'].presentText(e , soundIcon='', interrupt=False) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +import subprocess, os +from subprocess import Popen, PIPE +import _thread + +class command(): + def __init__(self): + pass + def initialize(self, environment, scriptPath=''): + self.env = environment + self.scriptPath = scriptPath + def shutdown(self): + pass + def getDescription(self): + return _('script: {0} fullpath: {1}').format(os.path.basename(self.scriptPath), self.scriptPath) + def run(self): + if not os.path.exists(self.scriptPath): + self.env['runtime']['outputManager'].presentText(_('Script file not found'), soundIcon='', interrupt=False) + return + if not os.path.isfile(self.scriptPath): + self.env['runtime']['outputManager'].presentText(_('Script source is not a valid file'), soundIcon='', interrupt=False) + return + if not os.access(self.scriptPath, os.X_OK): + self.env['runtime']['outputManager'].presentText(_('Script file is not executable'), soundIcon='', interrupt=False) + return + _thread.start_new_thread(self._threadRun , ()) + + def _threadRun(self): + try: + callstring = self.scriptPath + ' ' + self.env['general']['currUser'] + p = Popen(callstring , stdout=PIPE, stderr=PIPE, shell=True) + stdout, stderr = p.communicate() + stdout = stdout.decode('utf-8') + stderr = stderr.decode('utf-8') + self.env['runtime']['outputManager'].interruptOutput() + if stderr != '': + self.env['runtime']['outputManager'].presentText(str(stderr) , soundIcon='', interrupt=False) + if stdout != '': + self.env['runtime']['outputManager'].presentText(str(stdout) , soundIcon='', interrupt=False) + except Exception as e: + self.env['runtime']['outputManager'].presentText(e , soundIcon='', interrupt=False) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/temp_disable_speech.py b/src/fenrirscreenreader/commands/commands/temp_disable_speech.py index 300646a0..bbd863d4 100644 --- a/src/fenrirscreenreader/commands/commands/temp_disable_speech.py +++ b/src/fenrirscreenreader/commands/commands/temp_disable_speech.py @@ -1,23 +1,23 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('disables speech until next keypress') - - def run(self): - self.env['runtime']['outputManager'].tempDisableSpeech() - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('disables speech until next keypress') + + def run(self): + self.env['runtime']['outputManager'].tempDisableSpeech() + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/time.py b/src/fenrirscreenreader/commands/commands/time.py index 8e890edb..cb532e92 100644 --- a/src/fenrirscreenreader/commands/commands/time.py +++ b/src/fenrirscreenreader/commands/commands/time.py @@ -1,30 +1,30 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -import datetime - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('presents the time') - - def run(self): - timeFormat = self.env['runtime']['settingsManager'].getSetting('general', 'timeFormat') - - # get the time formatted - timeString = datetime.datetime.strftime(datetime.datetime.now(), timeFormat) - - # present the time via speak and braile, there is no soundicon, interrupt the current speech - self.env['runtime']['outputManager'].presentText(timeString , soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +import datetime + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('presents the time') + + def run(self): + timeFormat = self.env['runtime']['settingsManager'].getSetting('general', 'timeFormat') + + # get the time formatted + timeString = datetime.datetime.strftime(datetime.datetime.now(), timeFormat) + + # present the time via speak and braile, there is no soundicon, interrupt the current speech + self.env['runtime']['outputManager'].presentText(timeString , soundIcon='', interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/toggle_auto_indent.py b/src/fenrirscreenreader/commands/commands/toggle_auto_indent.py index 2e29136d..869c6400 100644 --- a/src/fenrirscreenreader/commands/commands/toggle_auto_indent.py +++ b/src/fenrirscreenreader/commands/commands/toggle_auto_indent.py @@ -1,26 +1,26 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('enables or disables automatic reading of indentation level changes') - - def run(self): - self.env['runtime']['settingsManager'].setSetting('general', 'autoPresentIndent', str(not self.env['runtime']['settingsManager'].getSettingAsBool('general', 'autoPresentIndent'))) - if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'autoPresentIndent'): - self.env['runtime']['outputManager'].presentText(_("autoindent enabled"), soundIcon='', interrupt=True) - else: - self.env['runtime']['outputManager'].presentText(_("autoindent disabled"), soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('enables or disables automatic reading of indentation level changes') + + def run(self): + self.env['runtime']['settingsManager'].setSetting('general', 'autoPresentIndent', str(not self.env['runtime']['settingsManager'].getSettingAsBool('general', 'autoPresentIndent'))) + if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'autoPresentIndent'): + self.env['runtime']['outputManager'].presentText(_("autoindent enabled"), soundIcon='', interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_("autoindent disabled"), soundIcon='', interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/toggle_auto_read.py b/src/fenrirscreenreader/commands/commands/toggle_auto_read.py index b3313149..b9f4d0ae 100644 --- a/src/fenrirscreenreader/commands/commands/toggle_auto_read.py +++ b/src/fenrirscreenreader/commands/commands/toggle_auto_read.py @@ -1,26 +1,26 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('enables or disables automatic reading of new text as it appears') - - def run(self): - self.env['runtime']['settingsManager'].setSetting('speech', 'autoReadIncoming', str(not self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'autoReadIncoming'))) - if self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'autoReadIncoming'): - self.env['runtime']['outputManager'].presentText(_("autoread enabled"), soundIcon='', interrupt=True) - else: - self.env['runtime']['outputManager'].presentText(_("autoread disabled"), soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('enables or disables automatic reading of new text as it appears') + + def run(self): + self.env['runtime']['settingsManager'].setSetting('speech', 'autoReadIncoming', str(not self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'autoReadIncoming'))) + if self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'autoReadIncoming'): + self.env['runtime']['outputManager'].presentText(_("autoread enabled"), soundIcon='', interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_("autoread disabled"), soundIcon='', interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/toggle_auto_spell_check.py b/src/fenrirscreenreader/commands/commands/toggle_auto_spell_check.py index 299e2677..548ad908 100644 --- a/src/fenrirscreenreader/commands/commands/toggle_auto_spell_check.py +++ b/src/fenrirscreenreader/commands/commands/toggle_auto_spell_check.py @@ -1,27 +1,27 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('enables or disables automatic spell checking') - - def run(self): - self.env['runtime']['settingsManager'].setSetting('general', 'autoSpellCheck', str(not self.env['runtime']['settingsManager'].getSettingAsBool('general', 'autoSpellCheck'))) - if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'autoSpellCheck'): - self.env['runtime']['outputManager'].presentText(_("auto spellcheck enabled"), soundIcon='', interrupt=True) - else: - self.env['runtime']['outputManager'].presentText(_("auto spellcheck disabled"), soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('enables or disables automatic spell checking') + + def run(self): + self.env['runtime']['settingsManager'].setSetting('general', 'autoSpellCheck', str(not self.env['runtime']['settingsManager'].getSettingAsBool('general', 'autoSpellCheck'))) + if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'autoSpellCheck'): + self.env['runtime']['outputManager'].presentText(_("auto spellcheck enabled"), soundIcon='', interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_("auto spellcheck disabled"), soundIcon='', interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/toggle_auto_time.py b/src/fenrirscreenreader/commands/commands/toggle_auto_time.py index 7871ffa2..7cfeb952 100644 --- a/src/fenrirscreenreader/commands/commands/toggle_auto_time.py +++ b/src/fenrirscreenreader/commands/commands/toggle_auto_time.py @@ -1,26 +1,26 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('Enables or disables automatic reading of time after specified intervals') - - def run(self): - self.env['runtime']['settingsManager'].setSetting('time', 'enabled', str(not self.env['runtime']['settingsManager'].getSettingAsBool('time', 'enabled'))) - if self.env['runtime']['settingsManager'].getSettingAsBool('time', 'enabled'): - self.env['runtime']['outputManager'].presentText(_("Automatic time announcement enabled"), soundIcon='', interrupt=True) - else: - self.env['runtime']['outputManager'].presentText(_("Automatic time announcement disabled"), soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('Enables or disables automatic reading of time after specified intervals') + + def run(self): + self.env['runtime']['settingsManager'].setSetting('time', 'enabled', str(not self.env['runtime']['settingsManager'].getSettingAsBool('time', 'enabled'))) + if self.env['runtime']['settingsManager'].getSettingAsBool('time', 'enabled'): + self.env['runtime']['outputManager'].presentText(_("Automatic time announcement enabled"), soundIcon='', interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_("Automatic time announcement disabled"), soundIcon='', interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/toggle_barrier.py b/src/fenrirscreenreader/commands/commands/toggle_barrier.py index 2af09c82..141eb93a 100644 --- a/src/fenrirscreenreader/commands/commands/toggle_barrier.py +++ b/src/fenrirscreenreader/commands/commands/toggle_barrier.py @@ -1,26 +1,26 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('enables or disables the barrier mode') - - def run(self): - self.env['runtime']['settingsManager'].setSetting('barrier', 'enabled', str(not self.env['runtime']['settingsManager'].getSettingAsBool('barrier', 'enabled'))) - if self.env['runtime']['settingsManager'].getSettingAsBool('barrier', 'enabled'): - self.env['runtime']['outputManager'].presentText(_("barrier mode enabled"), soundIcon='', interrupt=True) - else: - self.env['runtime']['outputManager'].presentText(_("barrier mode disabled"), soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('enables or disables the barrier mode') + + def run(self): + self.env['runtime']['settingsManager'].setSetting('barrier', 'enabled', str(not self.env['runtime']['settingsManager'].getSettingAsBool('barrier', 'enabled'))) + if self.env['runtime']['settingsManager'].getSettingAsBool('barrier', 'enabled'): + self.env['runtime']['outputManager'].presentText(_("barrier mode enabled"), soundIcon='', interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_("barrier mode disabled"), soundIcon='', interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/toggle_emoticons.py b/src/fenrirscreenreader/commands/commands/toggle_emoticons.py index a77cb793..518a19d2 100644 --- a/src/fenrirscreenreader/commands/commands/toggle_emoticons.py +++ b/src/fenrirscreenreader/commands/commands/toggle_emoticons.py @@ -1,26 +1,26 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('enables or disables announcement of emoticons instead of chars') - - def run(self): - self.env['runtime']['settingsManager'].setSetting('general', 'emoticons', str(not self.env['runtime']['settingsManager'].getSettingAsBool('general', 'emoticons'))) - if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'emoticons'): - self.env['runtime']['outputManager'].presentText(_('emoticons enabled'), soundIcon='', interrupt=True) - else: - self.env['runtime']['outputManager'].presentText(_('emoticons disabled'), soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('enables or disables announcement of emoticons instead of chars') + + def run(self): + self.env['runtime']['settingsManager'].setSetting('general', 'emoticons', str(not self.env['runtime']['settingsManager'].getSettingAsBool('general', 'emoticons'))) + if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'emoticons'): + self.env['runtime']['outputManager'].presentText(_('emoticons enabled'), soundIcon='', interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_('emoticons disabled'), soundIcon='', interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/toggle_has_attribute.py b/src/fenrirscreenreader/commands/commands/toggle_has_attribute.py index 65404111..63714a11 100644 --- a/src/fenrirscreenreader/commands/commands/toggle_has_attribute.py +++ b/src/fenrirscreenreader/commands/commands/toggle_has_attribute.py @@ -1,26 +1,26 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('enables or disables the announcement of attributes') - - def run(self): - self.env['runtime']['settingsManager'].setSetting('general', 'hasAttributes', str(not self.env['runtime']['settingsManager'].getSettingAsBool('general', 'hasAttributes'))) - if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'hasAttributes'): - self.env['runtime']['outputManager'].presentText(_("announcement of attributes enabled"), soundIcon='', interrupt=True) - else: - self.env['runtime']['outputManager'].presentText(_("announcement of attributes disabled"), soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('enables or disables the announcement of attributes') + + def run(self): + self.env['runtime']['settingsManager'].setSetting('general', 'hasAttributes', str(not self.env['runtime']['settingsManager'].getSettingAsBool('general', 'hasAttributes'))) + if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'hasAttributes'): + self.env['runtime']['outputManager'].presentText(_("announcement of attributes enabled"), soundIcon='', interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_("announcement of attributes disabled"), soundIcon='', interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/toggle_highlight_tracking.py b/src/fenrirscreenreader/commands/commands/toggle_highlight_tracking.py index ed031468..e2733355 100644 --- a/src/fenrirscreenreader/commands/commands/toggle_highlight_tracking.py +++ b/src/fenrirscreenreader/commands/commands/toggle_highlight_tracking.py @@ -1,29 +1,29 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('enables or disables tracking of highlighted text') - - def run(self): - currMode = self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'highlight') - - self.env['runtime']['settingsManager'].setSetting('focus', 'highlight', str(not currMode)) - self.env['runtime']['settingsManager'].setSetting('focus', 'cursor', str(currMode)) - if self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'highlight'): - self.env['runtime']['outputManager'].presentText(_('highlight tracking'), soundIcon='', interrupt=True) - else: - self.env['runtime']['outputManager'].presentText(_('cursor tracking'), soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('enables or disables tracking of highlighted text') + + def run(self): + currMode = self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'highlight') + + self.env['runtime']['settingsManager'].setSetting('focus', 'highlight', str(not currMode)) + self.env['runtime']['settingsManager'].setSetting('focus', 'cursor', str(currMode)) + if self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'highlight'): + self.env['runtime']['outputManager'].presentText(_('highlight tracking'), soundIcon='', interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_('cursor tracking'), soundIcon='', interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/toggle_sound.py b/src/fenrirscreenreader/commands/commands/toggle_sound.py index 88740cb6..a176d326 100644 --- a/src/fenrirscreenreader/commands/commands/toggle_sound.py +++ b/src/fenrirscreenreader/commands/commands/toggle_sound.py @@ -1,27 +1,27 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('enables or disables sound') - - def run(self): - if self.env['runtime']['settingsManager'].getSettingAsBool('sound', 'enabled'): - self.env['runtime']['outputManager'].presentText(_('sound disabled'), soundIcon='SoundOff', interrupt=True) - self.env['runtime']['settingsManager'].setSetting('sound', 'enabled', str(not self.env['runtime']['settingsManager'].getSettingAsBool('sound', 'enabled'))) - if self.env['runtime']['settingsManager'].getSettingAsBool('sound', 'enabled'): - self.env['runtime']['outputManager'].presentText(_('sound enabled'), soundIcon='SoundOn', interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('enables or disables sound') + + def run(self): + if self.env['runtime']['settingsManager'].getSettingAsBool('sound', 'enabled'): + self.env['runtime']['outputManager'].presentText(_('sound disabled'), soundIcon='SoundOff', interrupt=True) + self.env['runtime']['settingsManager'].setSetting('sound', 'enabled', str(not self.env['runtime']['settingsManager'].getSettingAsBool('sound', 'enabled'))) + if self.env['runtime']['settingsManager'].getSettingAsBool('sound', 'enabled'): + self.env['runtime']['outputManager'].presentText(_('sound enabled'), soundIcon='SoundOn', interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/commands/toggle_speech.py b/src/fenrirscreenreader/commands/commands/toggle_speech.py index ef4b6f5f..fc918825 100644 --- a/src/fenrirscreenreader/commands/commands/toggle_speech.py +++ b/src/fenrirscreenreader/commands/commands/toggle_speech.py @@ -1,28 +1,28 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('enables or disables speech') - - def run(self): - if self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'enabled'): - self.env['runtime']['outputManager'].interruptOutput() - self.env['runtime']['outputManager'].presentText(_('speech disabled'), soundIcon='SpeechOff', interrupt=True) - self.env['runtime']['settingsManager'].setSetting('speech', 'enabled', str(not self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'enabled'))) - if self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'enabled'): - self.env['runtime']['outputManager'].presentText(_('speech enabled'), soundIcon='SpeechOn', interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('enables or disables speech') + + def run(self): + if self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'enabled'): + self.env['runtime']['outputManager'].interruptOutput() + self.env['runtime']['outputManager'].presentText(_('speech disabled'), soundIcon='SpeechOff', interrupt=True) + self.env['runtime']['settingsManager'].setSetting('speech', 'enabled', str(not self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'enabled'))) + if self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'enabled'): + self.env['runtime']['outputManager'].presentText(_('speech enabled'), soundIcon='SpeechOn', interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/onByteInput/10000-shut_up.py b/src/fenrirscreenreader/commands/onByteInput/10000-shut_up.py index 7ce785f3..8828ffab 100644 --- a/src/fenrirscreenreader/commands/onByteInput/10000-shut_up.py +++ b/src/fenrirscreenreader/commands/onByteInput/10000-shut_up.py @@ -1,33 +1,33 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return '' - - def run(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'interruptOnKeyPress'): - return - if self.env['runtime']['screenManager'].isScreenChange(): - return - # if the filter is set - #if self.env['runtime']['settingsManager'].getSetting('keyboard', 'interruptOnKeyPressFilter').strip() != '': - # filterList = self.env['runtime']['settingsManager'].getSetting('keyboard', 'interruptOnKeyPressFilter').split(',') - # for currInput in self.env['input']['currInput']: - # if not currInput in filterList: - # return - self.env['runtime']['outputManager'].interruptOutput() - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return '' + + def run(self): + if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'interruptOnKeyPress'): + return + if self.env['runtime']['screenManager'].isScreenChange(): + return + # if the filter is set + #if self.env['runtime']['settingsManager'].getSetting('keyboard', 'interruptOnKeyPressFilter').strip() != '': + # filterList = self.env['runtime']['settingsManager'].getSetting('keyboard', 'interruptOnKeyPressFilter').split(',') + # for currInput in self.env['input']['currInput']: + # if not currInput in filterList: + # return + self.env['runtime']['outputManager'].interruptOutput() + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/onByteInput/15000-enable_temp_speech.py b/src/fenrirscreenreader/commands/onByteInput/15000-enable_temp_speech.py index 06476e05..f9d06a12 100644 --- a/src/fenrirscreenreader/commands/onByteInput/15000-enable_temp_speech.py +++ b/src/fenrirscreenreader/commands/onByteInput/15000-enable_temp_speech.py @@ -1,27 +1,27 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('disables speech until next keypress') - - def run(self): - if not self.env['commandBuffer']['enableSpeechOnKeypress']: - return - self.env['runtime']['settingsManager'].setSetting('speech', 'enabled', str(self.env['commandBuffer']['enableSpeechOnKeypress'])) - self.env['commandBuffer']['enableSpeechOnKeypress'] = False - self.env['runtime']['outputManager'].presentText(_("speech enabled"), soundIcon='SpeechOn', interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('disables speech until next keypress') + + def run(self): + if not self.env['commandBuffer']['enableSpeechOnKeypress']: + return + self.env['runtime']['settingsManager'].setSetting('speech', 'enabled', str(self.env['commandBuffer']['enableSpeechOnKeypress'])) + self.env['commandBuffer']['enableSpeechOnKeypress'] = False + self.env['runtime']['outputManager'].presentText(_("speech enabled"), soundIcon='SpeechOn', interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/onCursorChange/15000-char_echo.py b/src/fenrirscreenreader/commands/onCursorChange/15000-char_echo.py index e7f46786..a53837dc 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/15000-char_echo.py +++ b/src/fenrirscreenreader/commands/onCursorChange/15000-char_echo.py @@ -1,55 +1,55 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No Description found' - - def run(self): - # enabled? - active = self.env['runtime']['settingsManager'].getSettingAsInt('keyboard', 'charEchoMode') - # 0 = off - if active == 0: - return - # 2 = caps only - if active == 2: - if not self.env['input']['newCapsLock']: - return - # big changes are no char (but the value is bigger than one maybe the differ needs longer than you can type, so a little strange random buffer for now) - xMove = abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']) - if xMove > 3: - return - if self.env['runtime']['inputManager'].getShortcutType() in ['KEY']: - if self.env['runtime']['inputManager'].getLastDeepestInput() in [['KEY_TAB']]: - return - elif self.env['runtime']['inputManager'].getShortcutType() in ['BYTE']: - if self.env['runtime']['byteManager'].getLastByteKey() in [b' ', b'\t']: - return - # detect deletion or chilling - if self.env['screen']['newCursor']['x'] <= self.env['screen']['oldCursor']['x']: - return - # is there any change? - if not self.env['runtime']['screenManager'].isDelta(): - return - # filter unneded space on word begin - currDelta = self.env['screen']['newDelta'] - if len(currDelta.strip()) != len(currDelta) and \ - currDelta.strip() != '': - currDelta = currDelta.strip() - self.env['runtime']['outputManager'].presentText(currDelta, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) - print(currDelta) - - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No Description found' + + def run(self): + # enabled? + active = self.env['runtime']['settingsManager'].getSettingAsInt('keyboard', 'charEchoMode') + # 0 = off + if active == 0: + return + # 2 = caps only + if active == 2: + if not self.env['input']['newCapsLock']: + return + # big changes are no char (but the value is bigger than one maybe the differ needs longer than you can type, so a little strange random buffer for now) + xMove = abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']) + if xMove > 3: + return + if self.env['runtime']['inputManager'].getShortcutType() in ['KEY']: + if self.env['runtime']['inputManager'].getLastDeepestInput() in [['KEY_TAB']]: + return + elif self.env['runtime']['inputManager'].getShortcutType() in ['BYTE']: + if self.env['runtime']['byteManager'].getLastByteKey() in [b' ', b'\t']: + return + # detect deletion or chilling + if self.env['screen']['newCursor']['x'] <= self.env['screen']['oldCursor']['x']: + return + # is there any change? + if not self.env['runtime']['screenManager'].isDelta(): + return + # filter unneded space on word begin + currDelta = self.env['screen']['newDelta'] + if len(currDelta.strip()) != len(currDelta) and \ + currDelta.strip() != '': + currDelta = currDelta.strip() + self.env['runtime']['outputManager'].presentText(currDelta, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) + print(currDelta) + + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/onCursorChange/25000-word_echo_type.py b/src/fenrirscreenreader/commands/onCursorChange/25000-word_echo_type.py index b3285add..40054798 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/25000-word_echo_type.py +++ b/src/fenrirscreenreader/commands/onCursorChange/25000-word_echo_type.py @@ -1,58 +1,58 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -from fenrirscreenreader.utils import word_utils -import string - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No Description found' - - def run(self): - # is it enabled? - if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'wordEcho'): - return - # is naviation? - if self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x'] != 1: - return - # just when cursor move worddetection is needed - if not self.env['runtime']['cursorManager'].isCursorHorizontalMove(): - return - # for now no new line - if self.env['runtime']['cursorManager'].isCursorVerticalMove(): - return - # currently writing - if self.env['runtime']['screenManager'].isDelta(): - return - - # get the word - newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] - x, y, currWord, endOfScreen, lineBreak = \ - word_utils.getCurrentWord(self.env['screen']['newCursor']['x'], 0, newContent) - - # is there a word? - if currWord == '': - return - # at the end of a word - if not newContent[self.env['screen']['newCursor']['x']].isspace(): - return - # at the end of a word - if (x + len(currWord) != self.env['screen']['newCursor']['x']) and \ - (x + len(currWord) != self.env['screen']['newCursor']['x']-1): - return - - self.env['runtime']['outputManager'].presentText(currWord, interrupt=True, flush=False) - - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +from fenrirscreenreader.utils import word_utils +import string + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No Description found' + + def run(self): + # is it enabled? + if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'wordEcho'): + return + # is naviation? + if self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x'] != 1: + return + # just when cursor move worddetection is needed + if not self.env['runtime']['cursorManager'].isCursorHorizontalMove(): + return + # for now no new line + if self.env['runtime']['cursorManager'].isCursorVerticalMove(): + return + # currently writing + if self.env['runtime']['screenManager'].isDelta(): + return + + # get the word + newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] + x, y, currWord, endOfScreen, lineBreak = \ + word_utils.getCurrentWord(self.env['screen']['newCursor']['x'], 0, newContent) + + # is there a word? + if currWord == '': + return + # at the end of a word + if not newContent[self.env['screen']['newCursor']['x']].isspace(): + return + # at the end of a word + if (x + len(currWord) != self.env['screen']['newCursor']['x']) and \ + (x + len(currWord) != self.env['screen']['newCursor']['x']-1): + return + + self.env['runtime']['outputManager'].presentText(currWord, interrupt=True, flush=False) + + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/onCursorChange/45000-char_delete_echo.py b/src/fenrirscreenreader/commands/onCursorChange/45000-char_delete_echo.py index 3a4ddaa5..7d342703 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/45000-char_delete_echo.py +++ b/src/fenrirscreenreader/commands/onCursorChange/45000-char_delete_echo.py @@ -1,46 +1,46 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No Description found' - - def run(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'charDeleteEcho'): - return - # detect typing or chilling - if self.env['screen']['newCursor']['x'] >= self.env['screen']['oldCursor']['x']: - return - - # More than just a deletion happend - if self.env['runtime']['screenManager'].isDelta(ignoreSpace=True): - return - - # no deletion - if not self.env['runtime']['screenManager'].isNegativeDelta(): - return - - # too much for a single backspace... - # word begin produce a diff wiht len == 2 |a | others with 1 |a| - if len(self.env['screen']['newNegativeDelta']) > 2: - return - - currNegativeDelta = self.env['screen']['newNegativeDelta'] - if len(currNegativeDelta.strip()) != len(currNegativeDelta) and \ - currNegativeDelta.strip() != '': - currNegativeDelta = currNegativeDelta.strip() - self.env['runtime']['outputManager'].presentText(currNegativeDelta, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No Description found' + + def run(self): + if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'charDeleteEcho'): + return + # detect typing or chilling + if self.env['screen']['newCursor']['x'] >= self.env['screen']['oldCursor']['x']: + return + + # More than just a deletion happend + if self.env['runtime']['screenManager'].isDelta(ignoreSpace=True): + return + + # no deletion + if not self.env['runtime']['screenManager'].isNegativeDelta(): + return + + # too much for a single backspace... + # word begin produce a diff wiht len == 2 |a | others with 1 |a| + if len(self.env['screen']['newNegativeDelta']) > 2: + return + + currNegativeDelta = self.env['screen']['newNegativeDelta'] + if len(currNegativeDelta.strip()) != len(currNegativeDelta) and \ + currNegativeDelta.strip() != '': + currNegativeDelta = currNegativeDelta.strip() + self.env['runtime']['outputManager'].presentText(currNegativeDelta, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/onCursorChange/50000-present_char_if_cursor_change_horizontal.py b/src/fenrirscreenreader/commands/onCursorChange/50000-present_char_if_cursor_change_horizontal.py index a192d9e6..1fda1301 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/50000-present_char_if_cursor_change_horizontal.py +++ b/src/fenrirscreenreader/commands/onCursorChange/50000-present_char_if_cursor_change_horizontal.py @@ -1,51 +1,51 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -from fenrirscreenreader.utils import char_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return '' - - def run(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'cursor'): - return - if self.env['runtime']['screenManager'].isScreenChange(): - return - # detect an change on the screen, we just want to cursor arround, so no change should appear - if self.env['runtime']['screenManager'].isDelta(): - return - if self.env['runtime']['screenManager'].isNegativeDelta(): - return - # is a vertical change? - if self.env['runtime']['cursorManager'].isCursorVerticalMove(): - return - # is it a horizontal change? - if not self.env['runtime']['cursorManager'].isCursorHorizontalMove(): - return - - # echo word insteed of char - if self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'wordEcho'): - if abs(self.env['screen']['oldCursor']['x'] - self.env['screen']['newCursor']['x']) != 1: - # get the word - newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] - x, y, currWord, endOfScreen, lineBreak = \ - word_utils.getCurrentWord(self.env['screen']['newCursor']['x'], 0, newContent) - if self.env['screen']['newCursor']['x'] == x: - return - x, y, currChar = char_utils.getCurrentChar(self.env['screen']['newCursor']['x'], self.env['screen']['newCursor']['y'], self.env['screen']['newContentText']) - if not currChar.isspace(): - self.env['runtime']['outputManager'].presentText(currChar, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +from fenrirscreenreader.utils import char_utils + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return '' + + def run(self): + if not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'cursor'): + return + if self.env['runtime']['screenManager'].isScreenChange(): + return + # detect an change on the screen, we just want to cursor arround, so no change should appear + if self.env['runtime']['screenManager'].isDelta(): + return + if self.env['runtime']['screenManager'].isNegativeDelta(): + return + # is a vertical change? + if self.env['runtime']['cursorManager'].isCursorVerticalMove(): + return + # is it a horizontal change? + if not self.env['runtime']['cursorManager'].isCursorHorizontalMove(): + return + + # echo word insteed of char + if self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'wordEcho'): + if abs(self.env['screen']['oldCursor']['x'] - self.env['screen']['newCursor']['x']) != 1: + # get the word + newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] + x, y, currWord, endOfScreen, lineBreak = \ + word_utils.getCurrentWord(self.env['screen']['newCursor']['x'], 0, newContent) + if self.env['screen']['newCursor']['x'] == x: + return + x, y, currChar = char_utils.getCurrentChar(self.env['screen']['newCursor']['x'], self.env['screen']['newCursor']['y'], self.env['screen']['newContentText']) + if not currChar.isspace(): + self.env['runtime']['outputManager'].presentText(currChar, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/onCursorChange/55000-tab_completion.py b/src/fenrirscreenreader/commands/onCursorChange/55000-tab_completion.py index 412fe613..fd2b9353 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/55000-tab_completion.py +++ b/src/fenrirscreenreader/commands/onCursorChange/55000-tab_completion.py @@ -1,49 +1,49 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No Description found' - def run(self): - # try to detect the tab completion by cursor change - xMove = self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x'] - if xMove <= 0: - return - if self.env['runtime']['inputManager'].getShortcutType() in ['KEY']: - if not (self.env['runtime']['inputManager'].getLastDeepestInput() in [['KEY_TAB']]): - if xMove < 5: - return - elif self.env['runtime']['inputManager'].getShortcutType() in ['BYTE']: - found = False - for currByte in self.env['runtime']['byteManager'].getLastByteKey(): - if currByte == 9: - found = True - if not found: - if xMove < 5: - return - # is there any change? - if not self.env['runtime']['screenManager'].isDelta(): - return - if not xMove == len(self.env['screen']['newDelta']): - return - # filter unneded space on word begin - currDelta = self.env['screen']['newDelta'] - if len(currDelta.strip()) != len(currDelta) and \ - currDelta.strip() != '': - currDelta = currDelta.strip() - self.env['runtime']['outputManager'].presentText(currDelta, interrupt=True, announceCapital=True, flush=False) - - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No Description found' + def run(self): + # try to detect the tab completion by cursor change + xMove = self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x'] + if xMove <= 0: + return + if self.env['runtime']['inputManager'].getShortcutType() in ['KEY']: + if not (self.env['runtime']['inputManager'].getLastDeepestInput() in [['KEY_TAB']]): + if xMove < 5: + return + elif self.env['runtime']['inputManager'].getShortcutType() in ['BYTE']: + found = False + for currByte in self.env['runtime']['byteManager'].getLastByteKey(): + if currByte == 9: + found = True + if not found: + if xMove < 5: + return + # is there any change? + if not self.env['runtime']['screenManager'].isDelta(): + return + if not xMove == len(self.env['screen']['newDelta']): + return + # filter unneded space on word begin + currDelta = self.env['screen']['newDelta'] + if len(currDelta.strip()) != len(currDelta) and \ + currDelta.strip() != '': + currDelta = currDelta.strip() + self.env['runtime']['outputManager'].presentText(currDelta, interrupt=True, announceCapital=True, flush=False) + + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/onCursorChange/60000-word_echo_navigation.py b/src/fenrirscreenreader/commands/onCursorChange/60000-word_echo_navigation.py index 41275919..9f52829d 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/60000-word_echo_navigation.py +++ b/src/fenrirscreenreader/commands/onCursorChange/60000-word_echo_navigation.py @@ -1,54 +1,54 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -from fenrirscreenreader.utils import word_utils -import string - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No Description found' - - def run(self): - # is navigation? - if not abs(self.env['screen']['oldCursor']['x'] - self.env['screen']['newCursor']['x']) > 1: - return - - # just when cursor move worddetection is needed - if not self.env['runtime']['cursorManager'].isCursorHorizontalMove(): - return - # for now no new line - if self.env['runtime']['cursorManager'].isCursorVerticalMove(): - return - # currently writing - if self.env['runtime']['screenManager'].isDelta(): - return - - # get the word - newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] - x, y, currWord, endOfScreen, lineBreak = \ - word_utils.getCurrentWord(self.env['screen']['newCursor']['x'], 0, newContent) - - # is there a word? - if currWord == '': - return - - # at the start of a word - if (x + len(currWord) != self.env['screen']['newCursor']['x']) and \ - (self.env['screen']['newCursor']['x'] != x): - return - - self.env['runtime']['outputManager'].presentText(currWord, interrupt=True, flush=False) - - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +from fenrirscreenreader.utils import word_utils +import string + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No Description found' + + def run(self): + # is navigation? + if not abs(self.env['screen']['oldCursor']['x'] - self.env['screen']['newCursor']['x']) > 1: + return + + # just when cursor move worddetection is needed + if not self.env['runtime']['cursorManager'].isCursorHorizontalMove(): + return + # for now no new line + if self.env['runtime']['cursorManager'].isCursorVerticalMove(): + return + # currently writing + if self.env['runtime']['screenManager'].isDelta(): + return + + # get the word + newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] + x, y, currWord, endOfScreen, lineBreak = \ + word_utils.getCurrentWord(self.env['screen']['newCursor']['x'], 0, newContent) + + # is there a word? + if currWord == '': + return + + # at the start of a word + if (x + len(currWord) != self.env['screen']['newCursor']['x']) and \ + (self.env['screen']['newCursor']['x'] != x): + return + + self.env['runtime']['outputManager'].presentText(currWord, interrupt=True, flush=False) + + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/onCursorChange/65000-present_line_if_cursor_change_vertical.py b/src/fenrirscreenreader/commands/onCursorChange/65000-present_line_if_cursor_change_vertical.py index 8abb8797..baaf189d 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/65000-present_line_if_cursor_change_vertical.py +++ b/src/fenrirscreenreader/commands/onCursorChange/65000-present_line_if_cursor_change_vertical.py @@ -1,62 +1,62 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -from fenrirscreenreader.utils import line_utils -from fenrirscreenreader.utils import word_utils - -class command(): - def __init__(self): - self.lastIdent = -1 - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return '' - - def run(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'cursor'): - return - if self.env['runtime']['screenManager'].isScreenChange(): - self.lastIdent = 0 - return - # this leads to problems in vim -> status line change -> no announcement, so we do check the lengh as hack - if self.env['runtime']['screenManager'].isDelta(): - return - - # is a vertical change? - if not self.env['runtime']['cursorManager'].isCursorVerticalMove(): - return - - x, y, currLine = line_utils.getCurrentLine(self.env['screen']['newCursor']['x'], self.env['screen']['newCursor']['y'], self.env['screen']['newContentText']) - if currLine.isspace(): - self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False) - else: - # ident - currIdent = len(currLine) - len(currLine.lstrip()) - if self.lastIdent == -1: - self.lastIdent = currIdent - doInterrupt = True - if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'autoPresentIndent'): - if self.env['runtime']['settingsManager'].getSettingAsInt('general', 'autoPresentIndentMode') in [0,1]: - self.env['runtime']['outputManager'].playFrequence(currIdent * 50, 0.1, interrupt=doInterrupt) - if self.env['runtime']['settingsManager'].getSettingAsInt('general', 'autoPresentIndentMode') in [0,2]: - if self.lastIdent != currIdent: - self.env['runtime']['outputManager'].presentText(_('indented ') + str(currIdent) + ' ', interrupt=doInterrupt, flush=False) - doInterrupt = False - # barrier - sayLine = currLine - if self.env['runtime']['settingsManager'].getSettingAsBool('barrier','enabled'): - isBarrier, barrierLine = self.env['runtime']['barrierManager'].handleLineBarrier(self.env['screen']['newContentText'].split('\n'), self.env['screen']['newCursor']['x'],self.env['screen']['newCursor']['y']) - if isBarrier: - sayLine = barrierLine - # output - self.env['runtime']['outputManager'].presentText(sayLine, interrupt=doInterrupt, flush=False) - self.lastIdent = currIdent - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +from fenrirscreenreader.utils import line_utils +from fenrirscreenreader.utils import word_utils + +class command(): + def __init__(self): + self.lastIdent = -1 + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return '' + + def run(self): + if not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'cursor'): + return + if self.env['runtime']['screenManager'].isScreenChange(): + self.lastIdent = 0 + return + # this leads to problems in vim -> status line change -> no announcement, so we do check the lengh as hack + if self.env['runtime']['screenManager'].isDelta(): + return + + # is a vertical change? + if not self.env['runtime']['cursorManager'].isCursorVerticalMove(): + return + + x, y, currLine = line_utils.getCurrentLine(self.env['screen']['newCursor']['x'], self.env['screen']['newCursor']['y'], self.env['screen']['newContentText']) + if currLine.isspace(): + self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False) + else: + # ident + currIdent = len(currLine) - len(currLine.lstrip()) + if self.lastIdent == -1: + self.lastIdent = currIdent + doInterrupt = True + if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'autoPresentIndent'): + if self.env['runtime']['settingsManager'].getSettingAsInt('general', 'autoPresentIndentMode') in [0,1]: + self.env['runtime']['outputManager'].playFrequence(currIdent * 50, 0.1, interrupt=doInterrupt) + if self.env['runtime']['settingsManager'].getSettingAsInt('general', 'autoPresentIndentMode') in [0,2]: + if self.lastIdent != currIdent: + self.env['runtime']['outputManager'].presentText(_('indented ') + str(currIdent) + ' ', interrupt=doInterrupt, flush=False) + doInterrupt = False + # barrier + sayLine = currLine + if self.env['runtime']['settingsManager'].getSettingAsBool('barrier','enabled'): + isBarrier, barrierLine = self.env['runtime']['barrierManager'].handleLineBarrier(self.env['screen']['newContentText'].split('\n'), self.env['screen']['newCursor']['x'],self.env['screen']['newCursor']['y']) + if isBarrier: + sayLine = barrierLine + # output + self.env['runtime']['outputManager'].presentText(sayLine, interrupt=doInterrupt, flush=False) + self.lastIdent = currIdent + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/onCursorChange/68000-auto_identation_horizontal.py b/src/fenrirscreenreader/commands/onCursorChange/68000-auto_identation_horizontal.py index 785caa1c..ea80ee0e 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/68000-auto_identation_horizontal.py +++ b/src/fenrirscreenreader/commands/onCursorChange/68000-auto_identation_horizontal.py @@ -1,57 +1,57 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -from fenrirscreenreader.utils import line_utils -from fenrirscreenreader.utils import word_utils - -class command(): - def __init__(self): - self.lastIdent = -1 - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return '' - - def run(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'cursor'): - return - if self.env['runtime']['screenManager'].isScreenChange(): - self.lastIdent = 0 - return - - # is a vertical change? - if not self.env['runtime']['cursorManager'].isCursorHorizontalMove(): - return - x, y, currLine = line_utils.getCurrentLine(self.env['screen']['newCursor']['x'], self.env['screen']['newCursor']['y'], self.env['screen']['newContentText']) - currIdent = self.env['screen']['newCursor']['x'] - - if not currLine.isspace(): - # ident - lastIdent, lastY, lastLine = line_utils.getCurrentLine(self.env['screen']['newCursor']['x'], self.env['screen']['newCursor']['y'], self.env['screen']['oldContentText']) - if currLine.strip() != lastLine.strip(): - return - if len(currLine.lstrip()) == len(lastLine.lstrip()): - return - - currIdent = len(currLine) - len(currLine.lstrip()) - - if self.lastIdent == -1: - self.lastIdent = currIdent - if currIdent <= 0: - return - if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'autoPresentIndent'): - if self.env['runtime']['settingsManager'].getSettingAsInt('general', 'autoPresentIndentMode') in [0,1]: - self.env['runtime']['outputManager'].playFrequence(currIdent * 50, 0.1, interrupt=False) - if self.env['runtime']['settingsManager'].getSettingAsInt('general', 'autoPresentIndentMode') in [0,2]: - if self.lastIdent != currIdent: - self.env['runtime']['outputManager'].presentText(_('indented ') + str(currIdent) + ' ', interrupt=False, flush=False) - self.lastIdent = currIdent - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +from fenrirscreenreader.utils import line_utils +from fenrirscreenreader.utils import word_utils + +class command(): + def __init__(self): + self.lastIdent = -1 + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return '' + + def run(self): + if not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'cursor'): + return + if self.env['runtime']['screenManager'].isScreenChange(): + self.lastIdent = 0 + return + + # is a vertical change? + if not self.env['runtime']['cursorManager'].isCursorHorizontalMove(): + return + x, y, currLine = line_utils.getCurrentLine(self.env['screen']['newCursor']['x'], self.env['screen']['newCursor']['y'], self.env['screen']['newContentText']) + currIdent = self.env['screen']['newCursor']['x'] + + if not currLine.isspace(): + # ident + lastIdent, lastY, lastLine = line_utils.getCurrentLine(self.env['screen']['newCursor']['x'], self.env['screen']['newCursor']['y'], self.env['screen']['oldContentText']) + if currLine.strip() != lastLine.strip(): + return + if len(currLine.lstrip()) == len(lastLine.lstrip()): + return + + currIdent = len(currLine) - len(currLine.lstrip()) + + if self.lastIdent == -1: + self.lastIdent = currIdent + if currIdent <= 0: + return + if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'autoPresentIndent'): + if self.env['runtime']['settingsManager'].getSettingAsInt('general', 'autoPresentIndentMode') in [0,1]: + self.env['runtime']['outputManager'].playFrequence(currIdent * 50, 0.1, interrupt=False) + if self.env['runtime']['settingsManager'].getSettingAsInt('general', 'autoPresentIndentMode') in [0,2]: + if self.lastIdent != currIdent: + self.env['runtime']['outputManager'].presentText(_('indented ') + str(currIdent) + ' ', interrupt=False, flush=False) + self.lastIdent = currIdent + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/onCursorChange/85000-has_attribute.py b/src/fenrirscreenreader/commands/onCursorChange/85000-has_attribute.py index 27af8633..b7be5074 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/85000-has_attribute.py +++ b/src/fenrirscreenreader/commands/onCursorChange/85000-has_attribute.py @@ -1,34 +1,34 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -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') - def run(self): - # is it enabled? - if not self.env['runtime']['settingsManager'].getSettingAsBool('general', 'hasAttributes'): - return - # is a vertical change? - if not (self.env['runtime']['cursorManager'].isCursorVerticalMove() or\ - self.env['runtime']['cursorManager'].isCursorHorizontalMove()): - return - - cursorPos = self.env['screen']['newCursor'] - - if not self.env['runtime']['attributeManager'].hasAttributes(cursorPos): - return - self.env['runtime']['outputManager'].presentText('has attribute', soundIcon='HasAttributes', interrupt=False) - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +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') + def run(self): + # is it enabled? + if not self.env['runtime']['settingsManager'].getSettingAsBool('general', 'hasAttributes'): + return + # is a vertical change? + if not (self.env['runtime']['cursorManager'].isCursorVerticalMove() or\ + self.env['runtime']['cursorManager'].isCursorHorizontalMove()): + return + + cursorPos = self.env['screen']['newCursor'] + + if not self.env['runtime']['attributeManager'].hasAttributes(cursorPos): + return + self.env['runtime']['outputManager'].presentText('has attribute', soundIcon='HasAttributes', interrupt=False) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/onCursorChange/95000-exit_review_mode.py b/src/fenrirscreenreader/commands/onCursorChange/95000-exit_review_mode.py index f23be166..b9d095d9 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/95000-exit_review_mode.py +++ b/src/fenrirscreenreader/commands/onCursorChange/95000-exit_review_mode.py @@ -1,26 +1,26 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('exits review mode') - - def run(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('review', 'leaveReviewOnCursorChange'): - return - if self.env['runtime']['cursorManager'].isReviewMode(): - self.env['runtime']['cursorManager'].clearReviewCursor() - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('exits review mode') + + def run(self): + if not self.env['runtime']['settingsManager'].getSettingAsBool('review', 'leaveReviewOnCursorChange'): + return + if self.env['runtime']['cursorManager'].isReviewMode(): + self.env['runtime']['cursorManager'].clearReviewCursor() + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/45000-char_echo.py b/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/45000-char_echo.py index 6cc1a4f7..96ecc656 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/45000-char_echo.py +++ b/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/45000-char_echo.py @@ -1,42 +1,42 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No Description found' - - def run(self): - # big changes are no char (but the value is bigger than one maybe the differ needs longer than you can type, so a little strange random buffer for now) - xMove = abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']) - if xMove > 1: - return - if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'charEcho'): - return - # detect deletion or chilling - if self.env['screen']['newCursor']['x'] <= self.env['screen']['oldCursor']['x']: - return - # is there any change? - if not self.env['runtime']['screenManager'].isDelta(): - return - - # filter unneded space on word begin - currDelta = self.env['screen']['newDelta'] - if len(currDelta.strip()) != len(currDelta) and \ - currDelta.strip() != '': - currDelta = currDelta.strip() - self.env['runtime']['outputManager'].presentText(currDelta, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) - - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No Description found' + + def run(self): + # big changes are no char (but the value is bigger than one maybe the differ needs longer than you can type, so a little strange random buffer for now) + xMove = abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']) + if xMove > 1: + return + if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'charEcho'): + return + # detect deletion or chilling + if self.env['screen']['newCursor']['x'] <= self.env['screen']['oldCursor']['x']: + return + # is there any change? + if not self.env['runtime']['screenManager'].isDelta(): + return + + # filter unneded space on word begin + currDelta = self.env['screen']['newDelta'] + if len(currDelta.strip()) != len(currDelta) and \ + currDelta.strip() != '': + currDelta = currDelta.strip() + self.env['runtime']['outputManager'].presentText(currDelta, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) + + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/46000-tab_completion.py b/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/46000-tab_completion.py index 0b08a2a6..46ecb33d 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/46000-tab_completion.py +++ b/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/46000-tab_completion.py @@ -1,42 +1,42 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No Description found' - - def run(self): - # try to detect the tab completion by cursor change - xMove = abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']) - if xMove == 1: - return - # is there any change? - if not self.env['runtime']['screenManager'].isDelta(): - return - if not( (xMove > 1) and xMove == len(self.env['screen']['newDelta'])): - return - # detect deletion or chilling - if self.env['screen']['newCursor']['x'] <= self.env['screen']['oldCursor']['x']: - return - - # filter unneded space on word begin - currDelta = self.env['screen']['newDelta'] - if len(currDelta.strip()) != len(currDelta) and \ - currDelta.strip() != '': - currDelta = currDelta.strip() - self.env['runtime']['outputManager'].presentText(currDelta, interrupt=True, announceCapital=True, flush=False) - - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No Description found' + + def run(self): + # try to detect the tab completion by cursor change + xMove = abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']) + if xMove == 1: + return + # is there any change? + if not self.env['runtime']['screenManager'].isDelta(): + return + if not( (xMove > 1) and xMove == len(self.env['screen']['newDelta'])): + return + # detect deletion or chilling + if self.env['screen']['newCursor']['x'] <= self.env['screen']['oldCursor']['x']: + return + + # filter unneded space on word begin + currDelta = self.env['screen']['newDelta'] + if len(currDelta.strip()) != len(currDelta) and \ + currDelta.strip() != '': + currDelta = currDelta.strip() + self.env['runtime']['outputManager'].presentText(currDelta, interrupt=True, announceCapital=True, flush=False) + + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/50000-present_char_if_cursor_change_horizontal.py b/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/50000-present_char_if_cursor_change_horizontal.py index a192d9e6..1fda1301 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/50000-present_char_if_cursor_change_horizontal.py +++ b/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/50000-present_char_if_cursor_change_horizontal.py @@ -1,51 +1,51 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -from fenrirscreenreader.utils import char_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return '' - - def run(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'cursor'): - return - if self.env['runtime']['screenManager'].isScreenChange(): - return - # detect an change on the screen, we just want to cursor arround, so no change should appear - if self.env['runtime']['screenManager'].isDelta(): - return - if self.env['runtime']['screenManager'].isNegativeDelta(): - return - # is a vertical change? - if self.env['runtime']['cursorManager'].isCursorVerticalMove(): - return - # is it a horizontal change? - if not self.env['runtime']['cursorManager'].isCursorHorizontalMove(): - return - - # echo word insteed of char - if self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'wordEcho'): - if abs(self.env['screen']['oldCursor']['x'] - self.env['screen']['newCursor']['x']) != 1: - # get the word - newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] - x, y, currWord, endOfScreen, lineBreak = \ - word_utils.getCurrentWord(self.env['screen']['newCursor']['x'], 0, newContent) - if self.env['screen']['newCursor']['x'] == x: - return - x, y, currChar = char_utils.getCurrentChar(self.env['screen']['newCursor']['x'], self.env['screen']['newCursor']['y'], self.env['screen']['newContentText']) - if not currChar.isspace(): - self.env['runtime']['outputManager'].presentText(currChar, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +from fenrirscreenreader.utils import char_utils + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return '' + + def run(self): + if not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'cursor'): + return + if self.env['runtime']['screenManager'].isScreenChange(): + return + # detect an change on the screen, we just want to cursor arround, so no change should appear + if self.env['runtime']['screenManager'].isDelta(): + return + if self.env['runtime']['screenManager'].isNegativeDelta(): + return + # is a vertical change? + if self.env['runtime']['cursorManager'].isCursorVerticalMove(): + return + # is it a horizontal change? + if not self.env['runtime']['cursorManager'].isCursorHorizontalMove(): + return + + # echo word insteed of char + if self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'wordEcho'): + if abs(self.env['screen']['oldCursor']['x'] - self.env['screen']['newCursor']['x']) != 1: + # get the word + newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] + x, y, currWord, endOfScreen, lineBreak = \ + word_utils.getCurrentWord(self.env['screen']['newCursor']['x'], 0, newContent) + if self.env['screen']['newCursor']['x'] == x: + return + x, y, currChar = char_utils.getCurrentChar(self.env['screen']['newCursor']['x'], self.env['screen']['newCursor']['y'], self.env['screen']['newContentText']) + if not currChar.isspace(): + self.env['runtime']['outputManager'].presentText(currChar, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/55000-present_line_if_cursor_change_vertical.py b/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/55000-present_line_if_cursor_change_vertical.py index de2d01fa..7d0bb794 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/55000-present_line_if_cursor_change_vertical.py +++ b/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/55000-present_line_if_cursor_change_vertical.py @@ -1,59 +1,59 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -from fenrirscreenreader.utils import line_utils -from fenrirscreenreader.utils import word_utils - -class command(): - def __init__(self): - self.lastIdent = -1 - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return '' - - def run(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'cursor'): - return - if self.env['runtime']['screenManager'].isScreenChange(): - self.lastIdent = 0 - return - # this leads to problems in vim -> status line change -> no announcement, so we do check the lengh as hack - if self.env['runtime']['screenManager'].isDelta(): - return - - # is a vertical change? - if not self.env['runtime']['cursorManager'].isCursorVerticalMove(): - return - - x, y, currLine = line_utils.getCurrentLine(self.env['screen']['newCursor']['x'], self.env['screen']['newCursor']['y'], self.env['screen']['newContentText']) - if currLine.isspace(): - self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False) - else: - # ident - currIdent = len(currLine) - len(currLine.lstrip()) - if self.lastIdent == -1: - self.lastIdent = currIdent - doInterrupt = True - if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'autoPresentIndent'): - if self.lastIdent != currIdent: - self.env['runtime']['outputManager'].presentText(_('indented ') + str(currIdent) + ' ', interrupt=doInterrupt, flush=False) - doInterrupt = False - # barrier - sayLine = currLine - if self.env['runtime']['settingsManager'].getSettingAsBool('barrier','enabled'): - isBarrier, barrierLine = self.env['runtime']['barrierManager'].handleLineBarrier(self.env['screen']['newContentText'].split('\n'), self.env['screen']['newCursor']['x'],self.env['screen']['newCursor']['y']) - if isBarrier: - sayLine = barrierLine - # output - self.env['runtime']['outputManager'].presentText(sayLine, interrupt=doInterrupt, flush=False) - self.lastIdent = currIdent - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +from fenrirscreenreader.utils import line_utils +from fenrirscreenreader.utils import word_utils + +class command(): + def __init__(self): + self.lastIdent = -1 + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return '' + + def run(self): + if not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'cursor'): + return + if self.env['runtime']['screenManager'].isScreenChange(): + self.lastIdent = 0 + return + # this leads to problems in vim -> status line change -> no announcement, so we do check the lengh as hack + if self.env['runtime']['screenManager'].isDelta(): + return + + # is a vertical change? + if not self.env['runtime']['cursorManager'].isCursorVerticalMove(): + return + + x, y, currLine = line_utils.getCurrentLine(self.env['screen']['newCursor']['x'], self.env['screen']['newCursor']['y'], self.env['screen']['newContentText']) + if currLine.isspace(): + self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False) + else: + # ident + currIdent = len(currLine) - len(currLine.lstrip()) + if self.lastIdent == -1: + self.lastIdent = currIdent + doInterrupt = True + if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'autoPresentIndent'): + if self.lastIdent != currIdent: + self.env['runtime']['outputManager'].presentText(_('indented ') + str(currIdent) + ' ', interrupt=doInterrupt, flush=False) + doInterrupt = False + # barrier + sayLine = currLine + if self.env['runtime']['settingsManager'].getSettingAsBool('barrier','enabled'): + isBarrier, barrierLine = self.env['runtime']['barrierManager'].handleLineBarrier(self.env['screen']['newContentText'].split('\n'), self.env['screen']['newCursor']['x'],self.env['screen']['newCursor']['y']) + if isBarrier: + sayLine = barrierLine + # output + self.env['runtime']['outputManager'].presentText(sayLine, interrupt=doInterrupt, flush=False) + self.lastIdent = currIdent + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/60000-word_echo_type.py b/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/60000-word_echo_type.py index b3285add..40054798 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/60000-word_echo_type.py +++ b/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/60000-word_echo_type.py @@ -1,58 +1,58 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -from fenrirscreenreader.utils import word_utils -import string - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No Description found' - - def run(self): - # is it enabled? - if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'wordEcho'): - return - # is naviation? - if self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x'] != 1: - return - # just when cursor move worddetection is needed - if not self.env['runtime']['cursorManager'].isCursorHorizontalMove(): - return - # for now no new line - if self.env['runtime']['cursorManager'].isCursorVerticalMove(): - return - # currently writing - if self.env['runtime']['screenManager'].isDelta(): - return - - # get the word - newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] - x, y, currWord, endOfScreen, lineBreak = \ - word_utils.getCurrentWord(self.env['screen']['newCursor']['x'], 0, newContent) - - # is there a word? - if currWord == '': - return - # at the end of a word - if not newContent[self.env['screen']['newCursor']['x']].isspace(): - return - # at the end of a word - if (x + len(currWord) != self.env['screen']['newCursor']['x']) and \ - (x + len(currWord) != self.env['screen']['newCursor']['x']-1): - return - - self.env['runtime']['outputManager'].presentText(currWord, interrupt=True, flush=False) - - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +from fenrirscreenreader.utils import word_utils +import string + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No Description found' + + def run(self): + # is it enabled? + if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'wordEcho'): + return + # is naviation? + if self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x'] != 1: + return + # just when cursor move worddetection is needed + if not self.env['runtime']['cursorManager'].isCursorHorizontalMove(): + return + # for now no new line + if self.env['runtime']['cursorManager'].isCursorVerticalMove(): + return + # currently writing + if self.env['runtime']['screenManager'].isDelta(): + return + + # get the word + newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] + x, y, currWord, endOfScreen, lineBreak = \ + word_utils.getCurrentWord(self.env['screen']['newCursor']['x'], 0, newContent) + + # is there a word? + if currWord == '': + return + # at the end of a word + if not newContent[self.env['screen']['newCursor']['x']].isspace(): + return + # at the end of a word + if (x + len(currWord) != self.env['screen']['newCursor']['x']) and \ + (x + len(currWord) != self.env['screen']['newCursor']['x']-1): + return + + self.env['runtime']['outputManager'].presentText(currWord, interrupt=True, flush=False) + + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/61000-word_echo_navigation.py b/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/61000-word_echo_navigation.py index 41275919..9f52829d 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/61000-word_echo_navigation.py +++ b/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/61000-word_echo_navigation.py @@ -1,54 +1,54 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -from fenrirscreenreader.utils import word_utils -import string - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No Description found' - - def run(self): - # is navigation? - if not abs(self.env['screen']['oldCursor']['x'] - self.env['screen']['newCursor']['x']) > 1: - return - - # just when cursor move worddetection is needed - if not self.env['runtime']['cursorManager'].isCursorHorizontalMove(): - return - # for now no new line - if self.env['runtime']['cursorManager'].isCursorVerticalMove(): - return - # currently writing - if self.env['runtime']['screenManager'].isDelta(): - return - - # get the word - newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] - x, y, currWord, endOfScreen, lineBreak = \ - word_utils.getCurrentWord(self.env['screen']['newCursor']['x'], 0, newContent) - - # is there a word? - if currWord == '': - return - - # at the start of a word - if (x + len(currWord) != self.env['screen']['newCursor']['x']) and \ - (self.env['screen']['newCursor']['x'] != x): - return - - self.env['runtime']['outputManager'].presentText(currWord, interrupt=True, flush=False) - - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +from fenrirscreenreader.utils import word_utils +import string + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No Description found' + + def run(self): + # is navigation? + if not abs(self.env['screen']['oldCursor']['x'] - self.env['screen']['newCursor']['x']) > 1: + return + + # just when cursor move worddetection is needed + if not self.env['runtime']['cursorManager'].isCursorHorizontalMove(): + return + # for now no new line + if self.env['runtime']['cursorManager'].isCursorVerticalMove(): + return + # currently writing + if self.env['runtime']['screenManager'].isDelta(): + return + + # get the word + newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] + x, y, currWord, endOfScreen, lineBreak = \ + word_utils.getCurrentWord(self.env['screen']['newCursor']['x'], 0, newContent) + + # is there a word? + if currWord == '': + return + + # at the start of a word + if (x + len(currWord) != self.env['screen']['newCursor']['x']) and \ + (self.env['screen']['newCursor']['x'] != x): + return + + self.env['runtime']['outputManager'].presentText(currWord, interrupt=True, flush=False) + + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/65000-char_delete_echo.py b/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/65000-char_delete_echo.py index 3a4ddaa5..7d342703 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/65000-char_delete_echo.py +++ b/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/65000-char_delete_echo.py @@ -1,46 +1,46 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No Description found' - - def run(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'charDeleteEcho'): - return - # detect typing or chilling - if self.env['screen']['newCursor']['x'] >= self.env['screen']['oldCursor']['x']: - return - - # More than just a deletion happend - if self.env['runtime']['screenManager'].isDelta(ignoreSpace=True): - return - - # no deletion - if not self.env['runtime']['screenManager'].isNegativeDelta(): - return - - # too much for a single backspace... - # word begin produce a diff wiht len == 2 |a | others with 1 |a| - if len(self.env['screen']['newNegativeDelta']) > 2: - return - - currNegativeDelta = self.env['screen']['newNegativeDelta'] - if len(currNegativeDelta.strip()) != len(currNegativeDelta) and \ - currNegativeDelta.strip() != '': - currNegativeDelta = currNegativeDelta.strip() - self.env['runtime']['outputManager'].presentText(currNegativeDelta, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No Description found' + + def run(self): + if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'charDeleteEcho'): + return + # detect typing or chilling + if self.env['screen']['newCursor']['x'] >= self.env['screen']['oldCursor']['x']: + return + + # More than just a deletion happend + if self.env['runtime']['screenManager'].isDelta(ignoreSpace=True): + return + + # no deletion + if not self.env['runtime']['screenManager'].isNegativeDelta(): + return + + # too much for a single backspace... + # word begin produce a diff wiht len == 2 |a | others with 1 |a| + if len(self.env['screen']['newNegativeDelta']) > 2: + return + + currNegativeDelta = self.env['screen']['newNegativeDelta'] + if len(currNegativeDelta.strip()) != len(currNegativeDelta) and \ + currNegativeDelta.strip() != '': + currNegativeDelta = currNegativeDelta.strip() + self.env['runtime']['outputManager'].presentText(currNegativeDelta, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/66000-exit_review_mode.py b/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/66000-exit_review_mode.py index f23be166..b9d095d9 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/66000-exit_review_mode.py +++ b/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/66000-exit_review_mode.py @@ -1,26 +1,26 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('exits review mode') - - def run(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('review', 'leaveReviewOnCursorChange'): - return - if self.env['runtime']['cursorManager'].isReviewMode(): - self.env['runtime']['cursorManager'].clearReviewCursor() - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('exits review mode') + + def run(self): + if not self.env['runtime']['settingsManager'].getSettingAsBool('review', 'leaveReviewOnCursorChange'): + return + if self.env['runtime']['cursorManager'].isReviewMode(): + self.env['runtime']['cursorManager'].clearReviewCursor() + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/77000-has_attribute.py b/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/77000-has_attribute.py index 27af8633..b7be5074 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/77000-has_attribute.py +++ b/src/fenrirscreenreader/commands/onCursorChange/orig_sorting/77000-has_attribute.py @@ -1,34 +1,34 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -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') - def run(self): - # is it enabled? - if not self.env['runtime']['settingsManager'].getSettingAsBool('general', 'hasAttributes'): - return - # is a vertical change? - if not (self.env['runtime']['cursorManager'].isCursorVerticalMove() or\ - self.env['runtime']['cursorManager'].isCursorHorizontalMove()): - return - - cursorPos = self.env['screen']['newCursor'] - - if not self.env['runtime']['attributeManager'].hasAttributes(cursorPos): - return - self.env['runtime']['outputManager'].presentText('has attribute', soundIcon='HasAttributes', interrupt=False) - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +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') + def run(self): + # is it enabled? + if not self.env['runtime']['settingsManager'].getSettingAsBool('general', 'hasAttributes'): + return + # is a vertical change? + if not (self.env['runtime']['cursorManager'].isCursorVerticalMove() or\ + self.env['runtime']['cursorManager'].isCursorHorizontalMove()): + return + + cursorPos = self.env['screen']['newCursor'] + + if not self.env['runtime']['attributeManager'].hasAttributes(cursorPos): + return + self.env['runtime']['outputManager'].presentText('has attribute', soundIcon='HasAttributes', interrupt=False) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/onCursorChange/resort/15000-char_echo.py b/src/fenrirscreenreader/commands/onCursorChange/resort/15000-char_echo.py index 6cc1a4f7..96ecc656 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/resort/15000-char_echo.py +++ b/src/fenrirscreenreader/commands/onCursorChange/resort/15000-char_echo.py @@ -1,42 +1,42 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No Description found' - - def run(self): - # big changes are no char (but the value is bigger than one maybe the differ needs longer than you can type, so a little strange random buffer for now) - xMove = abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']) - if xMove > 1: - return - if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'charEcho'): - return - # detect deletion or chilling - if self.env['screen']['newCursor']['x'] <= self.env['screen']['oldCursor']['x']: - return - # is there any change? - if not self.env['runtime']['screenManager'].isDelta(): - return - - # filter unneded space on word begin - currDelta = self.env['screen']['newDelta'] - if len(currDelta.strip()) != len(currDelta) and \ - currDelta.strip() != '': - currDelta = currDelta.strip() - self.env['runtime']['outputManager'].presentText(currDelta, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) - - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No Description found' + + def run(self): + # big changes are no char (but the value is bigger than one maybe the differ needs longer than you can type, so a little strange random buffer for now) + xMove = abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']) + if xMove > 1: + return + if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'charEcho'): + return + # detect deletion or chilling + if self.env['screen']['newCursor']['x'] <= self.env['screen']['oldCursor']['x']: + return + # is there any change? + if not self.env['runtime']['screenManager'].isDelta(): + return + + # filter unneded space on word begin + currDelta = self.env['screen']['newDelta'] + if len(currDelta.strip()) != len(currDelta) and \ + currDelta.strip() != '': + currDelta = currDelta.strip() + self.env['runtime']['outputManager'].presentText(currDelta, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) + + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/onCursorChange/resort/25000-word_echo_type.py b/src/fenrirscreenreader/commands/onCursorChange/resort/25000-word_echo_type.py index b3285add..40054798 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/resort/25000-word_echo_type.py +++ b/src/fenrirscreenreader/commands/onCursorChange/resort/25000-word_echo_type.py @@ -1,58 +1,58 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -from fenrirscreenreader.utils import word_utils -import string - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No Description found' - - def run(self): - # is it enabled? - if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'wordEcho'): - return - # is naviation? - if self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x'] != 1: - return - # just when cursor move worddetection is needed - if not self.env['runtime']['cursorManager'].isCursorHorizontalMove(): - return - # for now no new line - if self.env['runtime']['cursorManager'].isCursorVerticalMove(): - return - # currently writing - if self.env['runtime']['screenManager'].isDelta(): - return - - # get the word - newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] - x, y, currWord, endOfScreen, lineBreak = \ - word_utils.getCurrentWord(self.env['screen']['newCursor']['x'], 0, newContent) - - # is there a word? - if currWord == '': - return - # at the end of a word - if not newContent[self.env['screen']['newCursor']['x']].isspace(): - return - # at the end of a word - if (x + len(currWord) != self.env['screen']['newCursor']['x']) and \ - (x + len(currWord) != self.env['screen']['newCursor']['x']-1): - return - - self.env['runtime']['outputManager'].presentText(currWord, interrupt=True, flush=False) - - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +from fenrirscreenreader.utils import word_utils +import string + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No Description found' + + def run(self): + # is it enabled? + if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'wordEcho'): + return + # is naviation? + if self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x'] != 1: + return + # just when cursor move worddetection is needed + if not self.env['runtime']['cursorManager'].isCursorHorizontalMove(): + return + # for now no new line + if self.env['runtime']['cursorManager'].isCursorVerticalMove(): + return + # currently writing + if self.env['runtime']['screenManager'].isDelta(): + return + + # get the word + newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] + x, y, currWord, endOfScreen, lineBreak = \ + word_utils.getCurrentWord(self.env['screen']['newCursor']['x'], 0, newContent) + + # is there a word? + if currWord == '': + return + # at the end of a word + if not newContent[self.env['screen']['newCursor']['x']].isspace(): + return + # at the end of a word + if (x + len(currWord) != self.env['screen']['newCursor']['x']) and \ + (x + len(currWord) != self.env['screen']['newCursor']['x']-1): + return + + self.env['runtime']['outputManager'].presentText(currWord, interrupt=True, flush=False) + + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/onCursorChange/resort/45000-char_delete_echo.py b/src/fenrirscreenreader/commands/onCursorChange/resort/45000-char_delete_echo.py index 3a4ddaa5..7d342703 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/resort/45000-char_delete_echo.py +++ b/src/fenrirscreenreader/commands/onCursorChange/resort/45000-char_delete_echo.py @@ -1,46 +1,46 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No Description found' - - def run(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'charDeleteEcho'): - return - # detect typing or chilling - if self.env['screen']['newCursor']['x'] >= self.env['screen']['oldCursor']['x']: - return - - # More than just a deletion happend - if self.env['runtime']['screenManager'].isDelta(ignoreSpace=True): - return - - # no deletion - if not self.env['runtime']['screenManager'].isNegativeDelta(): - return - - # too much for a single backspace... - # word begin produce a diff wiht len == 2 |a | others with 1 |a| - if len(self.env['screen']['newNegativeDelta']) > 2: - return - - currNegativeDelta = self.env['screen']['newNegativeDelta'] - if len(currNegativeDelta.strip()) != len(currNegativeDelta) and \ - currNegativeDelta.strip() != '': - currNegativeDelta = currNegativeDelta.strip() - self.env['runtime']['outputManager'].presentText(currNegativeDelta, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No Description found' + + def run(self): + if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'charDeleteEcho'): + return + # detect typing or chilling + if self.env['screen']['newCursor']['x'] >= self.env['screen']['oldCursor']['x']: + return + + # More than just a deletion happend + if self.env['runtime']['screenManager'].isDelta(ignoreSpace=True): + return + + # no deletion + if not self.env['runtime']['screenManager'].isNegativeDelta(): + return + + # too much for a single backspace... + # word begin produce a diff wiht len == 2 |a | others with 1 |a| + if len(self.env['screen']['newNegativeDelta']) > 2: + return + + currNegativeDelta = self.env['screen']['newNegativeDelta'] + if len(currNegativeDelta.strip()) != len(currNegativeDelta) and \ + currNegativeDelta.strip() != '': + currNegativeDelta = currNegativeDelta.strip() + self.env['runtime']['outputManager'].presentText(currNegativeDelta, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/onCursorChange/resort/50000-present_char_if_cursor_change_horizontal.py b/src/fenrirscreenreader/commands/onCursorChange/resort/50000-present_char_if_cursor_change_horizontal.py index a192d9e6..1fda1301 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/resort/50000-present_char_if_cursor_change_horizontal.py +++ b/src/fenrirscreenreader/commands/onCursorChange/resort/50000-present_char_if_cursor_change_horizontal.py @@ -1,51 +1,51 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -from fenrirscreenreader.utils import char_utils - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return '' - - def run(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'cursor'): - return - if self.env['runtime']['screenManager'].isScreenChange(): - return - # detect an change on the screen, we just want to cursor arround, so no change should appear - if self.env['runtime']['screenManager'].isDelta(): - return - if self.env['runtime']['screenManager'].isNegativeDelta(): - return - # is a vertical change? - if self.env['runtime']['cursorManager'].isCursorVerticalMove(): - return - # is it a horizontal change? - if not self.env['runtime']['cursorManager'].isCursorHorizontalMove(): - return - - # echo word insteed of char - if self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'wordEcho'): - if abs(self.env['screen']['oldCursor']['x'] - self.env['screen']['newCursor']['x']) != 1: - # get the word - newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] - x, y, currWord, endOfScreen, lineBreak = \ - word_utils.getCurrentWord(self.env['screen']['newCursor']['x'], 0, newContent) - if self.env['screen']['newCursor']['x'] == x: - return - x, y, currChar = char_utils.getCurrentChar(self.env['screen']['newCursor']['x'], self.env['screen']['newCursor']['y'], self.env['screen']['newContentText']) - if not currChar.isspace(): - self.env['runtime']['outputManager'].presentText(currChar, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +from fenrirscreenreader.utils import char_utils + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return '' + + def run(self): + if not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'cursor'): + return + if self.env['runtime']['screenManager'].isScreenChange(): + return + # detect an change on the screen, we just want to cursor arround, so no change should appear + if self.env['runtime']['screenManager'].isDelta(): + return + if self.env['runtime']['screenManager'].isNegativeDelta(): + return + # is a vertical change? + if self.env['runtime']['cursorManager'].isCursorVerticalMove(): + return + # is it a horizontal change? + if not self.env['runtime']['cursorManager'].isCursorHorizontalMove(): + return + + # echo word insteed of char + if self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'wordEcho'): + if abs(self.env['screen']['oldCursor']['x'] - self.env['screen']['newCursor']['x']) != 1: + # get the word + newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] + x, y, currWord, endOfScreen, lineBreak = \ + word_utils.getCurrentWord(self.env['screen']['newCursor']['x'], 0, newContent) + if self.env['screen']['newCursor']['x'] == x: + return + x, y, currChar = char_utils.getCurrentChar(self.env['screen']['newCursor']['x'], self.env['screen']['newCursor']['y'], self.env['screen']['newContentText']) + if not currChar.isspace(): + self.env['runtime']['outputManager'].presentText(currChar, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False) + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/onCursorChange/resort/55000-tab_completion.py b/src/fenrirscreenreader/commands/onCursorChange/resort/55000-tab_completion.py index 0b08a2a6..46ecb33d 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/resort/55000-tab_completion.py +++ b/src/fenrirscreenreader/commands/onCursorChange/resort/55000-tab_completion.py @@ -1,42 +1,42 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No Description found' - - def run(self): - # try to detect the tab completion by cursor change - xMove = abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']) - if xMove == 1: - return - # is there any change? - if not self.env['runtime']['screenManager'].isDelta(): - return - if not( (xMove > 1) and xMove == len(self.env['screen']['newDelta'])): - return - # detect deletion or chilling - if self.env['screen']['newCursor']['x'] <= self.env['screen']['oldCursor']['x']: - return - - # filter unneded space on word begin - currDelta = self.env['screen']['newDelta'] - if len(currDelta.strip()) != len(currDelta) and \ - currDelta.strip() != '': - currDelta = currDelta.strip() - self.env['runtime']['outputManager'].presentText(currDelta, interrupt=True, announceCapital=True, flush=False) - - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No Description found' + + def run(self): + # try to detect the tab completion by cursor change + xMove = abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']) + if xMove == 1: + return + # is there any change? + if not self.env['runtime']['screenManager'].isDelta(): + return + if not( (xMove > 1) and xMove == len(self.env['screen']['newDelta'])): + return + # detect deletion or chilling + if self.env['screen']['newCursor']['x'] <= self.env['screen']['oldCursor']['x']: + return + + # filter unneded space on word begin + currDelta = self.env['screen']['newDelta'] + if len(currDelta.strip()) != len(currDelta) and \ + currDelta.strip() != '': + currDelta = currDelta.strip() + self.env['runtime']['outputManager'].presentText(currDelta, interrupt=True, announceCapital=True, flush=False) + + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/onCursorChange/resort/60000-word_echo_navigation.py b/src/fenrirscreenreader/commands/onCursorChange/resort/60000-word_echo_navigation.py index 41275919..9f52829d 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/resort/60000-word_echo_navigation.py +++ b/src/fenrirscreenreader/commands/onCursorChange/resort/60000-word_echo_navigation.py @@ -1,54 +1,54 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -from fenrirscreenreader.utils import word_utils -import string - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No Description found' - - def run(self): - # is navigation? - if not abs(self.env['screen']['oldCursor']['x'] - self.env['screen']['newCursor']['x']) > 1: - return - - # just when cursor move worddetection is needed - if not self.env['runtime']['cursorManager'].isCursorHorizontalMove(): - return - # for now no new line - if self.env['runtime']['cursorManager'].isCursorVerticalMove(): - return - # currently writing - if self.env['runtime']['screenManager'].isDelta(): - return - - # get the word - newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] - x, y, currWord, endOfScreen, lineBreak = \ - word_utils.getCurrentWord(self.env['screen']['newCursor']['x'], 0, newContent) - - # is there a word? - if currWord == '': - return - - # at the start of a word - if (x + len(currWord) != self.env['screen']['newCursor']['x']) and \ - (self.env['screen']['newCursor']['x'] != x): - return - - self.env['runtime']['outputManager'].presentText(currWord, interrupt=True, flush=False) - - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +from fenrirscreenreader.utils import word_utils +import string + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No Description found' + + def run(self): + # is navigation? + if not abs(self.env['screen']['oldCursor']['x'] - self.env['screen']['newCursor']['x']) > 1: + return + + # just when cursor move worddetection is needed + if not self.env['runtime']['cursorManager'].isCursorHorizontalMove(): + return + # for now no new line + if self.env['runtime']['cursorManager'].isCursorVerticalMove(): + return + # currently writing + if self.env['runtime']['screenManager'].isDelta(): + return + + # get the word + newContent = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] + x, y, currWord, endOfScreen, lineBreak = \ + word_utils.getCurrentWord(self.env['screen']['newCursor']['x'], 0, newContent) + + # is there a word? + if currWord == '': + return + + # at the start of a word + if (x + len(currWord) != self.env['screen']['newCursor']['x']) and \ + (self.env['screen']['newCursor']['x'] != x): + return + + self.env['runtime']['outputManager'].presentText(currWord, interrupt=True, flush=False) + + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/onCursorChange/resort/65000-present_line_if_cursor_change_vertical.py b/src/fenrirscreenreader/commands/onCursorChange/resort/65000-present_line_if_cursor_change_vertical.py index de2d01fa..7d0bb794 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/resort/65000-present_line_if_cursor_change_vertical.py +++ b/src/fenrirscreenreader/commands/onCursorChange/resort/65000-present_line_if_cursor_change_vertical.py @@ -1,59 +1,59 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -from fenrirscreenreader.utils import line_utils -from fenrirscreenreader.utils import word_utils - -class command(): - def __init__(self): - self.lastIdent = -1 - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return '' - - def run(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'cursor'): - return - if self.env['runtime']['screenManager'].isScreenChange(): - self.lastIdent = 0 - return - # this leads to problems in vim -> status line change -> no announcement, so we do check the lengh as hack - if self.env['runtime']['screenManager'].isDelta(): - return - - # is a vertical change? - if not self.env['runtime']['cursorManager'].isCursorVerticalMove(): - return - - x, y, currLine = line_utils.getCurrentLine(self.env['screen']['newCursor']['x'], self.env['screen']['newCursor']['y'], self.env['screen']['newContentText']) - if currLine.isspace(): - self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False) - else: - # ident - currIdent = len(currLine) - len(currLine.lstrip()) - if self.lastIdent == -1: - self.lastIdent = currIdent - doInterrupt = True - if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'autoPresentIndent'): - if self.lastIdent != currIdent: - self.env['runtime']['outputManager'].presentText(_('indented ') + str(currIdent) + ' ', interrupt=doInterrupt, flush=False) - doInterrupt = False - # barrier - sayLine = currLine - if self.env['runtime']['settingsManager'].getSettingAsBool('barrier','enabled'): - isBarrier, barrierLine = self.env['runtime']['barrierManager'].handleLineBarrier(self.env['screen']['newContentText'].split('\n'), self.env['screen']['newCursor']['x'],self.env['screen']['newCursor']['y']) - if isBarrier: - sayLine = barrierLine - # output - self.env['runtime']['outputManager'].presentText(sayLine, interrupt=doInterrupt, flush=False) - self.lastIdent = currIdent - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +from fenrirscreenreader.utils import line_utils +from fenrirscreenreader.utils import word_utils + +class command(): + def __init__(self): + self.lastIdent = -1 + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return '' + + def run(self): + if not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'cursor'): + return + if self.env['runtime']['screenManager'].isScreenChange(): + self.lastIdent = 0 + return + # this leads to problems in vim -> status line change -> no announcement, so we do check the lengh as hack + if self.env['runtime']['screenManager'].isDelta(): + return + + # is a vertical change? + if not self.env['runtime']['cursorManager'].isCursorVerticalMove(): + return + + x, y, currLine = line_utils.getCurrentLine(self.env['screen']['newCursor']['x'], self.env['screen']['newCursor']['y'], self.env['screen']['newContentText']) + if currLine.isspace(): + self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False) + else: + # ident + currIdent = len(currLine) - len(currLine.lstrip()) + if self.lastIdent == -1: + self.lastIdent = currIdent + doInterrupt = True + if self.env['runtime']['settingsManager'].getSettingAsBool('general', 'autoPresentIndent'): + if self.lastIdent != currIdent: + self.env['runtime']['outputManager'].presentText(_('indented ') + str(currIdent) + ' ', interrupt=doInterrupt, flush=False) + doInterrupt = False + # barrier + sayLine = currLine + if self.env['runtime']['settingsManager'].getSettingAsBool('barrier','enabled'): + isBarrier, barrierLine = self.env['runtime']['barrierManager'].handleLineBarrier(self.env['screen']['newContentText'].split('\n'), self.env['screen']['newCursor']['x'],self.env['screen']['newCursor']['y']) + if isBarrier: + sayLine = barrierLine + # output + self.env['runtime']['outputManager'].presentText(sayLine, interrupt=doInterrupt, flush=False) + self.lastIdent = currIdent + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/onCursorChange/resort/85000-has_attribute.py b/src/fenrirscreenreader/commands/onCursorChange/resort/85000-has_attribute.py index 27af8633..b7be5074 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/resort/85000-has_attribute.py +++ b/src/fenrirscreenreader/commands/onCursorChange/resort/85000-has_attribute.py @@ -1,34 +1,34 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -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') - def run(self): - # is it enabled? - if not self.env['runtime']['settingsManager'].getSettingAsBool('general', 'hasAttributes'): - return - # is a vertical change? - if not (self.env['runtime']['cursorManager'].isCursorVerticalMove() or\ - self.env['runtime']['cursorManager'].isCursorHorizontalMove()): - return - - cursorPos = self.env['screen']['newCursor'] - - if not self.env['runtime']['attributeManager'].hasAttributes(cursorPos): - return - self.env['runtime']['outputManager'].presentText('has attribute', soundIcon='HasAttributes', interrupt=False) - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +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') + def run(self): + # is it enabled? + if not self.env['runtime']['settingsManager'].getSettingAsBool('general', 'hasAttributes'): + return + # is a vertical change? + if not (self.env['runtime']['cursorManager'].isCursorVerticalMove() or\ + self.env['runtime']['cursorManager'].isCursorHorizontalMove()): + return + + cursorPos = self.env['screen']['newCursor'] + + if not self.env['runtime']['attributeManager'].hasAttributes(cursorPos): + return + self.env['runtime']['outputManager'].presentText('has attribute', soundIcon='HasAttributes', interrupt=False) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/onCursorChange/resort/95000-exit_review_mode.py b/src/fenrirscreenreader/commands/onCursorChange/resort/95000-exit_review_mode.py index f23be166..b9d095d9 100644 --- a/src/fenrirscreenreader/commands/onCursorChange/resort/95000-exit_review_mode.py +++ b/src/fenrirscreenreader/commands/onCursorChange/resort/95000-exit_review_mode.py @@ -1,26 +1,26 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('exits review mode') - - def run(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('review', 'leaveReviewOnCursorChange'): - return - if self.env['runtime']['cursorManager'].isReviewMode(): - self.env['runtime']['cursorManager'].clearReviewCursor() - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('exits review mode') + + def run(self): + if not self.env['runtime']['settingsManager'].getSettingAsBool('review', 'leaveReviewOnCursorChange'): + return + if self.env['runtime']['cursorManager'].isReviewMode(): + self.env['runtime']['cursorManager'].clearReviewCursor() + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/onHeartBeat/2000-GetSessionInfo.py b/src/fenrirscreenreader/commands/onHeartBeat/2000-GetSessionInfo.py index 94029734..2856db92 100755 --- a/src/fenrirscreenreader/commands/onHeartBeat/2000-GetSessionInfo.py +++ b/src/fenrirscreenreader/commands/onHeartBeat/2000-GetSessionInfo.py @@ -1,29 +1,29 @@ -#!/usr/bin/env python3 -import time -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -import time -import datetime - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - self.lastTime = datetime.datetime.now() - self.lastDateString = '' - self.lastTimeString = '' - def shutdown(self): - pass - def getDescription(self): - return 'No Description found' - - def run(self): - self.env['runtime']['screenDriver'].getSessionInformation() - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +import time +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +import time +import datetime + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + self.lastTime = datetime.datetime.now() + self.lastDateString = '' + self.lastTimeString = '' + def shutdown(self): + pass + def getDescription(self): + return 'No Description found' + + def run(self): + self.env['runtime']['screenDriver'].getSessionInformation() + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/onHeartBeat/76000-time.py b/src/fenrirscreenreader/commands/onHeartBeat/76000-time.py index d645bfa0..6ed247b4 100755 --- a/src/fenrirscreenreader/commands/onHeartBeat/76000-time.py +++ b/src/fenrirscreenreader/commands/onHeartBeat/76000-time.py @@ -1,85 +1,85 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -import time -import datetime - -class command(): - def __init__(self): - pass - - def initialize(self, environment): - self.env = environment - self.lastTime = datetime.datetime.now() - self.lastDateString = '' - self.lastTimeString = '' - - def shutdown(self): - pass - - def getDescription(self): - return 'No Description found' - - def run(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('time', 'enabled'): - return - - onMinutes = self.env['runtime']['settingsManager'].getSetting('time', 'onMinutes') - delaySec = self.env['runtime']['settingsManager'].getSettingAsInt('time', 'delaySec') - - # no need - if onMinutes == '' and delaySec <= 0: - return - - onMinutes = onMinutes.split(',') - now = datetime.datetime.now() - - # ignore onMinutes if there is a delaySec - if delaySec > 0: - if int((now - self.lastTime).total_seconds()) < delaySec: - return - else: - # should announce? - if not str(now.minute).zfill(2) in onMinutes: - return - # already announced? - if now.hour == self.lastTime.hour: - if now.minute == self.lastTime.minute: - return - - dateFormat = self.env['runtime']['settingsManager'].getSetting('general', 'dateFormat') - dateString = datetime.datetime.strftime(now, dateFormat) - - presentDate = self.env['runtime']['settingsManager'].getSettingAsBool('time', 'presentDate') and \ - self.lastDateString != dateString - presentTime = self.env['runtime']['settingsManager'].getSettingAsBool('time', 'presentTime') - - # no changed value to announce - if not (presentDate or presentTime): - return - - timeFormat = self.env['runtime']['settingsManager'].getSetting('general', 'timeFormat') - timeString = datetime.datetime.strftime(now, timeFormat) - - if self.env['runtime']['settingsManager'].getSettingAsBool('time', 'interrupt'): - self.env['runtime']['outputManager'].interruptOutput() - if self.env['runtime']['settingsManager'].getSettingAsBool('time', 'announce'): - self.env['runtime']['outputManager'].playSoundIcon('announce') - - if presentTime: - # present the time - self.env['runtime']['outputManager'].presentText(_("It's {0}").format(timeString.replace(':00', " O'clock ").lstrip('0')), soundIcon='', interrupt=False) - # Check if it's 12:00 AM - if now.hour == 0 and now.minute == 0: - # present the date - self.env['runtime']['outputManager'].presentText(dateString, soundIcon='', interrupt=False) - - self.lastTime = datetime.datetime.now() - self.lastTimeString = timeString - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +import time +import datetime + +class command(): + def __init__(self): + pass + + def initialize(self, environment): + self.env = environment + self.lastTime = datetime.datetime.now() + self.lastDateString = '' + self.lastTimeString = '' + + def shutdown(self): + pass + + def getDescription(self): + return 'No Description found' + + def run(self): + if not self.env['runtime']['settingsManager'].getSettingAsBool('time', 'enabled'): + return + + onMinutes = self.env['runtime']['settingsManager'].getSetting('time', 'onMinutes') + delaySec = self.env['runtime']['settingsManager'].getSettingAsInt('time', 'delaySec') + + # no need + if onMinutes == '' and delaySec <= 0: + return + + onMinutes = onMinutes.split(',') + now = datetime.datetime.now() + + # ignore onMinutes if there is a delaySec + if delaySec > 0: + if int((now - self.lastTime).total_seconds()) < delaySec: + return + else: + # should announce? + if not str(now.minute).zfill(2) in onMinutes: + return + # already announced? + if now.hour == self.lastTime.hour: + if now.minute == self.lastTime.minute: + return + + dateFormat = self.env['runtime']['settingsManager'].getSetting('general', 'dateFormat') + dateString = datetime.datetime.strftime(now, dateFormat) + + presentDate = self.env['runtime']['settingsManager'].getSettingAsBool('time', 'presentDate') and \ + self.lastDateString != dateString + presentTime = self.env['runtime']['settingsManager'].getSettingAsBool('time', 'presentTime') + + # no changed value to announce + if not (presentDate or presentTime): + return + + timeFormat = self.env['runtime']['settingsManager'].getSetting('general', 'timeFormat') + timeString = datetime.datetime.strftime(now, timeFormat) + + if self.env['runtime']['settingsManager'].getSettingAsBool('time', 'interrupt'): + self.env['runtime']['outputManager'].interruptOutput() + if self.env['runtime']['settingsManager'].getSettingAsBool('time', 'announce'): + self.env['runtime']['outputManager'].playSoundIcon('announce') + + if presentTime: + # present the time + self.env['runtime']['outputManager'].presentText(_("It's {0}").format(timeString.replace(':00', " O'clock ").lstrip('0')), soundIcon='', interrupt=False) + # Check if it's 12:00 AM + if now.hour == 0 and now.minute == 0: + # present the date + self.env['runtime']['outputManager'].presentText(dateString, soundIcon='', interrupt=False) + + self.lastTime = datetime.datetime.now() + self.lastTimeString = timeString + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/onHeartBeat/deactive/1.echo.py b/src/fenrirscreenreader/commands/onHeartBeat/deactive/1.echo.py index 075acd6d..95e6bbda 100755 --- a/src/fenrirscreenreader/commands/onHeartBeat/deactive/1.echo.py +++ b/src/fenrirscreenreader/commands/onHeartBeat/deactive/1.echo.py @@ -1,26 +1,26 @@ -#!/usr/bin/env python3 -import time -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -import time - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - - def shutdown(self): - pass - def getDescription(self): - return 'No Description found' - - def run(self): - print(time.time()) - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +import time +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +import time + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + + def shutdown(self): + pass + def getDescription(self): + return 'No Description found' + + def run(self): + print(time.time()) + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/onKeyInput/10000-shut_up.py b/src/fenrirscreenreader/commands/onKeyInput/10000-shut_up.py index ddf927ec..522ab94a 100644 --- a/src/fenrirscreenreader/commands/onKeyInput/10000-shut_up.py +++ b/src/fenrirscreenreader/commands/onKeyInput/10000-shut_up.py @@ -1,37 +1,37 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return '' - - def run(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'interruptOnKeyPress'): - return - if self.env['runtime']['inputManager'].noKeyPressed(): - return - if self.env['runtime']['screenManager'].isScreenChange(): - return - if len(self.env['input']['currInput']) <= len(self.env['input']['prevInput']): - return - # if the filter is set - if self.env['runtime']['settingsManager'].getSetting('keyboard', 'interruptOnKeyPressFilter').strip() != '': - filterList = self.env['runtime']['settingsManager'].getSetting('keyboard', 'interruptOnKeyPressFilter').split(',') - for currInput in self.env['input']['currInput']: - if not currInput in filterList: - return - self.env['runtime']['outputManager'].interruptOutput() - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return '' + + def run(self): + if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'interruptOnKeyPress'): + return + if self.env['runtime']['inputManager'].noKeyPressed(): + return + if self.env['runtime']['screenManager'].isScreenChange(): + return + if len(self.env['input']['currInput']) <= len(self.env['input']['prevInput']): + return + # if the filter is set + if self.env['runtime']['settingsManager'].getSetting('keyboard', 'interruptOnKeyPressFilter').strip() != '': + filterList = self.env['runtime']['settingsManager'].getSetting('keyboard', 'interruptOnKeyPressFilter').split(',') + for currInput in self.env['input']['currInput']: + if not currInput in filterList: + return + self.env['runtime']['outputManager'].interruptOutput() + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/onKeyInput/15000-enable_temp_speech.py b/src/fenrirscreenreader/commands/onKeyInput/15000-enable_temp_speech.py index 77423368..29d37937 100644 --- a/src/fenrirscreenreader/commands/onKeyInput/15000-enable_temp_speech.py +++ b/src/fenrirscreenreader/commands/onKeyInput/15000-enable_temp_speech.py @@ -1,31 +1,31 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('disables speech until next keypress') - - def run(self): - if self.env['runtime']['inputManager'].noKeyPressed(): - return - if len(self.env['input']['prevInput']) >0: - return - if not self.env['commandBuffer']['enableSpeechOnKeypress']: - return - self.env['runtime']['settingsManager'].setSetting('speech', 'enabled', str(self.env['commandBuffer']['enableSpeechOnKeypress'])) - self.env['commandBuffer']['enableSpeechOnKeypress'] = False - self.env['runtime']['outputManager'].presentText(_("speech enabled"), soundIcon='SpeechOn', interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('disables speech until next keypress') + + def run(self): + if self.env['runtime']['inputManager'].noKeyPressed(): + return + if len(self.env['input']['prevInput']) >0: + return + if not self.env['commandBuffer']['enableSpeechOnKeypress']: + return + self.env['runtime']['settingsManager'].setSetting('speech', 'enabled', str(self.env['commandBuffer']['enableSpeechOnKeypress'])) + self.env['commandBuffer']['enableSpeechOnKeypress'] = False + self.env['runtime']['outputManager'].presentText(_("speech enabled"), soundIcon='SpeechOn', interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/onKeyInput/80000-capslock.py b/src/fenrirscreenreader/commands/onKeyInput/80000-capslock.py index 355897fe..f3efeb69 100644 --- a/src/fenrirscreenreader/commands/onKeyInput/80000-capslock.py +++ b/src/fenrirscreenreader/commands/onKeyInput/80000-capslock.py @@ -1,27 +1,27 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No description found' - def run(self): - if self.env['input']['oldCapsLock'] == self.env['input']['newCapsLock']: - return - if self.env['input']['newCapsLock']: - self.env['runtime']['outputManager'].presentText(_("Capslock on"), interrupt=True) - else: - self.env['runtime']['outputManager'].presentText(_("Capslock off"), interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No description found' + def run(self): + if self.env['input']['oldCapsLock'] == self.env['input']['newCapsLock']: + return + if self.env['input']['newCapsLock']: + self.env['runtime']['outputManager'].presentText(_("Capslock on"), interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_("Capslock off"), interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/onKeyInput/80300-scrolllock.py b/src/fenrirscreenreader/commands/onKeyInput/80300-scrolllock.py index 8e1ad95a..c3d64946 100644 --- a/src/fenrirscreenreader/commands/onKeyInput/80300-scrolllock.py +++ b/src/fenrirscreenreader/commands/onKeyInput/80300-scrolllock.py @@ -1,27 +1,27 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No description found' - def run(self): - if self.env['input']['oldScrollLock'] == self.env['input']['newScrollLock']: - return - if self.env['input']['newScrollLock']: - self.env['runtime']['outputManager'].presentText(_("Scrolllock on"), interrupt=True) - else: - self.env['runtime']['outputManager'].presentText(_("Scrolllock off"), interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No description found' + def run(self): + if self.env['input']['oldScrollLock'] == self.env['input']['newScrollLock']: + return + if self.env['input']['newScrollLock']: + self.env['runtime']['outputManager'].presentText(_("Scrolllock on"), interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_("Scrolllock off"), interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/onKeyInput/80500-numlock.py b/src/fenrirscreenreader/commands/onKeyInput/80500-numlock.py index 8164a4f8..96e1348e 100644 --- a/src/fenrirscreenreader/commands/onKeyInput/80500-numlock.py +++ b/src/fenrirscreenreader/commands/onKeyInput/80500-numlock.py @@ -1,27 +1,27 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No description found' - def run(self): - if self.env['input']['oldNumLock'] == self.env['input']['newNumLock']: - return - if self.env['input']['newNumLock']: - self.env['runtime']['outputManager'].presentText(_("Numlock on"), interrupt=True) - else: - self.env['runtime']['outputManager'].presentText(_("Numlock off"), interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No description found' + def run(self): + if self.env['input']['oldNumLock'] == self.env['input']['newNumLock']: + return + if self.env['input']['newNumLock']: + self.env['runtime']['outputManager'].presentText(_("Numlock on"), interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_("Numlock off"), interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/onKeyInput/81000-key_echo.py b/src/fenrirscreenreader/commands/onKeyInput/81000-key_echo.py index afa76258..fca7437a 100644 --- a/src/fenrirscreenreader/commands/onKeyInput/81000-key_echo.py +++ b/src/fenrirscreenreader/commands/onKeyInput/81000-key_echo.py @@ -1,23 +1,23 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No description found' - def run(self): - if self.env['runtime']['helpManager'].isTutorialMode(): - self.env['runtime']['inputManager'].keyEcho() - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No description found' + def run(self): + if self.env['runtime']['helpManager'].isTutorialMode(): + self.env['runtime']['inputManager'].keyEcho() + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/onPlugInputDevice/50000-plugSound.py b/src/fenrirscreenreader/commands/onPlugInputDevice/50000-plugSound.py index a7ade58e..461eb2b5 100755 --- a/src/fenrirscreenreader/commands/onPlugInputDevice/50000-plugSound.py +++ b/src/fenrirscreenreader/commands/onPlugInputDevice/50000-plugSound.py @@ -1,34 +1,34 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -import time - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - self.lastTime = time.time() - def shutdown(self): - pass - def getDescription(self): - return 'No description found' - def run(self): - playSound = False - deviceList = self.env['runtime']['inputManager'].getLastDetectedDevices() - try: - for deviceEntry in deviceList: - # dont play sounds for virtual devices - playSound = playSound or not deviceEntry['virtual'] - except: - playSound = True - if playSound: - if time.time() - self.lastTime > 5: - self.env['runtime']['outputManager'].playSoundIcon(soundIcon = 'accept', interrupt=True) - lastTime = time.time() - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +import time + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + self.lastTime = time.time() + def shutdown(self): + pass + def getDescription(self): + return 'No description found' + def run(self): + playSound = False + deviceList = self.env['runtime']['inputManager'].getLastDetectedDevices() + try: + for deviceEntry in deviceList: + # dont play sounds for virtual devices + playSound = playSound or not deviceEntry['virtual'] + except: + playSound = True + if playSound: + if time.time() - self.lastTime > 5: + self.env['runtime']['outputManager'].playSoundIcon(soundIcon = 'accept', interrupt=True) + lastTime = time.time() + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/onScreenChanged/10000-shut_up.py b/src/fenrirscreenreader/commands/onScreenChanged/10000-shut_up.py index b251eaea..82686368 100644 --- a/src/fenrirscreenreader/commands/onScreenChanged/10000-shut_up.py +++ b/src/fenrirscreenreader/commands/onScreenChanged/10000-shut_up.py @@ -1,23 +1,23 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return '' - - def run(self): - self.env['runtime']['outputManager'].interruptOutput() - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return '' + + def run(self): + self.env['runtime']['outputManager'].interruptOutput() + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/onScreenChanged/70000-barrier_detect.py b/src/fenrirscreenreader/commands/onScreenChanged/70000-barrier_detect.py index a3b5a774..ac5bf809 100644 --- a/src/fenrirscreenreader/commands/onScreenChanged/70000-barrier_detect.py +++ b/src/fenrirscreenreader/commands/onScreenChanged/70000-barrier_detect.py @@ -1,27 +1,27 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No Description found' - - def run(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('barrier','enabled'): - return - - self.env['runtime']['barrierManager'].handleLineBarrier(self.env['screen']['newContentText'].split('\n'), self.env['screen']['newCursor']['x'],self.env['screen']['newCursor']['y']) - - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No Description found' + + def run(self): + if not self.env['runtime']['settingsManager'].getSettingAsBool('barrier','enabled'): + return + + self.env['runtime']['barrierManager'].handleLineBarrier(self.env['screen']['newContentText'].split('\n'), self.env['screen']['newCursor']['x'],self.env['screen']['newCursor']['y']) + + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/onScreenChanged/80000-screen_change_announcement.py b/src/fenrirscreenreader/commands/onScreenChanged/80000-screen_change_announcement.py index 383208be..6a8b4069 100644 --- a/src/fenrirscreenreader/commands/onScreenChanged/80000-screen_change_announcement.py +++ b/src/fenrirscreenreader/commands/onScreenChanged/80000-screen_change_announcement.py @@ -1,25 +1,25 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No Description found' - - def run(self): - self.env['runtime']['outputManager'].presentText(_("screen {0}").format(self.env['screen']['newTTY']),soundIcon='ChangeTTY', interrupt=True, flush=False) - self.env['runtime']['outputManager'].presentText(self.env['screen']['newContentText'], interrupt=False, flush=False) - - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No Description found' + + def run(self): + self.env['runtime']['outputManager'].presentText(_("screen {0}").format(self.env['screen']['newTTY']),soundIcon='ChangeTTY', interrupt=True, flush=False) + self.env['runtime']['outputManager'].presentText(self.env['screen']['newContentText'], interrupt=False, flush=False) + + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/onScreenUpdate/56000-highlight_tracking.py b/src/fenrirscreenreader/commands/onScreenUpdate/56000-highlight_tracking.py index 59721a8e..b74acd31 100644 --- a/src/fenrirscreenreader/commands/onScreenUpdate/56000-highlight_tracking.py +++ b/src/fenrirscreenreader/commands/onScreenUpdate/56000-highlight_tracking.py @@ -1,23 +1,23 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('enables or disables tracking of highlighted') - def run(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'highlight'): - return - attributeDelta = self.env['runtime']['attributeManager'].getAttributeDelta() - self.env['runtime']['outputManager'].presentText(attributeDelta, soundIcon='', interrupt=True, flush=False) - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('enables or disables tracking of highlighted') + def run(self): + if not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'highlight'): + return + attributeDelta = self.env['runtime']['attributeManager'].getAttributeDelta() + self.env['runtime']['outputManager'].presentText(attributeDelta, soundIcon='', interrupt=True, flush=False) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/onScreenUpdate/60000-history.py b/src/fenrirscreenreader/commands/onScreenUpdate/60000-history.py index fa0fd7d1..4d2e137b 100644 --- a/src/fenrirscreenreader/commands/onScreenUpdate/60000-history.py +++ b/src/fenrirscreenreader/commands/onScreenUpdate/60000-history.py @@ -1,67 +1,67 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return '' - def run(self): - if self.env['screen']['newAttribDelta'] != '': - return - if self.env['runtime']['screenManager'].isScreenChange(): - return - if self.env['runtime']['cursorManager'].isCursorVerticalMove(): - return - if self.env['runtime']['attributeManager'].isAttributeChange(): - return - # hack for pdmenu and maybe other dialog apps that place the cursor at last cell/row - # this is not to be identified as history - if (self.env['screen']['newCursor']['x'] == self.env['runtime']['screenManager'].getColumns() - 1) and (self.env['screen']['newCursor']['y'] == self.env['runtime']['screenManager'].getRows() - 1): - return - if self.env['runtime']['inputManager'].getShortcutType() in ['KEY']: - if not (self.env['runtime']['inputManager'].getLastDeepestInput() in [['KEY_UP'],['KEY_DOWN']]): - return - elif self.env['runtime']['inputManager'].getShortcutType() in ['BYTE']: - if not (self.env['runtime']['byteManager'].getLastByteKey() in [b'^[[A',b'^[[B']): - return - - prevLine = self.env['screen']['oldContentText'].split('\n')[self.env['screen']['newCursor']['y']] - currLine = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] - if prevLine == currLine: - if self.env['screen']['newDelta'] != '': - return - if not currLine.isspace(): - currPrompt = currLine.find('$') - rootPrompt = currLine.find('#') - if currPrompt <= 0: - if rootPrompt > 0: - currPrompt = rootPrompt - else: - announce = currLine - if currPrompt > 0: - remove_digits = str.maketrans('0123456789', ' ') - if prevLine[:currPrompt].translate(remove_digits) == currLine[:currPrompt].translate(remove_digits): - announce = currLine[currPrompt+1:] - else: - announce = currLine - - if currLine.isspace(): - self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False) - else: - self.env['runtime']['outputManager'].presentText(announce, interrupt=True, flush=False) - self.env['commandsIgnore']['onScreenUpdate']['CHAR_DELETE_ECHO'] = True - self.env['commandsIgnore']['onScreenUpdate']['CHAR_ECHO'] = True - self.env['commandsIgnore']['onScreenUpdate']['INCOMING_IGNORE'] = True - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return '' + def run(self): + if self.env['screen']['newAttribDelta'] != '': + return + if self.env['runtime']['screenManager'].isScreenChange(): + return + if self.env['runtime']['cursorManager'].isCursorVerticalMove(): + return + if self.env['runtime']['attributeManager'].isAttributeChange(): + return + # hack for pdmenu and maybe other dialog apps that place the cursor at last cell/row + # this is not to be identified as history + if (self.env['screen']['newCursor']['x'] == self.env['runtime']['screenManager'].getColumns() - 1) and (self.env['screen']['newCursor']['y'] == self.env['runtime']['screenManager'].getRows() - 1): + return + if self.env['runtime']['inputManager'].getShortcutType() in ['KEY']: + if not (self.env['runtime']['inputManager'].getLastDeepestInput() in [['KEY_UP'],['KEY_DOWN']]): + return + elif self.env['runtime']['inputManager'].getShortcutType() in ['BYTE']: + if not (self.env['runtime']['byteManager'].getLastByteKey() in [b'^[[A',b'^[[B']): + return + + prevLine = self.env['screen']['oldContentText'].split('\n')[self.env['screen']['newCursor']['y']] + currLine = self.env['screen']['newContentText'].split('\n')[self.env['screen']['newCursor']['y']] + if prevLine == currLine: + if self.env['screen']['newDelta'] != '': + return + if not currLine.isspace(): + currPrompt = currLine.find('$') + rootPrompt = currLine.find('#') + if currPrompt <= 0: + if rootPrompt > 0: + currPrompt = rootPrompt + else: + announce = currLine + if currPrompt > 0: + remove_digits = str.maketrans('0123456789', ' ') + if prevLine[:currPrompt].translate(remove_digits) == currLine[:currPrompt].translate(remove_digits): + announce = currLine[currPrompt+1:] + else: + announce = currLine + + if currLine.isspace(): + self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True, flush=False) + else: + self.env['runtime']['outputManager'].presentText(announce, interrupt=True, flush=False) + self.env['commandsIgnore']['onScreenUpdate']['CHAR_DELETE_ECHO'] = True + self.env['commandsIgnore']['onScreenUpdate']['CHAR_ECHO'] = True + self.env['commandsIgnore']['onScreenUpdate']['INCOMING_IGNORE'] = True + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/onScreenUpdate/70000-incoming.py b/src/fenrirscreenreader/commands/onScreenUpdate/70000-incoming.py index de06a418..8ae69e2a 100644 --- a/src/fenrirscreenreader/commands/onScreenUpdate/70000-incoming.py +++ b/src/fenrirscreenreader/commands/onScreenUpdate/70000-incoming.py @@ -1,39 +1,39 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No Description found' - - def run(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'autoReadIncoming'): - return - # is there something to read? - if not self.env['runtime']['screenManager'].isDelta(ignoreSpace=True): - return - - # this must be a keyecho or something - #if len(self.env['screen']['newDelta'].strip(' \n\t')) <= 1: - xMove = abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']) - yMove = abs(self.env['screen']['newCursor']['y'] - self.env['screen']['oldCursor']['y']) - - if (xMove >= 1) and xMove == len(self.env['screen']['newDelta']): - # if len(self.env['screen']['newDelta'].strip(' \n\t0123456789')) <= 2: - if not '\n' in self.env['screen']['newDelta']: - return - #print(xMove, yMove, len(self.env['screen']['newDelta']), len(self.env['screen']['newNegativeDelta'])) - self.env['runtime']['outputManager'].presentText(self.env['screen']['newDelta'], interrupt=False, flush=False) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No Description found' + + def run(self): + if not self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'autoReadIncoming'): + return + # is there something to read? + if not self.env['runtime']['screenManager'].isDelta(ignoreSpace=True): + return + + # this must be a keyecho or something + #if len(self.env['screen']['newDelta'].strip(' \n\t')) <= 1: + xMove = abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']) + yMove = abs(self.env['screen']['newCursor']['y'] - self.env['screen']['oldCursor']['y']) + + if (xMove >= 1) and xMove == len(self.env['screen']['newDelta']): + # if len(self.env['screen']['newDelta'].strip(' \n\t0123456789')) <= 2: + if not '\n' in self.env['screen']['newDelta']: + return + #print(xMove, yMove, len(self.env['screen']['newDelta']), len(self.env['screen']['newNegativeDelta'])) + self.env['runtime']['outputManager'].presentText(self.env['screen']['newDelta'], interrupt=False, flush=False) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/onScreenUpdate/75000-incoming_promote.py b/src/fenrirscreenreader/commands/onScreenUpdate/75000-incoming_promote.py index 8e867bf8..b6639b24 100644 --- a/src/fenrirscreenreader/commands/onScreenUpdate/75000-incoming_promote.py +++ b/src/fenrirscreenreader/commands/onScreenUpdate/75000-incoming_promote.py @@ -1,35 +1,35 @@ -#!/usr/bin/env python3 -import time -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No Description found' - def run(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('promote', 'enabled'): - return - if self.env['runtime']['settingsManager'].getSetting('promote', 'list').strip(" \t\n") == '': - return - if int(time.time() - self.env['input']['lastInputTime']) < self.env['runtime']['settingsManager'].getSettingAsInt('promote', 'inactiveTimeoutSec'): - return - if len(self.env['runtime']['settingsManager'].getSetting('promote', 'list')) == 0: - return - for promote in self.env['runtime']['settingsManager'].getSetting('promote', 'list').split(','): - if promote in self.env['screen']['newDelta']: - self.env['runtime']['outputManager'].playSoundIcon('PromotedText') - self.env['input']['lastInputTime'] = time.time() - return - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +import time +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No Description found' + def run(self): + if not self.env['runtime']['settingsManager'].getSettingAsBool('promote', 'enabled'): + return + if self.env['runtime']['settingsManager'].getSetting('promote', 'list').strip(" \t\n") == '': + return + if int(time.time() - self.env['input']['lastInputTime']) < self.env['runtime']['settingsManager'].getSettingAsInt('promote', 'inactiveTimeoutSec'): + return + if len(self.env['runtime']['settingsManager'].getSetting('promote', 'list')) == 0: + return + for promote in self.env['runtime']['settingsManager'].getSetting('promote', 'list').split(','): + if promote in self.env['screen']['newDelta']: + self.env['runtime']['outputManager'].playSoundIcon('PromotedText') + self.env['input']['lastInputTime'] = time.time() + return + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/onScreenUpdate/80000-barrier_detect.py b/src/fenrirscreenreader/commands/onScreenUpdate/80000-barrier_detect.py index 6744457c..f2411814 100644 --- a/src/fenrirscreenreader/commands/onScreenUpdate/80000-barrier_detect.py +++ b/src/fenrirscreenreader/commands/onScreenUpdate/80000-barrier_detect.py @@ -1,26 +1,26 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No Description found' - def run(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('barrier','enabled'): - return - if not self.env['runtime']['screenManager'].isDelta(ignoreSpace=True): - return - self.env['runtime']['barrierManager'].handleLineBarrier(self.env['screen']['newContentText'].split('\n'), self.env['screen']['newCursor']['x'],self.env['screen']['newCursor']['y']) - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No Description found' + def run(self): + if not self.env['runtime']['settingsManager'].getSettingAsBool('barrier','enabled'): + return + if not self.env['runtime']['screenManager'].isDelta(ignoreSpace=True): + return + self.env['runtime']['barrierManager'].handleLineBarrier(self.env['screen']['newContentText'].split('\n'), self.env['screen']['newCursor']['x'],self.env['screen']['newCursor']['y']) + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/onScreenUpdate/rework/70000-incoming.py b/src/fenrirscreenreader/commands/onScreenUpdate/rework/70000-incoming.py index 7dce5b86..a7ab0466 100644 --- a/src/fenrirscreenreader/commands/onScreenUpdate/rework/70000-incoming.py +++ b/src/fenrirscreenreader/commands/onScreenUpdate/rework/70000-incoming.py @@ -1,50 +1,50 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No Description found' - - def run(self): - if not self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'autoReadIncoming'): - return - # is there something to read? - if not self.env['runtime']['screenManager'].isDelta(ignoreSpace=True): - return - - # this must be a keyecho or something - #if len(self.env['screen']['newDelta'].strip(' \n\t')) <= 1: - xMove = abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']) - yMove = abs(self.env['screen']['newCursor']['y'] - self.env['screen']['oldCursor']['y']) - #print('-----') - #print(self.env['screen']['newDelta']) - #print(xMove, yMove, len(self.env['screen']['newNegativeDelta']), self.env['screen']['newNegativeDelta']) - #print(xMove, yMove, len(self.env['screen']['newDelta']), self.env['screen']['newDelta']) - if (xMove >= 1) and abs(xMove) == len(self.env['screen']['newDelta']): - # if len(self.env['screen']['newDelta'].strip(' \n\t0123456789')) <= 2: - if not '\n' in self.env['screen']['newDelta']: - return - # shift line - if (xMove != 0) and len(self.env['screen']['newNegativeDelta']) == 0: - return - # filter out delete - if (xMove == 0) and (yMove == 0): - if len(self.env['screen']['newNegativeDelta']) - len(self.env['screen']['newDelta']) in [1,2,3]: - return - - self.env['runtime']['outputManager'].presentText(self.env['screen']['newDelta'], interrupt=False, flush=False) - - def setCallback(self, callback): - pass - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No Description found' + + def run(self): + if not self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'autoReadIncoming'): + return + # is there something to read? + if not self.env['runtime']['screenManager'].isDelta(ignoreSpace=True): + return + + # this must be a keyecho or something + #if len(self.env['screen']['newDelta'].strip(' \n\t')) <= 1: + xMove = abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']) + yMove = abs(self.env['screen']['newCursor']['y'] - self.env['screen']['oldCursor']['y']) + #print('-----') + #print(self.env['screen']['newDelta']) + #print(xMove, yMove, len(self.env['screen']['newNegativeDelta']), self.env['screen']['newNegativeDelta']) + #print(xMove, yMove, len(self.env['screen']['newDelta']), self.env['screen']['newDelta']) + if (xMove >= 1) and abs(xMove) == len(self.env['screen']['newDelta']): + # if len(self.env['screen']['newDelta'].strip(' \n\t0123456789')) <= 2: + if not '\n' in self.env['screen']['newDelta']: + return + # shift line + if (xMove != 0) and len(self.env['screen']['newNegativeDelta']) == 0: + return + # filter out delete + if (xMove == 0) and (yMove == 0): + if len(self.env['screen']['newNegativeDelta']) - len(self.env['screen']['newDelta']) in [1,2,3]: + return + + self.env['runtime']['outputManager'].presentText(self.env['screen']['newDelta'], interrupt=False, flush=False) + + def setCallback(self, callback): + pass + diff --git a/src/fenrirscreenreader/commands/onSwitchApplicationProfile/default.py b/src/fenrirscreenreader/commands/onSwitchApplicationProfile/default.py index 899ea560..b7680d59 100644 --- a/src/fenrirscreenreader/commands/onSwitchApplicationProfile/default.py +++ b/src/fenrirscreenreader/commands/onSwitchApplicationProfile/default.py @@ -1,33 +1,33 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No description found' - def load(self): - return - print('--------------') - print('default') - print('load new',self.env['screen']['newApplication']) - print('--------------') - - def unload(self): - return - print('--------------') - print('default') - print('unload old',self.env['screen']['oldApplication']) - print('--------------') - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No description found' + def load(self): + return + print('--------------') + print('default') + print('load new',self.env['screen']['newApplication']) + print('--------------') + + def unload(self): + return + print('--------------') + print('default') + print('unload old',self.env['screen']['oldApplication']) + print('--------------') + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/onSwitchApplicationProfile/inactive/agetty.py b/src/fenrirscreenreader/commands/onSwitchApplicationProfile/inactive/agetty.py index 9264a989..63c92e3f 100644 --- a/src/fenrirscreenreader/commands/onSwitchApplicationProfile/inactive/agetty.py +++ b/src/fenrirscreenreader/commands/onSwitchApplicationProfile/inactive/agetty.py @@ -1,31 +1,31 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No description found' - def load(self): - print('--------------') - print('agetty') - print('load new',self.env['screen']['newApplication']) - print('--------------') - - def unload(self): - print('--------------') - print('agetty') - print('unload old',self.env['screen']['oldApplication']) - print('--------------') - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No description found' + def load(self): + print('--------------') + print('agetty') + print('load new',self.env['screen']['newApplication']) + print('--------------') + + def unload(self): + print('--------------') + print('agetty') + print('unload old',self.env['screen']['oldApplication']) + print('--------------') + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/onSwitchApplicationProfile/inactive/bash.py b/src/fenrirscreenreader/commands/onSwitchApplicationProfile/inactive/bash.py index 5a421460..d16a5ef9 100644 --- a/src/fenrirscreenreader/commands/onSwitchApplicationProfile/inactive/bash.py +++ b/src/fenrirscreenreader/commands/onSwitchApplicationProfile/inactive/bash.py @@ -1,31 +1,31 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No description found' - def load(self): - print('--------------') - print('bash') - print('load new',self.env['screen']['newApplication']) - print('--------------') - - def unload(self): - print('--------------') - print('bash') - print('unload old',self.env['screen']['oldApplication']) - print('--------------') - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No description found' + def load(self): + print('--------------') + print('bash') + print('load new',self.env['screen']['newApplication']) + print('--------------') + + def unload(self): + print('--------------') + print('bash') + print('unload old',self.env['screen']['oldApplication']) + print('--------------') + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/onSwitchApplicationProfile/inactive/vim.py b/src/fenrirscreenreader/commands/onSwitchApplicationProfile/inactive/vim.py index 04d2edda..5f29e148 100644 --- a/src/fenrirscreenreader/commands/onSwitchApplicationProfile/inactive/vim.py +++ b/src/fenrirscreenreader/commands/onSwitchApplicationProfile/inactive/vim.py @@ -1,31 +1,31 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No description found' - def load(self): - print('--------------') - print('vim') - print('load new',self.env['screen']['newApplication']) - print('--------------') - - def unload(self): - print('--------------') - print('vim') - print('unload old',self.env['screen']['oldApplication']) - print('--------------') - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No description found' + def load(self): + print('--------------') + print('vim') + print('load new',self.env['screen']['newApplication']) + print('--------------') + + def unload(self): + print('--------------') + print('vim') + print('unload old',self.env['screen']['oldApplication']) + print('--------------') + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mc/file/open.py b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mc/file/open.py index fbfa0aa9..e3bddc87 100644 --- a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mc/file/open.py +++ b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mc/file/open.py @@ -1,21 +1,21 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No description found' - def run(self): - self.env['runtime']['outputManager'].presentText('ok i run open macro' , interrupt=True) - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No description found' + def run(self): + self.env['runtime']['outputManager'].presentText('ok i run open macro' , interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mc/file/save.py b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mc/file/save.py index b7f9d5ea..0e9db029 100644 --- a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mc/file/save.py +++ b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mc/file/save.py @@ -1,21 +1,21 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No description found' - def run(self): - self.env['runtime']['outputManager'].presentText('ok i run open save' , interrupt=True) - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No description found' + def run(self): + self.env['runtime']['outputManager'].presentText('ok i run open save' , interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mc/search/replace.py b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mc/search/replace.py index 6580dd63..f2f001db 100644 --- a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mc/search/replace.py +++ b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mc/search/replace.py @@ -1,21 +1,21 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No description found' - def run(self): - self.env['runtime']['outputManager'].presentText('ok i run replace macro' , interrupt=True) - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No description found' + def run(self): + self.env['runtime']['outputManager'].presentText('ok i run replace macro' , interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mc/search/search.py b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mc/search/search.py index 590d651e..6da6f437 100644 --- a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mc/search/search.py +++ b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mc/search/search.py @@ -1,21 +1,21 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No description found' - def run(self): - self.env['runtime']['outputManager'].presentText('ok i run search macro' , interrupt=True) - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No description found' + def run(self): + self.env['runtime']['outputManager'].presentText('ok i run search macro' , interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mc/search/test.py b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mc/search/test.py index ed09c8f1..3275d2f0 100644 --- a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mc/search/test.py +++ b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mc/search/test.py @@ -1,30 +1,30 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -import datetime - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('presents the date') - - def run(self): - dateFormat = self.env['runtime']['settingsManager'].getSetting('general', 'dateFormat') - - # get the time formatted - dateString = datetime.datetime.strftime(datetime.datetime.now(), dateFormat) - - # present the time via speak and braile, there is no soundicon, interrupt the current speech - self.env['runtime']['outputManager'].presentText(dateString , soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +import datetime + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('presents the date') + + def run(self): + dateFormat = self.env['runtime']['settingsManager'].getSetting('general', 'dateFormat') + + # get the time formatted + dateString = datetime.datetime.strftime(datetime.datetime.now(), dateFormat) + + # present the time via speak and braile, there is no soundicon, interrupt the current speech + self.env['runtime']['outputManager'].presentText(dateString , soundIcon='', interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/file/issue.py b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/file/issue.py index 337236b5..2fd16a90 100644 --- a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/file/issue.py +++ b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/file/issue.py @@ -1,25 +1,25 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - self.keyMakro = [[1, 'KEY_LEFTCTRL'], [1, 'KEY_G'], [0.05,'sleep'] ,[0, 'KEY_G'], [0, 'KEY_LEFTCTRL']] - def shutdown(self): - pass - def getDescription(self): - return 'No description found' - def run(self): - self.env['runtime']['inputManager'].sendKeys(self.keyMakro) - def setCallback(self, callback): - pass - - - +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + self.keyMakro = [[1, 'KEY_LEFTCTRL'], [1, 'KEY_G'], [0.05,'sleep'] ,[0, 'KEY_G'], [0, 'KEY_LEFTCTRL']] + def shutdown(self): + pass + def getDescription(self): + return 'No description found' + def run(self): + self.env['runtime']['inputManager'].sendKeys(self.keyMakro) + def setCallback(self, callback): + pass + + + diff --git a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/file/open.py b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/file/open.py index f1db29f0..081decbc 100644 --- a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/file/open.py +++ b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/file/open.py @@ -1,22 +1,22 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - self.macro = [[1,'KEY_LEFTSHIFT'],[1,'KEY_LEFTCTRL'],[1,'KEY_N'],[0.05,'SLEEP'],[0,'KEY_N'],[0,'KEY_LEFTCTRL'],[0,'KEY_LEFTSHIFT']] - def shutdown(self): - pass - def getDescription(self): - return 'No description found' - def run(self): - self.env['runtime']['inputManager'].sendKeys(self.macro) - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + self.macro = [[1,'KEY_LEFTSHIFT'],[1,'KEY_LEFTCTRL'],[1,'KEY_N'],[0.05,'SLEEP'],[0,'KEY_N'],[0,'KEY_LEFTCTRL'],[0,'KEY_LEFTSHIFT']] + def shutdown(self): + pass + def getDescription(self): + return 'No description found' + def run(self): + self.env['runtime']['inputManager'].sendKeys(self.macro) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/file/save.py b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/file/save.py index b7f9d5ea..0e9db029 100644 --- a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/file/save.py +++ b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/file/save.py @@ -1,21 +1,21 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No description found' - def run(self): - self.env['runtime']['outputManager'].presentText('ok i run open save' , interrupt=True) - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No description found' + def run(self): + self.env['runtime']['outputManager'].presentText('ok i run open save' , interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/search/replace.py b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/search/replace.py index 6580dd63..f2f001db 100644 --- a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/search/replace.py +++ b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/search/replace.py @@ -1,21 +1,21 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No description found' - def run(self): - self.env['runtime']['outputManager'].presentText('ok i run replace macro' , interrupt=True) - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No description found' + def run(self): + self.env['runtime']['outputManager'].presentText('ok i run replace macro' , interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/search/search.py b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/search/search.py index 590d651e..6da6f437 100644 --- a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/search/search.py +++ b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/search/search.py @@ -1,21 +1,21 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No description found' - def run(self): - self.env['runtime']['outputManager'].presentText('ok i run search macro' , interrupt=True) - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No description found' + def run(self): + self.env['runtime']['outputManager'].presentText('ok i run search macro' , interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/search/test.py b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/search/test.py index ed09c8f1..3275d2f0 100644 --- a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/search/test.py +++ b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/search/test.py @@ -1,30 +1,30 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -import datetime - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('presents the date') - - def run(self): - dateFormat = self.env['runtime']['settingsManager'].getSetting('general', 'dateFormat') - - # get the time formatted - dateString = datetime.datetime.strftime(datetime.datetime.now(), dateFormat) - - # present the time via speak and braile, there is no soundicon, interrupt the current speech - self.env['runtime']['outputManager'].presentText(dateString , soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +import datetime + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('presents the date') + + def run(self): + dateFormat = self.env['runtime']['settingsManager'].getSetting('general', 'dateFormat') + + # get the time formatted + dateString = datetime.datetime.strftime(datetime.datetime.now(), dateFormat) + + # present the time via speak and braile, there is no soundicon, interrupt the current speech + self.env['runtime']['outputManager'].presentText(dateString , soundIcon='', interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/nano/file/open.py b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/nano/file/open.py index fbfa0aa9..e3bddc87 100644 --- a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/nano/file/open.py +++ b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/nano/file/open.py @@ -1,21 +1,21 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No description found' - def run(self): - self.env['runtime']['outputManager'].presentText('ok i run open macro' , interrupt=True) - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No description found' + def run(self): + self.env['runtime']['outputManager'].presentText('ok i run open macro' , interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/nano/search/replace.py b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/nano/search/replace.py index 6580dd63..f2f001db 100644 --- a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/nano/search/replace.py +++ b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/nano/search/replace.py @@ -1,21 +1,21 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No description found' - def run(self): - self.env['runtime']['outputManager'].presentText('ok i run replace macro' , interrupt=True) - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No description found' + def run(self): + self.env['runtime']['outputManager'].presentText('ok i run replace macro' , interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/nano/search/search.py b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/nano/search/search.py index 590d651e..6da6f437 100644 --- a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/nano/search/search.py +++ b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/nano/search/search.py @@ -1,21 +1,21 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No description found' - def run(self): - self.env['runtime']['outputManager'].presentText('ok i run search macro' , interrupt=True) - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No description found' + def run(self): + self.env['runtime']['outputManager'].presentText('ok i run search macro' , interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/nano/search/test.py b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/nano/search/test.py index ed09c8f1..3275d2f0 100644 --- a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/nano/search/test.py +++ b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/nano/search/test.py @@ -1,30 +1,30 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -import datetime - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('presents the date') - - def run(self): - dateFormat = self.env['runtime']['settingsManager'].getSetting('general', 'dateFormat') - - # get the time formatted - dateString = datetime.datetime.strftime(datetime.datetime.now(), dateFormat) - - # present the time via speak and braile, there is no soundicon, interrupt the current speech - self.env['runtime']['outputManager'].presentText(dateString , soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +import datetime + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('presents the date') + + def run(self): + dateFormat = self.env['runtime']['settingsManager'].getSetting('general', 'dateFormat') + + # get the time formatted + dateString = datetime.datetime.strftime(datetime.datetime.now(), dateFormat) + + # present the time via speak and braile, there is no soundicon, interrupt the current speech + self.env['runtime']['outputManager'].presentText(dateString , soundIcon='', interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/vim/file/open.py b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/vim/file/open.py index fbfa0aa9..e3bddc87 100644 --- a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/vim/file/open.py +++ b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/vim/file/open.py @@ -1,21 +1,21 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No description found' - def run(self): - self.env['runtime']['outputManager'].presentText('ok i run open macro' , interrupt=True) - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No description found' + def run(self): + self.env['runtime']['outputManager'].presentText('ok i run open macro' , interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/vim/file/save.py b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/vim/file/save.py index b7f9d5ea..0e9db029 100644 --- a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/vim/file/save.py +++ b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/vim/file/save.py @@ -1,21 +1,21 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No description found' - def run(self): - self.env['runtime']['outputManager'].presentText('ok i run open save' , interrupt=True) - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No description found' + def run(self): + self.env['runtime']['outputManager'].presentText('ok i run open save' , interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/vim/search/replace.py b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/vim/search/replace.py index 6580dd63..f2f001db 100644 --- a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/vim/search/replace.py +++ b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/vim/search/replace.py @@ -1,21 +1,21 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No description found' - def run(self): - self.env['runtime']['outputManager'].presentText('ok i run replace macro' , interrupt=True) - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No description found' + def run(self): + self.env['runtime']['outputManager'].presentText('ok i run replace macro' , interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/vim/search/search.py b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/vim/search/search.py index 590d651e..6da6f437 100644 --- a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/vim/search/search.py +++ b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/vim/search/search.py @@ -1,21 +1,21 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return 'No description found' - def run(self): - self.env['runtime']['outputManager'].presentText('ok i run search macro' , interrupt=True) - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return 'No description found' + def run(self): + self.env['runtime']['outputManager'].presentText('ok i run search macro' , interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/vim/search/test.py b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/vim/search/test.py index ed09c8f1..3275d2f0 100644 --- a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/vim/search/test.py +++ b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/vim/search/test.py @@ -1,30 +1,30 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug -import datetime - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - def shutdown(self): - pass - def getDescription(self): - return _('presents the date') - - def run(self): - dateFormat = self.env['runtime']['settingsManager'].getSetting('general', 'dateFormat') - - # get the time formatted - dateString = datetime.datetime.strftime(datetime.datetime.now(), dateFormat) - - # present the time via speak and braile, there is no soundicon, interrupt the current speech - self.env['runtime']['outputManager'].presentText(dateString , soundIcon='', interrupt=True) - - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug +import datetime + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + def shutdown(self): + pass + def getDescription(self): + return _('presents the date') + + def run(self): + dateFormat = self.env['runtime']['settingsManager'].getSetting('general', 'dateFormat') + + # get the time formatted + dateString = datetime.datetime.strftime(datetime.datetime.now(), dateFormat) + + # present the time via speak and braile, there is no soundicon, interrupt the current speech + self.env['runtime']['outputManager'].presentText(dateString , soundIcon='', interrupt=True) + + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-profiles/template.py b/src/fenrirscreenreader/commands/vmenu-profiles/template.py index 0e522f3d..0f645761 100644 --- a/src/fenrirscreenreader/commands/vmenu-profiles/template.py +++ b/src/fenrirscreenreader/commands/vmenu-profiles/template.py @@ -1,29 +1,29 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Fenrir TTY screen reader -# By Chrys, Storm Dragon, and contributers. - -from fenrirscreenreader.core import debug - -class command(): - def __init__(self): - pass - def initialize(self, environment): - self.env = environment - # examples: - # self.keyMakro = [[1,'KEY_LEFTCTRL'],[1,'KEY_O'],[0.05,'SLEEP'],[0,'KEY_O'],[0,'KEY_LEFTCTRL']] - # self.keyMakro = [[1,'KEY_LEFTSHIFT'],[1,'KEY_LEFTCTRL'],[1,'KEY_N'],[0.05,'SLEEP'],[0,'KEY_N'],[0,'KEY_LEFTCTRL'],[0,'KEY_LEFTSHIFT']] - self.keyMakro = [] - self.byteMakro = [] - def shutdown(self): - pass - def getDescription(self): - return 'No description found' - def run(self): - if self.env['runtime']['inputManager'].getShortcutType() in ['KEY']: - self.env['runtime']['inputManager'].sendKeys(self.keyMakro) - elif self.env['runtime']['inputManager'].getShortcutType() in ['BYTE']: - self.env['runtime']['byteManager'].sendBytes(self.byteMakro) - def setCallback(self, callback): - pass +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from fenrirscreenreader.core import debug + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + # examples: + # self.keyMakro = [[1,'KEY_LEFTCTRL'],[1,'KEY_O'],[0.05,'SLEEP'],[0,'KEY_O'],[0,'KEY_LEFTCTRL']] + # self.keyMakro = [[1,'KEY_LEFTSHIFT'],[1,'KEY_LEFTCTRL'],[1,'KEY_N'],[0.05,'SLEEP'],[0,'KEY_N'],[0,'KEY_LEFTCTRL'],[0,'KEY_LEFTSHIFT']] + self.keyMakro = [] + self.byteMakro = [] + def shutdown(self): + pass + def getDescription(self): + return 'No description found' + def run(self): + if self.env['runtime']['inputManager'].getShortcutType() in ['KEY']: + self.env['runtime']['inputManager'].sendKeys(self.keyMakro) + elif self.env['runtime']['inputManager'].getShortcutType() in ['BYTE']: + self.env['runtime']['byteManager'].sendBytes(self.byteMakro) + def setCallback(self, callback): + pass