2015-11-03 04:38:59 -06:00
|
|
|
from __future__ import absolute_import
|
2014-10-27 16:29:04 -06:00
|
|
|
import os
|
|
|
|
import platform
|
2015-11-03 04:38:59 -06:00
|
|
|
import ctypes
|
2014-10-27 16:29:04 -06:00
|
|
|
|
|
|
|
from platform_utils import paths
|
|
|
|
from libloader import load_library
|
2015-11-03 04:38:59 -06:00
|
|
|
from .base import Output
|
2014-10-27 16:29:04 -06:00
|
|
|
|
|
|
|
class NVDA(Output):
|
|
|
|
"""Supports The NVDA screen reader"""
|
|
|
|
name = "NVDA"
|
|
|
|
lib32 = 'nvdaControllerClient32.dll'
|
|
|
|
lib64 = 'nvdaControllerClient64.dll'
|
2015-11-03 04:38:59 -06:00
|
|
|
argtypes = {
|
|
|
|
'nvdaController_brailleMessage': (ctypes.c_wchar_p,),
|
|
|
|
'nvdaController_speakText': (ctypes.c_wchar_p,),
|
|
|
|
}
|
2014-10-27 16:29:04 -06:00
|
|
|
|
|
|
|
def is_active(self):
|
|
|
|
try:
|
|
|
|
return self.lib.nvdaController_testIfRunning() == 0
|
|
|
|
except:
|
|
|
|
return False
|
|
|
|
|
|
|
|
def braille(self, text, **options):
|
2015-11-03 04:38:59 -06:00
|
|
|
self.lib.nvdaController_brailleMessage(text)
|
2014-10-27 16:29:04 -06:00
|
|
|
|
|
|
|
def speak(self, text, interrupt=False):
|
|
|
|
if interrupt:
|
|
|
|
self.silence()
|
2015-11-03 04:38:59 -06:00
|
|
|
self.lib.nvdaController_speakText(text)
|
2014-10-27 16:29:04 -06:00
|
|
|
|
|
|
|
def silence(self):
|
|
|
|
self.lib.nvdaController_cancelSpeech()
|
|
|
|
|
|
|
|
output_class = NVDA
|