From 43ddfb27873b82e2936f9ac6e3ca4318d91a31cc Mon Sep 17 00:00:00 2001 From: chrys Date: Mon, 11 Jun 2018 19:53:10 +0200 Subject: [PATCH] make barrir mode toggle --- config/keyboard/desktop.conf | 1 + config/keyboard/laptop.conf | 1 + .../commands/commands/toggle_barrier.py | 26 +++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 src/fenrirscreenreader/commands/commands/toggle_barrier.py diff --git a/config/keyboard/desktop.conf b/config/keyboard/desktop.conf index 14e79f5a..c76a7b09 100644 --- a/config/keyboard/desktop.conf +++ b/config/keyboard/desktop.conf @@ -82,6 +82,7 @@ KEY_FENRIR,KEY_CTRL,KEY_E=toggle_emoticons key_FENRIR,KEY_KPENTER=toggle_auto_read KEY_FENRIR,KEY_CTRL,KEY_T=toggle_auto_time KEY_FENRIR,KEY_KPASTERISK=toggle_highlight_tracking +#=toggle_barrier KEY_FENRIR,KEY_Q=quit_fenrir KEY_FENRIR,KEY_T=time 2,KEY_FENRIR,KEY_T=date diff --git a/config/keyboard/laptop.conf b/config/keyboard/laptop.conf index da00cc33..9d9a15f0 100644 --- a/config/keyboard/laptop.conf +++ b/config/keyboard/laptop.conf @@ -82,6 +82,7 @@ KEY_FENRIR,KEY_SHIFT,KEY_E=toggle_emoticons KEY_FENRIR,KEY_ENTER=toggle_auto_read KEY_FENRIR,KEY_CTRL,KEY_T=toggle_auto_time KEY_FENRIR,KEY_Y=toggle_highlight_tracking +#=toggle_barrier KEY_FENRIR,KEY_Q=quit_fenrir KEY_FENRIR,KEY_T=time 2,KEY_FENRIR,KEY_T=date diff --git a/src/fenrirscreenreader/commands/commands/toggle_barrier.py b/src/fenrirscreenreader/commands/commands/toggle_barrier.py new file mode 100644 index 00000000..f8e814ab --- /dev/null +++ b/src/fenrirscreenreader/commands/commands/toggle_barrier.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 barrier mode') + + def run(self): + self.env['runtime']['settingsManager'].setSetting('focus', 'barrier', str(not self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'barrier'))) + if self.env['runtime']['settingsManager'].getSettingAsBool('focus', 'barrier'): + 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