Skip to content

Commit

Permalink
version 0.4a1
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
davidacm committed Sep 7, 2019
1 parent 05d8197 commit af17fa7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
19 changes: 15 additions & 4 deletions addon/globalPlugins/delayedCharacterDescriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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)
2 changes: 1 addition & 1 deletion buildVars.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>",
# URL for the add-on documentation support
Expand Down
5 changes: 4 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
* 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.

0 comments on commit af17fa7

Please sign in to comment.