Skip to content

Commit c58c2bc

Browse files
committed
initial commit.
1 parent dcc0bcf commit c58c2bc

12 files changed

+486
-0
lines changed

.gitattributes

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Set default behaviour, in case users don't have core.autocrlf set.
2+
* text=auto
3+
4+
# Try to ensure that po files in the repo does not include
5+
# source code line numbers.
6+
# Every person expected to commit po files should change their personal config file as described here:
7+
# https://mail.gnome.org/archives/kupfer-list/2010-June/msg00002.html
8+
*.po filter=cleanpo

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
addon/doc/*.css
2+
addon/doc/en/
3+
*_docHandler.py
4+
*.html
5+
*.ini
6+
*.mo
7+
*.pot
8+
*.py[co]
9+
*.nvda-addon
10+
.sconsign.dblite
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# -*- coding: UTF-8 -*-
2+
# Synth ring settings selector: This add-on allows the user to select which settings should appear on the synth settings ring.
3+
# Copyright (C) 2019 David CM
4+
# Author: David CM <dhf360@gmail.com>
5+
# Released under GPL 2
6+
#globalPlugins/synthRingSettingsSelector.py
7+
8+
import config, globalPluginHandler, gui, synthDriverHandler, wx, addonHandler
9+
10+
addonHandler.initTranslation()
11+
12+
confspec = {
13+
"availableSettings": "string_list(default=list('language', 'voice', 'variant', 'rate', 'rateBoost', 'volume', 'pitch', 'inflection'))"
14+
}
15+
config.conf.spec["synthRingSettingsSelector"] = confspec
16+
17+
#saves the original setSynth function
18+
origSetSynth = synthDriverHandler.setSynth
19+
20+
# alternate function to setSynth.
21+
def setSynth(name,isFallback=False):
22+
# return temporally to the original function because that function sometimes calls itself, and we don't want our function to be called.
23+
synthDriverHandler.setSynth = origSetSynth
24+
r = origSetSynth(name,isFallback)
25+
synthDriverHandler.setSynth = setSynth
26+
if r: setAvailableSettings()
27+
return r
28+
29+
def setAvailableSettings():
30+
if synthDriverHandler._curSynth:
31+
for s in synthDriverHandler._curSynth.supportedSettings:
32+
s.availableInSettingsRing = True if s.id in config.conf['synthRingSettingsSelector']['availableSettings'] else False
33+
synthDriverHandler._curSynth.initSettings()
34+
35+
class SynthRingSettingsSelectorSettingsPanel(gui.SettingsPanel):
36+
# Translators: This is the label for the Synth ring settings selector settings category in NVDA Settings screen.
37+
title = _("Synth ring settings selector")
38+
39+
def makeSettings(self, settingsSizer):
40+
self.curSettings = config.conf['synthRingSettingsSelector']['availableSettings']
41+
sHelper = gui.guiHelper.BoxSizerHelper(self, sizer=settingsSizer)
42+
sHelper.addItem(wx.StaticText(self, label =_("Check the settings that you want to include in the Synth settings ring")))
43+
settingsGroup = gui.guiHelper.BoxSizerHelper(self, sizer=wx.StaticBoxSizer(
44+
wx.StaticBox(self, label= _("Settings group")), wx.VERTICAL))
45+
sHelper.addItem(settingsGroup)
46+
self.settingsCheckbox = {}
47+
for k in synthDriverHandler._curSynth.supportedSettings:
48+
self.settingsCheckbox[k.id] = settingsGroup.addItem(wx.CheckBox(self, label =k.displayNameWithAccelerator))
49+
self.settingsCheckbox[k.id].SetValue(k.id in self.curSettings)
50+
51+
def onSave(self):
52+
newSettings = []
53+
keys = self.settingsCheckbox.keys()
54+
for k in keys:
55+
if self.settingsCheckbox[k].GetValue(): newSettings.append(k)
56+
[newSettings.append(k) for k in self.curSettings if k not in keys]
57+
config.conf['synthRingSettingsSelector']['availableSettings'] = newSettings
58+
config.post_configProfileSwitch.notify()
59+
60+
61+
class GlobalPlugin(globalPluginHandler.GlobalPlugin):
62+
def __init__(self):
63+
super(globalPluginHandler.GlobalPlugin, self).__init__()
64+
self.handleConfigProfileSwitch()
65+
config.post_configProfileSwitch.register(self.handleConfigProfileSwitch)
66+
synthDriverHandler.setSynth = setSynth
67+
gui.settingsDialogs.setSynth = setSynth
68+
setAvailableSettings()
69+
gui.settingsDialogs.NVDASettingsDialog.categoryClasses.append(SynthRingSettingsSelectorSettingsPanel)
70+
71+
def handleConfigProfileSwitch(self):
72+
setAvailableSettings()
73+
74+
def terminate(self):
75+
super(GlobalPlugin, self).terminate()
76+
synthDriverHandler.setSynth = origSetSynth
77+
gui.settingsDialogs.setSynth = origSetSynth
78+
gui.settingsDialogs.NVDASettingsDialog.categoryClasses.remove(SynthRingSettingsSelectorSettingsPanel)
79+
config.post_configProfileSwitch.unregister(self.handleConfigProfileSwitch)

appveyor.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
version: '{branch}-{build}'
2+
environment:
3+
PY_PYTHON: 3.7-32
4+
install:
5+
- cmd: >-
6+
set PATH=C:\Python37\Scripts;%PATH%
7+
8+
pip install wheel
9+
10+
pip install scons
11+
12+
pip install markdown
13+
build_script:
14+
- cmd: scons
15+
artifacts:
16+
- path: '*.nvda-addon'
17+
name: addon
18+
type: WebDeployPackage
19+
before_deploy:
20+
- ps: $env:REPO_NAME = $env:APPVEYOR_REPO_NAME.Substring($env:APPVEYOR_REPO_NAME.IndexOf('/') + 1)
21+
deploy:
22+
- provider: GitHub
23+
tag: $(APPVEYOR_REPO_TAG_NAME)
24+
release: Release $(APPVEYOR_REPO_TAG_NAME)
25+
description: This is the release $(APPVEYOR_REPO_TAG_NAME) of the $(REPO_NAME) addon for the NVDA screen reader built and uploaded to GitHub using Appveyor.
26+
auth_token:
27+
secure: hwgAZezYq6+gi0L3+FGMaWOT/GBGeyVH9QqPxGSqVVGi3+VzqjMFy/9PcAMSE5cL
28+
artifact: addon
29+
on:
30+
appveyor_repo_tag: true

buildVars.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# -*- coding: UTF-8 -*-
2+
3+
# Build customizations
4+
# Change this file instead of sconstruct or manifest files, whenever possible.
5+
6+
# Full getext (please don't change)
7+
_ = lambda x : x
8+
9+
# Add-on information variables
10+
addon_info = {
11+
# for previously unpublished addons, please follow the community guidelines at:
12+
# https://bitbucket.org/nvdaaddonteam/todo/raw/master/guideLines.txt
13+
# add-on Name, internal for nvda
14+
"addon_name" : "synthRingSettingsSelector",
15+
# Add-on summary, usually the user visible name of the addon.
16+
# Translators: Summary for this add-on to be shown on installation and add-on information.
17+
"addon_summary" : _("Synth ring settings selector"),
18+
# Add-on description
19+
# Translators: Long description to be shown for this add-on on add-on information from add-ons manager
20+
"addon_description" : _("""This add-on allows the user to select which settings should appear on the synth settings ring."""),
21+
# version
22+
"addon_version" : "0.1",
23+
# Author(s)
24+
"addon_author" : u"David CM <dhf360@gmail.com>",
25+
# URL for the add-on documentation support
26+
"addon_url" : "https://github.com/david-acm/NVDA-synthRingSettingsSelector",
27+
# Documentation file name
28+
"addon_docFileName" : "readme.html",
29+
# Minimum NVDA version supported (e.g. "2018.3.0")
30+
"addon_minimumNVDAVersion" : "2019.2.0",
31+
# Last NVDA version supported/tested (e.g. "2018.4.0", ideally more recent than minimum version)
32+
"addon_lastTestedNVDAVersion" : "2019.2.0",
33+
# Add-on update channel (default is stable or None)
34+
"addon_updateChannel" : None,
35+
}
36+
37+
from os import path
38+
39+
# Define the python files that are the sources of your add-on.
40+
# You can use glob expressions here, they will be expanded.
41+
pythonSources = [path.join("addon", "globalPlugins", "synthRingSettingsSelector.py")]
42+
43+
# Files that contain strings for translation. Usually your python sources
44+
i18nSources = pythonSources + ["buildVars.py"]
45+
46+
# Files that will be ignored when building the nvda-addon file
47+
# Paths are relative to the addon directory, not to the root directory of your addon sources.
48+
excludedFiles = []

developerNotes.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#Synth settings ring selector NVDA Add-on #
2+
This add-on allows the user to select which settings should appear on the synth settings ring.
3+
4+
Copyright (C) 2019 David CM <dhf360@gmail.com>
5+
6+
This package is distributed under the terms of the GNU General Public License, version 2 or later.
7+
8+
## Packaging it for distribution
9+
Open a command line, change to the Add-on root folder and run the scons command. The created add-on, if there were no errors, is placed in the root directory.
10+
11+
## Notes
12+
* scons and gettext tools on this project are compatible with python 3 only. Doesn't work with python 2.7.

manifest-translated.ini.tpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
summary = "{addon_summary}"
2+
description = """{addon_description}"""

manifest.ini.tpl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name = {addon_name}
2+
summary = "{addon_summary}"
3+
description = """{addon_description}"""
4+
author = "{addon_author}"
5+
url = {addon_url}
6+
version = {addon_version}
7+
docFileName = {addon_docFileName}
8+
minimumNVDAVersion = {addon_minimumNVDAVersion}
9+
lastTestedNVDAVersion = {addon_lastTestedNVDAVersion}
10+
updateChannel = {addon_updateChannel}

readme.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#Synth settings ring selector NVDA Add-on #
2+
This add-on allows the user to select which settings should appear on the synth settings ring.
3+
4+
Copyright (C) 2019 David CM <dhf360@gmail.com>
5+
6+
This package is distributed under the terms of the GNU General Public License, version 2 or later.
7+
8+
## Features
9+
This add-on provides the following features:
10+
11+
* A category panel in the NVDA settings to select which settings you want to include in the synth settings ring.
12+
* save specific settings for each profile.
13+
* overrides the default synth driver settings that are shown in the synth settings ring.
14+
15+
## Requirements
16+
You need NVDA 2019.2 or later.
17+
18+
## Installation
19+
Just install it as a NVDA add-on.
20+
21+
## Usage
22+
To enable or disable which settings are included, go to NVDA settings and select "Synth ring settings selector" category. In that category you can configure all supported features by this add-on.
23+
Settings included by default:
24+
25+
* language.
26+
* voice.
27+
* variant.
28+
* rate.
29+
* rate boost.
30+
* volume.
31+
* pitch.
32+
* inflection.

0 commit comments

Comments
 (0)