Skip to content

Commit

Permalink
restart nvda, clean up, fix edge case, better docs
Browse files Browse the repository at this point in the history
  • Loading branch information
C-Loftus committed Jan 9, 2024
1 parent ad7680c commit d767c6d
Show file tree
Hide file tree
Showing 13 changed files with 87 additions and 31 deletions.
5 changes: 3 additions & 2 deletions core/core-agnostic.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# We want to get the settings from the talon file but then update
# them locally here so we can change them globally via expose talon actions
def initialize_settings():
ctx.settings["user.echo_dictation"]: bool = settings.get("user.echo_dictation")
ctx.settings["user.echo_context"]: bool = settings.get("user.echo_context")
ctx.settings["user.echo_dictation"]: bool = settings.get("user.echo_dictation", True)
ctx.settings["user.echo_context"]: bool = settings.get("user.echo_context", False)

# initialize the settings only after the user settings have been loaded
app.register('ready', initialize_settings)
Expand Down Expand Up @@ -94,6 +94,7 @@ def toggle_echo_all():

def tts(text: str):
'''text to speech with robot voice'''
print("Sight-Free-Talon Error: TTS not implemented in this context")

def espeak(text: str):
'''text to speech with espeak'''
Expand Down
13 changes: 10 additions & 3 deletions docs/src/ATTRIBUTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,31 @@
- [https://github.com/aPinix/indent-jump-vscode](https://github.com/aPinix/indent-jump-vscode)
- [https://www.techrxiv.org/articles/preprint/Image_Captioning_for_the_Visually_Impaired_and_Blind_A_Recipe_for_Low-Resource_Languages/22133894](https://www.techrxiv.org/articles/preprint/Image_Captioning_for_the_Visually_Impaired_and_Blind_A_Recipe_for_Low-Resource_Languages/22133894)
- [https://www.theverge.com/23203911/screen-readers-history-blind-henter-curran-teh-nvda](https://www.theverge.com/23203911/screen-readers-history-blind-henter-curran-teh-nvda)
- [https://www.freedomscientific.com/SurfsUp/Speech_Sounds_Schemes.htm]
- (https://www.freedomscientific.com/SurfsUp/Speech_Sounds_Schemes.htm)
- [https://www.freedomscientific.com/SurfsUp/Speech_Sounds_Schemes.htm](https://www.freedomscientific.com/SurfsUp/Speech_Sounds_Schemes.htm)

## Emacspeak

- [https://tvraman.github.io/emacspeak/manual/](https://tvraman.github.io/emacspeak/manual/)
- [https://emacspeak.blogspot.com/](https://emacspeak.blogspot.com/)
- [https://www.emacswiki.org/emacs/BrailleMode](https://www.emacswiki.org/emacs/BrailleMode)
- [https://www.emacswiki.org/emacs/EmacSpeak](https://www.emacswiki.org/emacs/EmacSpeak)
- [https://emacspeak.sourceforge.net/tips.html](https://emacspeak.sourceforge.net/tips.html)
- [https://tvraman.github.io/emacspeak/manual/TTS-Servers.html](https://tvraman.github.io/emacspeak/manual/TTS-Servers.html)

## NVDA

- NVDA Controller client `.dll` file can be found at: [https://www.nvaccess.org/files/nvda/releases/stable/](https://www.nvaccess.org/files/nvda/releases/stable/)
- Documentation for this controller client can be found at [https://github.com/nvaccess/nvda/blob/master/extras/controllerClient/readme.md](https://github.com/nvaccess/nvda/blob/master/extras/controllerClient/readme.md)
- [https://github.com/nvaccess/nvda/wiki/](https://github.com/nvaccess/nvda/wiki/)
- [ https://addons.nvda-project.org/addons/AudioThemes.en.html](https://addons.nvda-project.org/addons/AudioThemes.en.html)
- [https://addons.nvda-project.org/addons/phoneticPunctuation.en.html] (https://addons.nvda-project.org/addons/phoneticPunctuation.en.html)
- [https://addons.nvda-project.org/addons/phoneticPunctuation.en.html](https://addons.nvda-project.org/addons/phoneticPunctuation.en.html)
- Helpful settings
- Document Formatting: "Line Indentation Reporting" set to "Tones"
- Scratchpad located within the NVDA advanced settings, there you can import python scripts during development

## JAWS

- [https://www.freelists.org/post/jawsscripts/FW-FSAPIdll](https://www.freelists.org/post/jawsscripts/FW-FSAPIdll)

## Libraries

Expand All @@ -41,3 +47,4 @@

- [https://github.com/actions/runner-images/issues/4770](https://github.com/actions/runner-images/issues/4770)
- [https://github.com/AccessLint/screenreaders/tree/main/packages/voiceover](https://github.com/AccessLint/screenreaders/tree/main/packages/voiceover)
- [https://support.apple.com/en-gb/guide/voiceover/cpvougen/mac](https://support.apple.com/en-gb/guide/voiceover/cpvougen/mac)
11 changes: 11 additions & 0 deletions nvda/.addOn/changeInterrupt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import globalPluginHandler
from scriptHandler import script
import config

class GlobalPlugin(globalPluginHandler.GlobalPlugin):

@script(gesture="kb:NVDA+9")
def script_announceNVDAVersion(self, gesture):
interrupt = config.conf["keyboard"]["speechInterruptForCharacters"]
config.conf["keyboard"]["speechInterruptForCharacters"] = not interrupt

4 changes: 3 additions & 1 deletion nvda/.addOn/global.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,6 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):

@script(gesture="kb:NVDA+shift+v")
def script_announceNVDAVersion(self, gesture):
ui.message(versionInfo.version)
ui.message(versionInfo.version)


12 changes: 10 additions & 2 deletions nvda/nvda.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,16 @@ def toggle_nvda():
actions.user.tts("Turning NVDA off")
time.sleep(1)
actions.key("enter")


def restart_nvda():
"""Restarts NVDA"""
if actions.user.is_nvda_running():
actions.user.with_nvda_mod_press('q')
time.sleep(0.5)
actions.key("down")
time.sleep(0.5)
actions.key("enter")
actions.user.tts("Restarting NVDA")


def with_nvda_mod_press(key: str):
Expand Down Expand Up @@ -117,4 +126,3 @@ def braille(text: str):

# speech_system.register("pre:phrase", toggle_speak_typed_words)
# speech_system.register("post:phrase", toggle_speak_typed_words)

2 changes: 2 additions & 0 deletions nvda/nvda.talon
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,5 @@ braille display dialog:
pass through next:
user.with_nvda_mod_press('f2')

restart reader:
user.restart_nvda()
8 changes: 8 additions & 0 deletions pedal/.nvda-pedal.talon
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# tag: user.nvda_running

# -

# # navigate through links on a page
# deck(pedal_left:repeat):
# key(tab)
# sleep(.2)
9 changes: 9 additions & 0 deletions pedal/.slack-pedal.talon
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# title: /app.slack.com/

# -

# deck(pedal_left):
# key(tab:down)
# key(f6)
# key(tab:up)
# sleep(0.1)
9 changes: 0 additions & 9 deletions pedal/nvda-pedal.talon

This file was deleted.

10 changes: 0 additions & 10 deletions pedal/slack-pedal.talon

This file was deleted.

2 changes: 1 addition & 1 deletion sight-free-global.talon
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ toggle [screen] reader:
toggle (key | keypress) sound:
user.toggle_keypress_sound()

swtich voice:
(swtich | change) voice:
user.switch_voice()
3 changes: 0 additions & 3 deletions utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ def explore_settings():
builder.p(f"{setting}, {active_settings[setting]}")
builder.render()

def explore_modes():
"""Open the talon modes file"""

def extract_text():
"""Extract the text from the current window"""

Expand Down
30 changes: 30 additions & 0 deletions voiceover/tmp.applescript
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
--------------------
set currentDate to current date
say currentDate using "Ava"
delay 2

-----------------------
try
set doNotShowSplashScreen to (do shell script "defaults read com.apple.VoiceOverTraining doNotShowSplashScreen") as integer as boolean
on error
set doNotShowSplashScreen to false
end try
if doNotShowSplashScreen then
do shell script "/System/Library/CoreServices/VoiceOver.app/Contents/MacOS/VoiceOverStarter"
else
do shell script "defaults write com.apple.VoiceOverTraining doNotShowSplashScreen -bool true && /System/Library/CoreServices/VoiceOver.app/Contents/MacOS/VoiceOverStarter"
end if


--- allow voiceover to be controlled with applescript
tell application "VoiceOver" to say (do shell script "date +\"%l:%M %p\"") using "Karen" speaking rate 270 volume 0.4


-- Set the text you want VoiceOver to speak----------------
set textToSpeak to "Hello, this is a test."
do shell script "say " & quoted form of textToSpeak

----------------
tell application "VoiceOver"
tell commander to perform command item chooser
end tell

0 comments on commit d767c6d

Please sign in to comment.