[tuxdroid-svn] r1223 - software/tuxgi/trunk
Status: Beta
Brought to you by:
ks156
From: Paul_R <c2m...@c2...> - 2008-06-11 13:11:24
|
Author: Paul_R Date: 2008-06-11 15:11:25 +0200 (Wed, 11 Jun 2008) New Revision: 1223 Modified: software/tuxgi/trunk/tuxgi.py software/tuxgi/trunk/tuxgi2.glade Log: * Finished the TTS tab. Now, the voice list is OK, the tts can be stopped and paused. Modified: software/tuxgi/trunk/tuxgi.py =================================================================== --- software/tuxgi/trunk/tuxgi.py 2008-06-11 09:26:00 UTC (rev 1222) +++ software/tuxgi/trunk/tuxgi.py 2008-06-11 13:11:25 UTC (rev 1223) @@ -111,6 +111,8 @@ tux.event.handler.register("mouth_remaining_movements", self.on_mouth_stop, (0, None)) tux.event.handler.register("eyes_remaining_movements", self.on_eyes_stop, (0, None)) tux.event.handler.register("all", self.on_status) + tux.tts.registerEventOnVoiceList(self.update_voice_list) + self.update_voice_list() thread.start_new_thread(self.status_viewer_thread,()) #-------------------------------------------------------------------------- @@ -413,27 +415,30 @@ if toggled_by_event: return global onplay - voice_cb=self.get_widget("comboboxentry1") - pitch_sb=self.get_widget("spinbutton6").get_value() - textedit=self.get_widget("textview2") - buffer=textedit.get_buffer() - my_text=buffer.get_text(*buffer.get_bounds()) - tux.tts.setPitch(int(pitch_sb)) - tux.tts.speakAsync(my_text) + if onplay == False: + voice_cb=self.get_widget("comboboxentry1") + pitch_sb=self.get_widget("spinbutton6").get_value() + textedit=self.get_widget("textview2") + buffer=textedit.get_buffer() + my_text=buffer.get_text(*buffer.get_bounds()) + tux.tts.setPitch(int(pitch_sb)) + tux.tts.setLocutor(self.get_widget("comboboxentry1").get_active_text()) + tux.tts.speakAsync(my_text) + else: + tux.tts.stop() + #-------------------------------------------------------------------------- # On "pause" button clicked #-------------------------------------------------------------------------- def on_tts_pause_bt_clicked(self, widget, *args): - print "FIXME : TTS pause : not implemented yet" - ''' global onpause if onpause: - tux.tts.play() + tux.tts.setPause(False) onpause=False else: - tux.tts.pause() + tux.tts.setPause(True) onpause=True - ''' + #-------------------------------------------------------------------------- # On "Clear text" button clicked #-------------------------------------------------------------------------- @@ -473,26 +478,16 @@ # Update the voices list in the combobox #-------------------------------------------------------------------------- def update_voice_list(self): - pass - ''' global voice_list global voice_dic global current_voice - voice_dic = {} voice_list.clear() - for voice_id in tux.tts.authorized_voices_list: - voice_list.append([LANG_OF_SPK_LIST[voice_id],]) - voice_dic[LANG_OF_SPK_LIST[voice_id]] = voice_id + 1 - self.get_widget("comboboxentry1").set_model(voice_list) - if voice_dic.has_key(current_voice): - for i, voice_name in enumerate(voice_list): - if voice_name[0] == current_voice: - self.get_widget("comboboxentry1").set_active(i) - break - else: - self.get_widget("comboboxentry1").set_active(0) - ''' + voice_list = tux.tts.getVoices() + for i in range(len(voice_list)): + self.get_widget("comboboxentry1").insert_text(i, voice_list[i]) + self.get_widget("comboboxentry1").set_active(0) + # ----------------------------------------------------------------------------- # Tab "Audio" events Modified: software/tuxgi/trunk/tuxgi2.glade =================================================================== --- software/tuxgi/trunk/tuxgi2.glade 2008-06-11 09:26:00 UTC (rev 1222) +++ software/tuxgi/trunk/tuxgi2.glade 2008-06-11 13:11:25 UTC (rev 1223) @@ -1326,12 +1326,7 @@ <property name="width_request">300</property> <property name="height_request">27</property> <property name="visible">True</property> - <property name="items" translatable="yes">FR male -FR female -US male -US female -NL male -NL female</property> + <property name="items" translatable="yes"></property> <property name="add_tearoffs">False</property> <property name="has_frame">True</property> <property name="focus_on_click">True</property> |