From 2d5609dd840445ba878abe9c5aef88a94fd1d0a9 Mon Sep 17 00:00:00 2001 From: chrys Date: Sat, 7 Jul 2018 17:33:56 +0200 Subject: [PATCH] add has attribute toggle --- config/keyboard/desktop.conf | 1 + config/keyboard/laptop.conf | 1 + config/keyboard/pty.conf | 1 + .../commands/commands/toggle_has_attribute.py | 26 +++++++++++++++++++ 4 files changed, 29 insertions(+) create mode 100644 src/fenrirscreenreader/commands/commands/toggle_has_attribute.py diff --git a/config/keyboard/desktop.conf b/config/keyboard/desktop.conf index 638be423..547fd1fa 100644 --- a/config/keyboard/desktop.conf +++ b/config/keyboard/desktop.conf @@ -88,6 +88,7 @@ KEY_FENRIR,KEY_T=time 2,KEY_FENRIR,KEY_T=date KEY_KPSLASH=toggle_auto_indent KEY_KPMINUS=attribute_cursor +#=toggle_has_attribute KEY_FENRIR,KEY_S=spell_check 2,KEY_FENRIR,KEY_S=add_word_to_spell_check KEY_FENRIR,KEY_SHIFT,KEY_S=remove_word_from_spell_check diff --git a/config/keyboard/laptop.conf b/config/keyboard/laptop.conf index 9d9a15f0..fcc16e14 100644 --- a/config/keyboard/laptop.conf +++ b/config/keyboard/laptop.conf @@ -88,6 +88,7 @@ KEY_FENRIR,KEY_T=time 2,KEY_FENRIR,KEY_T=date KEY_FENRIR,KEY_BACKSLASH=toggle_auto_indent KEY_FENRIR,KEY_MINUS=attribute_cursor +#=toggle_has_attribute KEY_FENRIR,KEY_S=spell_check 2,KEY_FENRIR,KEY_S=add_word_to_spell_check KEY_FENRIR,KEY_SHIFT,KEY_S=remove_word_from_spell_check diff --git a/config/keyboard/pty.conf b/config/keyboard/pty.conf index f70fb948..989688de 100644 --- a/config/keyboard/pty.conf +++ b/config/keyboard/pty.conf @@ -2,6 +2,7 @@ ^[OP=toggle_tutorial_mode # double tap control+end read attributes 2,^[[1;5F=attribute_cursor +#=toggle_has_attribute # escape - stop speech ^[=shut_up # context menu key - stop speech diff --git a/src/fenrirscreenreader/commands/commands/toggle_has_attribute.py b/src/fenrirscreenreader/commands/commands/toggle_has_attribute.py new file mode 100644 index 00000000..21ae5348 --- /dev/null +++ b/src/fenrirscreenreader/commands/commands/toggle_has_attribute.py @@ -0,0 +1,26 @@ +#!/bin/python +# -*- 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