[tuxdroid-svn] r1227 - software/tuxgi/trunk
Status: Beta
Brought to you by:
ks156
From: Paul_R <c2m...@c2...> - 2008-06-12 10:53:42
|
Author: Paul_R Date: 2008-06-12 12:30:06 +0200 (Thu, 12 Jun 2008) New Revision: 1227 Modified: software/tuxgi/trunk/tuxgi.py software/tuxgi/trunk/tuxgi2.glade Log: * Added an attitune player Modified: software/tuxgi/trunk/tuxgi.py =================================================================== --- software/tuxgi/trunk/tuxgi.py 2008-06-12 08:28:47 UTC (rev 1226) +++ software/tuxgi/trunk/tuxgi.py 2008-06-12 10:30:06 UTC (rev 1227) @@ -40,6 +40,7 @@ import gtk import gobject import thread +import threading from SimpleGladeApp import SimpleGladeApp from SimpleGladeApp import bindtextdomain @@ -105,6 +106,9 @@ # On new window #-------------------------------------------------------------------------- def new(self): + self.__t = None + self.__thread_on = True + att_path = ' ' self.init_gui() tux.event.handler.register("tts_0_sound_state", self.on_sound_on) tux.event.handler.register("left_led_state", self.on_left_blue_led_on) @@ -115,6 +119,8 @@ tux.event.handler.register("all", self.on_status) tux.tts.registerEventOnVoiceList(self.update_voice_list) self.update_voice_list() + #self.__t = threading.Thread(target = self.status_viewer_thread) + #self.__t.start() thread.start_new_thread(self.status_viewer_thread,()) @@ -146,6 +152,17 @@ self.get_widget("radiobutton4").set_active(True) #-------------------------------------------------------------------------- + # Attitunes + #-------------------------------------------------------------------------- + def on_fileAtt_selection_changed(self, widget, *args): + tux.attitune.load(widget.get_filename()) + + def on_btnPlayAtt_clicked(self, widget, *args): + tux.attitune.play() + + def on_btnStopAtt_clicked(self, widget, *args): + tux.attitune.stop() + #-------------------------------------------------------------------------- # On window destroy #-------------------------------------------------------------------------- def on_window1_destroy(self, widget, *args): @@ -154,6 +171,10 @@ tux.destroy() sys.exit(0) + def on_window1_remove(self, widget, *args): + self.__thread_on = False + time.sleep(0.5) + #-------------------------------------------------------------------------- # On left blue led status is on #-------------------------------------------------------------------------- @@ -244,7 +265,7 @@ last_tuxdaemon_connect=False last_tuxttsdaemon_connect=False last_rf_state=False - while True: + while self.__thread_on: if status_list_changed: status_list_changed=False statusview_b=self.get_widget("textview1").get_buffer() @@ -276,7 +297,7 @@ else: self.get_widget("image4").set_from_stock(gtk.STOCK_CANCEL\ ,gtk.ICON_SIZE_BUTTON) - + time.sleep(0.5) # ----------------------------------------------------------------------------- # Tab "main" events @@ -840,5 +861,6 @@ gtk.gdk.threads_init() g_tDI.run() + if __name__ == "__main__": main() Modified: software/tuxgi/trunk/tuxgi2.glade =================================================================== --- software/tuxgi/trunk/tuxgi2.glade 2008-06-12 08:28:47 UTC (rev 1226) +++ software/tuxgi/trunk/tuxgi2.glade 2008-06-12 10:30:06 UTC (rev 1227) @@ -21,6 +21,7 @@ <property name="focus_on_map">True</property> <property name="urgency_hint">False</property> <signal name="destroy" handler="on_window1_destroy"/> + <signal name="delete_event" handler="on_window1_remove" last_modification_time="Thu, 12 Jun 2008 10:19:05 GMT"/> <child> <widget class="GtkNotebook" id="notebook1"> @@ -945,76 +946,60 @@ <property name="visible">True</property> <child> - <widget class="GtkButton" id="button8"> + <widget class="GtkButton" id="btnStopAtt"> <property name="width_request">113</property> <property name="height_request">27</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Send command</property> + <property name="label" translatable="yes">Stop</property> <property name="use_underline">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> - <signal name="clicked" handler="on_scommand_bt_clicked"/> + <signal name="clicked" handler="on_btnStopAtt_clicked" last_modification_time="Thu, 12 Jun 2008 09:48:39 GMT"/> </widget> <packing> <property name="x">0</property> - <property name="y">38</property> + <property name="y">72</property> </packing> </child> <child> - <widget class="GtkButton" id="button11"> + <widget class="GtkFileChooserButton" id="fileAtt"> <property name="width_request">113</property> <property name="height_request">27</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Ping</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <signal name="clicked" handler="on_ping_bt_clicked"/> + <property name="title" translatable="yes">Select A File</property> + <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property> + <property name="local_only">True</property> + <property name="show_hidden">False</property> + <property name="do_overwrite_confirmation">False</property> + <property name="width_chars">-1</property> + <signal name="selection_changed" handler="on_fileAtt_selection_changed" last_modification_time="Thu, 12 Jun 2008 09:48:27 GMT"/> </widget> <packing> <property name="x">0</property> - <property name="y">106</property> + <property name="y">6</property> </packing> </child> <child> - <widget class="GtkButton" id="button9"> + <widget class="GtkButton" id="btnPlayAtt"> <property name="width_request">113</property> <property name="height_request">27</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">Get light level</property> + <property name="label" translatable="yes">Play +</property> <property name="use_underline">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> - <signal name="clicked" handler="on_cversion_bt_clicked"/> + <signal name="clicked" handler="on_btnPlayAtt_clicked" last_modification_time="Thu, 12 Jun 2008 09:48:33 GMT"/> </widget> <packing> <property name="x">0</property> - <property name="y">72</property> + <property name="y">40</property> </packing> </child> - - <child> - <widget class="GtkButton" id="button7"> - <property name="width_request">113</property> - <property name="height_request">27</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Tux Droid Shell</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <signal name="clicked" handler="on_tdshell_bt_clicked"/> - </widget> - <packing> - <property name="x">0</property> - <property name="y">4</property> - </packing> - </child> </widget> </child> </widget> |