From af17fa794813e576c2cbf220246e3b788fe635b1 Mon Sep 17 00:00:00 2001 From: David CM Date: Sat, 7 Sep 2019 12:13:01 -0600 Subject: [PATCH] version 0.4a1 add a script to enable or disable delayed character descriptions. The user must set the command to call this script if s'he need it. update readme with the script info. --- .../delayedCharacterDescriptions.py | 19 +++++++++++++++---- buildVars.py | 2 +- readme.md | 5 ++++- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/addon/globalPlugins/delayedCharacterDescriptions.py b/addon/globalPlugins/delayedCharacterDescriptions.py index 8074f4f..0193794 100644 --- a/addon/globalPlugins/delayedCharacterDescriptions.py +++ b/addon/globalPlugins/delayedCharacterDescriptions.py @@ -6,6 +6,8 @@ #globalPlugins/delayedCharacterDescriptions.py import characterProcessing, config, controlTypes, globalPluginHandler, gui, addonHandler, six, speech, textInfos, threading, wx +from globalCommands import SCRCAT_SPEECH + addonHandler.initTranslation() characterDescriptionTimer = threading.Timer(0.3, zip) # fake timer because this can't be None. @@ -83,9 +85,9 @@ def __init__(self): config.post_configProfileSwitch.register(self.handleConfigProfileSwitch) def handleConfigProfileSwitch(self): - self.switch(config.conf['delayedCharacterDescriptions']['enabled']) + self.toggle(config.conf['delayedCharacterDescriptions']['enabled']) - def switch(self, status): + def toggle(self, status): if status: speech.speakTextInfo = speakTextInfo speech.speak = speak @@ -97,8 +99,17 @@ def switch(self, status): speech.speakSpelling = origSpeakSpelling speech.cancelSpeech = origCancelSpeech + def script_toggleDelayedDescriptions(self, gesture): + config.conf['delayedCharacterDescriptions']['enabled'] = not config.conf['delayedCharacterDescriptions']['enabled'] + self.toggle(config.conf['delayedCharacterDescriptions']['enabled']) + # Translators: message spoken if the user enables or disables delayed character descriptions. + speech.speakMessage(_('Delayed descriptions %s') % (_('on') if config.conf['delayedCharacterDescriptions']['enabled'] else _('off'))) + # Translators: message presented in input mode. + script_toggleDelayedDescriptions.__doc__ = _("Toggles delayed character descriptions on or off") + script_toggleDelayedDescriptions.category = SCRCAT_SPEECH + def terminate(self): super(GlobalPlugin, self).terminate() - self.switch(False) + self.toggle(False) gui.settingsDialogs.NVDASettingsDialog.categoryClasses.remove(DelayedCharactersPanel) - config.post_configProfileSwitch.unregister(self.handleConfigProfileSwitch) + config.post_configProfileSwitch.unregister(self.handleConfigProfileSwitch) \ No newline at end of file diff --git a/buildVars.py b/buildVars.py index 5439944..81634e8 100644 --- a/buildVars.py +++ b/buildVars.py @@ -19,7 +19,7 @@ # Translators: Long description to be shown for this add-on on add-on information from add-ons manager "addon_description" : _("""This add-on speaks the character description for the last read character after n miliseconds when the character was read by character review commands, E.G. left and right arrow keys, left, current or right character review commands, ETC."""), # version - "addon_version" : "0.3a2", + "addon_version" : "0.4a1", # Author(s) "addon_author" : u"David CM ", # URL for the add-on documentation support diff --git a/readme.md b/readme.md index 8abb1f1..3102125 100644 --- a/readme.md +++ b/readme.md @@ -23,4 +23,7 @@ This package is distributed under the terms of the GNU General Public License, v To enable or disable it, go to NVDA settings and select Delayed character descriptions. In that category you can set the following parameters: * Enable delayed descriptions for characters: this check enables or disables the add-on. -* Delay to announce character descriptions (in ms): the time the add-on waits to speak the description for the read character. You can't set it greater than 20000 ms. \ No newline at end of file +* Delay to announce character descriptions (in ms): the time the add-on waits to speak the description for the read character. You can't set it greater than 20000 ms. + +This add-on has a script that lets you toggle the delayed descriptions status. +You can assign a command or gesture in speech category in the NVDA input gestures dialog. \ No newline at end of file