Skip to content

Commit

Permalink
fix the usage of the text class
Browse files Browse the repository at this point in the history
  • Loading branch information
topic2k committed Jan 15, 2017
1 parent d6b3f19 commit ee836ff
Showing 1 changed file with 24 additions and 23 deletions.
47 changes: 24 additions & 23 deletions plugins/Speech/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,27 +79,29 @@


class Text:
name = "Text to speech"
description = "Uses the Microsoft Speech API (SAPI) to speak a text."
label = "Speak: %s"
errorCreate = "Cannot create voice object"
buttonInsertTime = "Insert time HH:MM:SS"
buttonInsertTime1 = "Insert time HH:MM"
buttonInsertDate = "Insert date (20XX)"
buttonInsertDate1 = "Insert date (XX)"
normal = "Normal"
slow = "Slow"
fast = "Fast"
silent = "Silent"
loud = "Loud"
labelVoice = "Voice:"
labelRate = "Rate:"
labelVolume = "Volume:"
voiceProperties = "Voice properties"
textBoxLabel = "Text"
suffix = "SpeakingFinished"
addSuffix = "Additional event suffix:"
device = "Output device:"
ttsError = 'Speech: Unable to start the TTS engine'

class TextToSpeech:
name = "Text to speech"
description = "Uses the Microsoft Speech API (SAPI) to speak a text."
label = "Speak: %s"
buttonInsertTime = "Insert time HH:MM:SS"
buttonInsertTime1 = "Insert time HH:MM"
buttonInsertDate = "Insert date (20XX)"
buttonInsertDate1 = "Insert date (XX)"
normal = "Normal"
slow = "Slow"
fast = "Fast"
silent = "Silent"
loud = "Loud"
labelVoice = "Voice:"
labelRate = "Rate:"
labelVolume = "Volume:"
voiceProperties = "Voice properties"
textBoxLabel = "Text"
addSuffix = "Additional event suffix:"
device = "Output device:"


class CustomSlider(wx.Window):
Expand Down Expand Up @@ -206,7 +208,7 @@ def run(self):
#tts = DispatchWithEvents("SAPI.SpVoice.1", SpeechEvents)
tts = Dispatch('SAPI.SpVoice')
except:
self.plugin.PrintError(self.plugin.text.errorCreate)
self.plugin.PrintError(self.plugin.text.ttsError)
return
vcs = tts.GetVoices()
voices = [(voice.GetDescription(), voice) for voice in vcs]
Expand All @@ -231,15 +233,14 @@ def run(self):


class Speech(eg.PluginClass):
text = Text()
text = Text

def __init__(self):
self.AddAction(TextToSpeech)



class TextToSpeech(eg.ActionClass):
text = Text()

def __call__(self, voiceName, rate, voiceText, suff, volume, device = None):
self.suff = suff if suff != 0 else ""
Expand Down

0 comments on commit ee836ff

Please sign in to comment.