From 58208beb3a5dae3150cfa31766bad4b32a2f64c3 Mon Sep 17 00:00:00 2001 From: chrys Date: Tue, 12 Feb 2019 20:04:46 +0100 Subject: [PATCH] make vmenu path configurable --- config/settings/espeak.settings.conf | 3 +++ config/settings/settings-daemon.conf | 3 +++ config/settings/settings-pty.conf | 3 +++ config/settings/settings.conf | 3 +++ config/settings/settings.conf.example | 3 +++ config/settings/settings.conf.storm | 3 +++ .../settings/speech-dispatcher.settings.conf | 3 +++ .../vmenu-profiles/KEY/mutt/file/issue.py | 25 +++++++++++++++++++ src/fenrirscreenreader/core/settingsData.py | 3 +++ src/fenrirscreenreader/core/vmenuManager.py | 12 +++++++-- 10 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/file/issue.py diff --git a/config/settings/espeak.settings.conf b/config/settings/espeak.settings.conf index e0b331a7..46a71cab 100644 --- a/config/settings/espeak.settings.conf +++ b/config/settings/espeak.settings.conf @@ -219,6 +219,9 @@ enabled=True inactiveTimeoutSec=120 list= +[menu] +vmenuPath= + [time] enabled=False presentTime=True diff --git a/config/settings/settings-daemon.conf b/config/settings/settings-daemon.conf index 2d48e901..0f2e0392 100644 --- a/config/settings/settings-daemon.conf +++ b/config/settings/settings-daemon.conf @@ -229,6 +229,9 @@ enabled=True inactiveTimeoutSec=120 list= +[menu] +vmenuPath= + [time] # automatic time anouncement enabled=False diff --git a/config/settings/settings-pty.conf b/config/settings/settings-pty.conf index 2d48e901..0f2e0392 100644 --- a/config/settings/settings-pty.conf +++ b/config/settings/settings-pty.conf @@ -229,6 +229,9 @@ enabled=True inactiveTimeoutSec=120 list= +[menu] +vmenuPath= + [time] # automatic time anouncement enabled=False diff --git a/config/settings/settings.conf b/config/settings/settings.conf index 65bec737..14623b65 100644 --- a/config/settings/settings.conf +++ b/config/settings/settings.conf @@ -229,6 +229,9 @@ enabled=True inactiveTimeoutSec=120 list= +[menu] +vmenuPath= + [time] # automatic time anouncement enabled=False diff --git a/config/settings/settings.conf.example b/config/settings/settings.conf.example index 2c48c35f..08734cc0 100644 --- a/config/settings/settings.conf.example +++ b/config/settings/settings.conf.example @@ -230,6 +230,9 @@ enabled=True inactiveTimeoutSec=120 list= +[menu] +vmenuPath= + [time] # automatic time anouncement enabled=False diff --git a/config/settings/settings.conf.storm b/config/settings/settings.conf.storm index 1103186a..b254cdff 100644 --- a/config/settings/settings.conf.storm +++ b/config/settings/settings.conf.storm @@ -175,6 +175,9 @@ enabled=True inactiveTimeoutSec=120 list= +[menu] +vmenuPath= + [time] # automatic time anouncement enabled=False diff --git a/config/settings/speech-dispatcher.settings.conf b/config/settings/speech-dispatcher.settings.conf index 32337ae8..01df2785 100644 --- a/config/settings/speech-dispatcher.settings.conf +++ b/config/settings/speech-dispatcher.settings.conf @@ -229,6 +229,9 @@ enabled=True inactiveTimeoutSec=120 list= +[menu] +vmenuPath= + [time] # automatic time anouncement enabled=False diff --git a/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/file/issue.py b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/file/issue.py new file mode 100644 index 00000000..fa0ab1cf --- /dev/null +++ b/src/fenrirscreenreader/commands/vmenu-profiles/KEY/mutt/file/issue.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 + 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/core/settingsData.py b/src/fenrirscreenreader/core/settingsData.py index d69cc0c8..8549c16b 100644 --- a/src/fenrirscreenreader/core/settingsData.py +++ b/src/fenrirscreenreader/core/settingsData.py @@ -99,6 +99,9 @@ settingsData = { 'leaveReviewOnCursorChange': True, 'leaveReviewOnScreenChange': True, }, +'menu':{ + 'vmenuPath': '', +}, 'promote':{ 'enabled': True, 'inactiveTimeoutSec': 120, diff --git a/src/fenrirscreenreader/core/vmenuManager.py b/src/fenrirscreenreader/core/vmenuManager.py index e0a080db..9c327b2e 100755 --- a/src/fenrirscreenreader/core/vmenuManager.py +++ b/src/fenrirscreenreader/core/vmenuManager.py @@ -21,7 +21,15 @@ class vmenuManager(): self.lastSearchTime = time.time() def initialize(self, environment): self.env = environment + # use default path self.defaultVMenuPath = fenrirPath+ "/commands/vmenu-profiles/" + self.env['runtime']['inputManager'].getShortcutType() + # if there is no user configuration + if self.env['runtime']['settingsManager'].getSetting('menu', 'vmenuPath') != '': + self.defaultVMenuPath = self.env['runtime']['settingsManager'].getSetting('menu', 'vmenuPath') + if not self.defaultVMenuPath.endswith('/'): + self.defaultVMenuPath += '/' + self.defaultVMenuPath += self.env['runtime']['inputManager'].getShortcutType() + self.createMenuTree() self.closeAfterAction = False def shutdown(self): @@ -37,9 +45,9 @@ class vmenuManager(): while True: entry = self.getCurrentEntry() if entry.startswith(self.searchText): - return True + return True if not self.nextIndex(): - return False + return False if True: return False def setCurrMenu(self, currMenu = ''):