Get simple speak working on windows as well

This commit is contained in:
Kovid Goyal 2020-11-18 11:19:29 +05:30
parent d9592d090b
commit 3125ae8339
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 18 additions and 1 deletions

View File

@ -5,7 +5,7 @@
from calibre.constants import iswindows, ismacos
if iswindows:
pass
from .windows import Client
elif ismacos:
pass
else:

View File

@ -0,0 +1,17 @@
#!/usr/bin/env python
# vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
class Client:
def __init__(self):
from calibre.utils.windows.winsapi import ISpVoice
self.sp_voice = ISpVoice()
def __del__(self):
self.sp_voice = None
def speak_simple_text(self, text):
from calibre_extensions.winsapi import SPF_ASYNC, SPF_PURGEBEFORESPEAK, SPF_IS_NOT_XML
self.sp_voice.speak(text, SPF_ASYNC | SPF_PURGEBEFORESPEAK | SPF_IS_NOT_XML)