Author: remi
Date: 2008-12-13 18:23:47 +0100 (Sat, 13 Dec 2008)
New Revision: 3088

Modified:
   software_suite_v2/software/scripts/loto/loto.py
Log:
* added Callback on "speak on" event -> Open the mouth (Asynchronous command)
* added Callback on "speak off" event -> Close the mouth (Asynchronous command)
* updated the speak calling function. Now it uses the tux.tts.speakPush 
function instead of tux.tts.speak (speakPush  is an asynchronous function which 
pushes the text in a stack in order to avoiding the speech erasing)
* uncommented the welcome message in order to select the "Julie" voice. 
(speakPush can't select a new voice)
* fixed host ip of the server (192.168.1.5 only work at your home ;) )

Modified: software_suite_v2/software/scripts/loto/loto.py
===================================================================
--- software_suite_v2/software/scripts/loto/loto.py     2008-12-13 17:04:27 UTC 
(rev 3087)
+++ software_suite_v2/software/scripts/loto/loto.py     2008-12-13 17:23:47 UTC 
(rev 3088)
@@ -33,6 +33,11 @@
 import sys, random, time, threading
 from tuxisalive.api import *
 
+def onSpeakOn(*args):
+    tux.mouth.open()
+    
+def onSpeakOff(*args):
+    tux.mouth.close()
 
 def ReadNumber(*args):
     global THEnumber
@@ -61,9 +66,7 @@
     iEtat = 0
     
 def tux_speak(text):
-    tux.mouth.open()
-    tux.tts.speak(text, "Julie", 100)
-    tux.mouth.close()
+    tux.tts.speakPush(text)
 
 def GenererGrilles(NbGrilles):
    """ Generate a loto sheet """
@@ -101,7 +104,7 @@
    exit()
 
 # Start game
-tux = TuxAPI('192.168.1.5', 270)
+tux = TuxAPI('127.0.0.1', 270)
 tux.server.autoConnect(CLIENT_LEVEL_RESTRICTED, 'Loto', 'NONE')
 tux.server.waitConnected(10.0)
 tux.dongle.waitConnected(10.0)
@@ -113,8 +116,11 @@
   tux.button.right.registerEventOnPressed(NewNumber)
   tux.button.head.registerEventOnPressed(ResetGame)
   tux.button.remote.registerEventOnPressed(Quitter, K_STANDBY)
+  tux.tts.registerEventOnSoundOn(onSpeakOn)
+  tux.tts.registerEventOnSoundOff(onSpeakOff)
 
-  #tux_speak("Bievenue au Tux Loto !. La partie de loto peut maintenant 
commencer !. Bonne chance a tous !.")
+  tux.tts.speak("Bienvenue au Teuckss Loto !. La partie de loto peut " + 
+    "maintenant commencer !. Bonne chance a tous !.", "Julie", 100)
   
   iEtat = 1
   while iEtat == 1:


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to