Skip to content

Commit 809197a

Browse files
committed
update version 0.2
add compatibility for NVDA older versions (2018.2 and later) need testing.
1 parent f44c52e commit 809197a

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

addon/globalPlugins/synthRingSettingsSelector.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55
# Released under GPL 2
66
#globalPlugins/synthRingSettingsSelector.py
77

8-
import config, globalPluginHandler, globalVars, gui, synthDriverHandler, wx, addonHandler
8+
import buildVersion, config, globalPluginHandler, globalVars, gui, synthDriverHandler, wx, addonHandler
99

1010
addonHandler.initTranslation()
1111

12+
SETTINGS_ID = 'id'
13+
SETTINGS_AVAILABLE = 'availableInSettingsRing'
14+
1215
confspec = {
1316
"availableSettings": "string_list(default=list('language', 'voice', 'variant', 'rate', 'rateBoost', 'volume', 'pitch', 'inflection'))"
1417
}
@@ -27,10 +30,11 @@ def setSynth(name,isFallback=False):
2730
return r
2831

2932
def setAvailableSettings():
30-
if synthDriverHandler._curSynth:
33+
if synthDriverHandler._curSynth and globalVars.settingsRing:
3134
for s in synthDriverHandler._curSynth.supportedSettings:
32-
s.availableInSettingsRing = True if s.id in config.conf['synthRingSettingsSelector']['availableSettings'] else False
33-
if globalVars.settingsRing: globalVars.settingsRing.updateSupportedSettings(synthDriverHandler._curSynth)
35+
setattr(s, SETTINGS_AVAILABLE, True if getattr(s, SETTINGS_ID) in config.conf['synthRingSettingsSelector']['availableSettings'] else False)
36+
globalVars.settingsRing.updateSupportedSettings(synthDriverHandler._curSynth)
37+
3438

3539
class SynthRingSettingsSelectorSettingsPanel(gui.SettingsPanel):
3640
# Translators: This is the label for the Synth ring settings selector settings category in NVDA Settings screen.
@@ -46,8 +50,8 @@ def makeSettings(self, settingsSizer):
4650
sHelper.addItem(settingsGroup)
4751
self.settingsCheckbox = {}
4852
for k in synthDriverHandler._curSynth.supportedSettings:
49-
self.settingsCheckbox[k.id] = settingsGroup.addItem(wx.CheckBox(self, label =k.displayNameWithAccelerator))
50-
self.settingsCheckbox[k.id].SetValue(k.id in self.curSettings)
53+
self.settingsCheckbox[getattr(k, SETTINGS_ID)] = settingsGroup.addItem(wx.CheckBox(self, label =k.displayNameWithAccelerator))
54+
self.settingsCheckbox[getattr(k, SETTINGS_ID)].SetValue(getattr(k, SETTINGS_ID) in self.curSettings)
5155

5256
def onSave(self):
5357
newSettings = []
@@ -59,9 +63,14 @@ def onSave(self):
5963
config.post_configProfileSwitch.notify()
6064

6165

66+
6267
class GlobalPlugin(globalPluginHandler.GlobalPlugin):
6368
def __init__(self):
69+
global SETTINGS_AVAILABLE, SETTINGS_ID
6470
super(globalPluginHandler.GlobalPlugin, self).__init__()
71+
if int(buildVersion.formatBuildVersionString()[:6].replace(".", "")) < 20192:
72+
SETTINGS_ID = 'name'
73+
SETTINGS_AVAILABLE = 'availableInSynthSettingsRing'
6574
self.handleConfigProfileSwitch()
6675
config.post_configProfileSwitch.register(self.handleConfigProfileSwitch)
6776
synthDriverHandler.setSynth = setSynth
@@ -77,4 +86,4 @@ def terminate(self):
7786
synthDriverHandler.setSynth = origSetSynth
7887
gui.settingsDialogs.setSynth = origSetSynth
7988
gui.settingsDialogs.NVDASettingsDialog.categoryClasses.remove(SynthRingSettingsSelectorSettingsPanel)
80-
config.post_configProfileSwitch.unregister(self.handleConfigProfileSwitch)
89+
config.post_configProfileSwitch.unregister(self.handleConfigProfileSwitch)

buildVars.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
# Translators: Long description to be shown for this add-on on add-on information from add-ons manager
2020
"addon_description" : _("""This add-on allows the user to select which settings should appear on the synth settings ring."""),
2121
# version
22-
"addon_version" : "0.2",
22+
"addon_version" : "0.3",
2323
# Author(s)
2424
"addon_author" : u"David CM <dhf360@gmail.com>",
2525
# URL for the add-on documentation support
2626
"addon_url" : "https://github.com/david-acm/NVDA-synthRingSettingsSelector",
2727
# Documentation file name
2828
"addon_docFileName" : "readme.html",
2929
# Minimum NVDA version supported (e.g. "2018.3.0")
30-
"addon_minimumNVDAVersion" : "2019.2.0",
30+
"addon_minimumNVDAVersion" : "2018.2.0",
3131
# Last NVDA version supported/tested (e.g. "2018.4.0", ideally more recent than minimum version)
3232
"addon_lastTestedNVDAVersion" : "2019.2.0",
3333
# Add-on update channel (default is stable or None)

0 commit comments

Comments
 (0)