Reverted TTS implementation from 35913c4. Since blind people use screen readers for this functionality. Will have a look at http://www.linux-sppeakup.org/.
This commit is contained in:
parent
60aaae4337
commit
90eff26657
|
|
@ -11,4 +11,3 @@ from .lib.locale_helpers import *
|
|||
from .lib.services import *
|
||||
from .lib.packages import *
|
||||
from .lib.output import *
|
||||
from .lib.tss import *
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
import sys
|
||||
from .tts import TTS
|
||||
|
||||
# Found first reference here: https://stackoverflow.com/questions/7445658/how-to-detect-if-the-console-does-support-ansi-escape-codes-in-python
|
||||
# And re-used this: https://github.com/django/django/blob/master/django/core/management/color.py#L12
|
||||
|
|
@ -44,7 +43,4 @@ def log(*args, **kwargs):
|
|||
kwargs = {'bg' : 'black', 'fg': 'white', **kwargs}
|
||||
string = stylize_output(string, **kwargs)
|
||||
|
||||
print(string)
|
||||
with TTS() as tts_instance:
|
||||
if tts_instance.is_available:
|
||||
tts_instance.speak(string.replace('-', '').strip().lstrip())
|
||||
print(string)
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
class TTS():
|
||||
def __init__(self):
|
||||
try:
|
||||
import pyttsx3
|
||||
self._available = True
|
||||
except:
|
||||
self._available = False
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
return self._available
|
||||
@property
|
||||
def is_available(self):
|
||||
return self._available
|
||||
|
||||
@property
|
||||
def volume(self):
|
||||
return self.engine.getProperty('volume')
|
||||
|
||||
@volume.setter
|
||||
def volume(self, percentage):
|
||||
self.engine.setProperty('volume', percentage/100)
|
||||
return self.volume
|
||||
|
||||
|
||||
def speak(self, phrase):
|
||||
if self.available:
|
||||
self.engine.say("I will speak this text")
|
||||
engine.runAndWait()
|
||||
|
||||
def __enter__(self):
|
||||
self.engine = pyttsx3.init()
|
||||
return self
|
||||
|
||||
def __exit__(self, *args, **kwargs):
|
||||
self.engine.stop()
|
||||
Loading…
Reference in New Issue