Skip to content

Commit

Permalink
Set proxy status when saving to file
Browse files Browse the repository at this point in the history
Pin pyobjc version to 9.0.1
Bump package version
  • Loading branch information
dormant-user committed Oct 2, 2023
1 parent 495ef91 commit 7eb49a3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ dependencies = [
"comtypes; platform_system == 'Windows'",
"pypiwin32; platform_system == 'Windows'",
"pywin32; platform_system == 'Windows'",
"pyobjc>=2.4; platform_system == 'Darwin'",
"pyobjc==9.0.1; platform_system == 'Darwin'",
"six"
]
description = "Text to Speech (TTS) library for Python 3. Works without internet connection or delay. Supports multiple TTS engines, including Sapi5, nsss, and espeak."
Expand Down
2 changes: 1 addition & 1 deletion pyttsx3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from .engine import Engine

version = '3.4.0'
version = '3.5'
_activeEngines = weakref.WeakValueDictionary()


Expand Down
6 changes: 2 additions & 4 deletions pyttsx3/drivers/nsss.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import time

# noinspection PyUnresolvedReferences
from AppKit import NSSpeechSynthesizer
from Foundation import *
Expand Down Expand Up @@ -141,10 +139,10 @@ def setProperty(self, name, value):

@objc.python_method
def save_to_file(self, text, filename):
self._proxy.setBusy(True)
self._completed = True
url = Foundation.NSURL.fileURLWithPath_(filename)
self._tts.startSpeakingString_toURL_(text, url)
# waits (for 1% of the length of text) the system to finish writing to the file system before continuing
time.sleep(max(1.0, len(text) * 0.01))

def speechSynthesizer_didFinishSpeaking_(self, tts, success):
if not self._completed:
Expand Down

0 comments on commit 7eb49a3

Please sign in to comment.