Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Speak.activity/voice.py
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@member.fsf.org>2009-07-14 02:25:24 (GMT)
committer Aleksey Lim <alsroot@member.fsf.org>2009-07-14 02:25:24 (GMT)
commit27509f29c0123a7ce137233f9b21b1a860c7937c (patch)
tree16c2005b2970af555b60d610bd20cee883ebf408 /Speak.activity/voice.py
parent6814e865787cd1daad3006070f9de4af93cc7d56 (diff)
Create voices combobox widget; make Speak library deploying friendly
Diffstat (limited to 'Speak.activity/voice.py')
-rw-r--r--Speak.activity/voice.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/Speak.activity/voice.py b/Speak.activity/voice.py
index fd58b5e..6cc6f9c 100644
--- a/Speak.activity/voice.py
+++ b/Speak.activity/voice.py
@@ -69,7 +69,7 @@ expectedVoiceNames = [
]
_allVoices = {}
-DEFAULT = None
+_defaultVoice = None
class Voice:
def __init__(self, language, name):
@@ -94,10 +94,15 @@ def allVoices():
return _allVoices
-def _defaultVoice():
+def defaultVoice():
"""Try to figure out the default voice, from the current locale ($LANG).
Fall back to espeak's voice called Default."""
+ global _defaultVoice
+
+ if _defaultVoice:
+ return _defaultVoice
+
voices = allVoices()
def fit(a,b):
@@ -122,6 +127,5 @@ def _defaultVoice():
best = voice
print "Best voice for LANG %s seems to be %s %s" % (lang, best.language, best.friendlyname)
+ _defaultVoice = best
return best
-
-DEFAULT = _defaultVoice()