Make RT import statement conditional, fix formatting, ignore WinRT for type checking
This commit is contained in:
parent
ac78698a1e
commit
a30064d5e9
@ -917,11 +917,13 @@ def setup_audio(taskman: TaskManager, base_folder: str) -> None:
|
||||
|
||||
av_player.players.append(MacTTSPlayer(taskman))
|
||||
elif isWin:
|
||||
from aqt.tts import WindowsRTTTSFilePlayer, WindowsTTSPlayer
|
||||
from aqt.tts import WindowsTTSPlayer
|
||||
|
||||
av_player.players.append(WindowsTTSPlayer(taskman))
|
||||
|
||||
if platform.release() == "10":
|
||||
from aqt.tts import WindowsRTTTSFilePlayer
|
||||
|
||||
# If Windows 10, ensure it's October 2018 update or later
|
||||
if int(platform.version().split(".")[-1]) >= 17763:
|
||||
av_player.players.append(WindowsRTTTSFilePlayer(taskman))
|
||||
|
@ -529,7 +529,7 @@ if isWin:
|
||||
tmppath = os.path.join(tmpdir(), "tts.wav")
|
||||
|
||||
def import_voices(self) -> None:
|
||||
import winrt.windows.media.speechsynthesis as speechsynthesis
|
||||
import winrt.windows.media.speechsynthesis as speechsynthesis # type: ignore
|
||||
|
||||
self.voice_list = speechsynthesis.SpeechSynthesizer.get_all_voices()
|
||||
|
||||
@ -569,8 +569,8 @@ if isWin:
|
||||
cb()
|
||||
|
||||
async def speakText(self, tag: TTSTag, voice_id):
|
||||
import winrt.windows.media.speechsynthesis as speechsynthesis
|
||||
import winrt.windows.storage.streams as streams
|
||||
import winrt.windows.media.speechsynthesis as speechsynthesis # type: ignore
|
||||
import winrt.windows.storage.streams as streams # type: ignore
|
||||
|
||||
synthesizer = speechsynthesis.SpeechSynthesizer()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user