From 7ce471cd08e01eff51e4e3f2a52103fc63060811 Mon Sep 17 00:00:00 2001 From: chrys Date: Tue, 12 Feb 2019 22:33:16 +0100 Subject: [PATCH] add first letter navigation to vmenu --- .../commands/vmenu-navigation/search_a.py | 25 ++++++ .../commands/vmenu-navigation/search_b.py | 25 ++++++ .../commands/vmenu-navigation/search_c.py | 25 ++++++ .../commands/vmenu-navigation/search_d.py | 25 ++++++ .../commands/vmenu-navigation/search_e.py | 25 ++++++ .../commands/vmenu-navigation/search_f.py | 25 ++++++ .../commands/vmenu-navigation/search_g.py | 25 ++++++ .../commands/vmenu-navigation/search_h.py | 25 ++++++ .../commands/vmenu-navigation/search_i.py | 25 ++++++ .../commands/vmenu-navigation/search_j.py | 25 ++++++ .../commands/vmenu-navigation/search_k.py | 25 ++++++ .../commands/vmenu-navigation/search_l.py | 25 ++++++ .../commands/vmenu-navigation/search_m.py | 25 ++++++ .../commands/vmenu-navigation/search_n.py | 25 ++++++ .../commands/vmenu-navigation/search_o.py | 25 ++++++ .../commands/vmenu-navigation/search_p.py | 25 ++++++ .../commands/vmenu-navigation/search_q.py | 25 ++++++ .../commands/vmenu-navigation/search_r.py | 25 ++++++ .../commands/vmenu-navigation/search_s.py | 25 ++++++ .../commands/vmenu-navigation/search_t.py | 25 ++++++ .../commands/vmenu-navigation/search_u.py | 25 ++++++ .../commands/vmenu-navigation/search_v.py | 25 ++++++ .../commands/vmenu-navigation/search_w.py | 25 ++++++ .../commands/vmenu-navigation/search_x.py | 25 ++++++ .../commands/vmenu-navigation/search_y.py | 25 ++++++ .../commands/vmenu-navigation/search_z.py | 25 ++++++ src/fenrirscreenreader/core/helpManager.py | 24 ++++-- src/fenrirscreenreader/core/vmenuManager.py | 82 +++++++++++++++---- 28 files changed, 729 insertions(+), 27 deletions(-) create mode 100644 src/fenrirscreenreader/commands/vmenu-navigation/search_a.py create mode 100644 src/fenrirscreenreader/commands/vmenu-navigation/search_b.py create mode 100644 src/fenrirscreenreader/commands/vmenu-navigation/search_c.py create mode 100644 src/fenrirscreenreader/commands/vmenu-navigation/search_d.py create mode 100644 src/fenrirscreenreader/commands/vmenu-navigation/search_e.py create mode 100644 src/fenrirscreenreader/commands/vmenu-navigation/search_f.py create mode 100644 src/fenrirscreenreader/commands/vmenu-navigation/search_g.py create mode 100644 src/fenrirscreenreader/commands/vmenu-navigation/search_h.py create mode 100644 src/fenrirscreenreader/commands/vmenu-navigation/search_i.py create mode 100644 src/fenrirscreenreader/commands/vmenu-navigation/search_j.py create mode 100644 src/fenrirscreenreader/commands/vmenu-navigation/search_k.py create mode 100644 src/fenrirscreenreader/commands/vmenu-navigation/search_l.py create mode 100644 src/fenrirscreenreader/commands/vmenu-navigation/search_m.py create mode 100644 src/fenrirscreenreader/commands/vmenu-navigation/search_n.py create mode 100644 src/fenrirscreenreader/commands/vmenu-navigation/search_o.py create mode 100644 src/fenrirscreenreader/commands/vmenu-navigation/search_p.py create mode 100644 src/fenrirscreenreader/commands/vmenu-navigation/search_q.py create mode 100644 src/fenrirscreenreader/commands/vmenu-navigation/search_r.py create mode 100644 src/fenrirscreenreader/commands/vmenu-navigation/search_s.py create mode 100644 src/fenrirscreenreader/commands/vmenu-navigation/search_t.py create mode 100644 src/fenrirscreenreader/commands/vmenu-navigation/search_u.py create mode 100644 src/fenrirscreenreader/commands/vmenu-navigation/search_v.py create mode 100644 src/fenrirscreenreader/commands/vmenu-navigation/search_w.py create mode 100644 src/fenrirscreenreader/commands/vmenu-navigation/search_x.py create mode 100644 src/fenrirscreenreader/commands/vmenu-navigation/search_y.py create mode 100644 src/fenrirscreenreader/commands/vmenu-navigation/search_z.py diff --git a/src/fenrirscreenreader/commands/vmenu-navigation/search_a.py b/src/fenrirscreenreader/commands/vmenu-navigation/search_a.py new file mode 100644 index 00000000..7e4236ca --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu-navigation/search_a.py @@ -0,0 +1,25 @@ +#!/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 _('search for an menu entry') + def run(self): + text = self.env['runtime']['vmenuManager'].searchEntry('a') + if text != '': + self.env['runtime']['outputManager'].presentText(text, interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_('not found'), soundIcon='ErrorScreen', interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-navigation/search_b.py b/src/fenrirscreenreader/commands/vmenu-navigation/search_b.py new file mode 100644 index 00000000..5da6a568 --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu-navigation/search_b.py @@ -0,0 +1,25 @@ +#!/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 _('search for an menu entry') + def run(self): + text = self.env['runtime']['vmenuManager'].searchEntry('b') + if text != '': + self.env['runtime']['outputManager'].presentText(text, interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_('not found'), soundIcon='ErrorScreen', interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-navigation/search_c.py b/src/fenrirscreenreader/commands/vmenu-navigation/search_c.py new file mode 100644 index 00000000..1634540d --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu-navigation/search_c.py @@ -0,0 +1,25 @@ +#!/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 _('search for an menu entry') + def run(self): + text = self.env['runtime']['vmenuManager'].searchEntry('c') + if text != '': + self.env['runtime']['outputManager'].presentText(text, interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_('not found'), soundIcon='ErrorScreen', interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-navigation/search_d.py b/src/fenrirscreenreader/commands/vmenu-navigation/search_d.py new file mode 100644 index 00000000..d77b6c19 --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu-navigation/search_d.py @@ -0,0 +1,25 @@ +#!/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 _('search for an menu entry') + def run(self): + text = self.env['runtime']['vmenuManager'].searchEntry('d') + if text != '': + self.env['runtime']['outputManager'].presentText(text, interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_('not found'), soundIcon='ErrorScreen', interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-navigation/search_e.py b/src/fenrirscreenreader/commands/vmenu-navigation/search_e.py new file mode 100644 index 00000000..c0b35e0b --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu-navigation/search_e.py @@ -0,0 +1,25 @@ +#!/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 _('search for an menu entry') + def run(self): + text = self.env['runtime']['vmenuManager'].searchEntry('e') + if text != '': + self.env['runtime']['outputManager'].presentText(text, interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_('not found'), soundIcon='ErrorScreen', interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-navigation/search_f.py b/src/fenrirscreenreader/commands/vmenu-navigation/search_f.py new file mode 100644 index 00000000..cc37e45b --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu-navigation/search_f.py @@ -0,0 +1,25 @@ +#!/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 _('search for an menu entry') + def run(self): + text = self.env['runtime']['vmenuManager'].searchEntry('f') + if text != '': + self.env['runtime']['outputManager'].presentText(text, interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_('not found'), soundIcon='ErrorScreen', interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-navigation/search_g.py b/src/fenrirscreenreader/commands/vmenu-navigation/search_g.py new file mode 100644 index 00000000..fc235726 --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu-navigation/search_g.py @@ -0,0 +1,25 @@ +#!/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 _('search for an menu entry') + def run(self): + text = self.env['runtime']['vmenuManager'].searchEntry('g') + if text != '': + self.env['runtime']['outputManager'].presentText(text, interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_('not found'), soundIcon='ErrorScreen', interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-navigation/search_h.py b/src/fenrirscreenreader/commands/vmenu-navigation/search_h.py new file mode 100644 index 00000000..10fc5fb3 --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu-navigation/search_h.py @@ -0,0 +1,25 @@ +#!/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 _('search for an menu entry') + def run(self): + text = self.env['runtime']['vmenuManager'].searchEntry('h') + if text != '': + self.env['runtime']['outputManager'].presentText(text, interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_('not found'), soundIcon='ErrorScreen', interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-navigation/search_i.py b/src/fenrirscreenreader/commands/vmenu-navigation/search_i.py new file mode 100644 index 00000000..e616fbf5 --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu-navigation/search_i.py @@ -0,0 +1,25 @@ +#!/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 _('search for an menu entry') + def run(self): + text = self.env['runtime']['vmenuManager'].searchEntry('i') + if text != '': + self.env['runtime']['outputManager'].presentText(text, interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_('not found'), soundIcon='ErrorScreen', interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-navigation/search_j.py b/src/fenrirscreenreader/commands/vmenu-navigation/search_j.py new file mode 100644 index 00000000..92c716ce --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu-navigation/search_j.py @@ -0,0 +1,25 @@ +#!/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 _('search for an menu entry') + def run(self): + text = self.env['runtime']['vmenuManager'].searchEntry('j') + if text != '': + self.env['runtime']['outputManager'].presentText(text, interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_('not found'), soundIcon='ErrorScreen', interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-navigation/search_k.py b/src/fenrirscreenreader/commands/vmenu-navigation/search_k.py new file mode 100644 index 00000000..3ced6b78 --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu-navigation/search_k.py @@ -0,0 +1,25 @@ +#!/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 _('search for an menu entry') + def run(self): + text = self.env['runtime']['vmenuManager'].searchEntry('k') + if text != '': + self.env['runtime']['outputManager'].presentText(text, interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_('not found'), soundIcon='ErrorScreen', interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-navigation/search_l.py b/src/fenrirscreenreader/commands/vmenu-navigation/search_l.py new file mode 100644 index 00000000..75e81c1f --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu-navigation/search_l.py @@ -0,0 +1,25 @@ +#!/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 _('search for an menu entry') + def run(self): + text = self.env['runtime']['vmenuManager'].searchEntry('l') + if text != '': + self.env['runtime']['outputManager'].presentText(text, interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_('not found'), soundIcon='ErrorScreen', interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-navigation/search_m.py b/src/fenrirscreenreader/commands/vmenu-navigation/search_m.py new file mode 100644 index 00000000..d143ac75 --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu-navigation/search_m.py @@ -0,0 +1,25 @@ +#!/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 _('search for an menu entry') + def run(self): + text = self.env['runtime']['vmenuManager'].searchEntry('m') + if text != '': + self.env['runtime']['outputManager'].presentText(text, interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_('not found'), soundIcon='ErrorScreen', interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-navigation/search_n.py b/src/fenrirscreenreader/commands/vmenu-navigation/search_n.py new file mode 100644 index 00000000..9ed32f68 --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu-navigation/search_n.py @@ -0,0 +1,25 @@ +#!/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 _('search for an menu entry') + def run(self): + text = self.env['runtime']['vmenuManager'].searchEntry('n') + if text != '': + self.env['runtime']['outputManager'].presentText(text, interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_('not found'), soundIcon='ErrorScreen', interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-navigation/search_o.py b/src/fenrirscreenreader/commands/vmenu-navigation/search_o.py new file mode 100644 index 00000000..b281757a --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu-navigation/search_o.py @@ -0,0 +1,25 @@ +#!/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 _('search for an menu entry') + def run(self): + text = self.env['runtime']['vmenuManager'].searchEntry('o') + if text != '': + self.env['runtime']['outputManager'].presentText(text, interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_('not found'), soundIcon='ErrorScreen', interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-navigation/search_p.py b/src/fenrirscreenreader/commands/vmenu-navigation/search_p.py new file mode 100644 index 00000000..7f5d0025 --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu-navigation/search_p.py @@ -0,0 +1,25 @@ +#!/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 _('search for an menu entry') + def run(self): + text = self.env['runtime']['vmenuManager'].searchEntry('p') + if text != '': + self.env['runtime']['outputManager'].presentText(text, interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_('not found'), soundIcon='ErrorScreen', interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-navigation/search_q.py b/src/fenrirscreenreader/commands/vmenu-navigation/search_q.py new file mode 100644 index 00000000..ad0dcdbb --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu-navigation/search_q.py @@ -0,0 +1,25 @@ +#!/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 _('search for an menu entry') + def run(self): + text = self.env['runtime']['vmenuManager'].searchEntry('q') + if text != '': + self.env['runtime']['outputManager'].presentText(text, interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_('not found'), soundIcon='ErrorScreen', interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-navigation/search_r.py b/src/fenrirscreenreader/commands/vmenu-navigation/search_r.py new file mode 100644 index 00000000..43cd84a3 --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu-navigation/search_r.py @@ -0,0 +1,25 @@ +#!/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 _('search for an menu entry') + def run(self): + text = self.env['runtime']['vmenuManager'].searchEntry('r') + if text != '': + self.env['runtime']['outputManager'].presentText(text, interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_('not found'), soundIcon='ErrorScreen', interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-navigation/search_s.py b/src/fenrirscreenreader/commands/vmenu-navigation/search_s.py new file mode 100644 index 00000000..22a9b5da --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu-navigation/search_s.py @@ -0,0 +1,25 @@ +#!/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 _('search for an menu entry') + def run(self): + text = self.env['runtime']['vmenuManager'].searchEntry('s') + if text != '': + self.env['runtime']['outputManager'].presentText(text, interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_('not found'), soundIcon='ErrorScreen', interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-navigation/search_t.py b/src/fenrirscreenreader/commands/vmenu-navigation/search_t.py new file mode 100644 index 00000000..7dbb9813 --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu-navigation/search_t.py @@ -0,0 +1,25 @@ +#!/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 _('search for an menu entry') + def run(self): + text = self.env['runtime']['vmenuManager'].searchEntry('t') + if text != '': + self.env['runtime']['outputManager'].presentText(text, interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_('not found'), soundIcon='ErrorScreen', interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-navigation/search_u.py b/src/fenrirscreenreader/commands/vmenu-navigation/search_u.py new file mode 100644 index 00000000..3a4bb39a --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu-navigation/search_u.py @@ -0,0 +1,25 @@ +#!/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 _('search for an menu entry') + def run(self): + text = self.env['runtime']['vmenuManager'].searchEntry('u') + if text != '': + self.env['runtime']['outputManager'].presentText(text, interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_('not found'), soundIcon='ErrorScreen', interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-navigation/search_v.py b/src/fenrirscreenreader/commands/vmenu-navigation/search_v.py new file mode 100644 index 00000000..26a6e16f --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu-navigation/search_v.py @@ -0,0 +1,25 @@ +#!/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 _('search for an menu entry') + def run(self): + text = self.env['runtime']['vmenuManager'].searchEntry('v') + if text != '': + self.env['runtime']['outputManager'].presentText(text, interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_('not found'), soundIcon='ErrorScreen', interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-navigation/search_w.py b/src/fenrirscreenreader/commands/vmenu-navigation/search_w.py new file mode 100644 index 00000000..7e4236ca --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu-navigation/search_w.py @@ -0,0 +1,25 @@ +#!/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 _('search for an menu entry') + def run(self): + text = self.env['runtime']['vmenuManager'].searchEntry('a') + if text != '': + self.env['runtime']['outputManager'].presentText(text, interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_('not found'), soundIcon='ErrorScreen', interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-navigation/search_x.py b/src/fenrirscreenreader/commands/vmenu-navigation/search_x.py new file mode 100644 index 00000000..0c45a9f9 --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu-navigation/search_x.py @@ -0,0 +1,25 @@ +#!/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 _('search for an menu entry') + def run(self): + text = self.env['runtime']['vmenuManager'].searchEntry('x') + if text != '': + self.env['runtime']['outputManager'].presentText(text, interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_('not found'), soundIcon='ErrorScreen', interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-navigation/search_y.py b/src/fenrirscreenreader/commands/vmenu-navigation/search_y.py new file mode 100644 index 00000000..2656a311 --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu-navigation/search_y.py @@ -0,0 +1,25 @@ +#!/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 _('search for an menu entry') + def run(self): + text = self.env['runtime']['vmenuManager'].searchEntry('y') + if text != '': + self.env['runtime']['outputManager'].presentText(text, interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_('not found'), soundIcon='ErrorScreen', interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/commands/vmenu-navigation/search_z.py b/src/fenrirscreenreader/commands/vmenu-navigation/search_z.py new file mode 100644 index 00000000..32714e18 --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu-navigation/search_z.py @@ -0,0 +1,25 @@ +#!/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 _('search for an menu entry') + def run(self): + text = self.env['runtime']['vmenuManager'].searchEntry('z') + if text != '': + self.env['runtime']['outputManager'].presentText(text, interrupt=True) + else: + self.env['runtime']['outputManager'].presentText(_('not found'), soundIcon='ErrorScreen', interrupt=True) + def setCallback(self, callback): + pass diff --git a/src/fenrirscreenreader/core/helpManager.py b/src/fenrirscreenreader/core/helpManager.py index 6ec5030c..e60731c7 100755 --- a/src/fenrirscreenreader/core/helpManager.py +++ b/src/fenrirscreenreader/core/helpManager.py @@ -10,7 +10,8 @@ from fenrirscreenreader.core import debug class helpManager(): def __init__(self): self.helpDict = {} - self.tutorialListIndex = None + self.tutorialListIndex = None + self.bindingsBackup = None def initialize(self, environment): self.env = environment def shutdown(self): @@ -18,21 +19,26 @@ class helpManager(): def toggleTutorialMode(self): self.setTutorialMode(not self.env['general']['tutorialMode']) def setTutorialMode(self, newTutorialMode): - self.env['general']['tutorialMode'] = newTutorialMode + if self.environment['runtime']['vmenuManager'].getActive(): + return + self.env['general']['tutorialMode'] = newTutorialMode if newTutorialMode: - self.createHelpDict() + self.bindingsBackup = self.env['bindings'].copy() + self.createHelpDict() self.env['bindings'][str([1, ['KEY_ESC']])] = 'TOGGLE_TUTORIAL_MODE' self.env['bindings'][str([1, ['KEY_UP']])] = 'PREV_HELP' self.env['bindings'][str([1, ['KEY_DOWN']])] = 'NEXT_HELP' - self.env['bindings'][str([1, ['KEY_SPACE']])] = 'CURR_HELP' + self.env['bindings'][str([1, ['KEY_SPACE']])] = 'CURR_HELP' else: try: - del(self.env['bindings'][str([1, ['KEY_ESC']])]) - del(self.env['bindings'][str([1, ['KEY_UP']])]) - del(self.env['bindings'][str([1, ['KEY_DOWN']])]) - del(self.env['bindings'][str([1, ['KEY_SPACE']])]) + self.env['bindings'] = self.bindingsBackup.copy() + self.bindingsBackup = None + #del(self.env['bindings'][str([1, ['KEY_ESC']])]) + #del(self.env['bindings'][str([1, ['KEY_UP']])]) + #del(self.env['bindings'][str([1, ['KEY_DOWN']])]) + #del(self.env['bindings'][str([1, ['KEY_SPACE']])]) except: - pass + pass def isTutorialMode(self): return self.env['general']['tutorialMode'] def getCommandHelpText(self, command, section = 'commands'): diff --git a/src/fenrirscreenreader/core/vmenuManager.py b/src/fenrirscreenreader/core/vmenuManager.py index 9c327b2e..3e96d719 100755 --- a/src/fenrirscreenreader/core/vmenuManager.py +++ b/src/fenrirscreenreader/core/vmenuManager.py @@ -17,8 +17,11 @@ class vmenuManager(): self.currIndex = None self.currMenu = '' self.active = False + self.reset = True + self.useTimeout = True self.searchText = '' self.lastSearchTime = time.time() + self.bindingsBackup = None def initialize(self, environment): self.env = environment # use default path @@ -34,22 +37,29 @@ class vmenuManager(): self.closeAfterAction = False def shutdown(self): pass - def searchEntry(self, value): + def clearSearchText(self): + self.searchText = '' + def searchEntry(self, value, forceReset = False): if self.currIndex == None: - return False - if time.time() - self.lastSearchTime > 1: - self.searchText = '' + return '' + if self.reset or forceReset: + self.clearSearchText() + else: + if self.useTimeout: + if time.time() - self.lastSearchTime > 1: + self.clearSearchText() self.searchText += value self.lastSearchTime = time.time() - startIndex = 0 + startIndex = self.getCurrIndex() while True: + if not self.nextIndex(): + return '' entry = self.getCurrentEntry() if entry.startswith(self.searchText): - return True - if not self.nextIndex(): - return False - if True: - return False + return entry + if startIndex == self.getCurrIndex(): + return '' + def setCurrMenu(self, currMenu = ''): self.currIndex = None self.currMenu = '' @@ -76,6 +86,8 @@ class vmenuManager(): def togglelVMenuMode(self, closeAfterAction = True): self.setActive(not self.getActive(), closeAfterAction) def setActive(self, active, closeAfterAction = True): + if self.env['runtime']['helpManager'].isTutorialMode(): + return self.active = active if self.active: self.closeAfterAction = closeAfterAction @@ -92,6 +104,8 @@ class vmenuManager(): except Exception as e: print(e) try: + self.bindingsBackup = self.env['bindings'].copy() + # navigation self.env['bindings'][str([1, ['KEY_ESC']])] = 'TOGGLE_VMENU_MODE' self.env['bindings'][str([1, ['KEY_UP']])] = 'PREV_VMENU_ENTRY' self.env['bindings'][str([1, ['KEY_DOWN']])] = 'NEXT_VMENU_ENTRY' @@ -99,18 +113,47 @@ class vmenuManager(): self.env['bindings'][str([1, ['KEY_LEFT']])] = 'DEC_LEVEL_VMENU' self.env['bindings'][str([1, ['KEY_RIGHT']])] = 'INC_LEVEL_VMENU' self.env['bindings'][str([1, ['KEY_ENTER']])] = 'EXEC_VMENU_ENTRY' + # search + self.env['bindings'][str([1, ['KEY_A']])] = 'SEARCH_A' + self.env['bindings'][str([1, ['KEY_B']])] = 'SEARCH_B' + self.env['bindings'][str([1, ['KEY_C']])] = 'SEARCH_C' + self.env['bindings'][str([1, ['KEY_D']])] = 'SEARCH_D' + self.env['bindings'][str([1, ['KEY_E']])] = 'SEARCH_E' + self.env['bindings'][str([1, ['KEY_F']])] = 'SEARCH_F' + self.env['bindings'][str([1, ['KEY_G']])] = 'SEARCH_G' + self.env['bindings'][str([1, ['KEY_H']])] = 'SEARCH_H' + self.env['bindings'][str([1, ['KEY_I']])] = 'SEARCH_I' + self.env['bindings'][str([1, ['KEY_J']])] = 'SEARCH_J' + self.env['bindings'][str([1, ['KEY_K']])] = 'SEARCH_K' + self.env['bindings'][str([1, ['KEY_L']])] = 'SEARCH_L' + self.env['bindings'][str([1, ['KEY_M']])] = 'SEARCH_M' + self.env['bindings'][str([1, ['KEY_N']])] = 'SEARCH_N' + self.env['bindings'][str([1, ['KEY_O']])] = 'SEARCH_O' + self.env['bindings'][str([1, ['KEY_P']])] = 'SEARCH_P' + self.env['bindings'][str([1, ['KEY_Q']])] = 'SEARCH_Q' + self.env['bindings'][str([1, ['KEY_R']])] = 'SEARCH_R' + self.env['bindings'][str([1, ['KEY_S']])] = 'SEARCH_S' + self.env['bindings'][str([1, ['KEY_T']])] = 'SEARCH_T' + self.env['bindings'][str([1, ['KEY_U']])] = 'SEARCH_U' + self.env['bindings'][str([1, ['KEY_V']])] = 'SEARCH_V' + self.env['bindings'][str([1, ['KEY_W']])] = 'SEARCH_W' + self.env['bindings'][str([1, ['KEY_X']])] = 'SEARCH_X' + self.env['bindings'][str([1, ['KEY_Y']])] = 'SEARCH_Y' + self.env['bindings'][str([1, ['KEY_Z']])] = 'SEARCH_Z' except Exception as e: print(e) else: try: self.currIndex = None - del(self.env['bindings'][str([1, ['KEY_ESC']])]) - del(self.env['bindings'][str([1, ['KEY_UP']])]) - del(self.env['bindings'][str([1, ['KEY_DOWN']])]) - del(self.env['bindings'][str([1, ['KEY_SPACE']])]) - del(self.env['bindings'][str([1, ['KEY_LEFT']])]) - del(self.env['bindings'][str([1, ['KEY_RIGHT']])]) - del(self.env['bindings'][str([1, ['KEY_ENTER']])]) + self.env['bindings'] = self.bindingsBackup.copy() + self.bindingsBackup = None + #del(self.env['bindings'][str([1, ['KEY_ESC']])]) + #del(self.env['bindings'][str([1, ['KEY_UP']])]) + #del(self.env['bindings'][str([1, ['KEY_DOWN']])]) + #del(self.env['bindings'][str([1, ['KEY_SPACE']])]) + #del(self.env['bindings'][str([1, ['KEY_LEFT']])]) + #del(self.env['bindings'][str([1, ['KEY_RIGHT']])]) + #del(self.env['bindings'][str([1, ['KEY_ENTER']])]) except: pass def createMenuTree(self): @@ -164,7 +207,10 @@ class vmenuManager(): else: self.currIndex[len(self.currIndex) - 1] += 1 return True - + def getCurrIndex(self): + if self.currIndex == None: + return 0 + return self.currIndex[len(self.currIndex) - 1] def prevIndex(self): if self.currIndex == None: return False