[tuxdroid-svn] r710 - in software/gadgets/tux_controller/trunk: . TuxController TuxController/Scrip
Status: Beta
Brought to you by:
ks156
From: Paul_R <c2m...@c2...> - 2007-11-19 08:06:02
|
Author: Paul_R Date: 2007-11-19 09:05:50 +0100 (Mon, 19 Nov 2007) New Revision: 710 Modified: software/gadgets/tux_controller/trunk/TuxController.tgf software/gadgets/tux_controller/trunk/TuxController/Scripts/Python/GUI/widget/other.glade software/gadgets/tux_controller/trunk/TuxController/Scripts/Python/GUI/widget/other.pyp software/gadgets/tux_controller/trunk/TuxController/Strings/fr_ALL.xml software/gadgets/tux_controller/trunk/TuxController/strings.xml Log: * Added all the functions launched when the buttons are pressed. * Added the status tab with the treeview Modified: software/gadgets/tux_controller/trunk/TuxController/Scripts/Python/GUI/widget/other.glade =================================================================== --- software/gadgets/tux_controller/trunk/TuxController/Scripts/Python/GUI/widget/other.glade 2007-11-16 14:34:24 UTC (rev 709) +++ software/gadgets/tux_controller/trunk/TuxController/Scripts/Python/GUI/widget/other.glade 2007-11-19 08:05:50 UTC (rev 710) @@ -517,17 +517,29 @@ </child> <child> - <widget class="GtkButton" id="btnEyesOpen"> - <property name="width_request">32</property> - <property name="height_request">32</property> + <widget class="GtkVSeparator" id="vseparator10"> + <property name="width_request">16</property> + <property name="height_request">50</property> <property name="visible">True</property> + </widget> + <packing> + <property name="x">65</property> + <property name="y">7</property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="btnEyesRun"> + <property name="width_request">34</property> + <property name="height_request">34</property> + <property name="visible">True</property> <property name="can_focus">True</property> <property name="relief">GTK_RELIEF_NONE</property> <property name="focus_on_click">False</property> - <signal name="clicked" handler="on_btnEyesOpen_clicked" last_modification_time="Thu, 15 Nov 2007 08:45:59 GMT"/> + <signal name="clicked" handler="on_btnEyesRun_clicked" last_modification_time="Thu, 15 Nov 2007 08:32:08 GMT"/> <child> - <widget class="GtkAlignment" id="alignment1"> + <widget class="GtkAlignment" id="alignment11"> <property name="visible">True</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> @@ -539,13 +551,13 @@ <property name="right_padding">0</property> <child> - <widget class="GtkHBox" id="hbox1"> + <widget class="GtkHBox" id="hbox11"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">2</property> <child> - <widget class="GtkImage" id="imgEyesOpen"> + <widget class="GtkImage" id="imgEyesRun"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_focus">True</property> @@ -564,7 +576,7 @@ </child> <child> - <widget class="GtkLabel" id="label1"> + <widget class="GtkLabel" id="label11"> <property name="visible">True</property> <property name="label" translatable="yes"> </property> @@ -594,23 +606,24 @@ </child> </widget> <packing> - <property name="x">16</property> - <property name="y">0</property> + <property name="x">80</property> + <property name="y">16</property> </packing> </child> <child> - <widget class="GtkButton" id="btnEyesClose"> + <widget class="GtkButton" id="btnEyesOpen"> <property name="width_request">32</property> <property name="height_request">32</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="relief">GTK_RELIEF_NONE</property> <property name="focus_on_click">False</property> - <signal name="clicked" handler="on_btnEyesClose_clicked" last_modification_time="Thu, 15 Nov 2007 08:46:12 GMT"/> + <signal name="pressed" handler="on_btnEyesOpen_pressed" last_modification_time="Fri, 16 Nov 2007 07:47:02 GMT"/> + <signal name="released" handler="on_btnEyesOpen_released" last_modification_time="Fri, 16 Nov 2007 07:47:05 GMT"/> <child> - <widget class="GtkAlignment" id="alignment3"> + <widget class="GtkAlignment" id="alignment1"> <property name="visible">True</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> @@ -622,13 +635,13 @@ <property name="right_padding">0</property> <child> - <widget class="GtkHBox" id="hbox3"> + <widget class="GtkHBox" id="hbox1"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">2</property> <child> - <widget class="GtkImage" id="imgEyesClose"> + <widget class="GtkImage" id="imgEyesOpen"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_focus">True</property> @@ -647,7 +660,7 @@ </child> <child> - <widget class="GtkLabel" id="label3"> + <widget class="GtkLabel" id="label1"> <property name="visible">True</property> <property name="label" translatable="yes"> </property> @@ -678,34 +691,23 @@ </widget> <packing> <property name="x">16</property> - <property name="y">32</property> + <property name="y">0</property> </packing> </child> <child> - <widget class="GtkVSeparator" id="vseparator10"> - <property name="width_request">16</property> - <property name="height_request">50</property> + <widget class="GtkButton" id="btnEyesClose"> + <property name="width_request">32</property> + <property name="height_request">32</property> <property name="visible">True</property> - </widget> - <packing> - <property name="x">65</property> - <property name="y">7</property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="btnEyesRun"> - <property name="width_request">34</property> - <property name="height_request">34</property> - <property name="visible">True</property> <property name="can_focus">True</property> <property name="relief">GTK_RELIEF_NONE</property> <property name="focus_on_click">False</property> - <signal name="clicked" handler="on_btnEyesRun_clicked" last_modification_time="Thu, 15 Nov 2007 08:32:08 GMT"/> + <signal name="pressed" handler="on_btnEyesClose_pressed" last_modification_time="Fri, 16 Nov 2007 07:47:14 GMT"/> + <signal name="released" handler="on_btnEyesClose_released" last_modification_time="Fri, 16 Nov 2007 07:47:18 GMT"/> <child> - <widget class="GtkAlignment" id="alignment11"> + <widget class="GtkAlignment" id="alignment3"> <property name="visible">True</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> @@ -717,13 +719,13 @@ <property name="right_padding">0</property> <child> - <widget class="GtkHBox" id="hbox11"> + <widget class="GtkHBox" id="hbox3"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">2</property> <child> - <widget class="GtkImage" id="imgEyesRun"> + <widget class="GtkImage" id="imgEyesClose"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_focus">True</property> @@ -742,7 +744,7 @@ </child> <child> - <widget class="GtkLabel" id="label11"> + <widget class="GtkLabel" id="label3"> <property name="visible">True</property> <property name="label" translatable="yes"> </property> @@ -772,8 +774,8 @@ </child> </widget> <packing> - <property name="x">80</property> - <property name="y">16</property> + <property name="x">16</property> + <property name="y">32</property> </packing> </child> </widget> @@ -1061,7 +1063,8 @@ <property name="can_focus">True</property> <property name="relief">GTK_RELIEF_NONE</property> <property name="focus_on_click">False</property> - <signal name="clicked" handler="on_btnMouthClose_clicked" last_modification_time="Thu, 15 Nov 2007 08:46:22 GMT"/> + <signal name="pressed" handler="on_btnMouthClose_pressed" last_modification_time="Fri, 16 Nov 2007 07:47:24 GMT"/> + <signal name="released" handler="on_btnMouthClose_released" last_modification_time="Fri, 16 Nov 2007 07:47:28 GMT"/> <child> <widget class="GtkAlignment" id="alignment12"> @@ -1144,7 +1147,8 @@ <property name="can_focus">True</property> <property name="relief">GTK_RELIEF_NONE</property> <property name="focus_on_click">False</property> - <signal name="clicked" handler="on_btnMouthOpen_clicked" last_modification_time="Thu, 15 Nov 2007 08:46:32 GMT"/> + <signal name="pressed" handler="on_btnMouthOpen_pressed" last_modification_time="Fri, 16 Nov 2007 07:47:37 GMT"/> + <signal name="released" handler="on_btnMouthOpen_released" last_modification_time="Fri, 16 Nov 2007 07:47:40 GMT"/> <child> <widget class="GtkAlignment" id="alignment5"> @@ -1441,7 +1445,8 @@ <property name="can_focus">True</property> <property name="relief">GTK_RELIEF_NONE</property> <property name="focus_on_click">False</property> - <signal name="clicked" handler="on_btnWingsUp_clicked" last_modification_time="Thu, 15 Nov 2007 08:46:41 GMT"/> + <signal name="pressed" handler="on_btnWingsUp_pressed" last_modification_time="Fri, 16 Nov 2007 07:47:48 GMT"/> + <signal name="released" handler="on_btnWingsUp_released" last_modification_time="Fri, 16 Nov 2007 07:47:50 GMT"/> <child> <widget class="GtkAlignment" id="alignment6"> @@ -1524,7 +1529,8 @@ <property name="can_focus">True</property> <property name="relief">GTK_RELIEF_NONE</property> <property name="focus_on_click">False</property> - <signal name="clicked" handler="on_btnWingsDown_clicked" last_modification_time="Thu, 15 Nov 2007 08:46:50 GMT"/> + <signal name="pressed" handler="on_btnWingsDown_pressed" last_modification_time="Fri, 16 Nov 2007 07:47:58 GMT"/> + <signal name="released" handler="on_btnWingsDown_released" last_modification_time="Fri, 16 Nov 2007 07:48:01 GMT"/> <child> <widget class="GtkAlignment" id="alignment7"> @@ -1686,18 +1692,6 @@ </child> <child> - <widget class="GtkVSeparator" id="vseparator17"> - <property name="width_request">16</property> - <property name="height_request">70</property> - <property name="visible">True</property> - </widget> - <packing> - <property name="x">68</property> - <property name="y">7</property> - </packing> - </child> - - <child> <widget class="GtkButton" id="btnSpinLeft"> <property name="width_request">32</property> <property name="height_request">32</property> @@ -2021,6 +2015,18 @@ <property name="y">77</property> </packing> </child> + + <child> + <widget class="GtkVSeparator" id="vseparator17"> + <property name="width_request">16</property> + <property name="height_request">70</property> + <property name="visible">True</property> + </widget> + <packing> + <property name="x">68</property> + <property name="y">7</property> + </packing> + </child> </widget> <packing> <property name="left_attach">1</property> @@ -2098,6 +2104,32 @@ </child> <child> + <widget class="GtkLabel" id="lblSoundL"> + <property name="width_request">138</property> + <property name="height_request">16</property> + <property name="visible">True</property> + <property name="label" translatable="yes"> </property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_RIGHT</property> + <property name="wrap">True</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="x">0</property> + <property name="y">56</property> + </packing> + </child> + + <child> <widget class="GtkLabel" id="lblLight"> <property name="width_request">46</property> <property name="height_request">17</property> @@ -2176,11 +2208,11 @@ </child> <child> - <widget class="GtkLabel" id="lblSoundL"> + <widget class="GtkLabel" id="lblLightL"> <property name="width_request">138</property> <property name="height_request">16</property> <property name="visible">True</property> - <property name="label" translatable="yes"> </property> + <property name="label" translatable="yes"></property> <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_RIGHT</property> @@ -2196,12 +2228,24 @@ <property name="angle">0</property> </widget> <packing> - <property name="x">0</property> - <property name="y">56</property> + <property name="x">312</property> + <property name="y">0</property> </packing> </child> <child> + <widget class="GtkVSeparator" id="vseparator20"> + <property name="width_request">16</property> + <property name="height_request">70</property> + <property name="visible">True</property> + </widget> + <packing> + <property name="x">356</property> + <property name="y">0</property> + </packing> + </child> + + <child> <widget class="GtkLabel" id="lblBatteryL"> <property name="width_request">138</property> <property name="height_request">16</property> @@ -2232,7 +2276,7 @@ <property name="width_request">138</property> <property name="height_request">16</property> <property name="visible">True</property> - <property name="label" translatable="yes"></property> + <property name="label" translatable="yes"> </property> <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_RIGHT</property> @@ -2314,6 +2358,27 @@ <child> <widget class="GtkFixed" id="fixed30"> <property name="visible">True</property> + + <child> + <widget class="GtkScrolledWindow" id="scrolledwindow1"> + <property name="width_request">792</property> + <property name="height_request">416</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property> + <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property> + <property name="shadow_type">GTK_SHADOW_NONE</property> + <property name="window_placement">GTK_CORNER_TOP_LEFT</property> + + <child> + <placeholder/> + </child> + </widget> + <packing> + <property name="x">8</property> + <property name="y">8</property> + </packing> + </child> </widget> <packing> <property name="tab_expand">False</property> Modified: software/gadgets/tux_controller/trunk/TuxController/Scripts/Python/GUI/widget/other.pyp =================================================================== --- software/gadgets/tux_controller/trunk/TuxController/Scripts/Python/GUI/widget/other.pyp 2007-11-16 14:34:24 UTC (rev 709) +++ software/gadgets/tux_controller/trunk/TuxController/Scripts/Python/GUI/widget/other.pyp 2007-11-19 08:05:50 UTC (rev 710) @@ -22,12 +22,16 @@ __led_toggled_by_event = False self.average = 0 self.count = 0 + self.__eyes_mutex = threading.Lock() + self.__mouth_mutex = threading.Lock() + self.__wings_mutex = threading.Lock() def update(self): self.update_status() self.binding() self.update_pix() self.update_labels() + self.status_table() def on_window1_destroy(self, widget, *args): tux.monitoring.remove(self.light_idx) @@ -104,6 +108,42 @@ self.get_widget('lblBatteryL').set_text(_me.string('lblBatteryL')) self.get_widget('lblSoundL').set_text(_me.string('lblSoundL')) + def status_table(self): + self.status_tree = gtk.TreeStore(str, str, str, str) + self.status_view = gtk.TreeView(self.status_tree) + + self.name1_renderer = gtk.CellRendererText() + self.name1_column = gtk.TreeViewColumn(_me.string('colStatus'), self.name1_renderer, text=0) + self.name1_column.set_min_width(300) + self.name1_column.add_attribute(self.name1_renderer, 'text', 0) + + self.value1_renderer = gtk.CellRendererText() + self.value1_column = gtk.TreeViewColumn(_me.string('colValue'), self.value1_renderer, text=1 ) + self.value1_column.set_min_width(85) + self.value1_column.add_attribute(self.value1_renderer, 'text', 1) + + self.name2_renderer = gtk.CellRendererText() + self.name2_column = gtk.TreeViewColumn(_me.string('colStatus'), self.name2_renderer, text=2) + self.name2_column.set_min_width(300) + self.name2_column.add_attribute(self.name2_renderer, 'text', 2) + + self.value2_renderer = gtk.CellRendererText() + self.value2_column = gtk.TreeViewColumn(_me.string('colValue'), self.value2_renderer, text=3 ) + self.value2_column.set_min_width(85) + self.value2_column.add_attribute(self.value2_renderer, 'text', 3) + + self.status_view.append_column(self.name1_column) + self.status_view.append_column(self.value1_column) + self.status_view.append_column(self.name2_column) + self.status_view.append_column(self.value2_column) + + self.status_view.set_rules_hint(True) + + self.get_widget("scrolledwindow1").add(self.status_view) + self.get_widget("scrolledwindow1").show_all() + + tux.sys.looped_function(self.refresh_treeview, 0.5) + #################################################################### # @@ -121,12 +161,30 @@ tux.cmd.leds_blink(int(value), int(freq)) ## btnEyesOpen - def on_btnEyesOpen_clicked(self, widget, *args): + def on_btnEyesOpen_pressed(self, widget, *args): + if self.__eyes_mutex.locked(): + return + self.__eyes_mutex.acquire() + tux.cmd.eyes_on_free(0) + + def on_btnEyesOpen_released(self, widget, *args): + tux.sys.wait(0.1) tux.cmd.eyes_open() + self.__eyes_mutex.release() + + ## btnEyesClose - def on_btnEyesClose_clicked(self, widget, *args): + def on_btnEyesClose_pressed(self, widget, *args): + if self.__eyes_mutex.locked(): + return + self.__eyes_mutex.acquire() + tux.cmd.eyes_on_free(0) + + def on_btnEyesClose_released(self, widget, *args): + tux.sys.wait(0.1) tux.cmd.eyes_close() + self.__eyes_mutex.release() ## btnEyesRun def on_btnEyesRun_clicked(self, widget, *args): @@ -137,12 +195,28 @@ tux.cmd.eyes_on_free(int(value)) ## btnMouthClose - def on_btnMouthClose_clicked(self, widget, *args): - tux.cmd.mouth_close() + def on_btnMouthClose_pressed(self, widget, *args): + if self.__mouth_mutex.locked(): + return + self.__mouth_mutex.acquire() + tux.cmd.mouth_on_free(0) + + def on_btnMouthClose_released(self, widget, *args): + tux.sys.wait(0.1) + tux.cmd.mouth_close() + self.__mouth_mutex.release() + +## btnMouthOpen + def on_btnMouthOpen_pressed(self, widget, *args): + if self.__mouth_mutex.locked(): + return + self.__mouth_mutex.acquire() + tux.cmd.mouth_on_free(0) -## btnMouthOpen - def on_btnMouthOpen_clicked(self, widget, *args): + def on_btnMouthOpen_released(self, widget, *args): + tux.sys.wait(0.1) tux.cmd.mouth_open() + self.__mouth_mutex.release() ## btnMouthRun def on_btnMouthRun_clicked(self, widget, *args): @@ -153,13 +227,30 @@ tux.cmd.mouth_on_free(int(value)) ## btnWingsUp - def on_btnWingsUp_clicked(self, widget, *args): - tux.cmd.raw(0x39, 0, 0, 0) + def on_btnWingsUp_pressed(self, widget, *args): + if self.__wings_mutex.locked(): + return + self.__wings_mutex.acquire() + tux.cmd.wings_on_free(0) + + def on_btnWingsUp_released(self, widget, *args): + tux.sys.wait(0.1) + tux.cmd.wings_up() + self.__wings_mutex.release() + ## btnWingsDown - def on_btnWingsDown_clicked(self, widget, *args): - tux.cmd.raw(0x3A, 0, 0, 0) + def on_btnWingsDown_pressed(self, widget, *args): + if self.__wings_mutex.locked(): + return + self.__wings_mutex.acquire() + tux.cmd.wings_on(0) + def on_btnWingsDown_released(self, widget, *args): + tux.sys.wait(0.1) + tux.cmd.wings_down() + self.__wings_mutex.release() + ## btnWingsRun def on_btnWingsRun_clicked(self, widget, *args): value = self.get_widget('spinWings').get_value() @@ -216,6 +307,9 @@ tux.cmd.ledl_on() else: tux.cmd.ledl_off() + + def on_chkLEDRight_clicked(self, widget, *args): + print 'clicked' ## slideLED def on_slideLED_value_changed(self, widget, *args): @@ -290,3 +384,23 @@ val = float(val / 127.0) self.get_widget('lblSound').set_text('%.1f%s'%(val*100, '%')) self.get_widget('SoundLevel').set_fraction(val) + + def refresh_treeview(self): + thread.start_new_thread(self.refresh, ()) + return True + + def refresh(self): + ## Buttons status + + lwing_pushed = tux.status.lwing_bt() + rwing_pushed = tux.status.rwing_bt() + head_pushed = tux.status.head_bt() + #print (lwing_pushed,rwing_pushed,head_pushed) + self.status_tree.clear() + self.status_tree.append(None, ['lwing_pushed', str(lwing_pushed), 'test', 'test']) + self.status_tree.append(None, ['rwing_pushed', str(rwing_pushed), 'test', 'test']) + self.status_tree.append(None, ['head_pushed', str(head_pushed), 'test', 'test']) + #print 'refreshing' + ## Motors status + + Modified: software/gadgets/tux_controller/trunk/TuxController/Strings/fr_ALL.xml =================================================================== --- software/gadgets/tux_controller/trunk/TuxController/Strings/fr_ALL.xml 2007-11-16 14:34:24 UTC (rev 709) +++ software/gadgets/tux_controller/trunk/TuxController/Strings/fr_ALL.xml 2007-11-19 08:05:50 UTC (rev 710) @@ -19,10 +19,12 @@ <gui_conf_current_bind_lb type='str'>Assignation</gui_conf_current_bind_lb> <gui_conf_author_lb type='str'>Auteur</gui_conf_author_lb> <lblSoundL type='str'>Niveau de son</lblSoundL> + <colValue type='str'>Valeur</colValue> <speaker_name type='str'>Bruno8k</speaker_name> <gui_conf_remote_set_bt type='str'>Set</gui_conf_remote_set_bt> <name_to_read type='str'>Commande de Tux Droid</name_to_read> <gui_conf_window_title type='str'>Paramètres</gui_conf_window_title> <lblLightL type='str'>Niveau de lumière</lblLightL> <Second type='str'>sec.</Second> + <colStatus type='str'>Statut</colStatus> </strings> Modified: software/gadgets/tux_controller/trunk/TuxController/strings.xml =================================================================== --- software/gadgets/tux_controller/trunk/TuxController/strings.xml 2007-11-16 14:34:24 UTC (rev 709) +++ software/gadgets/tux_controller/trunk/TuxController/strings.xml 2007-11-19 08:05:50 UTC (rev 710) @@ -19,10 +19,12 @@ <gui_conf_current_bind_lb type='str'>Current</gui_conf_current_bind_lb> <gui_conf_author_lb type='str'>Author</gui_conf_author_lb> <lblSoundL type='str'>Sound level</lblSoundL> + <colValue type='str'>Value</colValue> <speaker_name type='str'>Ryan8k</speaker_name> <gui_conf_remote_set_bt type='str'>Set</gui_conf_remote_set_bt> <name_to_read type='str'>Tux Droid Controler</name_to_read> <gui_conf_window_title type='str'>Parameters</gui_conf_window_title> <lblLightL type='str'>Light level</lblLightL> <Second type='str'>sec.</Second> + <colStatus type='str'>Status</colStatus> </strings> Modified: software/gadgets/tux_controller/trunk/TuxController.tgf =================================================================== (Binary files differ) |