tux-droid-svn Mailing List for Tux Droid CE (Page 211)
Status: Beta
Brought to you by:
ks156
You can subscribe to this list here.
2007 |
Jan
|
Feb
(32) |
Mar
(108) |
Apr
(71) |
May
(38) |
Jun
(128) |
Jul
(1) |
Aug
(14) |
Sep
(77) |
Oct
(104) |
Nov
(90) |
Dec
(71) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(81) |
Feb
(18) |
Mar
(40) |
Apr
(102) |
May
(151) |
Jun
(74) |
Jul
(151) |
Aug
(257) |
Sep
(447) |
Oct
(379) |
Nov
(404) |
Dec
(430) |
2009 |
Jan
(173) |
Feb
(236) |
Mar
(519) |
Apr
(300) |
May
(112) |
Jun
(232) |
Jul
(314) |
Aug
(58) |
Sep
(203) |
Oct
(293) |
Nov
(26) |
Dec
(109) |
2010 |
Jan
(19) |
Feb
(25) |
Mar
(33) |
Apr
(1) |
May
|
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Paul_R <c2m...@c2...> - 2007-12-06 15:58:47
|
Author: Paul_R Date: 2007-12-06 16:58:49 +0100 (Thu, 06 Dec 2007) New Revision: 755 Modified: firmware/tuxcore/trunk/motors.c Log: * Fixed a bug when the spin direction change. Modified: firmware/tuxcore/trunk/motors.c =================================================================== --- firmware/tuxcore/trunk/motors.c 2007-12-06 15:51:41 UTC (rev 754) +++ firmware/tuxcore/trunk/motors.c 2007-12-06 15:58:49 UTC (rev 755) @@ -679,7 +679,6 @@ void spin_left(uint8_t const angle, uint8_t const pwm) { gStatus.mot |= GSTATUS_MOT_SPIN; - spin_direction = LEFT; spin_move_counter = angle; /* If the rotation direction is changing and we are not stopped exactly on * the switch (position switch not pressed), we need to increment the angle @@ -687,6 +686,7 @@ * soon as the rotation starts. */ if ((spin_direction == RIGHT) && (PSW_SPIN_PIN & PSW_SPIN_MK)) spin_move_counter++; + spin_direction = LEFT; spin_PWM = pwm; spin_PWM_mask &= ~MOT_SPIN_R_MK; spin_PWM_mask |= MOT_SPIN_L_MK; @@ -701,7 +701,6 @@ void spin_right(uint8_t const angle, uint8_t const pwm) { gStatus.mot |= GSTATUS_MOT_SPIN; - spin_direction = RIGHT; spin_move_counter = angle; /* If the rotation direction is changing and we are not stopped exactly on * the switch (position switch not pressed), we need to increment the angle @@ -709,6 +708,7 @@ * soon as the rotation starts. */ if ((spin_direction == LEFT) && (PSW_SPIN_PIN & PSW_SPIN_MK)) spin_move_counter++; + spin_direction = RIGHT; spin_PWM = pwm; spin_PWM_mask &= ~MOT_SPIN_L_MK; spin_PWM_mask |= MOT_SPIN_R_MK; |
From: Paul_R <c2m...@c2...> - 2007-12-06 15:51:55
|
Author: Paul_R Date: 2007-12-06 16:51:41 +0100 (Thu, 06 Dec 2007) New Revision: 754 Modified: software/gadgets/tux_controller/trunk/TuxController.tgf software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/gadget.png software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/spin_left.png software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/spin_right.png 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/Scripts/Python/main.pyp software/gadgets/tux_controller/trunk/TuxController/Strings/fr_ALL.xml software/gadgets/tux_controller/trunk/TuxController/about.xml software/gadgets/tux_controller/trunk/TuxController/settings.xml software/gadgets/tux_controller/trunk/TuxController/strings.xml software/gadgets/tux_controller/trunk/TuxDroidController.tgf Log: * Controler compatible with the 1.2beta version (API, daemon & firmware). The remote control isn't linked with movements for now. The voice recognition isn't configured. Modified: software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/gadget.png =================================================================== (Binary files differ) Modified: software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/spin_left.png =================================================================== (Binary files differ) Modified: software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/spin_right.png =================================================================== (Binary files differ) 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-12-06 13:16:02 UTC (rev 753) +++ software/gadgets/tux_controller/trunk/TuxController/Scripts/Python/GUI/widget/other.glade 2007-12-06 15:51:41 UTC (rev 754) @@ -21,17 +21,13 @@ <signal name="destroy" handler="on_window1_destroy" last_modification_time="Thu, 15 Nov 2007 14:17:58 GMT"/> <child> - <widget class="GtkNotebook" id="notebook1"> + <widget class="GtkVBox" id="vbox2"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="show_tabs">True</property> - <property name="show_border">True</property> - <property name="tab_pos">GTK_POS_TOP</property> - <property name="scrollable">False</property> - <property name="enable_popup">False</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> <child> - <widget class="GtkVBox" id="vbox2"> + <widget class="GtkHBox" id="hbox18"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">0</property> @@ -40,19 +36,175 @@ <widget class="GtkTable" id="table1"> <property name="border_width">2</property> <property name="visible">True</property> - <property name="n_rows">5</property> - <property name="n_columns">3</property> + <property name="n_rows">6</property> + <property name="n_columns">2</property> <property name="homogeneous">False</property> <property name="row_spacing">0</property> <property name="column_spacing">0</property> <child> - <widget class="GtkFixed" id="btnLEDRun"> - <property name="width_request">518</property> - <property name="height_request">66</property> + <widget class="GtkFixed" id="fixed13"> + <property name="height_request">57</property> <property name="visible">True</property> <child> + <widget class="GtkCheckButton" id="chkShow"> + <property name="width_request">216</property> + <property name="height_request">24</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">checkbutton1</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="on_chkShow_toggled" last_modification_time="Thu, 06 Dec 2007 12:55:43 GMT"/> + </widget> + <packing> + <property name="x">8</property> + <property name="y">27</property> + </packing> + </child> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="y_options">fill</property> + </packing> + </child> + + <child> + <widget class="GtkFixed" id="fixed25"> + <property name="visible">True</property> + + <child> + <widget class="GtkImage" id="imgSpin"> + <property name="width_request">367</property> + <property name="height_request">83</property> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="x">0</property> + <property name="y">0</property> + </packing> + </child> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> + <property name="x_options">fill</property> + <property name="y_options">fill</property> + </packing> + </child> + + <child> + <widget class="GtkFixed" id="fixed24"> + <property name="width_request">372</property> + <property name="height_request">0</property> + <property name="visible">True</property> + + <child> + <widget class="GtkImage" id="imgWings"> + <property name="width_request">367</property> + <property name="height_request">142</property> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="x">0</property> + <property name="y">0</property> + </packing> + </child> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + <property name="x_options">fill</property> + <property name="y_options">fill</property> + </packing> + </child> + + <child> + <widget class="GtkFixed" id="fixed23"> + <property name="visible">True</property> + + <child> + <widget class="GtkImage" id="imgMouth"> + <property name="width_request">367</property> + <property name="height_request">62</property> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="x">0</property> + <property name="y">0</property> + </packing> + </child> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">fill</property> + <property name="y_options">fill</property> + </packing> + </child> + + <child> + <widget class="GtkFixed" id="fixed22"> + <property name="visible">True</property> + + <child> + <widget class="GtkImage" id="imgEyes"> + <property name="width_request">367</property> + <property name="height_request">79</property> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="x">0</property> + <property name="y">16</property> + </packing> + </child> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + <property name="y_options">fill</property> + </packing> + </child> + + <child> + <widget class="GtkFixed" id="fix1"> + <property name="height_request">21</property> + <property name="visible">True</property> + + <child> <widget class="GtkSpinButton" id="spinLED"> <property name="width_request">70</property> <property name="height_request">27</property> @@ -74,94 +226,82 @@ </child> <child> - <widget class="GtkRadioButton" id="radLEDcount"> - <property name="width_request">114</property> - <property name="height_request">22</property> + <widget class="GtkVSeparator" id="vseparator19"> + <property name="width_request">16</property> + <property name="height_request">50</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">radiobutton36</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> </widget> <packing> - <property name="x">200</property> - <property name="y">32</property> + <property name="x">68</property> + <property name="y">4</property> </packing> </child> <child> - <widget class="GtkCheckButton" id="chkLEDLeft"> + <widget class="GtkCheckButton" id="chkLEDRight"> <property name="width_request">20</property> <property name="height_request">20</property> <property name="visible">True</property> - <property name="label" translatable="yes"> -</property> + <property name="label" translatable="yes"></property> <property name="use_underline">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <property name="active">False</property> <property name="inconsistent">False</property> <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_chkLEDLeft_toggled" last_modification_time="Thu, 15 Nov 2007 10:15:58 GMT"/> + <signal name="toggled" handler="on_chkLEDRight_toggled" last_modification_time="Thu, 15 Nov 2007 10:15:35 GMT"/> </widget> <packing> - <property name="x">40</property> - <property name="y">24</property> + <property name="x">8</property> + <property name="y">25</property> </packing> </child> <child> - <widget class="GtkCheckButton" id="chkLEDRight"> + <widget class="GtkCheckButton" id="chkLEDLeft"> <property name="width_request">20</property> <property name="height_request">20</property> <property name="visible">True</property> - <property name="label" translatable="yes"></property> + <property name="label" translatable="yes"> +</property> <property name="use_underline">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> <property name="active">False</property> <property name="inconsistent">False</property> <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_chkLEDRight_toggled" last_modification_time="Thu, 15 Nov 2007 10:15:35 GMT"/> + <signal name="toggled" handler="on_chkLEDLeft_toggled" last_modification_time="Thu, 15 Nov 2007 10:15:58 GMT"/> </widget> <packing> - <property name="x">8</property> - <property name="y">24</property> + <property name="x">40</property> + <property name="y">25</property> </packing> </child> <child> - <widget class="GtkVSeparator" id="vseparator18"> - <property name="width_request">16</property> - <property name="height_request">50</property> + <widget class="GtkHScale" id="slideLED"> + <property name="width_request">160</property> + <property name="height_request">32</property> <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="draw_value">True</property> + <property name="value_pos">GTK_POS_RIGHT</property> + <property name="digits">0</property> + <property name="update_policy">GTK_UPDATE_CONTINUOUS</property> + <property name="inverted">False</property> + <property name="adjustment">150 1 255 1 0 0</property> + <signal name="value_changed" handler="on_slideLED_value_changed" last_modification_time="Thu, 15 Nov 2007 08:37:21 GMT"/> </widget> <packing> - <property name="x">65</property> - <property name="y">7</property> + <property name="x">208</property> + <property name="y">17</property> </packing> </child> <child> - <widget class="GtkVSeparator" id="vseparator19"> - <property name="width_request">16</property> - <property name="height_request">50</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="btnLEDRun"> - <property name="width_request">34</property> - <property name="height_request">34</property> + <property name="width_request">36</property> + <property name="height_request">36</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="relief">GTK_RELIEF_NONE</property> @@ -242,69 +382,29 @@ </child> <child> - <widget class="GtkRadioButton" id="radLEDsec"> - <property name="width_request">114</property> - <property name="height_request">22</property> + <widget class="GtkVSeparator" id="vseparator18"> + <property name="width_request">16</property> + <property name="height_request">50</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">sec.</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">True</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <property name="group">radLEDcount</property> </widget> <packing> - <property name="x">200</property> - <property name="y">8</property> + <property name="x">65</property> + <property name="y">4</property> </packing> </child> - - <child> - <widget class="GtkHScale" id="slideLED"> - <property name="width_request">160</property> - <property name="height_request">32</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="draw_value">True</property> - <property name="value_pos">GTK_POS_RIGHT</property> - <property name="digits">0</property> - <property name="update_policy">GTK_UPDATE_CONTINUOUS</property> - <property name="inverted">False</property> - <property name="adjustment">150 1 255 1 0 0</property> - <signal name="value_changed" handler="on_slideLED_value_changed" last_modification_time="Thu, 15 Nov 2007 08:37:21 GMT"/> - </widget> - <packing> - <property name="x">320</property> - <property name="y">16</property> - </packing> - </child> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> <property name="top_attach">0</property> <property name="bottom_attach">1</property> - </packing> - </child> - - <child> - <widget class="GtkFixed" id="fixed13"> - <property name="visible">True</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> <property name="y_options">fill</property> </packing> </child> <child> - <widget class="GtkFixed" id="fixed26"> + <widget class="GtkFixed" id="fix2"> + <property name="height_request">79</property> <property name="visible">True</property> <child> @@ -323,79 +423,26 @@ </widget> <packing> <property name="x">120</property> - <property name="y">20</property> + <property name="y">38</property> </packing> </child> <child> - <widget class="GtkVSeparator" id="vseparator11"> - <property name="width_request">16</property> - <property name="height_request">50</property> - <property name="visible">True</property> - </widget> - <packing> - <property name="x">68</property> - <property name="y">7</property> - </packing> - </child> - - <child> - <widget class="GtkRadioButton" id="radEyessec"> - <property name="width_request">114</property> - <property name="height_request">22</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">radiobutton37</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="x">200</property> - <property name="y">8</property> - </packing> - </child> - - <child> - <widget class="GtkRadioButton" id="radEyescount"> - <property name="width_request">114</property> - <property name="height_request">22</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">radiobutton38</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <property name="group">radEyessec</property> - </widget> - <packing> - <property name="x">200</property> - <property name="y">32</property> - </packing> - </child> - - <child> <widget class="GtkVSeparator" id="vseparator10"> <property name="width_request">16</property> - <property name="height_request">50</property> + <property name="height_request">82</property> <property name="visible">True</property> </widget> <packing> <property name="x">65</property> - <property name="y">7</property> + <property name="y">6</property> </packing> </child> <child> <widget class="GtkButton" id="btnEyesRun"> - <property name="width_request">34</property> - <property name="height_request">34</property> + <property name="width_request">36</property> + <property name="height_request">36</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="relief">GTK_RELIEF_NONE</property> @@ -471,23 +518,34 @@ </widget> <packing> <property name="x">80</property> - <property name="y">16</property> + <property name="y">34</property> </packing> </child> <child> - <widget class="GtkButton" id="btnEyesClose"> - <property name="width_request">32</property> - <property name="height_request">32</property> + <widget class="GtkVSeparator" id="vseparator11"> + <property name="width_request">16</property> + <property name="height_request">82</property> <property name="visible">True</property> + </widget> + <packing> + <property name="x">68</property> + <property name="y">6</property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="btnEyesOpen"> + <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="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"/> + <signal name="clicked" handler="on_btnEyesOpen_released" last_modification_time="Thu, 06 Dec 2007 14:42:38 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> @@ -499,13 +557,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> @@ -524,7 +582,7 @@ </child> <child> - <widget class="GtkLabel" id="label3"> + <widget class="GtkLabel" id="label1"> <property name="visible">True</property> <property name="label" translatable="yes"> </property> @@ -555,23 +613,22 @@ </widget> <packing> <property name="x">16</property> - <property name="y">32</property> + <property name="y">18</property> </packing> </child> <child> - <widget class="GtkButton" id="btnEyesOpen"> - <property name="width_request">32</property> - <property name="height_request">32</property> + <widget class="GtkButton" id="btnEyesClose"> + <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="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"/> + <signal name="clicked" handler="on_btnEyesClose_released" last_modification_time="Thu, 06 Dec 2007 14:29:18 GMT"/> <child> - <widget class="GtkAlignment" id="alignment1"> + <widget class="GtkAlignment" id="alignment3"> <property name="visible">True</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> @@ -583,13 +640,13 @@ <property name="right_padding">0</property> <child> - <widget class="GtkHBox" id="hbox1"> + <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="imgEyesOpen"> + <widget class="GtkImage" id="imgEyesClose"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_focus">True</property> @@ -608,7 +665,7 @@ </child> <child> - <widget class="GtkLabel" id="label1"> + <widget class="GtkLabel" id="label3"> <property name="visible">True</property> <property name="label" translatable="yes"> </property> @@ -639,7 +696,7 @@ </widget> <packing> <property name="x">16</property> - <property name="y">16</property> + <property name="y">51</property> </packing> </child> </widget> @@ -654,7 +711,8 @@ </child> <child> - <widget class="GtkFixed" id="fixed27"> + <widget class="GtkFixed" id="fix3"> + <property name="height_request">62</property> <property name="visible">True</property> <child> @@ -673,79 +731,38 @@ </widget> <packing> <property name="x">120</property> - <property name="y">20</property> + <property name="y">12</property> </packing> </child> <child> - <widget class="GtkVSeparator" id="vseparator13"> + <widget class="GtkVSeparator" id="vseparator12"> <property name="width_request">16</property> <property name="height_request">50</property> <property name="visible">True</property> </widget> <packing> - <property name="x">68</property> - <property name="y">8</property> + <property name="x">65</property> + <property name="y">3</property> </packing> </child> <child> - <widget class="GtkVSeparator" id="vseparator12"> + <widget class="GtkVSeparator" id="vseparator13"> <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> + <property name="x">68</property> + <property name="y">3</property> </packing> </child> <child> - <widget class="GtkRadioButton" id="radMouthsec"> - <property name="width_request">114</property> - <property name="height_request">22</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">radiobutton39</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="x">200</property> - <property name="y">8</property> - </packing> - </child> - - <child> - <widget class="GtkRadioButton" id="radMouthcount"> - <property name="width_request">114</property> - <property name="height_request">22</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">radiobutton40</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <property name="group">radMouthsec</property> - </widget> - <packing> - <property name="x">200</property> - <property name="y">32</property> - </packing> - </child> - - <child> <widget class="GtkButton" id="btnMouthRun"> - <property name="width_request">34</property> - <property name="height_request">34</property> + <property name="width_request">36</property> + <property name="height_request">36</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="relief">GTK_RELIEF_NONE</property> @@ -821,20 +838,19 @@ </widget> <packing> <property name="x">80</property> - <property name="y">16</property> + <property name="y">10</property> </packing> </child> <child> <widget class="GtkButton" id="btnMouthClose"> - <property name="width_request">32</property> - <property name="height_request">32</property> + <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="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"/> + <signal name="clicked" handler="on_btnMouthClose_released" last_modification_time="Thu, 06 Dec 2007 14:29:07 GMT"/> <child> <widget class="GtkAlignment" id="alignment12"> @@ -911,14 +927,13 @@ <child> <widget class="GtkButton" id="btnMouthOpen"> - <property name="width_request">32</property> - <property name="height_request">32</property> + <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="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"/> + <signal name="clicked" handler="on_btnMouthOpen_released" last_modification_time="Thu, 06 Dec 2007 14:29:34 GMT"/> <child> <widget class="GtkAlignment" id="alignment5"> @@ -989,7 +1004,7 @@ </widget> <packing> <property name="x">16</property> - <property name="y">24</property> + <property name="y">31</property> </packing> </child> </widget> @@ -1004,7 +1019,8 @@ </child> <child> - <widget class="GtkFixed" id="fixed28"> + <widget class="GtkFixed" id="fix4"> + <property name="height_request">142</property> <property name="visible">True</property> <child> @@ -1023,67 +1039,14 @@ </widget> <packing> <property name="x">120</property> - <property name="y">20</property> + <property name="y">56</property> </packing> </child> <child> - <widget class="GtkVSeparator" id="vseparator15"> - <property name="width_request">16</property> - <property name="height_request">50</property> - <property name="visible">True</property> - </widget> - <packing> - <property name="x">68</property> - <property name="y">7</property> - </packing> - </child> - - <child> - <widget class="GtkRadioButton" id="radWingssec"> - <property name="width_request">114</property> - <property name="height_request">22</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">radiobutton41</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="x">200</property> - <property name="y">8</property> - </packing> - </child> - - <child> - <widget class="GtkRadioButton" id="radWingscount"> - <property name="width_request">114</property> - <property name="height_request">22</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">radiobutton42</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <property name="group">radWingssec</property> - </widget> - <packing> - <property name="x">200</property> - <property name="y">32</property> - </packing> - </child> - - <child> <widget class="GtkButton" id="btnWingsRun"> - <property name="width_request">34</property> - <property name="height_request">34</property> + <property name="width_request">36</property> + <property name="height_request">36</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="relief">GTK_RELIEF_NONE</property> @@ -1159,7 +1122,7 @@ </widget> <packing> <property name="x">80</property> - <property name="y">16</property> + <property name="y">54</property> </packing> </child> @@ -1178,24 +1141,47 @@ <signal name="value_changed" handler="on_slideWings_value_changed" last_modification_time="Thu, 15 Nov 2007 08:42:15 GMT"/> </widget> <packing> - <property name="x">312</property> - <property name="y">16</property> + <property name="x">208</property> + <property name="y">53</property> </packing> </child> <child> - <widget class="GtkButton" id="btnWingsDown"> - <property name="width_request">32</property> - <property name="height_request">32</property> + <widget class="GtkVSeparator" id="vseparator14"> + <property name="width_request">16</property> + <property name="height_request">131</property> <property name="visible">True</property> + </widget> + <packing> + <property name="x">65</property> + <property name="y">7</property> + </packing> + </child> + + <child> + <widget class="GtkVSeparator" id="vseparator15"> + <property name="width_request">16</property> + <property name="height_request">131</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="btnWingsUp"> + <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="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"/> + <signal name="clicked" handler="on_btnWingsUp_released" last_modification_time="Thu, 06 Dec 2007 14:42:55 GMT"/> <child> - <widget class="GtkAlignment" id="alignment7"> + <widget class="GtkAlignment" id="alignment6"> <property name="visible">True</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> @@ -1207,13 +1193,13 @@ <property name="right_padding">0</property> <child> - <widget class="GtkHBox" id="hbox7"> + <widget class="GtkHBox" id="hbox6"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">2</property> <child> - <widget class="GtkImage" id="imgWingsDown"> + <widget class="GtkImage" id="imgWingsUp"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_focus">True</property> @@ -1232,7 +1218,7 @@ </child> <child> - <widget class="GtkLabel" id="label7"> + <widget class="GtkLabel" id="label6"> <property name="visible">True</property> <property name="label" translatable="yes"> </property> @@ -1268,18 +1254,17 @@ </child> <child> - <widget class="GtkButton" id="btnWingsUp"> - <property name="width_request">32</property> - <property name="height_request">32</property> + <widget class="GtkButton" id="btnWingsDown"> + <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="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"/> + <signal name="clicked" handler="on_btnWingsDown_released" last_modification_time="Thu, 06 Dec 2007 14:43:04 GMT"/> <child> - <widget class="GtkAlignment" id="alignment6"> + <widget class="GtkAlignment" id="alignment7"> <property name="visible">True</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> @@ -1291,13 +1276,13 @@ <property name="right_padding">0</property> <child> - <widget class="GtkHBox" id="hbox6"> + <widget class="GtkHBox" id="hbox7"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">2</property> <child> - <widget class="GtkImage" id="imgWingsUp"> + <widget class="GtkImage" id="imgWingsDown"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_focus">True</property> @@ -1316,7 +1301,7 @@ </child> <child> - <widget class="GtkLabel" id="label6"> + <widget class="GtkLabel" id="label7"> <property name="visible">True</property> <property name="label" translatable="yes"> </property> @@ -1347,21 +1332,9 @@ </widget> <packing> <property name="x">16</property> - <property name="y">8</property> + <property name="y">72</property> </packing> </child> - - <child> - <widget class="GtkVSeparator" id="vseparator14"> - <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> </widget> <packing> <property name="left_attach">1</property> @@ -1374,7 +1347,8 @@ </child> <child> - <widget class="GtkFixed" id="fixed29"> + <widget class="GtkFixed" id="fix5"> + <property name="height_request">83</property> <property name="visible">True</property> <child> @@ -1398,12 +1372,24 @@ </child> <child> - <widget class="GtkRadioButton" id="radSpinsec"> - <property name="width_request">114</property> + <widget class="GtkVSeparator" id="vseparator16"> + <property name="width_request">16</property> + <property name="height_request">70</property> + <property name="visible">True</property> + </widget> + <packing> + <property name="x">65</property> + <property name="y">7</property> + </packing> + </child> + + <child> + <widget class="GtkRadioButton" id="radSpinDirRight"> + <property name="width_request">136</property> <property name="height_request">22</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">radiobutton43</property> + <property name="label" translatable="yes">radiobutton2</property> <property name="use_underline">True</property> <property name="relief">GTK_RELIEF_NORMAL</property> <property name="focus_on_click">True</property> @@ -1412,47 +1398,36 @@ <property name="draw_indicator">True</property> </widget> <packing> - <property name="x">200</property> - <property name="y">8</property> + <property name="x">264</property> + <property name="y">56</property> </packing> </child> <child> - <widget class="GtkHScale" id="slideSpin"> - <property name="width_request">160</property> - <property name="height_request">32</property> + <widget class="GtkRadioButton" id="radSpinDirLeft"> + <property name="width_request">136</property> + <property name="height_request">24</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="draw_value">True</property> - <property name="value_pos">GTK_POS_RIGHT</property> - <property name="digits">0</property> - <property name="update_policy">GTK_UPDATE_CONTINUOUS</property> - <property name="inverted">False</property> - <property name="adjustment">5 1 5 1 0 0</property> - <signal name="value_changed" handler="on_slideSpin_value_changed" last_modification_time="Thu, 15 Nov 2007 08:42:21 GMT"/> + <property name="label" translatable="yes">radiobutton1</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + <property name="group">radSpinDirRight</property> </widget> <packing> - <property name="x">312</property> - <property name="y">16</property> + <property name="x">120</property> + <property name="y">56</property> </packing> </child> <child> - <widget class="GtkVSeparator" id="vseparator16"> - <property name="width_request">16</property> - <property name="height_request">70</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="btnSpinLeft"> - <property name="width_request">32</property> - <property name="height_request">32</property> + <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> @@ -1535,8 +1510,8 @@ <child> <widget class="GtkButton" id="btnSpinRight"> - <property name="width_request">32</property> - <property name="height_request">32</property> + <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> @@ -1619,8 +1594,8 @@ <child> <widget class="GtkButton" id="btnSpinRun"> - <property name="width_request">34</property> - <property name="height_request">34</property> + <property name="width_request">36</property> + <property name="height_request">36</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="relief">GTK_RELIEF_NONE</property> @@ -1701,68 +1676,26 @@ </child> <child> - <widget class="GtkRadioButton" id="radSpincount"> - <property name="width_request">114</property> - <property name="height_request">22</property> + <widget class="GtkHScale" id="slideSpin"> + <property name="width_request">160</property> + <property name="height_request">32</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes">radiobutton44</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <property name="group">radSpinsec</property> + <property name="draw_value">True</property> + <property name="value_pos">GTK_POS_RIGHT</property> + <property name="digits">0</property> + <property name="update_policy">GTK_UPDATE_CONTINUOUS</property> + <property name="inverted">False</property> + <property name="adjustment">5 1 5 1 0 0</property> + <signal name="value_changed" handler="on_slideSpin_value_changed" last_modification_time="Thu, 15 Nov 2007 08:42:21 GMT"/> </widget> <packing> - <property name="x">200</property> - <property name="y">32</property> + <property name="x">208</property> + <property name="y">16</property> </packing> </child> <child> - <widget class="GtkRadioButton" id="radSpinDirRight"> - <property name="width_request">136</property> - <property name="height_request">22</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">radiobutton2</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="x">264</property> - <property name="y">56</property> - </packing> - </child> - - <child> - <widget class="GtkRadioButton" id="radSpinDirLeft"> - <property name="width_request">136</property> - <property name="height_request">24</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">radiobutton1</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <property name="group">radSpinDirRight</property> - </widget> - <packing> - <property name="x">120</property> - <property name="y">56</property> - </packing> - </child> - - <child> <widget class="GtkVSeparator" id="vseparator17"> <property name="width_request">16</property> <property name="height_request">70</property> @@ -1785,141 +1718,6 @@ </child> <child> - <widget class="GtkFixed" id="fixed25"> - <property name="visible">True</property> - - <child> - <widget class="GtkImage" id="imgSpin"> - <property name="width_request">367</property> - <property name="height_request">83</property> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="x">0</property> - <property name="y">0</property> - </packing> - </child> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkFixed" id="fixed24"> - <property name="width_request">372</property> - <property name="height_request">0</property> - <property name="visible">True</property> - - <child> - <widget class="GtkImage" id="imgWings"> - <property name="width_request">367</property> - <property name="height_request">142</property> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="x">0</property> - <property name="y">0</property> - </packing> - </child> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkFixed" id="fixed23"> - <property name="visible">True</property> - - <child> - <widget class="GtkImage" id="imgMouth"> - <property name="width_request">367</property> - <property name="height_request">62</property> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="x">0</property> - <property name="y">0</property> - </packing> - </child> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkFixed" id="fixed22"> - <property name="visible">True</property> - - <child> - <widget class="GtkImage" id="imgEyes"> - <property name="width_request">367</property> - <property name="height_request">79</property> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="x">0</property> - <property name="y">16</property> - </packing> - </child> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox17"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> <widget class="GtkFixed" id="fixed32"> <property name="visible">True</property> @@ -1972,15 +1770,15 @@ </child> <child> - <widget class="GtkLabel" id="lblSound"> - <property name="width_request">46</property> - <property name="height_request">17</property> + <widget class="GtkLabel" id="lblLightL"> + <property name="width_request">91</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_LEFT</property> - <property name="wrap">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> @@ -1993,12 +1791,12 @@ </widget> <packing> <property name="x">312</property> - <property name="y">56</property> + <property name="y">8</property> </packing> </child> <child> - <widget class="GtkLabel" id="lblBattery"> + <widget class="GtkLabel" id="lblSound"> <property name="width_request">46</property> <property name="height_request">17</property> <property name="visible">True</property> @@ -2019,16 +1817,16 @@ </widget> <packing> <property name="x">312</property> - <property name="y">32</property> + <property name="y">56</property> </packing> </child> <child> - <widget class="GtkLabel" id="lblLightL"> + <widget class="GtkLabel" id="lblBatteryL"> <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> @@ -2044,13 +1842,13 @@ <property name="angle">0</property> </widget> <packing> - <property name="x">312</property> - <property name="y">0</property> + <property name="x">0</property> + <property name="y">32</property> </packing> </child> <child> - <widget class="GtkLabel" id="lblBatteryL"> + <widget class="GtkLabel" id="lblSoundL"> <property name="width_request">138</property> <property name="height_request">16</property> <property name="visible">True</property> @@ -2071,12 +1869,12 @@ </widget> <packing> <property name="x">0</property> - <property name="y">32</property> + <property name="y">56</property> </packing> </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> @@ -2097,12 +1895,12 @@ </widget> <packing> <property name="x">0</property> - <property name="y">56</property> + <property name="y">8</property> </packing> </child> <child> - <widget class="GtkLabel" id="lblLight"> + <widget class="GtkLabel" id="lblBattery"> <property name="width_request">46</property> <property name="height_request">17</property> <property name="visible">True</property> @@ -2123,20 +1921,20 @@ </widget> <packing> <property name="x">312</property> - <property name="y">8</property> + <property name="y">32</property> </packing> </child> <child> - <widget class="GtkLabel" id="lblLightL"> - <property name="width_request">138</property> - <property name="height_request">16</property> + <widget class="GtkLabel" id="lblLight"> + <property name="width_request">46</property> + <property name="height_request">17</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="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> <property name="selectable">False</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> @@ -2148,26 +1946,95 @@ <property name="angle">0</property> </widget> <packing> - <property name="x">0</property> + <property name="x">312</property> <property name="y">8</property> </packing> </child> </widget> <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">5</property> + <property name="bottom_attach">6</property> + <property name="x_options">fill</property> </packing> ... [truncated message content] |
From: Paul_R <c2m...@c2...> - 2007-12-06 13:16:05
|
Author: Paul_R Date: 2007-12-06 14:16:02 +0100 (Thu, 06 Dec 2007) New Revision: 753 Modified: software/gadgets/sound_monitor/trunk/audio_monitor.tgf software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/conf/other.pyp software/gadgets/sound_monitor/trunk/audio_monitor/about.xml software/gadgets/sound_monitor/trunk/audio_monitor/settings.xml software/gadgets/sound_monitor/trunk/audio_monitor/strings.xml Log: * Add a protection when the path contain spaces Modified: software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/conf/other.pyp =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/conf/other.pyp 2007-12-06 10:29:13 UTC (rev 752) +++ software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/conf/other.pyp 2007-12-06 13:16:02 UTC (rev 753) @@ -27,7 +27,10 @@ _me.set_param('Path', self.get_widget('fileChooser').get_current_folder()) def on_fileChooser_current_folder_changed(self, widget, *args): - _me.set_param('Path', widget.get_current_folder()) + path = widget.get_current_folder() + path = path.replace('%20', ' ') + _me.set_param('Path', path) + print path def on_spinSample_changed(self, widget, *args): _me.set_param('Sample', float(widget.get_text())) Modified: software/gadgets/sound_monitor/trunk/audio_monitor/about.xml =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/about.xml 2007-12-06 10:29:13 UTC (rev 752) +++ software/gadgets/sound_monitor/trunk/audio_monitor/about.xml 2007-12-06 13:16:02 UTC (rev 753) @@ -1,8 +1,8 @@ <?xml version='1.0' encoding='UTF-8'?> <about> + <gadget_author type='str'>Paul Rathgeb</gadget_author> + <gadget_version type='str'>0.0.1</gadget_version> <gadget_description type='str'> </gadget_description> - <gadget_author type='str'>Paul Rathgeb</gadget_author> <gadget_name type='str'>sound_monitor</gadget_name> - <gadget_version type='str'>0.0.1</gadget_version> </about> Modified: software/gadgets/sound_monitor/trunk/audio_monitor/settings.xml =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/settings.xml 2007-12-06 10:29:13 UTC (rev 752) +++ software/gadgets/sound_monitor/trunk/audio_monitor/settings.xml 2007-12-06 13:16:02 UTC (rev 753) @@ -1,12 +1,12 @@ <?xml version='1.0' encoding='UTF-8'?> <settings> <parameters> + <Sample type='float'>400.0</Sample> <chkDogBehavior type='bool'>False</chkDogBehavior> <SpyThreshold type='int'>30</SpyThreshold> <MainScript type='str'>None</MainScript> <chkSpy type='bool'>False</chkSpy> <chkDog type='bool'>True</chkDog> - <Sample type='float'>400.0</Sample> <chkSpyRecord type='bool'>False</chkSpyRecord> <chkDogDefault type='bool'>False</chkDogDefault> <Path type='str'>None</Path> Modified: software/gadgets/sound_monitor/trunk/audio_monitor/strings.xml =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/strings.xml 2007-12-06 10:29:13 UTC (rev 752) +++ software/gadgets/sound_monitor/trunk/audio_monitor/strings.xml 2007-12-06 13:16:02 UTC (rev 753) @@ -3,7 +3,7 @@ <at_gui_widget_lblSpyLevel type='str'>Level</at_gui_widget_lblSpyLevel> <at_gui_widget_chkDog type='str'>Enable the guard dog mode</at_gui_widget_chkDog> <at_gui_conf_label13 type='str'>Delay (sec) :</at_gui_conf_label13> - <Location type='str'>Select where the file must be stored.</Location> + <at_gui_conf_label12 type='str'>Updates</at_gui_conf_label12> <help_text type='str'> </help_text> <vr_Sound type='str'>Sound</vr_Sound> @@ -22,5 +22,5 @@ <at_gui_widget_chkSpy type='str'>Enable the spy mode</at_gui_widget_chkSpy> <Duration type='str'>Duration</Duration> <lblSample type='str'>Sample : </lblSample> - <at_gui_conf_label12 type='str'>Updates</at_gui_conf_label12> + <Location type='str'>Select where the file must be stored.</Location> </strings> Modified: software/gadgets/sound_monitor/trunk/audio_monitor.tgf =================================================================== (Binary files differ) |
Author: Paul_R Date: 2007-12-06 11:29:13 +0100 (Thu, 06 Dec 2007) New Revision: 752 Modified: software/gadgets/sound_monitor/trunk/audio_monitor.tgf software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/conf/other.glade software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/conf/other.pyp software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/other.pyp software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/main.pyp software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/notify.pyp software/gadgets/sound_monitor/trunk/audio_monitor/Strings/fr_ALL.xml software/gadgets/sound_monitor/trunk/audio_monitor/about.xml software/gadgets/sound_monitor/trunk/audio_monitor/settings.xml software/gadgets/sound_monitor/trunk/audio_monitor/strings.xml Log: * Added two line in the graph when events occurs. * Added a file chooser to specify where the .wav files must be stored. Modified: software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/conf/other.glade =================================================================== (Binary files differ) Modified: software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/conf/other.pyp =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/conf/other.pyp 2007-12-05 16:28:39 UTC (rev 751) +++ software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/conf/other.pyp 2007-12-06 10:29:13 UTC (rev 752) @@ -1,4 +1,6 @@ bindtextdomain("params", "") +import commands +import os class Window(SimpleGladeApp): def __init__(self, @@ -9,16 +11,27 @@ def new(self): - self.measure = _me.get_param('measure') self.updates_commons() - def updates_commons(self): - txt = "%s : %s" % (_me.string('name_to_read'), - _me.string('gui_conf_window_title')) + txt = "%s : %s" % (_me.string('name_to_read'), _me.string('gui_conf_window_title')) self.get_widget("window1").set_title(txt) - - + self.get_widget('lblLocation').set_label(_me.string('Location')) + self.get_widget('spinSample').set_value(_me.get_param('Sample')) + self.get_widget('lblSample').set_label(_me.string('lblSample')) + if os.path.exists(_me.get_param('Path')): + self.get_widget('fileChooser').set_current_folder(_me.get_param('Path')) + else: + user = commands.getoutput('echo $USER') + self.get_widget('fileChooser').set_current_folder('/home/%s'%user) + _me.set_param('Path', self.get_widget('fileChooser').get_current_folder()) + + def on_fileChooser_current_folder_changed(self, widget, *args): + _me.set_param('Path', widget.get_current_folder()) + + def on_spinSample_changed(self, widget, *args): + _me.set_param('Sample', float(widget.get_text())) + ########################################################### # # On cancel button clicked @@ -35,7 +48,5 @@ # ########################################################### def on_accept_clicked(self, widget, *args): - _me.set_var('notify_delay', int(self.get_widget("delay_spinbutton").get_value())) - self.get_widget("window1").destroy() Modified: software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/other.pyp =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/other.pyp 2007-12-05 16:28:39 UTC (rev 751) +++ software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/other.pyp 2007-12-06 10:29:13 UTC (rev 752) @@ -45,12 +45,12 @@ self.get_widget('chkDogDefault').set_label(_me.string('at_gui_widget_chkDogDefault')) self.get_widget('chkDogDefault').set_active(_me.get_param('chkDogDefault')) - self.get_widget('spinDog').set_value(_me.get_param('spinDog')) + self.get_widget('spinDog').set_value(_me.get_param('DogThreshold')) self.get_widget('chkSpy').set_label(_me.string('at_gui_widget_chkSpy')) self.get_widget('chkSpy').set_active(_me.get_param('chkSpy')) - self.get_widget('spinSpy').set_value(_me.get_param('spinSpy')) + self.get_widget('spinSpy').set_value(_me.get_param('SpyThreshold')) self.get_widget('lblDogLevel').set_text(_me.string('at_gui_widget_lblDogLevel')) self.get_widget('lblSpyLevel').set_text(_me.string('at_gui_widget_lblSpyLevel')) @@ -99,7 +99,14 @@ self.measure.graph_measure = self.graph self.measure.refresh_treeview = self.refresh_treeview self.graph.measure = self.measure - + + if os.path.exists(_me.get_param('Path')): + self.measure.capture_path = _me.get_param('Path') + else: + user = commands.getoutput('echo $USER') + self.measure.capture_path = '/home/%s'%user + _me.set_param('Path', 'home/%s'%user) + self.monitor_id = tux.monitoring.insert(0xF0, self.measure.on_sound_level) tux.micro.on() self.update_value() @@ -139,7 +146,7 @@ def read_sound(self, widget): soundcard = tux.hw.alsa_device tux.micro.off() - tux.sys.shell("aplay -D %s /tmp/__tux-record%d.wav"%(soundcard, self.selected_file)) + tux.sys.shell("aplay -D %s %s/__tux-record%d.wav"%(soundcard, self.measure.capture_path,self.selected_file)) tux.micro.on() ########################################################### @@ -148,8 +155,7 @@ # ########################################################### def on_window1_destroy(self, widget, *args): - if self.measure.num > 1: - os.system('rm /tmp/__tux-record*') + pass def on_cbbType_changed(self, widget, *args): if self.get_widget('cbbType').get_active() == 0: @@ -161,9 +167,11 @@ def on_spinbutton1_changed(self, widget, *args): self.measure.dog_threshold = float(widget.get_text()) + _me.set_param('DogThreshold', float(widget.get_text())) def on_spinbutton2_changed(self, widget, *args): self.measure.spy_threshold = float(widget.get_text()) + _me.set_param('SpyThreshold', float(widget.get_text())) def on_chkSpy_toggled(self, widget, *args): _me.set_param('chkSpy', widget.get_active()) @@ -294,21 +302,36 @@ #and trace the curce self.context.set_line_width(0.6) self.context.set_source_rgb(0.9, 0.6,0) - self.context.move_to(self.rect.x - 2, self.rect.height + 2) + self.context.move_to(self.rect.x - 2, self.rect.height / 2) self.context.line_to(self.rect.x, self.rect.height - (self.measure.val_table_pos[0] * coeff_y)) for i, val in enumerate(self.measure.val_table_pos): - self.context.line_to(self.rect.x + ((i) * coeff_x), self.rect.height - ((self.measure.RANGE/2 + val) * coeff_y)) + self.context.line_to(self.rect.x + ((i) * coeff_x), self.rect.height - ((self.measure.RANGE/2 + val) * coeff_y)) self.context.line_to(self.rect.x + ((i) * coeff_x), self.rect.height + 5) - self.context.move_to(self.rect.x - 2, self.rect.height + 2) + self.context.move_to(self.rect.x - 2, self.rect.height / 2) self.context.line_to(self.rect.x, self.rect.height - (self.measure.val_table_pos[0] * coeff_y)) for i, val in enumerate(self.measure.val_table_pos): self.context.line_to(self.rect.x + ((i) * coeff_x), self.rect.height - ((self.measure.RANGE/2 - val) * coeff_y)) self.context.line_to(self.rect.x + ((i) * coeff_x), self.rect.height + 5) self.context.stroke() + self.draw_events(coeff_x, coeff_y) - + def draw_events(self, coeff_x, coeff_y): + self.context.set_line_width(2) + for i, val in enumerate(self.measure.event_table): + if val == 1: + self.context.set_source_rgb(1, 0, 0.7) + self.context.move_to(self.rect.x + ((i) * coeff_x), 0) + self.context.line_to(self.rect.x + ((i) * coeff_x), 5) + self.context.stroke() + if val == 2: + self.context.set_source_rgb(1, 0.7, 0) + self.context.move_to(self.rect.x + ((i) * coeff_x), 5) + self.context.line_to(self.rect.x + ((i) * coeff_x), 10) + self.context.stroke() + + def fill(self, coeff_x, coeff_y): #determine the coefficients to adjust the curve in the window space self.context.move_to(self.rect.x - 2, self.rect.height / 2) @@ -334,6 +357,7 @@ self.RANGE = 1024.0 self.sample_backup = self.sample self.val_table_pos = [0] * int(self.sample) + self.event_table = [-1] * int(self.sample) self.dog_threshold = 0 self.spy_threshold = 0 @@ -346,8 +370,10 @@ self.__capture_buffer = [] self.__temp_buffer = [] self.capture_idx = tux.micro.on_buffer.connect(self.__on_capture_buffer) - self.__capture_path = '' + self.capture_path = '' self.num = 1 + self.__start_timeout = True + self.__start_delay = time.time() + 2 self.__capture_start = False self.__stop = False self.__delay_to_stop = time.time() @@ -368,10 +394,14 @@ if self.Increase_control(self.spy_threshold): self.record_sound() - if self.dog_enabled and self.actuator == False: + if self.dog_enabled and self.actuator == False and self.__start_timeout == False: if self.Increase_control(self.dog_threshold): self.notify = True self.actuator = True + + if self.__start_timeout: + if self.__start_delay < time.time(): + self.__start_timeout = False ########################################################### @@ -394,8 +424,17 @@ try: if self.sample_backup != self.sample: self.sample = self.sample_backup - self.val_table_pos = [512] * int(self.sample) + self.val_table_pos = [0] * int(self.sample) + self.event_table = [-1] * int(self.sample) + if self.__capture_start: + self.event_table.append(1) + elif self.actuator: + self.event_table.append(2) + else: + self.event_table.append(-1) + self.event_table.pop(0) + val = (args[1] + args[2] + args[3] + args[4]) self.val_table_pos.append(val) self.val_table_pos.pop(0) @@ -479,7 +518,7 @@ self.__time = act_time[0] + ':' + act_time[1] + ':' + act_time[2] self.__duration = time.time() - self.__capture_path = '/tmp/__tux-record%d.wav'%self.num + self.__capture_path = self.capture_path + '/__tux-record%d.wav'%self.num self.__capture_start = True self.__start_flag = True Modified: software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/main.pyp =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/main.pyp 2007-12-05 16:28:39 UTC (rev 751) +++ software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/main.pyp 2007-12-06 10:29:13 UTC (rev 752) @@ -1,28 +1,37 @@ import os +import time def on_standby(): gdg_dict = _me.get_param('dict') for keys in gdg_dict: gadgets[keys].notify.set_active(gdg_dict[keys]) + + gadgets['sound_monitor'].notify.set_active(False) tux.micro.off() tux.cmd.mouth_close() tux.event.on_remote_bt[K_STANDBY] = None tux.monitoring.remove(_me.get_param('monitor_id')) tux.micro.on_buffer.disconnect(_me.get_param('buffer_idx')) + _me.gui('widget').hide_from_main() _me.exit_main_loop() -gdg_dict = {} -for Gdgname in gadgets.keys(): - if Gdgname != 'sound_monitor' and Gdgname != 'Manager': - gdg_dict[Gdgname] = gadgets[Gdgname].get_var('notified') - gadgets[Gdgname].notify.set_active(False) - - -_me.set_param('dict', gdg_dict) -tux.cmd.mouth_open() -tux.event.on_remote_bt[K_STANDBY] = on_standby -_me.gui('widget').show_from_main() -_me.run_main_loop() +def start_gadget(): + gdg_dict = {} + for Gdgname in gadgets.keys(): + if Gdgname != 'sound_monitor' and Gdgname != 'Manager': + gdg_dict[Gdgname] = gadgets[Gdgname].get_var('notified') + gadgets[Gdgname].notify.set_active(False) + + gadgets['sound_monitor'].notify.set_active(True) + + tux.cmd.mouth_open() + _me.set_param('dict', gdg_dict) + tux.event.on_remote_bt[K_STANDBY] = on_standby + _me.gui('widget').show_from_main() + _me.run_main_loop() + +start_gadget() + Modified: software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/notify.pyp =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/notify.pyp 2007-12-05 16:28:39 UTC (rev 751) +++ software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/notify.pyp 2007-12-06 10:29:13 UTC (rev 752) @@ -1,4 +1,4 @@ -def notify_checker(): +def notify_checker(): if _me.get_param('measure'): measure = _me.get_param('measure') if measure.notify: @@ -16,7 +16,7 @@ for i in range(5): tux.cmd.sound_play(14) tux.sys.wait(0.7) - tux.sys.wait(1) + tux.sys.wait(0.5) else: path = _me.get_param('dogBehavior') if os.path.exists(path) and os.path.isfile(path): Modified: software/gadgets/sound_monitor/trunk/audio_monitor/Strings/fr_ALL.xml =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/Strings/fr_ALL.xml 2007-12-05 16:28:39 UTC (rev 751) +++ software/gadgets/sound_monitor/trunk/audio_monitor/Strings/fr_ALL.xml 2007-12-06 10:29:13 UTC (rev 752) @@ -1,24 +1,26 @@ <?xml version='1.0' encoding='UTF-8'?> <strings> - <at_gui_widget_lblSpyLevel type='str'>Spy level</at_gui_widget_lblSpyLevel> + <at_gui_widget_lblSpyLevel type='str'>Niveau</at_gui_widget_lblSpyLevel> + <at_gui_widget_chkDog type='str'>Activer le mode chien de garde</at_gui_widget_chkDog> + <at_gui_conf_label13 type='str'>Delay (sec) :</at_gui_conf_label13> + <at_gui_conf_label12 type='str'>Updates</at_gui_conf_label12> + <help_text type='str'> + </help_text> + <vr_Sound type='str'>Sound</vr_Sound> <Play type='str'>Lecture</Play> - <at_gui_widget_cbbRecord type='str'>Sons enregistrés</at_gui_widget_cbbRecord> <at_gui_widget_cbbDog type='str'>Chien de garde</at_gui_widget_cbbDog> - <name_to_read type='str'>Moniteur de son</name_to_read> <at_gui_conf_label6 type='str'>Cancel</at_gui_conf_label6> <at_gui_conf_label5 type='str'>Accept</at_gui_conf_label5> - <at_gui_widget_chkDog type='str'>Activer le mode chien de garde</at_gui_widget_chkDog> - <at_gui_widget_lblDogLevel type='str'>Dog level</at_gui_widget_lblDogLevel> - <Duration type='str'>Durée</Duration> + <at_gui_widget_chkDogDefault type='str'>Utiliser un script :</at_gui_widget_chkDogDefault> + <at_gui_widget_lblDogLevel type='str'>Niveau</at_gui_widget_lblDogLevel> <Time type='str'>Heure</Time> - <at_gui_conf_label13 type='str'>Delay (sec) :</at_gui_conf_label13> - <at_gui_conf_label12 type='str'>Updates</at_gui_conf_label12> - <File type='str'>Fichier</File> - <at_gui_widget_chkDogDefault type='str'>Utiliser un script :</at_gui_widget_chkDogDefault> - <help_text type='str'> - </help_text> <at_gui_widget_cbbSpy type='str'>Mode espion</at_gui_widget_cbbSpy> <speaker_name type='str'>Bruno8k</speaker_name> - <vr_Sound type='str'>Sound</vr_Sound> + <at_gui_widget_cbbRecord type='str'>Sons enregistrés</at_gui_widget_cbbRecord> + <name_to_read type='str'>Moniteur de son</name_to_read> + <File type='str'>Fichier</File> <at_gui_widget_chkSpy type='str'>Activer le mode espion</at_gui_widget_chkSpy> + <Duration type='str'>Durée</Duration> + <lblSample type='str'>Nombre de points : </lblSample> + <Location type='str'>Selectionner ou les sons doivent être sauvés.</Location> </strings> Modified: software/gadgets/sound_monitor/trunk/audio_monitor/about.xml =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/about.xml 2007-12-05 16:28:39 UTC (rev 751) +++ software/gadgets/sound_monitor/trunk/audio_monitor/about.xml 2007-12-06 10:29:13 UTC (rev 752) @@ -1,8 +1,8 @@ <?xml version='1.0' encoding='UTF-8'?> <about> - <gadget_name type='str'>sound_monitor</gadget_name> - <gadget_author type='str'>Paul Rathgeb</gadget_author> <gadget_description type='str'> </gadget_description> + <gadget_author type='str'>Paul Rathgeb</gadget_author> + <gadget_name type='str'>sound_monitor</gadget_name> <gadget_version type='str'>0.0.1</gadget_version> </about> Modified: software/gadgets/sound_monitor/trunk/audio_monitor/settings.xml =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/settings.xml 2007-12-05 16:28:39 UTC (rev 751) +++ software/gadgets/sound_monitor/trunk/audio_monitor/settings.xml 2007-12-06 10:29:13 UTC (rev 752) @@ -1,15 +1,16 @@ <?xml version='1.0' encoding='UTF-8'?> <settings> <parameters> - <spinDog type='int'>30</spinDog> <chkDogBehavior type='bool'>False</chkDogBehavior> + <SpyThreshold type='int'>30</SpyThreshold> <MainScript type='str'>None</MainScript> <chkSpy type='bool'>False</chkSpy> <chkDog type='bool'>True</chkDog> - <Sample type='float'>600.0</Sample> + <Sample type='float'>400.0</Sample> <chkSpyRecord type='bool'>False</chkSpyRecord> <chkDogDefault type='bool'>False</chkDogDefault> - <spinSpy type='int'>40</spinSpy> + <Path type='str'>None</Path> + <DogThreshold type='int'>30</DogThreshold> </parameters> <general> <have_settings_part type='bool'>True</have_settings_part> @@ -25,7 +26,7 @@ </gui_state> <language type='str'>en_US</language> <notified type='bool'>True</notified> - <notify_delay type='int'>10</notify_delay> + <notify_delay type='int'>1</notify_delay> <framework_version type='str'>0.0.0</framework_version> <menu_active type='bool'>True</menu_active> <have_widget_part type='bool'>False</have_widget_part> Modified: software/gadgets/sound_monitor/trunk/audio_monitor/strings.xml =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/strings.xml 2007-12-05 16:28:39 UTC (rev 751) +++ software/gadgets/sound_monitor/trunk/audio_monitor/strings.xml 2007-12-06 10:29:13 UTC (rev 752) @@ -1,24 +1,26 @@ <?xml version='1.0' encoding='UTF-8'?> <strings> <at_gui_widget_lblSpyLevel type='str'>Level</at_gui_widget_lblSpyLevel> + <at_gui_widget_chkDog type='str'>Enable the guard dog mode</at_gui_widget_chkDog> + <at_gui_conf_label13 type='str'>Delay (sec) :</at_gui_conf_label13> + <Location type='str'>Select where the file must be stored.</Location> + <help_text type='str'> + </help_text> + <vr_Sound type='str'>Sound</vr_Sound> <Play type='str'>Play</Play> - <at_gui_widget_cbbRecord type='str'>Recorded files</at_gui_widget_cbbRecord> <at_gui_widget_cbbDog type='str'>Guard dog mode</at_gui_widget_cbbDog> - <name_to_read type='str'>Audio monitor</name_to_read> <at_gui_conf_label6 type='str'>Cancel</at_gui_conf_label6> <at_gui_conf_label5 type='str'>Accept</at_gui_conf_label5> - <at_gui_widget_chkDog type='str'>Enable the guard dog mode</at_gui_widget_chkDog> + <at_gui_widget_chkDogDefault type='str'>Use an external script</at_gui_widget_chkDogDefault> <at_gui_widget_lblDogLevel type='str'>Level</at_gui_widget_lblDogLevel> - <Duration type='str'>Duration</Duration> <Time type='str'>Hour</Time> - <at_gui_conf_label13 type='str'>Delay (sec) :</at_gui_conf_label13> - <at_gui_conf_label12 type='str'>Updates</at_gui_conf_label12> + <at_gui_widget_cbbSpy type='str'>Spy mode</at_gui_widget_cbbSpy> + <speaker_name type='str'>Ryan8k</speaker_name> + <at_gui_widget_cbbRecord type='str'>Recorded files</at_gui_widget_cbbRecord> + <name_to_read type='str'>Audio monitor</name_to_read> <File type='str'>File</File> <at_gui_widget_chkSpy type='str'>Enable the spy mode</at_gui_widget_chkSpy> - <help_text type='str'> - </help_text> - <at_gui_widget_cbbSpy type='str'>Spy mode</at_gui_widget_cbbSpy> - <vr_Sound type='str'>Sound</vr_Sound> - <at_gui_widget_chkDogDefault type='str'>Use an external script</at_gui_widget_chkDogDefault> - <speaker_name type='str'>Ryan8k</speaker_name> + <Duration type='str'>Duration</Duration> + <lblSample type='str'>Sample : </lblSample> + <at_gui_conf_label12 type='str'>Updates</at_gui_conf_label12> </strings> Modified: software/gadgets/sound_monitor/trunk/audio_monitor.tgf =================================================================== (Binary files differ) |
Author: Paul_R Date: 2007-12-05 17:28:39 +0100 (Wed, 05 Dec 2007) New Revision: 751 Removed: software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/Sound_class.py Modified: software/gadgets/sound_monitor/trunk/audio_monitor.tgf software/gadgets/sound_monitor/trunk/audio_monitor/Pictures/Icons/gadget.png software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/conf/other.glade software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/other.glade software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/other.pyp software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/init.pyp software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/main.pyp software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/notify.pyp software/gadgets/sound_monitor/trunk/audio_monitor/Strings/fr_ALL.xml software/gadgets/sound_monitor/trunk/audio_monitor/settings.xml software/gadgets/sound_monitor/trunk/audio_monitor/strings.xml Log: * Changed the gadget icon's * Moved the widget part into the main * Finished the spy and guard dog mode. * Moved the Sound_classes (measure and graph) in the widget file (other.pyp). Modified: software/gadgets/sound_monitor/trunk/audio_monitor/Pictures/Icons/gadget.png =================================================================== (Binary files differ) Property changes on: software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/conf/other.glade ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/other.glade =================================================================== (Binary files differ) Property changes on: software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/other.glade ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/other.pyp =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/other.pyp 2007-12-05 16:14:55 UTC (rev 750) +++ software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/other.pyp 2007-12-05 16:28:39 UTC (rev 751) @@ -1,9 +1,15 @@ bindtextdomain("params", "") -sys.path.append(_me.get_path('root') + '/Scripts/Python') -from Sound_class import Sound_Graph +import gtk +import sys +import time +import os +import threading +import thread +import math +import commands +import wave class Window(SimpleGladeApp): - def __init__(self, path=_me.get_path('root') + '/Scripts/Python/GUI/widget/other.glade', root="window1", @@ -16,7 +22,6 @@ # ########################################################### def new(self): - self.get_widget("window1").set_title(_me.string('name_to_read')) thread.start_new_thread(self.update, ()) @@ -27,44 +32,45 @@ # ########################################################### def update_value(self): - self.measure.changetext = _me.string('conf_lblChange') self.measure.thresholdtext = _me.string('conf_lblThreshold') self.get_widget('cbbType').append_text(_me.string('at_gui_widget_cbbDog')) self.get_widget('cbbType').append_text(_me.string('at_gui_widget_cbbSpy')) self.get_widget('cbbType').append_text(_me.string('at_gui_widget_cbbRecord')) self.get_widget('cbbType').set_active(0) + self.get_widget('chkDog').set_label(_me.string('at_gui_widget_chkDog')) - self.get_widget('chkDogBehavior').set_label(_me.string('at_gui_widget_chkDogDehavior')) + self.get_widget('chkDog').set_active(_me.get_param('chkDog')) + self.get_widget('chkDogDefault').set_label(_me.string('at_gui_widget_chkDogDefault')) + self.get_widget('chkDogDefault').set_active(_me.get_param('chkDogDefault')) + + self.get_widget('spinDog').set_value(_me.get_param('spinDog')) + self.get_widget('chkSpy').set_label(_me.string('at_gui_widget_chkSpy')) - self.get_widget('chkSpyRecord').set_label(_me.string('at_gui_widget_chkSpyRecord')) + self.get_widget('chkSpy').set_active(_me.get_param('chkSpy')) + + self.get_widget('spinSpy').set_value(_me.get_param('spinSpy')) + self.get_widget('lblDogLevel').set_text(_me.string('at_gui_widget_lblDogLevel')) self.get_widget('lblSpyLevel').set_text(_me.string('at_gui_widget_lblSpyLevel')) self.treeview() - - def on_spinbutton1_changed(self, widget, *args): - print widget.get_text() - self.measure.dog_threshold = float(widget.get_text()) - def on_spinbutton2_changed(self, widget, *args): - self.measure.spy_threshold = float(widget.get_text()) - def treeview(self): - self.index_column = gtk.TreeViewColumn('Index') - self.index_column.set_min_width(80) + self.index_column = gtk.TreeViewColumn(_me.string('Time')) + self.index_column.set_min_width(100) self.index_cell = gtk.CellRendererText() self.index_column.pack_start(self.index_cell, True) self.index_column.add_attribute(self.index_cell, 'text', 0) - self.event_column = gtk.TreeViewColumn(_me.string('conf_lblEvent')) - self.event_column.set_min_width(190) + self.event_column = gtk.TreeViewColumn(_me.string('File')) + self.event_column.set_min_width(170) self.event_cell = gtk.CellRendererText() self.event_column.pack_start(self.event_cell, True) self.event_column.add_attribute(self.event_cell, 'text', 1) - self.type_column = gtk.TreeViewColumn(_me.string('conf_lblType')) + self.type_column = gtk.TreeViewColumn(_me.string('Duration')) self.type_column.set_min_width(80) self.type_cell = gtk.CellRendererText() self.type_column.pack_start(self.type_cell, True) @@ -75,40 +81,76 @@ self.gadget_viewer.append_column(self.index_column) self.gadget_viewer.append_column(self.event_column) self.gadget_viewer.append_column(self.type_column) + + self.gadget_viewer.connect("button_press_event", self.on_tree_button_pressed) + self.gadget_viewer.get_selection().connect("changed",self.on_treeview_selected) self.get_widget("scrolledwindow1").add(self.gadget_viewer) self.get_widget("scrolledwindow1").set_size_request(0, 150) self.get_widget("scrolledwindow1").show_all() - self.value_list.append(None, ['test', 'test', 'test']) - - - ########################################################### - # - # Event functions - # - ########################################################### - def on_window1_destroy(self, widget, *args): - _me.get_param('measure').GUI_on = False - self.measure.GUI_on = False - - - + def refresh_treeview(self, values): + self.value_list.append(None, values) + def update(self): + self.measure = Sound_Measure(float(_me.get_param('Sample'))) + _me.set_param('measure', self.measure) self.graph = Sound_Graph() - _me.set_param('graph', self.graph) - self.measure = _me.get_param('measure') - _me.get_param('measure').graph_measure = self.graph - _me.get_param('graph').measure_graph = self.measure - _me.get_param('measure').GUI_on = True + self.measure.graph_measure = self.graph + self.measure.refresh_treeview = self.refresh_treeview + self.graph.measure = self.measure + + self.monitor_id = tux.monitoring.insert(0xF0, self.measure.on_sound_level) + tux.micro.on() self.update_value() self.graph.set_size_request(400, 200) + _me.set_param('monitor_id', self.monitor_id) + _me.set_param('buffer_idx', self.measure.capture_idx) gtk.gdk.threads_enter() layout = self.get_widget('vbox2') layout.add(self.graph) layout.show_all() gtk.gdk.threads_leave() + def on_tree_button_pressed(self, widget, event): + def show_popup(p, button, time): + tux.sys.wait(0.1) + self.show_gadget_popup(p, button, time) + if event.button == 3: # right click + thread.start_new_thread(show_popup, (None, event.button, event.time)) + +#------------------------------------------------------------ +# Treeview menu +#------------------------------------------------------------ + def show_gadget_popup(self, status_icon, button, activate_time): + menu = gtk.Menu() + + item = gtk.CheckMenuItem(_me.string('Play')) + item.connect("activate", self.read_sound) + menu.append(item) + + menu.show_all() + menu.popup(None, None, None, button, activate_time) + + def on_treeview_selected(self, obj): + path = obj.get_selected_rows() + self.selected_file = path[1][0][0] + 1 + + def read_sound(self, widget): + soundcard = tux.hw.alsa_device + tux.micro.off() + tux.sys.shell("aplay -D %s /tmp/__tux-record%d.wav"%(soundcard, self.selected_file)) + tux.micro.on() + + ########################################################### + # + # Event functions + # + ########################################################### + def on_window1_destroy(self, widget, *args): + if self.measure.num > 1: + os.system('rm /tmp/__tux-record*') + def on_cbbType_changed(self, widget, *args): if self.get_widget('cbbType').get_active() == 0: self.get_widget('notebook').set_current_page(0) @@ -117,4 +159,330 @@ if self.get_widget('cbbType').get_active() == 2: self.get_widget('notebook').set_current_page(2) - + def on_spinbutton1_changed(self, widget, *args): + self.measure.dog_threshold = float(widget.get_text()) + + def on_spinbutton2_changed(self, widget, *args): + self.measure.spy_threshold = float(widget.get_text()) + + def on_chkSpy_toggled(self, widget, *args): + _me.set_param('chkSpy', widget.get_active()) + self.measure.spy_enabled = widget.get_active() + + def on_chkDog_toggled(self, widget, *args): + _me.set_param('chkDog', widget.get_active()) + self.measure.dog_enabled = widget.get_active() + + def on_chkDogDefault_toggled(self, widget, *args): + _me.set_param('chkDogDefault', widget.get_active()) + + def on_fileDogBehavior_selection_changed(self, widget, *args): + + _me.set_param('dogBehavior', widget.get_filename()) + +class Sound_Graph(gtk.DrawingArea): + def __init__(self): + super(Sound_Graph, self).__init__() + self.connect("expose_event", self.expose) + self.context = None + + def expose(self, widget, event): + self.context = widget.window.cairo_create() + self.context.rectangle(event.area.x, event.area.y, + event.area.width, event.area.height) + self.context.clip() + self.draw() + return False + + def refresh(self): + if self.window: + width,height = self.window.get_size() + self.window.invalidate_rect(gtk.gdk.Rectangle(0,0,width,height),False) + + def draw(self): + self.rect = self.get_allocation() + + self.draw_space() + self.draw_hor_div() + self.draw_ver_div() + if self.measure.dog_enabled: + self.draw_threshold(self.measure.dog_threshold, 1) + if self.measure.spy_enabled: + self.draw_threshold(self.measure.spy_threshold, 2) + self.draw_curve() + + def draw_space(self): + #draw axes + #draw a rectangle in the window area + self.context.rectangle(self.rect.x, self.rect.y, self.rect.width, self.rect.height) + #set a white background + self.context.set_source_rgb(1, 1, 1) + self.context.fill() + #draw a black border + self.context.set_source_rgb(0, 0, 0) + self.context.set_line_width(1) + self.context.stroke() + + + def draw_hor_div(self): + #draw horizontal grid with 10 div. and 10 sub-div + for i in range(20): + y = (self.rect.height / 20.0) * float(i) + #place correctly the vector + self.context.move_to(self.rect.width, y) + if i % 2 == 1: + #Minor div: no text + self.context.set_source_rgb(0.1, 0.1, 0.1) + self.context.set_line_width(0.3) + self.context.line_to(0, y) + else: + #Major div: place text + self.context.set_source_rgb(0, 0, 0) + self.context.set_line_width(0.4) + self.context.line_to(0, y) + self.context.set_source_rgb(0.15, 0.15, 0.15) + if i > 10: + self.context.show_text('-'+str((i - 10.0)/10.0)) + elif i < 10: + self.context.show_text(str((10.0 - i)/10.0)) + else: + self.context.show_text('0') + self.context.stroke() + + def draw_threshold(self, value, color): + threshold = float((value * self.rect.height/2) / 100) + threshold1 = self.rect.height / 2 + threshold + threshold2 = self.rect.height / 2 - threshold + if color == 1: + self.context.set_source_rgb(0.5, 0.5, 0) + elif color == 2: + self.context.set_source_rgb(0, 0.5, 0.5) + else: + self.context.set_source_rgb(0.5, 0.5, 0.5) + self.context.set_line_width(0.8) + self.context.move_to(self.rect.width, threshold1) + self.context.line_to(0, threshold1) + self.context.move_to(self.rect.width, threshold2) + self.context.line_to(0, threshold2) + self.context.stroke() + + def draw_ver_div(self): + #draw vertical division + #create a tab with the wanted divisions + temp_tab = [0.25, 0.5, 0.75] + for i in range(3): + self.context.set_source_rgb(0.2, 0.2, 0.2) + self.context.set_line_width(0.6) + #place correctly the vector + self.context.move_to(self.rect.width * temp_tab[i], 0) + #trace a line + self.context.line_to(self.rect.width * temp_tab[i], self.rect.height) + #replace the vector to draw text + self.context.move_to(self.rect.width * temp_tab[i], self.rect.height - 5) + #determine the time labels + txt = ((0.1 * self.measure.sample) - (0.1 * self.measure.sample * temp_tab[i])) + txt = str('%.2f' % txt) + self.context.show_text(str(txt) + " sec.") + self.context.stroke() + + def draw_curve(self): + coeff_y = float(self.rect.height / self.measure.RANGE) + coeff_x = float(self.rect.width / (self.measure.sample - 1)) + + self.fill(coeff_x, coeff_y) + + #and trace the curce + self.context.set_line_width(0.6) + self.context.set_source_rgb(0.9, 0.6,0) + self.context.move_to(self.rect.x - 2, self.rect.height + 2) + self.context.line_to(self.rect.x, self.rect.height - (self.measure.val_table_pos[0] * coeff_y)) + for i, val in enumerate(self.measure.val_table_pos): + self.context.line_to(self.rect.x + ((i) * coeff_x), self.rect.height - ((self.measure.RANGE/2 + val) * coeff_y)) + self.context.line_to(self.rect.x + ((i) * coeff_x), self.rect.height + 5) + + self.context.move_to(self.rect.x - 2, self.rect.height + 2) + self.context.line_to(self.rect.x, self.rect.height - (self.measure.val_table_pos[0] * coeff_y)) + for i, val in enumerate(self.measure.val_table_pos): + self.context.line_to(self.rect.x + ((i) * coeff_x), self.rect.height - ((self.measure.RANGE/2 - val) * coeff_y)) + self.context.line_to(self.rect.x + ((i) * coeff_x), self.rect.height + 5) + self.context.stroke() + + + + def fill(self, coeff_x, coeff_y): + #determine the coefficients to adjust the curve in the window space + self.context.move_to(self.rect.x - 2, self.rect.height / 2) + for i, val in enumerate(self.measure.val_table_pos): + self.context.line_to(self.rect.x + ((i) * coeff_x), self.rect.height - ((self.measure.RANGE/2 + val) * coeff_y)) + self.context.line_to(self.rect.x + ((i) * coeff_x), self.rect.height/2) + self.context.close_path() + self.context.set_source_rgba(0.9, 0.6, 0, 0.2) + self.context.fill() + + self.context.move_to(self.rect.x - 2, self.rect.height / 2) + for i, val in enumerate(self.measure.val_table_pos): + self.context.line_to(self.rect.x + ((i) * coeff_x), self.rect.height - ((self.measure.RANGE/2 - val) * coeff_y)) + self.context.line_to(self.rect.x + ((i) * coeff_x), self.rect.height/2) + self.context.close_path() + self.context.fill() + + +class Sound_Measure(object): + def __init__(self, sample): + self.rate = 0.1 + self.sample = sample + self.RANGE = 1024.0 + self.sample_backup = self.sample + self.val_table_pos = [0] * int(self.sample) + + self.dog_threshold = 0 + self.spy_threshold = 0 + self.dog_enabled = False + self.spy_enabled = False + self.RANGE = 1024.0 + self.notify = False + self.actuator = False + + self.__capture_buffer = [] + self.__temp_buffer = [] + self.capture_idx = tux.micro.on_buffer.connect(self.__on_capture_buffer) + self.__capture_path = '' + self.num = 1 + self.__capture_start = False + self.__stop = False + self.__delay_to_stop = time.time() + self.__write_mutex = threading.Lock() + self.__capture_mutex = threading.Lock() + self.__time = '' + self.__duration = 0.0 + self.__start_flag = False + + + ########################################################### + # + # Events control + # + ########################################################### + def event_control(self): + if self.spy_enabled and self.__capture_start == False and self.actuator == False: + if self.Increase_control(self.spy_threshold): + self.record_sound() + + if self.dog_enabled and self.actuator == False: + if self.Increase_control(self.dog_threshold): + self.notify = True + self.actuator = True + + + ########################################################### + # + # Threshold control + # + ########################################################### + def Increase_control(self, value): + val_act = ((self.val_table_pos[len(self.val_table_pos)-1])*100) / (self.RANGE/2) + val_prev = ((self.val_table_pos[len(self.val_table_pos)-2])*100) / (self.RANGE/2) + if val_prev <= value and val_act > value: + return True + + ########################################################### + # + # Acquire & Recording + # + ########################################################### + def on_sound_level(self, args): + try: + if self.sample_backup != self.sample: + self.sample = self.sample_backup + self.val_table_pos = [512] * int(self.sample) + + val = (args[1] + args[2] + args[3] + args[4]) + self.val_table_pos.append(val) + self.val_table_pos.pop(0) + self.graph_measure.refresh() + self.event_control() + except: + print sys.exc_info() + + + def __on_capture_buffer(self, buffer): + if self.__write_mutex.locked(): + return + + self.__write_mutex.acquire() + + if self.__capture_start == False: + for val in buffer: + self.__temp_buffer.append(val) + if len(self.__temp_buffer) > 1600: + for i in range(800): + self.__temp_buffer.pop(0) + + else: + if self.__start_flag: + self.__start_flag = False + self.__capture_buffer = self.__temp_buffer + self.__temp_buffer = [] + + for val in buffer: + self.__capture_buffer.append(val) + + val_act = ((self.val_table_pos[len(self.val_table_pos)-1])*100) / (self.RANGE/2) + if val_act < self.spy_threshold and self.__stop == False: + self.__delay_to_stop = time.time() + 0.2 + self.__stop = True + elif val_act > self.spy_threshold and self.__stop: + self.__stop = False + + if (time.time() >= self.__delay_to_stop) and self.__stop: + self.__stop = False + self.__capture_start = False + time.sleep(0.2) + self.__write_capture() + duration = time.time() - self.__duration + self.refresh_treeview([self.__time, 'record%d.wav'%self.num, '%.1f sec.'%duration]) + self.num += 1 + self.capture_buffer = [] + + self.__write_mutex.release() + + def __write_capture(self): + freqech = 8000 + sound_str = "" + for val in self.__capture_buffer: + sound_str += chr(val) + + wavfile = wave.open(self.__capture_path, 'w') + wavfile.setparams((1, 1, freqech , len(self.__capture_buffer), 'NONE', 'not compressed')) + wavfile.writeframes(sound_str) + wavfile.close() + + + def record_sound(self): + self.__capture_buffer = [] + if self.__capture_start: + return + act_time = time.localtime() + act_time = [act_time[3], act_time[4], act_time[5]] + if act_time[2]<10: + act_time[2] = '0%d'%act_time[2] + else: + act_time[2] = str(act_time[2]) + if act_time[1]<10: + act_time[1] = '0%d'%act_time[1] + else: + act_time[1] = str(act_time[1]) + if act_time[0]<10: + act_time[0] = '0%d'%act_time[0] + else: + act_time[0] = str(act_time[0]) + + self.__time = act_time[0] + ':' + act_time[1] + ':' + act_time[2] + self.__duration = time.time() + self.__capture_path = '/tmp/__tux-record%d.wav'%self.num + self.__capture_start = True + self.__start_flag = True + + + + Deleted: software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/Sound_class.py =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/Sound_class.py 2007-12-05 16:14:55 UTC (rev 750) +++ software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/Sound_class.py 2007-12-05 16:28:39 UTC (rev 751) @@ -1,379 +0,0 @@ -import gtk -import sys -import time -import os -import threading -import thread -import math -sys.path.append('/opt/tuxdroid/api/python') -from tux import * - -class Sound_Graph(gtk.DrawingArea): - def __init__(self): - super(Sound_Graph, self).__init__() - self.connect("expose_event", self.expose) - self.context = None - - def expose(self, widget, event): - self.context = widget.window.cairo_create() - self.context.rectangle(event.area.x, event.area.y, - event.area.width, event.area.height) - self.context.clip() - self.draw() - return False - - def refresh(self): - if self.window: - width,height = self.window.get_size() - self.window.invalidate_rect(gtk.gdk.Rectangle(0,0,width,height),False) - - def draw(self): - self.rect = self.get_allocation() - - self.draw_space() - self.draw_hor_div() - self.draw_ver_div() - if self.measure_graph.dog_threshold: - self.draw_threshold(self.measure_graph.dog_threshold, 1) - if self.measure_graph.spy_threshold: - self.draw_threshold(self.measure_graph.spy_threshold, 2) - self.draw_curve() - - def draw_space(self): - #draw axes - #draw a rectangle in the window area - self.context.rectangle(self.rect.x, self.rect.y, self.rect.width, self.rect.height) - #set a white background - self.context.set_source_rgb(1, 1, 1) - self.context.fill() - #draw a black border - self.context.set_source_rgb(0, 0, 0) - self.context.set_line_width(1) - self.context.stroke() - - - def draw_hor_div(self): - #draw horizontal grid with 10 div. and 10 sub-div - for i in range(20): - y = (self.rect.height / 20.0) * float(i) - #place correctly the vector - self.context.move_to(self.rect.width, y) - if i % 2 == 1: - #Minor div: no text - self.context.set_source_rgb(0.1, 0.1, 0.1) - self.context.set_line_width(0.3) - self.context.line_to(0, y) - else: - #Major div: place text - self.context.set_source_rgb(0, 0, 0) - self.context.set_line_width(0.4) - self.context.line_to(0, y) - self.context.set_source_rgb(0.15, 0.15, 0.15) - if i > 10: - self.context.show_text('-'+str((i - 10.0)/10.0)) - elif i < 10: - self.context.show_text(str((10.0 - i)/10.0)) - else: - self.context.show_text('0') - self.context.stroke() - - def draw_threshold(self, value, color): - threshold = float((value * self.rect.height/2) / 100) - threshold1 = self.rect.height / 2 + threshold - threshold2 = self.rect.height / 2 - threshold - if color == 1: - self.context.set_source_rgb(0.5, 0.5, 0) - elif color == 2: - self.context.set_source_rgb(0, 0.5, 0.5) - else: - self.context.set_source_rgb(0.5, 0.5, 0.5) - self.context.set_line_width(0.8) - self.context.move_to(self.rect.width, threshold1) - self.context.line_to(0, threshold1) - self.context.move_to(self.rect.width, threshold2) - self.context.line_to(0, threshold2) - self.context.stroke() - - def draw_ver_div(self): - #draw vertical division - #create a tab with the wanted divisions - temp_tab = [0.25, 0.5, 0.75] - for i in range(3): - self.context.set_source_rgb(0.2, 0.2, 0.2) - self.context.set_line_width(0.6) - #place correctly the vector - self.context.move_to(self.rect.width * temp_tab[i], 0) - #trace a line - self.context.line_to(self.rect.width * temp_tab[i], self.rect.height) - #replace the vector to draw text - self.context.move_to(self.rect.width * temp_tab[i], self.rect.height - 5) - #determine the time labels - txt = ((0.1 * self.measure_graph.sample) - (0.1 * self.measure_graph.sample * temp_tab[i])) - txt = str('%.2f' % txt) - self.context.show_text(str(txt) + " sec.") - self.context.stroke() - - def draw_curve(self): - coeff_y = float(self.rect.height / self.measure_graph.RANGE) - coeff_x = float(self.rect.width / (self.measure_graph.sample - 1)) - - self.fill(coeff_x, coeff_y) - - #and trace the curce - self.context.set_line_width(0.6) - self.context.set_source_rgb(0.9, 0.6, 0.5) - self.context.move_to(self.rect.x - 2, self.rect.height + 2) - self.context.line_to(self.rect.x, self.rect.height - (self.measure_graph.val_table_pos[0] * coeff_y)) - temp_event = 0 - for i, val in enumerate(self.measure_graph.val_table_pos): - self.context.line_to(self.rect.x + ((i) * coeff_x), self.rect.height - (val * coeff_y)) - self.context.line_to(self.rect.x + ((i) * coeff_x), self.rect.height + 5) - - self.context.move_to(self.rect.x - 2, self.rect.height + 2) - self.context.line_to(self.rect.x, self.rect.height - (self.measure_graph.val_table_neg[0] * coeff_y)) - temp_event = 0 - for i, val in enumerate(self.measure_graph.val_table_neg): - self.context.line_to(self.rect.x + ((i) * coeff_x), self.rect.height - (val * coeff_y)) - self.context.line_to(self.rect.x + ((i) * coeff_x), self.rect.height + 5) - self.context.stroke() - - - - def fill(self, coeff_x, coeff_y): - #determine the coefficients to adjust the curve in the window space - self.context.move_to(self.rect.x - 2, self.rect.height / 2) - for i, val in enumerate(self.measure_graph.val_table_pos): - self.context.line_to(self.rect.x + ((i) * coeff_x), self.rect.height - (val * coeff_y)) - self.context.line_to(self.rect.x + ((i) * coeff_x), self.rect.height/2) - self.context.close_path() - self.context.set_source_rgba(0.9, 0.6, 0.5, 0.2) - self.context.fill() - - self.context.move_to(self.rect.x - 2, self.rect.height / 2) - for i, val in enumerate(self.measure_graph.val_table_neg): - self.context.line_to(self.rect.x + ((i) * coeff_x), self.rect.height - (val * coeff_y)) - self.context.line_to(self.rect.x + ((i) * coeff_x), self.rect.height/2) - self.context.close_path() - self.context.fill() - - -class Sound_Measure(object): - def __init__(self, sample): - self.rate = 0.1 - self.sample = sample - self.RANGE = 1024.0 - self.sample_backup = self.sample - self.val_table_pos = [int(self.RANGE / 2)] * int(self.sample) - self.val_table_neg = [int(self.RANGE / 2)] * int(self.sample) - self.test_tab = [0] - self.disable_event = False - - self.dog_threshold = 0 - self.spy_threshold = 0 - self.tick = time.time() + 1 - self.average = 0 - self.count = 0 - self.GUI_on = False - self.start_flag = True - self.wait = time.time() + 2.0 - self.RANGE = 1024.0 - self.__on_sound_mutex = threading.Lock() - self.__timeout_mutex = threading.Lock() - - - ########################################################### - # - # Events control - # - ########################################################### - def event_control(self): - if self.GUI_on: - self.__tab = self.test_tab - - for i in range (len(self.__tab)): - val = 50 - self.Threshold_control(i, val) - #self.Change_control(i, val) - - self.test_tab = self.__tab - - - # To prevent notifications at startup - if self.start_flag == True or self.disable_event == True: - self.start_flag = False - self.test_tab[0][7] = False - self.disable_event = False - self.start_flag = False - for i in range (len(self.event_tab)): - self.event_tab[i][7] = False - - - - - ########################################################### - # - # Threshold control - # - ########################################################### - def Threshold_control(self, index, val): - if self.__tab[index][1] == 1: - if self.__tab[index][7] != True: - if self.__tab[index][2] == 0: - #Increasing threshold control - if self.Increase_control(val) == True: - self.__tab[index][7] = True - elif self.__tab[index][2] == 1: - #Decreasing threshold control - if self.Decrease_control(val) == True: - self.__tab[index][7] = True - elif self.__tab[index][2] == 2: - #Both direction theshold control - if self.Both_control(val) == True: - self.__tab[index][7] = True - - def Increase_control(self, value): - print 'enter' - val_act = ((self.val_table_pos[len(self.val_table_pos)-1]-512)*100) / (self.RANGE/2) - val_prev = ((self.val_table_pos[len(self.val_table_pos)-2]-512)*100) / (self.RANGE/2) - if val_prev <= value and val_act > value: - print 'OK' - return True - - - def Decrease_control(self, val): - val_act = (self.val_table_pos[len(self.val_table_pos)-1]*100) / (self.RANGE/2) - val_prev = (self.val_table_pos[len(self.val_table_pos)-2]*100) / (self.RANGE/2) - if val_prev >= val and val_act < val: - return True - - def Both_control(self, val): - val_act = (self.val_table_pos[int(len(self.val_table_pos)-1)]*100) / (self.RANGE/2) - val_prev = (self.val_table_pos[int(len(self.val_table_pos)-2)]*100) / (self.RANGE/2) - if val_prev <= val and val_act > val or val_prev >= val and val_act < val: - return True - - - ########################################################### - # - # Changes control - # - ########################################################### - def Change_control(self, i, val): - #Changements control - if self.__tab[i][1] == 0: - pts_per_sec = self.sample / (self.rate * self.sample) - time = int(self.__tab[i][4] * pts_per_sec) - if self.__tab[i][7] != True: - # Drop change part : - if self.__tab[i][2] == 0: - if self.Drop_control(time, val, self.__tab[i][8], i) == True: - self.__tab[i][7] = True - # Raise change part - if self.__tab[i][2] == 1: - if self.Raise_control(time, val, self.__tab[i][8], i) == True: - self.__tab[i][7] = True - ''' - # Drop and Raise change - if self.__tab[i][2] == 2: - if self.ChangeD_control(time, val, self.__tab[i][8], i) == True: - self.__tab[i][7] = True - # Raise and Drop change - if self.__tab[i][2] == 3: - if self.ChangeU_control(time, val, self.__tab[i][8], i) == True: - self.__tab[i][7] = True - ''' - - - def Drop_control(self, time, val, timeout, index): - #timeout control : to prevent multiple notifications with the same event - if timeout != 0: - timeout -= 1 - init_val = len(self.val_table_pos) - 1 - int(time) + timeout - maximum = max(self.val_table_pos[init_val:len(self.val_table_pos)-1]) - - if maximum >= self.val_table_pos[len(self.val_table_pos)-1] + ((val/100)*self.RANGE): - self.__tab[index][8] = int(time) - return True - else: - self.__tab[index][8] = timeout - - def Raise_control(self, time, val, timeout, index): - if timeout != 0: - timeout -= 1 - init_val = len(self.val_table_pos) - 1 - int(time) + timeout - minimum = min(self.val_table_pos[init_val:(len(self.val_table_pos)-1)]) - if minimum <= self.val_table_pos[len(self.val_table_pos)-1] - ((val/100)*self.RANGE): - self.__tab[index][8] = int(time) - return True - else: - self.__tab[index][8] = timeout - - - ########################################################### - # - # Test functions - # - ########################################################### - def test_notification(self): - if self.test_tab[0][7] == True: - self.test_tab[0][7] = False - if self.test_tab[0][5] == True: - path = self.test_tab[0][6] - path = path.replace('%20', ' ') - if os.path.isfile(path) and os.path.exists(path): - path = self.test_tab[0][6] - path = "'%s'" % path - tux.sys.shell_free(path) - elif self.test_tab[0][1] == 0: - thread.start_new_thread(self.test_default_behavior, (self.changetext,)) - elif self.test_tab[0][1] == 1: - thread.start_new_thread(self.test_default_behavior, (self.thresholdtext,)) - - def test_default_behavior(self, txt): - tux.cmd.mouth_open() - tux.tts.speak(txt) - tux.cmd.mouth_close() - - ########################################################### - # - # Acquire - # - ########################################################### - def on_sound_level(self, args): - if self.__on_sound_mutex.locked(): - return - self.__on_sound_mutex.acquire() - - if self.sample_backup != self.sample: - self.sample = self.sample_backup - self.val_table_pos = [] * int(self.sample) - self.val_table_neg = [int(self.RANGE/2)] * int(self.sample) - - - val = (args[1] + args[2] + args[3] + args[4]) - print val - self.val_table_pos.append(self.RANGE/2 + val) - self.val_table_neg.append(self.RANGE/2 - val) - self.val_table_pos.pop(0) - self.val_table_neg.pop(0) - - - try: - #If widget GUI is displayed, refresh the graph. - if self.GUI_on: - self.graph_measure.refresh() - except: - print 'graph' - print sys.exc_info() - #And check for events - try: - self.event_control() - except: - print 'events' - print sys.exc_info() - self.__on_sound_mutex.release() - - - - - Modified: software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/init.pyp =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/init.pyp 2007-12-05 16:14:55 UTC (rev 750) +++ software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/init.pyp 2007-12-05 16:28:39 UTC (rev 751) @@ -1,25 +1 @@ -sys.path.append(_me.get_path('root') + '/Scripts/Python') -from Sound_class import Sound_Measure - -measure = Sound_Measure(float(_me.get_param('Sample'))) -_me.set_param('measure', measure) - -# update the sample and rate values - -measure.sample = float(_me.get_param('Sample')) -measure.sample_backup = measure.sample - -measure.test_tab = _me.get_param('test_tab') -monitor_id = tux.monitoring.insert(0xF0, measure.on_sound_level) -_me.set_param('monitor_id', monitor_id) -tux.micro.on() - - -def destroy(): - tux.monitoring.remove(_me.get_param('monitor_id')) - -_me.insert_funct('destroy', destroy) - - - - +pass Modified: software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/main.pyp =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/main.pyp 2007-12-05 16:14:55 UTC (rev 750) +++ software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/main.pyp 2007-12-05 16:28:39 UTC (rev 751) @@ -1,5 +1,28 @@ -def update_informations(): - pass +import os + +def on_standby(): + gdg_dict = _me.get_param('dict') + for keys in gdg_dict: + gadgets[keys].notify.set_active(gdg_dict[keys]) + tux.micro.off() + tux.cmd.mouth_close() + tux.event.on_remote_bt[K_STANDBY] = None + tux.monitoring.remove(_me.get_param('monitor_id')) + tux.micro.on_buffer.disconnect(_me.get_param('buffer_idx')) + _me.gui('widget').hide_from_main() + _me.exit_main_loop() +gdg_dict = {} +for Gdgname in gadgets.keys(): + if Gdgname != 'sound_monitor' and Gdgname != 'Manager': + gdg_dict[Gdgname] = gadgets[Gdgname].get_var('notified') + gadgets[Gdgname].notify.set_active(False) + + +_me.set_param('dict', gdg_dict) +tux.cmd.mouth_open() +tux.event.on_remote_bt[K_STANDBY] = on_standby +_me.gui('widget').show_from_main() +_me.run_main_loop() Modified: software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/notify.pyp =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/notify.pyp 2007-12-05 16:14:55 UTC (rev 750) +++ software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/notify.pyp 2007-12-05 16:28:39 UTC (rev 751) @@ -1,8 +1,27 @@ -def notify_checker(): - return False +def notify_checker(): + if _me.get_param('measure'): + measure = _me.get_param('measure') + if measure.notify: + measure.notify = False + return True + else: + return False + else: + return False - - def notify_actuator(): - pass + measure = _me.get_param('measure') + if _me.get_param('chkDogDefault') == False: + tux.cmd.wings_on_free(10) + for i in range(5): + tux.cmd.sound_play(14) + tux.sys.wait(0.7) + tux.sys.wait(1) + else: + path = _me.get_param('dogBehavior') + if os.path.exists(path) and os.path.isfile(path): + tux.sys.shell(path) + measure.actuator = False + + Modified: software/gadgets/sound_monitor/trunk/audio_monitor/Strings/fr_ALL.xml =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/Strings/fr_ALL.xml 2007-12-05 16:14:55 UTC (rev 750) +++ software/gadgets/sound_monitor/trunk/audio_monitor/Strings/fr_ALL.xml 2007-12-05 16:28:39 UTC (rev 751) @@ -1,21 +1,24 @@ <?xml version='1.0' encoding='UTF-8'?> <strings> <at_gui_widget_lblSpyLevel type='str'>Spy level</at_gui_widget_lblSpyLevel> - <at_gui_widget_cbbRecord type='str'>Recorded files</at_gui_widget_cbbRecord> - <at_gui_widget_cbbDog type='str'>Dog mode</at_gui_widget_cbbDog> + <Play type='str'>Lecture</Play> + <at_gui_widget_cbbRecord type='str'>Sons enregistrés</at_gui_widget_cbbRecord> + <at_gui_widget_cbbDog type='str'>Chien de garde</at_gui_widget_cbbDog> <name_to_read type='str'>Moniteur de son</name_to_read> <at_gui_conf_label6 type='str'>Cancel</at_gui_conf_label6> <at_gui_conf_label5 type='str'>Accept</at_gui_conf_label5> - <at_gui_widget_chkDog type='str'>Dog mode enable</at_gui_widget_chkDog> + <at_gui_widget_chkDog type='str'>Activer le mode chien de garde</at_gui_widget_chkDog> <at_gui_widget_lblDogLevel type='str'>Dog level</at_gui_widget_lblDogLevel> - <at_gui_widget_chkSpyRecord type='str'>Enable recording</at_gui_widget_chkSpyRecord> + <Duration type='str'>Durée</Duration> + <Time type='str'>Heure</Time> <at_gui_conf_label13 type='str'>Delay (sec) :</at_gui_conf_label13> <at_gui_conf_label12 type='str'>Updates</at_gui_conf_label12> - <at_gui_widget_chkDogBehavior type='str'>Enable Dog notification</at_gui_widget_chkDogBehavior> + <File type='str'>Fichier</File> + <at_gui_widget_chkDogDefault type='str'>Utiliser un script :</at_gui_widget_chkDogDefault> <help_text type='str'> </help_text> - <at_gui_widget_cbbSpy type='str'>Spy mode</at_gui_widget_cbbSpy> + <at_gui_widget_cbbSpy type='str'>Mode espion</at_gui_widget_cbbSpy> <speaker_name type='str'>Bruno8k</speaker_name> - <at_gui_widget_chkDogDefault type='str'>Default Behavior</at_gui_widget_chkDogDefault> - <at_gui_widget_chkSpy type='str'>Enable the spy mode</at_gui_widget_chkSpy> + <vr_Sound type='str'>Sound</vr_Sound> + <at_gui_widget_chkSpy type='str'>Activer le mode espion</at_gui_widget_chkSpy> </strings> Modified: software/gadgets/sound_monitor/trunk/audio_monitor/settings.xml =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/settings.xml 2007-12-05 16:14:55 UTC (rev 750) +++ software/gadgets/sound_monitor/trunk/audio_monitor/settings.xml 2007-12-05 16:28:39 UTC (rev 751) @@ -1,9 +1,15 @@ <?xml version='1.0' encoding='UTF-8'?> <settings> <parameters> + <spinDog type='int'>30</spinDog> + <chkDogBehavior type='bool'>False</chkDogBehavior> + <MainScript type='str'>None</MainScript> + <chkSpy type='bool'>False</chkSpy> + <chkDog type='bool'>True</chkDog> <Sample type='float'>600.0</Sample> - <test_tab type='list'>[[1, 0, 0, 0.10000000000000001, 20.0, True, None, False, 0]]</test_tab> - <MainScript type='str'>None</MainScript> + <chkSpyRecord type='bool'>False</chkSpyRecord> + <chkDogDefault type='bool'>False</chkDogDefault> + <spinSpy type='int'>40</spinSpy> </parameters> <general> <have_settings_part type='bool'>True</have_settings_part> @@ -19,10 +25,10 @@ </gui_state> <language type='str'>en_US</language> <notified type='bool'>True</notified> - <notify_delay type='int'>1</notify_delay> + <notify_delay type='int'>10</notify_delay> <framework_version type='str'>0.0.0</framework_version> <menu_active type='bool'>True</menu_active> - <have_widget_part type='bool'>True</have_widget_part> + <have_widget_part type='bool'>False</have_widget_part> <speaker type='int'>3</speaker> <pitch type='int'>100</pitch> <have_main_part type='bool'>True</have_main_part> Modified: software/gadgets/sound_monitor/trunk/audio_monitor/strings.xml =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/strings.xml 2007-12-05 16:14:55 UTC (rev 750) +++ software/gadgets/sound_monitor/trunk/audio_monitor/strings.xml 2007-12-05 16:28:39 UTC (rev 751) @@ -1,21 +1,24 @@ <?xml version='1.0' encoding='UTF-8'?> <strings> <at_gui_widget_lblSpyLevel type='str'>Level</at_gui_widget_lblSpyLevel> + <Play type='str'>Play</Play> <at_gui_widget_cbbRecord type='str'>Recorded files</at_gui_widget_cbbRecord> - <at_gui_widget_cbbDog type='str'>Dog mode</at_gui_widget_cbbDog> + <at_gui_widget_cbbDog type='str'>Guard dog mode</at_gui_widget_cbbDog> <name_to_read type='str'>Audio monitor</name_to_read> <at_gui_conf_label6 type='str'>Cancel</at_gui_conf_label6> <at_gui_conf_label5 type='str'>Accept</at_gui_conf_label5> - <at_gui_widget_chkDog type='str'>Enable the dog mode</at_gui_widget_chkDog> + <at_gui_widget_chkDog type='str'>Enable the guard dog mode</at_gui_widget_chkDog> <at_gui_widget_lblDogLevel type='str'>Level</at_gui_widget_lblDogLevel> - <at_gui_widget_chkSpyRecord type='str'>Enable recording</at_gui_widget_chkSpyRecord> + <Duration type='str'>Duration</Duration> + <Time type='str'>Hour</Time> <at_gui_conf_label13 type='str'>Delay (sec) :</at_gui_conf_label13> <at_gui_conf_label12 type='str'>Updates</at_gui_conf_label12> - <at_gui_widget_chkDogBehavior type='str'>Enable behavior</at_gui_widget_chkDogBehavior> + <File type='str'>File</File> + <at_gui_widget_chkSpy type='str'>Enable the spy mode</at_gui_widget_chkSpy> <help_text type='str'> </help_text> <at_gui_widget_cbbSpy type='str'>Spy mode</at_gui_widget_cbbSpy> - <at_gui_widget_chkSpy type='str'>Enable the spy mode</at_gui_widget_chkSpy> - <at_gui_widget_chkDogDefault type='str'>Default behavior</at_gui_widget_chkDogDefault> + <vr_Sound type='str'>Sound</vr_Sound> + <at_gui_widget_chkDogDefault type='str'>Use an external script</at_gui_widget_chkDogDefault> <speaker_name type='str'>Ryan8k</speaker_name> </strings> Modified: software/gadgets/sound_monitor/trunk/audio_monitor.tgf =================================================================== (Binary files differ) |
From: jaguarondi <c2m...@c2...> - 2007-12-05 16:15:12
|
Author: jaguarondi Date: 2007-12-05 17:14:55 +0100 (Wed, 05 Dec 2007) New Revision: 750 Modified: firmware/tuxcore/trunk/ir.c firmware/tuxcore/trunk/standalone.c Log: * Added a protection on IR RC5 receiver code so that only codes from kysoh's remote are considered valid. The IR code needs to be refactored so for now I prefer to reject false triggerings rather than try to support usages we don't really need right now. Modified: firmware/tuxcore/trunk/ir.c =================================================================== --- firmware/tuxcore/trunk/ir.c 2007-12-03 16:33:46 UTC (rev 749) +++ firmware/tuxcore/trunk/ir.c 2007-12-05 16:14:55 UTC (rev 750) @@ -164,8 +164,11 @@ } else { - gStatus.ir = irReceivedCode; /* Updates global Status */ - gStatus.ir |= GSTATUS_IR_VALID; /* set valid bit */ + /* Update global status */ + gStatus.ir = ((uint8_t)irReceivedCode & 0x3F); + /* Check if the code comes from our remote control. */ + if ((irReceivedCode & 0x07C0) == 0x0740) + gStatus.ir |= GSTATUS_IR_VALID; /* set valid bit */ if (irReceivedCode & 0x0800) gStatus.ir |= GSTATUS_IR_TOGGLE; /* set toggle bit */ else Modified: firmware/tuxcore/trunk/standalone.c =================================================================== --- firmware/tuxcore/trunk/standalone.c 2007-12-03 16:33:46 UTC (rev 749) +++ firmware/tuxcore/trunk/standalone.c 2007-12-05 16:14:55 UTC (rev 750) @@ -223,7 +223,7 @@ /* IR signal processing */ /* put here things that should be done only once when a button is pushed */ - if (gStatus.ir != ir_oldvalue) + if (gStatus.ir != ir_oldvalue && gStatus.ir & GSTATUS_IR_VALID) { ir_command = gStatus.ir & GSTATUS_IR_COMMAND; ir_toggle = gStatus.ir & GSTATUS_IR_TOGGLE; |
From: Paul_R <c2m...@c2...> - 2007-12-03 16:33:48
|
Author: Paul_R Date: 2007-12-03 17:33:46 +0100 (Mon, 03 Dec 2007) New Revision: 749 Modified: software/gadgets/settings/trunk/settings.tgf software/gadgets/settings/trunk/settings/Scripts/Python/GUI/widget/other.pyp software/gadgets/settings/trunk/settings/about.xml software/gadgets/settings/trunk/settings/settings.xml software/gadgets/settings/trunk/settings/strings.xml Log: * Fixed a bug in the sound programming sequence Modified: software/gadgets/settings/trunk/settings/Scripts/Python/GUI/widget/other.pyp =================================================================== --- software/gadgets/settings/trunk/settings/Scripts/Python/GUI/widget/other.pyp 2007-12-03 16:31:43 UTC (rev 748) +++ software/gadgets/settings/trunk/settings/Scripts/Python/GUI/widget/other.pyp 2007-12-03 16:33:46 UTC (rev 749) @@ -819,9 +819,7 @@ self.get_widget('progressbar1').set_fraction(current) current = current + fraction tux.cmd.sound_erase() - tux.sys.wait(1) - while tux.status.sound_record()[0] != 0: tux.sys.wait(0.1) @@ -831,12 +829,8 @@ self.get_widget('progressbar1').set_fraction(current) self.get_widget('lblSoundState').set_text(_me.string('soundProg')+str(i+1)) tux.cmd.sound_storing() - while tux.status.sound_record()[0] != 1: - tux.sys.wait(0.1) tux.sys.shell("aplay -D %s %s"%(soundcard, sound_table[i])) - while tux.status.sound_record()[0] != 2: - tux.sys.wait(0.1) - + tux.sys.wait(0.1) tux.cmd.sound_confirm(True) current = current + fraction tux.sys.wait(0.1) @@ -851,6 +845,8 @@ # On "play" flash sound button clicked #-------------------------------------------------------------------------- def on_wave_internal_play_bt_clicked(self, widget, *args): + if self.__sound_mutex.locked(): + return def _funct(): index=self.get_widget("spinbutton7").get_value() tux.cmd.sound_play(int(index),0) @@ -861,60 +857,80 @@ # On "play flash sound number 1" button clicked #-------------------------------------------------------------------------- def on_wave_internal_play1_clicked(self, widget, *args): + if self.__sound_mutex.locked(): + return thread.start_new_thread(tux.cmd.sound_play,(1,0,)) #-------------------------------------------------------------------------- # On "play flash sound number 2" button clicked #-------------------------------------------------------------------------- def on_wave_internal_play2_clicked(self, widget, *args): + if self.__sound_mutex.locked(): + return thread.start_new_thread(tux.cmd.sound_play,(2,0,)) #-------------------------------------------------------------------------- # On "play flash sound number 3" button clicked #-------------------------------------------------------------------------- def on_wave_internal_play3_clicked(self, widget, *args): + if self.__sound_mutex.locked(): + return thread.start_new_thread(tux.cmd.sound_play,(3,0,)) #-------------------------------------------------------------------------- # On "play flash sound number 4" button clicked #-------------------------------------------------------------------------- def on_wave_internat_play4_clicked(self, widget, *args): + if self.__sound_mutex.locked(): + return thread.start_new_thread(tux.cmd.sound_play,(4,0,)) #-------------------------------------------------------------------------- # On "play flash sound number 5" button clicked #-------------------------------------------------------------------------- def on_wave_internal_play5_clicked(self, widget, *args): + if self.__sound_mutex.locked(): + return thread.start_new_thread(tux.cmd.sound_play,(5,0,)) #-------------------------------------------------------------------------- # On "play flash sound number 6" button clicked #-------------------------------------------------------------------------- def on_wave_internal_play6_clicked(self, widget, *args): + if self.__sound_mutex.locked(): + return thread.start_new_thread(tux.cmd.sound_play,(6,0,)) #-------------------------------------------------------------------------- # On "play flash sound number 7" button clicked #-------------------------------------------------------------------------- def on_wave_internal_play7_clicked(self, widget, *args): + if self.__sound_mutex.locked(): + return thread.start_new_thread(tux.cmd.sound_play,(7,0,)) #-------------------------------------------------------------------------- # On "play flash sound number 8" button clicked #-------------------------------------------------------------------------- def on_wave_internal_play8_clicked(self, widget, *args): + if self.__sound_mutex.locked(): + return thread.start_new_thread(tux.cmd.sound_play,(8,0,)) #-------------------------------------------------------------------------- # On "play flash sound number 9" button clicked #-------------------------------------------------------------------------- def on_wave_internal_play9_clicked(self, widget, *args): + if self.__sound_mutex.locked(): + return thread.start_new_thread(tux.cmd.sound_play,(9,0,)) #-------------------------------------------------------------------------- # On "play flash sound number 10" button clicked #-------------------------------------------------------------------------- def on_wave_internal_play10_clicked(self, widget, *args): + if self.__sound_mutex.locked(): + return thread.start_new_thread(tux.cmd.sound_play,(10,0,)) #-------------------------------------------------------------------------- Modified: software/gadgets/settings/trunk/settings/about.xml =================================================================== (Binary files differ) Modified: software/gadgets/settings/trunk/settings/settings.xml =================================================================== --- software/gadgets/settings/trunk/settings/settings.xml 2007-12-03 16:31:43 UTC (rev 748) +++ software/gadgets/settings/trunk/settings/settings.xml 2007-12-03 16:33:46 UTC (rev 749) @@ -14,14 +14,14 @@ <visible type='bool'>True</visible> <x type='int'>0</x> </widget> + <conf> + <visible type='bool'>False</visible> + </conf> <selftest> <y type='int'>25</y> <visible type='bool'>True</visible> <x type='int'>0</x> </selftest> - <conf> - <visible type='bool'>False</visible> - </conf> </gui_state> <language type='str'>en_US</language> <notified type='bool'>True</notified> Modified: software/gadgets/settings/trunk/settings/strings.xml =================================================================== --- software/gadgets/settings/trunk/settings/strings.xml 2007-12-03 16:31:43 UTC (rev 748) +++ software/gadgets/settings/trunk/settings/strings.xml 2007-12-03 16:33:46 UTC (rev 749) @@ -16,14 +16,14 @@ <itemCPU type='str'>Flash the CPUs</itemCPU> <btnSoundPlayMic type='str'>Play</btnSoundPlayMic> <btnUpdate type='str'>Check for updates</btnUpdate> - <btnSoundRecordMic type='str'>Record</btnSoundRecordMic> + <FVersion type='str'>Version can't be read</FVersion> <gui_conf_about_title type='str'>About</gui_conf_about_title> <chkSoundOriginal type='str'>Include originals</chkSoundOriginal> <btnSoundClear type='str'>Clear list</btnSoundClear> <Sound1 type='str'>Be sure that the sound volume control is at the maximum.</Sound1> <lblIDNum type='str'>Tux's ID : </lblIDNum> - <Sound type='str'>Have you heard the sound ?</Sound> + <SVN type='str'>SVN</SVN> <lblSleepDelay type='str'>Active the sleep mode after a inactivity period of</lblSleepDelay> <itemDescription type='str'>Show the description</itemDescription> <lblConfigTest type='str'>Self tests</lblConfigTest> @@ -46,7 +46,7 @@ <Connect type='str'>Please connect the power plug and press the 'Yes' button</Connect> <lblSoundExternal type='str'>Play external wave file</lblSoundExternal> - <lblSoundStore type='str'>Store wave files locally</lblSoundStore> + <gui_conf_version_lb type='str'>Version</gui_conf_version_lb> <btnSleepSleep type='str'>Sleep</btnSleepSleep> <gui_conf_remote_set_bt type='str'>Set</gui_conf_remote_set_bt> <lblUsedChannel type='str'>Your wifi use the channel :</lblUsedChannel> @@ -60,11 +60,11 @@ <Start type='str'>Start</Start> <treeFile type='str'>Fichier</treeFile> <lblSoundLocal type='str'>Play local wave files</lblSoundLocal> - <gui_conf_version_lb type='str'>Version</gui_conf_version_lb> + <lblSoundStore type='str'>Store wave files locally</lblSoundStore> <gui_conf_update_title type='str'>Update</gui_conf_update_title> <lblTabConfig type='str'>Configuration</lblTabConfig> <gui_conf_cancel_bt type='str'>Cancel</gui_conf_cancel_bt> - <FVersion type='str'>Version can't be read</FVersion> + <btnSoundRecordMic type='str'>Record</btnSoundRecordMic> <btnSleepWakeup type='str'>Wakeup</btnSleepWakeup> <btnCancelT type='str'>No</btnCancelT> <itemChangeLog type='str'>Show ChangeLog</itemChangeLog> @@ -84,7 +84,7 @@ To do this, you need to connect loudspeakers in the green connector, and press the 'Yes' button.</Out> - <SVN type='str'>SVN</SVN> + <Sound type='str'>Have you heard the sound ?</Sound> <btnOKT type='str'>Yes</btnOKT> <Mic type='str'>After closing this window, say anything to Tux.</Mic> <btnStopT type='str'>Stop</btnStopT> Modified: software/gadgets/settings/trunk/settings.tgf =================================================================== (Binary files differ) |
From: Paul_R <c2m...@c2...> - 2007-12-03 16:31:48
|
Author: Paul_R Date: 2007-12-03 17:31:43 +0100 (Mon, 03 Dec 2007) New Revision: 748 Added: software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/beak_closed.png software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/beak_open.png software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/eyes_closed.png software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/led_off.png software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/led_on.png software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/spin_left.png software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/spin_off.png software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/spin_right.png software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/wings_down.png software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/wings_up.png Modified: software/gadgets/tux_controller/trunk/TuxController.tgf software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/down.png software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/left.png software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/right.png software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/run.png software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/up.png 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/settings.xml software/gadgets/tux_controller/trunk/TuxDroidController.tgf Log: * Added the images Added: software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/beak_closed.png =================================================================== (Binary files differ) Property changes on: software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/beak_closed.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/beak_open.png =================================================================== (Binary files differ) Property changes on: software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/beak_open.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/down.png =================================================================== (Binary files differ) Added: software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/eyes_closed.png =================================================================== (Binary files differ) Property changes on: software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/eyes_closed.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/led_off.png =================================================================== (Binary files differ) Property changes on: software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/led_off.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/led_on.png =================================================================== (Binary files differ) Property changes on: software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/led_on.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/left.png =================================================================== (Binary files differ) Modified: software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/right.png =================================================================== (Binary files differ) Modified: software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/run.png =================================================================== (Binary files differ) Added: software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/spin_left.png =================================================================== (Binary files differ) Property changes on: software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/spin_left.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/spin_off.png =================================================================== (Binary files differ) Property changes on: software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/spin_off.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/spin_right.png =================================================================== (Binary files differ) Property changes on: software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/spin_right.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/up.png =================================================================== (Binary files differ) Added: software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/wings_down.png =================================================================== (Binary files differ) Property changes on: software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/wings_down.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/wings_up.png =================================================================== (Binary files differ) Property changes on: software/gadgets/tux_controller/trunk/TuxController/Pictures/Icons/wings_up.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream 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-12-03 15:05:36 UTC (rev 747) +++ software/gadgets/tux_controller/trunk/TuxController/Scripts/Python/GUI/widget/other.glade 2007-12-03 16:31:43 UTC (rev 748) @@ -41,7 +41,7 @@ <property name="border_width">2</property> <property name="visible">True</property> <property name="n_rows">5</property> - <property name="n_columns">2</property> + <property name="n_columns">3</property> <property name="homogeneous">False</property> <property name="row_spacing">0</property> <property name="column_spacing">0</property> @@ -281,18 +281,6 @@ <property name="y">16</property> </packing> </child> - - <child> - <widget class="GtkHSeparator" id="hseparator16"> - <property name="width_request">518</property> - <property name="height_request">5</property> - <property name="visible">True</property> - </widget> - <packing> - <property name="x">0</property> - <property name="y">60</property> - </packing> - </child> </widget> <packing> <property name="left_attach">1</property> @@ -305,18 +293,6 @@ <child> <widget class="GtkFixed" id="fixed13"> <property name="visible">True</property> - - <child> - <widget class="GtkHSeparator" id="hseparator17"> - <property name="width_request">288</property> - <property name="height_request">5</property> - <property name="visible">True</property> - </widget> - <packing> - <property name="x">0</property> - <property name="y">60</property> - </packing> - </child> </widget> <packing> <property name="left_attach">0</property> @@ -328,106 +304,6 @@ </child> <child> - <widget class="GtkFixed" id="fixed22"> - <property name="visible">True</property> - - <child> - <widget class="GtkHSeparator" id="hseparator21"> - <property name="width_request">288</property> - <property name="height_request">5</property> - <property name="visible">True</property> - </widget> - <packing> - <property name="x">0</property> - <property name="y">60</property> - </packing> - </child> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkFixed" id="fixed23"> - <property name="visible">True</property> - - <child> - <widget class="GtkHSeparator" id="hseparator22"> - <property name="width_request">288</property> - <property name="height_request">5</property> - <property name="visible">True</property> - </widget> - <packing> - <property name="x">0</property> - <property name="y">60</property> - </packing> - </child> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkFixed" id="fixed24"> - <property name="visible">True</property> - - <child> - <widget class="GtkHSeparator" id="hseparator23"> - <property name="width_request">288</property> - <property name="height_request">5</property> - <property name="visible">True</property> - </widget> - <packing> - <property name="x">0</property> - <property name="y">60</property> - </packing> - </child> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="x_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkFixed" id="fixed25"> - <property name="visible">True</property> - - <child> - <widget class="GtkHSeparator" id="hseparator24"> - <property name="width_request">288</property> - <property name="height_request">5</property> - <property name="visible">True</property> - </widget> - <packing> - <property name="x">0</property> - <property name="y">77</property> - </packing> - </child> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - <property name="x_options">fill</property> - </packing> - </child> - - <child> <widget class="GtkFixed" id="fixed26"> <property name="visible">True</property> @@ -452,18 +328,6 @@ </child> <child> - <widget class="GtkHSeparator" id="hseparator25"> - <property name="width_request">518</property> - <property name="height_request">5</property> - <property name="visible">True</property> - </widget> - <packing> - <property name="x">0</property> - <property name="y">60</property> - </packing> - </child> - - <child> <widget class="GtkVSeparator" id="vseparator11"> <property name="width_request">16</property> <property name="height_request">50</property> @@ -612,18 +476,18 @@ </child> <child> - <widget class="GtkButton" id="btnEyesOpen"> + <widget class="GtkButton" id="btnEyesClose"> <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="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"/> + <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="alignment1"> + <widget class="GtkAlignment" id="alignment3"> <property name="visible">True</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> @@ -635,13 +499,13 @@ <property name="right_padding">0</property> <child> - <widget class="GtkHBox" id="hbox1"> + <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="imgEyesOpen"> + <widget class="GtkImage" id="imgEyesClose"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_focus">True</property> @@ -660,7 +524,7 @@ </child> <child> - <widget class="GtkLabel" id="label1"> + <widget class="GtkLabel" id="label3"> <property name="visible">True</property> <property name="label" translatable="yes"> </property> @@ -691,23 +555,23 @@ </widget> <packing> <property name="x">16</property> - <property name="y">0</property> + <property name="y">32</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="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"/> + <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> @@ -719,13 +583,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> @@ -744,7 +608,7 @@ </child> <child> - <widget class="GtkLabel" id="label3"> + <widget class="GtkLabel" id="label1"> <property name="visible">True</property> <property name="label" translatable="yes"> </property> @@ -775,7 +639,7 @@ </widget> <packing> <property name="x">16</property> - <property name="y">32</property> + <property name="y">16</property> </packing> </child> </widget> @@ -814,18 +678,6 @@ </child> <child> - <widget class="GtkHSeparator" id="hseparator26"> - <property name="width_request">518</property> - <property name="height_request">5</property> - <property name="visible">True</property> - </widget> - <packing> - <property name="x">0</property> - <property name="y">60</property> - </packing> - </child> - - <child> <widget class="GtkVSeparator" id="vseparator13"> <property name="width_request">16</property> <property name="height_request">50</property> @@ -850,88 +702,6 @@ </child> <child> - <widget class="GtkButton" id="button4"> - <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> - - <child> - <widget class="GtkAlignment" id="alignment4"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">0</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">0</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkHBox" id="hbox4"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">2</property> - - <child> - <widget class="GtkImage" id="image4"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="has_focus">True</property> - <property name="stock">gtk-go-up</property> - <property name="icon_size">4</property> - <property name="xalign">0</property> - <property name="yalign">0</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label4"> - <property name="visible">True</property> - <property name="label" translatable="yes"> -</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</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="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="x">16</property> - <property name="y">0</property> - </packing> - </child> - - <child> <widget class="GtkRadioButton" id="radMouthsec"> <property name="width_request">114</property> <property name="height_request">22</property> @@ -1219,7 +989,7 @@ </widget> <packing> <property name="x">16</property> - <property name="y">32</property> + <property name="y">24</property> </packing> </child> </widget> @@ -1258,18 +1028,6 @@ </child> <child> - <widget class="GtkHSeparator" id="hseparator27"> - <property name="width_request">518</property> - <property name="height_request">5</property> - <property name="visible">True</property> - </widget> - <packing> - <property name="x">0</property> - <property name="y">60</property> - </packing> - </child> - - <child> <widget class="GtkVSeparator" id="vseparator15"> <property name="width_request">16</property> <property name="height_request">50</property> @@ -1282,18 +1040,6 @@ </child> <child> - <widget class="GtkVSeparator" id="vseparator14"> - <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="GtkRadioButton" id="radWingssec"> <property name="width_request">114</property> <property name="height_request">22</property> @@ -1438,18 +1184,18 @@ </child> <child> - <widget class="GtkButton" id="btnWingsUp"> + <widget class="GtkButton" id="btnWingsDown"> <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="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"/> + <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="alignment6"> + <widget class="GtkAlignment" id="alignment7"> <property name="visible">True</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> @@ -1461,13 +1207,13 @@ <property name="right_padding">0</property> <child> - <widget class="GtkHBox" id="hbox6"> + <widget class="GtkHBox" id="hbox7"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">2</property> <child> - <widget class="GtkImage" id="imgWingsUp"> + <widget class="GtkImage" id="imgWingsDown"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_focus">True</property> @@ -1486,7 +1232,7 @@ </child> <child> - <widget class="GtkLabel" id="label6"> + <widget class="GtkLabel" id="label7"> <property name="visible">True</property> <property name="label" translatable="yes"> </property> @@ -1517,23 +1263,23 @@ </widget> <packing> <property name="x">16</property> - <property name="y">0</property> + <property name="y">40</property> </packing> </child> <child> - <widget class="GtkButton" id="btnWingsDown"> + <widget class="GtkButton" id="btnWingsUp"> <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="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"/> + <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="alignment7"> + <widget class="GtkAlignment" id="alignment6"> <property name="visible">True</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> @@ -1545,13 +1291,13 @@ <property name="right_padding">0</property> <child> - <widget class="GtkHBox" id="hbox7"> + <widget class="GtkHBox" id="hbox6"> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">2</property> <child> - <widget class="GtkImage" id="imgWingsDown"> + <widget class="GtkImage" id="imgWingsUp"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="has_focus">True</property> @@ -1570,7 +1316,7 @@ </child> <child> - <widget class="GtkLabel" id="label7"> + <widget class="GtkLabel" id="label6"> <property name="visible">True</property> <property name="label" translatable="yes"> </property> @@ -1601,9 +1347,21 @@ </widget> <packing> <property name="x">16</property> - <property name="y">32</property> + <property name="y">8</property> </packing> </child> + + <child> + <widget class="GtkVSeparator" id="vseparator14"> + <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> </widget> <packing> <property name="left_attach">1</property> @@ -2005,18 +1763,6 @@ </child> <child> - <widget class="GtkHSeparator" id="hseparator28"> - <property name="width_request">518</property> - <property name="height_request">5</property> - <property name="visible">True</property> - </widget> - <packing> - <property name="x">0</property> - <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> @@ -2037,6 +1783,128 @@ <property name="y_options">fill</property> </packing> </child> + + <child> + <widget class="GtkFixed" id="fixed25"> + <property name="visible">True</property> + + <child> + <widget class="GtkImage" id="imgSpin"> + <property name="width_request">367</property> + <property name="height_request">83</property> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="x">0</property> + <property name="y">0</property> + </packing> + </child> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> + <property name="x_options">fill</property> + <property name="y_options">fill</property> + </packing> + </child> + + <child> + <widget class="GtkFixed" id="fixed24"> + <property name="width_request">372</property> + <property name="height_request">0</property> + <property name="visible">True</property> + + <child> + <widget class="GtkImage" id="imgWings"> + <property name="width_request">367</property> + <property name="height_request">142</property> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="x">0</property> + <property name="y">0</property> + </packing> + </child> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> + <property name="x_options">fill</property> + <property name="y_options">fill</property> + </packing> + </child> + + <child> + <widget class="GtkFixed" id="fixed23"> + <property name="visible">True</property> + + <child> + <widget class="GtkImage" id="imgMouth"> + <property name="width_request">367</property> + <property name="height_request">62</property> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="x">0</property> + <property name="y">0</property> + </packing> + </child> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">fill</property> + <property name="y_options">fill</property> + </packing> + </child> + + <child> + <widget class="GtkFixed" id="fixed22"> + <property name="visible">True</property> + + <child> + <widget class="GtkImage" id="imgEyes"> + <property name="width_request">367</property> + <property name="height_request">79</property> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="x">0</property> + <property name="y">16</property> + </packing> + </child> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + <property name="y_options">fill</property> + </packing> + </child> </widget> <packing> <property name="padding">0</property> @@ -2104,15 +1972,15 @@ </child> <child> - <widget class="GtkLabel" id="lblSoundL"> - <property name="width_request">138</property> - <property name="height_request">16</property> + <widget class="GtkLabel" id="lblSound"> + <property name="width_request">46</property> + <property name="height_request">17</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="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> <property name="selectable">False</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> @@ -2124,13 +1992,13 @@ <property name="angle">0</property> </widget> <packing> - <property name="x">0</property> + <property name="x">312</property> <property name="y">56</property> </packing> </child> <child> - <widget class="GtkLabel" id="lblLight"> + <widget class="GtkLabel" id="lblBattery"> <property name="width_request">46</property> <property name="height_request">17</property> <property name="visible">True</property> @@ -2151,20 +2019,20 @@ </widget> <packing> <property name="x">312</property> - <property name="y">8</property> + <property name="y">32</property> </packing> </child> <child> - <widget class="GtkLabel" id="lblBattery"> - <property name="width_request">46</property> - <property name="height_request">17</property> + <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_LEFT</property> - <property name="wrap">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> @@ -2177,20 +2045,20 @@ </widget> <packing> <property name="x">312</property> - <property name="y">32</property> + <property name="y">0</property> </packing> </child> <child> - <widget class="GtkLabel" id="lblSound"> - <property name="width_request">46</property> - <property name="height_request">17</property> + <widget class="GtkLabel" id="lblBatteryL"> + <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_LEFT</property> - <property name="wrap">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> @@ -2202,17 +2070,17 @@ <property name="angle">0</property> </widget> <packing> - <property name="x">312</property> - <property name="y">56</property> + <property name="x">0</property> + <property name="y">32</property> </packing> </child> <child> - <widget class="GtkLabel" id="lblLightL"> + <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="label" translatable="yes"> </property> <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_RIGHT</property> @@ -2228,33 +2096,21 @@ <property name="angle">0</property> </widget> <packing> - <property name="x">312</property> - <property name="y">0</property> + <property name="x">0</property> + <property name="y">56</property> </packing> </child> <child> - <widget class="GtkVSeparator" id="vseparator20"> - <property name="width_request">16</property> - <property name="height_request">70</property> + <widget class="GtkLabel" id="lblLight"> + <property name="width_request">46</property> + <property name="height_request">17</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> - <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="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> <property name="selectable">False</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> @@ -2266,8 +2122,8 @@ <property name="angle">0</property> </widget> <packing> - <property name="x">0</property> - <property name="y">32</property> + <property name="x">312</property> + <property name="y">8</property> </packing> </child> 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-12-03 15:05:36 UTC (rev 747) +++ software/gadgets/tux_controller/trunk/TuxController/Scripts/Python/GUI/widget/other.pyp 2007-12-03 16:31:43 UTC (rev 748) @@ -34,6 +34,9 @@ self.status_table() def on_window1_destroy(self, widget, *args): + ''' + When the window is destroyed, don't forget to remove the monitoring vectors + ''' tux.monitoring.remove(self.light_idx) tux.monitoring.remove(self.sound_idx) tux.monitoring.remove(self.battery_idx) @@ -41,12 +44,29 @@ tux.event.on_left_blue_led_off = None tux.event.on_right_blue_led_on = None tux.event.on_right_blue_led_off = None + tux.event.on_eyes_open = None + tux.event.on_eyes_closed = None + tux.event.on_mouth_open = None + tux.event.on_mouth_close = None + tux.event.on_spin_stop = None def binding(self): + ''' + This function 'connect' some Tux's events with local functions. + See the tux.event help for more informations. + + The light, battery and audio monitoring are also initialized here. + ''' tux.event.on_left_blue_led_on = self.on_left_led_on tux.event.on_left_blue_led_off = self.on_left_led_off tux.event.on_right_blue_led_on = self.on_right_led_on tux.event.on_right_blue_led_off = self.on_right_led_off + tux.event.on_eyes_open = self.on_eyes_open + tux.event.on_eyes_close = self.on_eyes_close + tux.event.on_mouth_open = self.on_mouth_open + tux.event.on_mouth_close = self.on_mouth_close + tux.event.on_spin_stop = self.on_spin_stop + self.light_idx = tux.monitoring.insert(0x1B, self.on_light_level) self.battery_idx = tux.monitoring.insert(0x25, self.on_battery_level) tux.micro.on() @@ -54,6 +74,9 @@ tux.sys.wait(0.1) def update_status(self): + ''' + This function update the status when the gadget is starting. + ''' if tux.status.lled(): self.get_widget('chkLEDLeft').set_active(True) else: @@ -65,27 +88,72 @@ self.get_widget('chkLEDRight').set_active(False) def update_pix(self): - path = _me.get_path('pictures')+'/Icons/' - self.get_widget('imgLEDRun').set_from_file(path+'run.png') + ''' + It's necessary to update the pictures. + The first step is to determine the path where the pictures are stored. + To do this, the instruction _me.get_path('pictures') return the path + of the 'picture' folder of the TGF. + ''' + self.path = _me.get_path('pictures')+'/Icons/' - self.get_widget('imgEyesOpen').set_from_file(path+'up.png') - self.get_widget('imgEyesClose').set_from_file(path+'down.png') - self.get_widget('imgEyesRun').set_from_file(path+'run.png') + ### Update the buttons icons + self.get_widget('imgLEDRun').set_from_file(self.path+'run.png') - self.get_widget('imgMouthClose').set_from_file(path+'up.png') - self.get_widget('imgMouthOpen').set_from_file(path+'down.png') - self.get_widget('imgMouthRun').set_from_file(path+'run.png') + self.get_widget('imgEyesOpen').set_from_file(self.path+'up.png') + self.get_widget('imgEyesClose').set_from_file(self.path+'down.png') + self.get_widget('imgEyesRun').set_from_file(self.path+'run.png') - self.get_widget('imgWingsUp').set_from_file(path+'up.png') - self.get_widget('imgWingsDown').set_from_file(path+'down.png') - self.get_widget('imgWingsRun').set_from_file(path+'run.png') + self.get_widget('imgMouthClose').set_from_file(self.path+'up.png') + self.get_widget('imgMouthOpen').set_from_file(self.path+'down.png') + self.get_widget('imgMouthRun').set_from_file(self.path+'run.png') - self.get_widget('imgSpinLeft').set_from_file(path+'left.png') - self.get_widget('imgSpinRight').set_from_file(path+'right.png') - self.get_widget('imgSpinRun').set_from_file(path+'run.png') + self.get_widget('imgWingsUp').set_from_file(self.path+'up.png') + self.get_widget('imgWingsDown').set_from_file(self.path+'down.png') + self.get_widget('imgWingsRun').set_from_file(self.path+'run.png') + + self.get_widget('imgSpinLeft').set_from_file(self.path+'left.png') + self.get_widget('imgSpinRight').set_from_file(self.path+'right.png') + self.get_widget('imgSpinRun').set_from_file(self.path+'run.png') + + ### Update the Tux pictures + if tux.status.rled() == 0: + self.get_widget('imgEyes').set_from_file(self.path+'led_off.png') + else: + self.get_widget('imgEyes').set_from_file(self.path+'led_on.png') + ## Do the same for the second led... + #if tux.status.rlled() == 0: + # self.get_widget('imgEyes').set_from_file(path+'led_off.png') + #else: + # self.get_widget('imgEyes').set_from_file(path+'led_on.png') + + if tux.status.eyes_closed() == 0: + self.get_widget('imgEyes').set_from_file(self.path+'eyes_closed.png') + + if tux.status.mouth_closed() == 0: + self.get_widget('imgMouth').set_from_file(self.path+'beak_closed.png') + else: + self.get_widget('imgMouth').set_from_file(self.path+'beak_open.png') + ## I'm waiting for an absolute wings position status + #if tux.status.wings_up() == 0: + self.get_widget('imgWings').set_from_file(self.path+'wings_down.png') + + ## I'm waiting for a spinning status + #if tux.status.spinning() + self.get_widget('imgSpin').set_from_file(self.path+'spin_off.png') + + def update_labels(self): + ''' + Update the GUI labels. + + To enable the gadget to be translated, all the strings are configured on the + Tux Gadget Maker strings section. + + To load a string, just use _me.get_string('my_string') + ''' + ## Update the TAB labels self.get_widget('tabControl').set_label(_me.string('tabControl')) self.get_widget('tabStatus').set_label(_me.string('tabStatus')) @@ -104,14 +172,23 @@ self.get_widget('radSpinDirLeft').set_label(_me.string('radSpinDirLeft')) self.get_widget('radSpinDirRight').set_label(_me.string('radSpinDirRight')) - self.get_widget('lblLightL').set_text(_me.string('lblLightL')) + self.get_widget('lblBatteryL').set_text(_me.string('lblBatteryL')) self.get_widget('lblSoundL').set_text(_me.string('lblSoundL')) + self.get_widget('lblLightL').set_text(_me.string('lblLightL')) def status_table(self): + ''' + This function create a custom Treeview. + + The treeviews can't be created directly with glade, so we need to define it + directly in software + ''' + ### Define a new gtk.Treeview self.status_tree = gtk.TreeStore(str, str, str, str) self.status_view = gtk.TreeView(self.status_tree) + ### Create the columns 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) @@ -132,6 +209,7 @@ self.value2_column.set_min_width(85) self.value2_column.add_attribute(self.value2_renderer, 'text', 3) + ### Add the columns to the treeview self.status_view.append_column(self.name1_column) self.status_view.append_column(self.value1_column) self.status_view.append_column(self.name2_column) @@ -139,9 +217,15 @@ self.status_view.set_rules_hint(True) + ### Add the treeview to the scrolledwindow1 self.get_widget("scrolledwindow1").add(self.status_view) + + ### And show all ! self.get_widget("scrolledwindow1").show_all() + + ### tux.sys.looped_function allow to execute a function periodically. + ## Here, this function is used to refresh the status treeview. tux.sys.looped_function(self.refresh_treeview, 0.5) @@ -149,6 +233,9 @@ # # Widget items events # +# This section contains all the functions connected to the widgets +# signals. +# #################################################################### ## btnLEDrun def on_btnLEDRun_clicked(self, widget, *args): @@ -264,6 +351,9 @@ def on_btnSpinLeft_pressed(self, widget, *args): tux.cmd.spinl_on_free(0) +### I'm waiting for an event function... + self.get_widget('imgSpin').set_from_file(self.path+'spin_left.png') + def on_btnSpinLeft_released(self, widget, *args): tux.cmd.spinl_on_free(1) @@ -271,6 +361,9 @@ def on_btnSpinRight_pressed(self, widget, *args): tux.cmd.spinr_on_free(0) +### I'm waiting for an event function... + self.get_widget('imgSpin').set_from_file(self.path+'spin_right.png') + def on_btnSpinRight_released(self, widget, *args): tux.cmd.spinr_on_free(1) @@ -286,12 +379,26 @@ else: if self.get_widget('radSpinDirLeft').get_active(): tux.cmd.spinl_on_free(int(value), int(freq)) + +### I'm waiting for an event function... + self.get_widget('imgSpin').set_from_file(self.path+'spin_left.png') else: tux.cmd.spinr_on_free(int(value), int(freq)) + +### I'm waiting for an event function... + self.get_widget('imgSpin').set_from_file(self.path+'spin_right.png') - + ## chkLEDRight def on_chkLEDRight_toggled(self, widget, *args): + ''' + When the check box is toggled, the LED will be switched off/on. + This trig a LED event, which will toggle the checkbox, which + will trig a LED event, etc ... + + To prevent this bug, a global flag is used to indicate that the + LED has been toggled by an event, and not by the user. + ''' global __led_toggled_by_event if __led_toggled_by_event: return if widget.get_active(): @@ -330,32 +437,64 @@ # # Tux events functions # +# These functions are trigged when an Tux event occurs. +# All of these functions are declared in the 'binding' function. +# #################################################################### def on_right_led_on(self): global __led_toggled_by_event __led_toggled_by_event = True self.get_widget('chkLEDRight').set_active(True) + self.get_widget('imgEyes').set_from_file(self.path+'led_on.png') __led_toggled_by_event = False def on_right_led_off(self): global __led_toggled_by_event __led_toggled_by_event = True self.get_widget('chkLEDRight').set_active(False) + self.get_widget('imgEyes').set_from_file(self.path+'led_off.png') __led_toggled_by_event = False def on_left_led_on(self): global __led_toggled_by_event __led_toggled_by_event = True self.get_widget('chkLEDLeft').set_active(True) + self.get_widget('imgEyes').set_from_file(self.path+'led_on.png') __led_toggled_by_event = False def on_left_led_off(self): global __led_toggled_by_event __led_toggled_by_event = True self.get_widget('chkLEDLeft').set_active(False) + self.get_widget('imgEyes').set_from_file(self.path+'led_off.png') __led_toggled_by_event = False + def on_eyes_close(self): + self.get_widget('imgEyes').set_from_file(self.path+'eyes_closed.png') + + def on_eyes_open(self): + if tux.status.lled() == 0 or tux.status.rled() == 0: + self.get_widget('imgEyes').set_from_file(self.path+'led_off.png') + else: + self.get_widget('imgEyes').set_from_file(self.path+'led_on.png') + + ### Specify the behavior of each leds + + #if tux.status.lled() == 0: + # self.get_widget('imgEyes').set_from_file(self.path+'led_off.png') + #else: + # self.get_widget('imgEyes').set_from_file(self.path+'led_on.png') + + def on_mouth_open(self): + self.get_widget('imgMouth').set_from_file(self.path+'beak_open.png') + + def on_mouth_close(self): + self.get_widget('imgMouth').set_from_file(self.path+'beak_closed.png') + + def on_spin_stop(self): + self.get_widget('imgSpin').set_from_file(self.path+'spin_off.png') + def on_light_level(self, args): level = args[0]*256 + args[1] level = level / 1124.0 * 100.0 @@ -384,17 +523,27 @@ val = float(val / 127.0) self.get_widget('lblSound').set_text('%.1f%s'%(val*100, '%')) self.get_widget('SoundLevel').set_fraction(val) - + +#################################################################### +# +# Refresh the statuses treeview +# +#################################################################### def refresh_treeview(self): + ''' + All statuses must be requested. This operation require a lot of time. + So, to not block the gadget when the treeview is refreshed, the function + is launched on a thread. + ''' 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']) Modified: software/gadgets/tux_controller/trunk/TuxController/settings.xml =================================================================== --- software/gadgets/tux_controller/trunk/TuxController/settings.xml 2007-12-03 15:05:36 UTC (rev 747) +++ software/gadgets/tux_controller/trunk/TuxController/settings.xml 2007-12-03 16:31:43 UTC (rev 748) @@ -7,9 +7,9 @@ <have_settings_part type='bool'>True</have_settings_part> <gui_state> <widget> - <y type='int'>25</y> + <y type='int'>64</y> <visible type='bool'>True</visible> - <x type='int'>0</x> + <x type='int'>210</x> </widget> <conf> <visible type='bool'>False</visible> Modified: software/gadgets/tux_controller/trunk/TuxController.tgf =================================================================== (Binary files differ) Modified: software/gadgets/tux_controller/trunk/TuxDroidController.tgf =================================================================== (Binary files differ) |
From: Paul_R <c2m...@c2...> - 2007-12-03 15:05:39
|
Author: Paul_R Date: 2007-12-03 16:05:36 +0100 (Mon, 03 Dec 2007) New Revision: 747 Modified: software/gadgets/settings/trunk/settings.tgf software/gadgets/settings/trunk/settings/Scripts/Python/GUI/widget/other.pyp software/gadgets/settings/trunk/settings/about.xml Log: * Added somes protections to not store the sounds if the firmwares versions are <730 for tuxaudio and <733 for tuxcore * Added tests to wait the correct status. Modified: software/gadgets/settings/trunk/settings/Scripts/Python/GUI/widget/other.pyp =================================================================== --- software/gadgets/settings/trunk/settings/Scripts/Python/GUI/widget/other.pyp 2007-12-03 07:52:57 UTC (rev 746) +++ software/gadgets/settings/trunk/settings/Scripts/Python/GUI/widget/other.pyp 2007-12-03 15:05:36 UTC (rev 747) @@ -151,7 +151,7 @@ #------------------------------------------------------------ # Sound tab labels #------------------------------------------------------------ - def SoundLabelUpdate(self): + def SoundLabelUpdate(self): self.get_widget('btnSoundAdd').set_label(_me.string('btnSoundAdd')) self.get_widget('btnSoundClear').set_label(_me.string('btnSoundClear')) self.get_widget('btnSoundModify').set_label(_me.string('btnSoundModify')) @@ -611,7 +611,7 @@ #-------------------------------------------------------------------------- # On "play" external wave file button clicked - #-------------------------------------------------------------------------- + #------------------------------------tux.status.sound_record()-------------------------------------- def on_wave_external_play_bt_clicked(self, widget, *args): if str(self.get_widget("soundExternalChooser").get_filename())=="None": return tux.sys.shell_free("aplay -D %s %s"% (soundcard, self.get_widget("soundExternalChooser").get_filename())) @@ -796,6 +796,19 @@ print "Sound storing : Error : file merged is too big" return + try: + ver = tux.hw.behavior_get_version() + if int(ver[3]) < 733: + self.__sound_mutex.release() + return + ver = tux.hw.audio_get_version() + if int(ver[3]) < 730: + self.__sound_mutex.release() + return + except: + self.__sound_mutex.release() + return + fraction = float(len(wavs.wav_paths) + 2) fraction = 1 / fraction current = fraction @@ -806,16 +819,24 @@ self.get_widget('progressbar1').set_fraction(current) current = current + fraction tux.cmd.sound_erase() - tux.sys.wait(0.1) + + tux.sys.wait(1) + while tux.status.sound_record()[0] != 0: tux.sys.wait(0.1) + sound_table = wavs.wav_paths - for i in range(len(wavs.wav_paths)): + for i in range(len(sound_table)): self.get_widget('progressbar1').set_fraction(current) self.get_widget('lblSoundState').set_text(_me.string('soundProg')+str(i+1)) tux.cmd.sound_storing() - tux.sys.shell("aplay -D %s %s"%(soundcard, wavs.wav_paths[i])) + while tux.status.sound_record()[0] != 1: + tux.sys.wait(0.1) + tux.sys.shell("aplay -D %s %s"%(soundcard, sound_table[i])) + while tux.status.sound_record()[0] != 2: + tux.sys.wait(0.1) + tux.cmd.sound_confirm(True) current = current + fraction tux.sys.wait(0.1) Modified: software/gadgets/settings/trunk/settings/about.xml =================================================================== (Binary files differ) Modified: software/gadgets/settings/trunk/settings.tgf =================================================================== (Binary files differ) |
Author: Paul_R Date: 2007-12-03 08:52:57 +0100 (Mon, 03 Dec 2007) New Revision: 746 Modified: software/gadgets/sound_monitor/trunk/audio_monitor.tgf software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/conf/other.pyp software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/other.glade software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/other.pyp software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/Sound_class.py software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/init.pyp software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/notify.pyp software/gadgets/sound_monitor/trunk/audio_monitor/Strings/fr_ALL.xml software/gadgets/sound_monitor/trunk/audio_monitor/settings.xml software/gadgets/sound_monitor/trunk/audio_monitor/strings.xml Log: * Adapted the GUIs - Cleanup the settings window - Add the configuration options on the widget window * Added the threshold lines (spy and dog mode) Modified: software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/conf/other.pyp =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/conf/other.pyp 2007-11-30 14:38:46 UTC (rev 745) +++ software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/conf/other.pyp 2007-12-03 07:52:57 UTC (rev 746) @@ -10,44 +10,15 @@ def new(self): self.measure = _me.get_param('measure') - #_me.insert_funct('refresh_tree', self.refresh_tree) - #_me.insert_funct('verify_tab', self.verify_tab) self.updates_commons() - #self.make_viewtree() - #self.update_labels() - - - + def updates_commons(self): - # Window title txt = "%s : %s" % (_me.string('name_to_read'), _me.string('gui_conf_window_title')) self.get_widget("window1").set_title(txt) - - # Update Frame - txt = _me.string('gui_conf_update_title') - self.get_widget("label12").set_text(txt) - - txt = "%s : " % _me.string('gui_conf_delay_lb') - self.get_widget("label13").set_text(txt) - - value = _me.get_var('notify_delay') - self.get_widget("delay_spinbutton").set_value(value) - - # Bottom buttons - txt = _me.string('gui_conf_cancel_bt') - self.get_widget("label6").set_text(txt) - - txt = _me.string('gui_conf_accept_bt') - self.get_widget("label5").set_text(txt) - #self.get_widget('txt_conf_rate').set_text(str(_me.get_param('Rate'))) - #self.get_widget('txt_conf_sample').set_text(str(_me.get_param('Sample'))) - #self.get_widget('txtLowThreshold').set_text(str(_me.get_param('low_threshold'))) - #self.get_widget('txtHighThreshold').set_text(str(_me.get_param('high_threshold'))) - ########################################################### # # On cancel button clicked @@ -67,407 +38,4 @@ _me.set_var('notify_delay', int(self.get_widget("delay_spinbutton").get_value())) self.get_widget("window1").destroy() - ''' - _me.set_param('Rate', float(self.get_widget('txt_conf_rate').get_text())) - _me.set_param('Sample',float(self.get_widget('txt_conf_sample').get_text())) - _me.set_param(('MainScript'), str(self.get_widget('mainScript').get_filename())) - _me.set_param(('chkMotors'), self.get_widget('chkMotors').get_active()) - self.measure.chkMotors = self.get_widget('chkMotors').get_active() - self.measure.rate_backup = _me.get_param('Rate') - self.measure.sample_backup = _me.get_param('Sample') - - try: - float(self.get_widget('txtLowThreshold').get_text()) - except: - self.get_widget('txtLowThreshold').set_text('4.8') - - if float(self.get_widget('txtLowThreshold').get_text()) < 4.0: - self.get_widget('txtLowThreshold').set_text('4.0') - if float(self.get_widget('txtLowThreshold').get_text()) > 6.3: - self.get_widget('txtLowThreshold').set_text('6.3') - self.measure.low_threshold = float(self.get_widget('txtLowThreshold').get_text()) - _me.set_param('low_threshold', self.measure.low_threshold) - - try: - float(self.get_widget('txtHighThreshold').get_text()) - except: - self.get_widget('txtHighThreshold').set_text('4.8') - - if float(self.get_widget('txtHighThreshold').get_text()) < self.measure.low_threshold: - self.get_widget('txtHighThreshold').set_text(str(self.measure.low_threshold + 0.1)) - if float(self.get_widget('txtHighThreshold').get_text()) > 6.4: - self.get_widget('txtHighThreshold').set_text('6.4') - - self.measure.high_threshold = float(self.get_widget('txtHighThreshold').get_text()) - _me.set_param('high_threshold', self.measure.high_threshold) - - self.measure.absolute_threshold_high_flag = False - self.measure.absolute_threshold_low_flag = False - ''' - - - ''' - ########################################################### - # - # Battery configuration control - # - ########################################################### - def make_viewtree(self): - self.index_column = gtk.TreeViewColumn('Index') - self.index_column.set_min_width(50) - self.index_cell = gtk.CellRendererText() - self.index_column.pack_start(self.index_cell, True) - self.index_column.add_attribute(self.index_cell, 'text', 0) - - self.event_column = gtk.TreeViewColumn(_me.string('conf_lblEvent')) - self.event_column.set_min_width(100) - self.event_cell = gtk.CellRendererText() - self.event_column.pack_start(self.event_cell, True) - self.event_column.add_attribute(self.event_cell, 'text', 1) - - self.type_column = gtk.TreeViewColumn(_me.string('conf_lblType')) - self.type_column.set_min_width(100) - self.type_cell = gtk.CellRendererText() - self.type_column.pack_start(self.type_cell, True) - self.type_column.add_attribute(self.type_cell, 'text', 2) - - self.value_column = gtk.TreeViewColumn(_me.string('conf_lblValue')) - self.value_column.set_min_width(100) - self.value_cell = gtk.CellRendererText() - self.value_column.pack_start(self.value_cell, True) - self.value_column.add_attribute(self.value_cell, 'text', 3) - - self.time_column = gtk.TreeViewColumn(_me.string('conf_lblTime')) - self.time_column.set_min_width(100) - self.time_cell = gtk.CellRendererText() - self.time_column.pack_start(self.time_cell, True) - self.time_column.add_attribute(self.time_cell, 'text', 4) - - self.notified_column = gtk.TreeViewColumn(_me.string('conf_lblNotified')) - self.notified_column.set_min_width(100) - self.notified_cell = gtk.CellRendererText() - self.notified_column.pack_start(self.notified_cell, True) - self.notified_column.add_attribute(self.notified_cell, 'text', 5) - - self.behavior_column = gtk.TreeViewColumn(_me.string('conf_lblBehavior')) - self.behavior_cell = gtk.CellRendererText() - self.behavior_column.pack_start(self.behavior_cell, True) - self.behavior_column.add_attribute(self.behavior_cell, 'text', 6) - - self.value_list = gtk.TreeStore(int, str, str, str, str, str, str) - self.gadget_viewer = gtk.TreeView(self.value_list) - self.gadget_viewer.append_column(self.index_column) - self.gadget_viewer.append_column(self.event_column) - self.gadget_viewer.append_column(self.type_column) - self.gadget_viewer.append_column(self.value_column) - self.gadget_viewer.append_column(self.time_column) - self.gadget_viewer.append_column(self.notified_column) - self.gadget_viewer.append_column(self.behavior_column) - self.get_widget("scrolledwindow1").add(self.gadget_viewer) - self.get_widget("scrolledwindow1").set_size_request(0, 150) - self.get_widget("scrolledwindow1").show_all() - self.get_widget('cbb_conf_event').set_active(0) - self.get_widget('txt_conf_value').set_text('1.0') - self.get_widget('txt_conf_time').set_text('0.1') - self.get_widget('chkMotors').set_label(_me.string('lblMotors')) - self.get_widget('chkMotors').set_active(_me.get_param('chkMotors')) - self.measure.chkMotors = _me.get_param('chkMotors') - self.gadget_viewer.get_selection().connect("changed",self.on_row_selected) - #self.gadget_viewer.connect("row_activated", self.on_row_selected) - self.measure.event_tab = _me.get_param('config') - self.get_widget('cbb_conf_event').append_text(_me.string('conf_lblChange')) - self.get_widget('cbb_conf_event').append_text(_me.string('conf_lblThreshold')) - self.get_widget('cbb_conf_event').set_active(0) - - - for i in range(len(self.measure.event_tab)): - self.add_row(i) - ''' - ''' - ########################################################### - # - # Update the labels - # - ########################################################### - def update_labels(self): - #self.get_widget("lbl_conf_event").set_text(_me.string('conf_lblEvent')) - - #self.get_widget("lbl_conf_type").set_text(_me.string('conf_lblType')) - #self.get_widget("lbl_conf_value").set_text(_me.string('conf_lblValue')) - #self.get_widget("lbl_conf_time").set_text(_me.string('conf_lblTime')) - #self.get_widget("lbl_conf_notified").set_text(_me.string('conf_lblNotified')) - #self.get_widget("lbl_conf_behavior").set_text(_me.string('conf_lblBehavior')) - #self.get_widget("btn_conf_add").set_label(_me.string('conf_btnAdd')) - #self.get_widget("btn_conf_remove").set_label(_me.string('conf_btnRemove')) - #self.get_widget("btn_conf_modify").set_label(_me.string('conf_btnModify')) - #self.get_widget("btnBehavior").set_label(_me.string('conf_btnBehavior')) - #self.get_widget("lbl_conf_sample").set_text(_me.string('conf_lblSample')) - #self.get_widget("lbl_conf_rate").set_text(_me.string('conf_lblRate')) - #self.get_widget("lblControlFrame").set_text(_me.string('conf_lblControl')) - #self.get_widget("lblScript").set_text(_me.string('MainBehavior')) - #self.get_widget("lblHighThreshold").set_label(_me.string('lblHighThreshold')) - #self.get_widget("lblLowThreshold").set_label(_me.string('lblLowThreshold')) - ''' - - ''' - ########################################################### - # - # On row selected - # - ########################################################### - def on_row_selected(self, obj): - path = obj.get_selected_rows() - self.__iter = self.value_list.get_iter(path[1][0]) - index = self.value_list.get_value(self.__iter, 0) - event = self.value_list.get_value(self.__iter, 1) - typet = self.value_list.get_value(self.__iter, 2) - value = self.value_list.get_value(self.__iter, 3) - time = self.value_list.get_value(self.__iter, 4) - notify = self.value_list.get_value(self.__iter, 5) - behavior = self.value_list.get_value(self.__iter, 6) - - if event == _me.string('conf_lblChange'): - self.get_widget('cbb_conf_event').set_active(0) - if typet == _me.string('conf_lblDrop'): - self.get_widget('cbb_conf_type').set_active(0) - if typet == _me.string('conf_lblRaise'): - self.get_widget('cbb_conf_type').set_active(1) - if typet == _me.string('conf_lblChangeD'): - self.get_widget('cbb_conf_type').set_active(2) - if typet == _me.string('conf_lblChangeU'): - self.get_widget('cbb_conf_type').set_active(3) - self.get_widget('txt_conf_value').set_text(value) - self.get_widget('txt_conf_time').set_text(time) - - else: - self.get_widget('cbb_conf_event').set_active(1) - if typet == _me.string('conf_lblIncrease'): - self.get_widget('cbb_conf_type').set_active(0) - if typet == _me.string('conf_lblDecrease'): - self.get_widget('cbb_conf_type').set_active(1) - if typet == _me.string('conf_lblBoth'): - self.get_widget('cbb_conf_type').set_active(2) - - self.get_widget('txt_conf_value').set_text(value) - self.get_widget('txt_conf_time').set_text('') - - if notify == _me.string('conf_lblNotifiedBehavior'): - self.get_widget('chk_conf_notified').set_active(True) - else: - self.get_widget('chk_conf_notified').set_active(False) - - if behavior != 'N.A.': - self.get_widget('conf_behavior').set_filename(behavior) - else: - self.get_widget('conf_behavior').set_filename('None') - - - ########################################################### - # - # On row modified - # - ########################################################### - def on_btn_conf_modify_clicked(self, widget, *args): - index = self.value_list.get_value(self.__iter, 0) - - self.measure.event_tab = _me.get_param('config') - length = len(_me.get_param('config')) - self.verify_value() - - value = [] - value = [index, - self.get_widget('cbb_conf_event').get_active(), - self.get_widget('cbb_conf_type').get_active(), - float(self.get_widget('txt_conf_value').get_text()), - float(self.get_widget('txt_conf_time').get_text()), - self.get_widget('chk_conf_notified').get_active(), - str(self.get_widget('conf_behavior').get_filename()), - False, - 0] - self.measure.event_tab = _me.get_param('config') - - if self.verify_tab(value): - self.measure.event_tab[(index-1)] = value - _me.set_param('config', self.measure.event_tab) - self.value_list.clear() - for i in range(len(self.measure.event_tab)): - self.add_row(i) - - ########################################################### - # - # On row deleted - # - ########################################################### - def on_btn_conf_remove_clicked(self, widget, *args): - index = self.value_list.get_value(self.__iter, 0) - self.measure.event_tab =_me.get_param('config') - self.measure.event_tab.pop(index - 1) - _me.set_param('config', self.measure.event_tab) - self.__iter = 0 - self.value_list.clear() - for i in range(len(self.measure.event_tab)): - self.add_row(i) - - ########################################################### - # - # On row added - # - ########################################################### - def on_btn_conf_add_clicked(self, widget, *args): - length = len(_me.get_param('config')) - self.verify_value() - value = [] - value = [(length + 1), - self.get_widget('cbb_conf_event').get_active(), - self.get_widget('cbb_conf_type').get_active(), - float(self.get_widget('txt_conf_value').get_text()), - float(self.get_widget('txt_conf_time').get_text()), - self.get_widget('chk_conf_notified').get_active(), - str(self.get_widget('conf_behavior').get_filename()), - False, - 0] - self.measure.event_tab = _me.get_param('config') - if self.verify_tab(value): - self.measure.event_tab.append(value) - self.refresh_tree() - - def refresh_tree(self): - _me.set_param('config', self.measure.event_tab) - self.value_list.clear() - for i in range(len(self.measure.event_tab)): - self.add_row(i) - - - def verify_tab(self, tab): - for i in range(len(self.measure.event_tab)): - if self.measure.event_tab[i][1] == tab[1]: - if self.measure.event_tab[i][2] == tab[2]: - if self.measure.event_tab[i][3] == tab[3]: - if self.measure.event_tab[i][4] == tab[4]: - if self.measure.event_tab[i][5] == tab[5]: - if self.measure.event_tab[i][6] == tab[6]: - return False - return True - - ########################################################### - # - # Add row function - # - ########################################################### - def add_row(self, tab_index): - self.measure.event_tab = _me.get_param('config') - i = tab_index - - if self.measure.event_tab[i][1] == 0: - Event = _me.string('conf_lblChange') - if self.measure.event_tab[i][2] == 0: - Type = _me.string('conf_lblDrop') - elif self.measure.event_tab[i][2] == 1: - Type = _me.string('conf_lblRaise') - elif self.measure.event_tab[i][2] == 2: - Type = _me.string('conf_lblChangeD') - elif self.measure.event_tab[i][2] == 3: - Type = _me.string('conf_lblChangeU') - Value = str(self.measure.event_tab[i][3]) - Time = str(self.measure.event_tab[i][4]) - else: - Event = _me.string('conf_lblThreshold') - if self.measure.event_tab[i][2] == 0: - Type = _me.string('conf_lblIncrease') - elif self.measure.event_tab[i][2] == 1: - Type = _me.string('conf_lblDecrease') - elif self.measure.event_tab[i][2] == 2: - Type = _me.string('conf_lblBoth') - Value = str(self.measure.event_tab[i][3]) - Time = 'N.A.' - - if self.measure.event_tab[i][5]: - Notify = _me.string('conf_lblNotifiedBehavior') - if self.measure.event_tab[i][6] ==None: - Behavior = _me.string('conf_lblDefaultBehavior') - else: - Behavior = str(self.measure.event_tab[i][6]) - else: - Notify = _me.string('conf_lblNotNotified') - Behavior = 'N.A.' - - self.value_list.append(None,[(i+1), Event, Type, Value, Time, Notify, Behavior]) - ''' - ''' - ########################################################### - # - # On combo box event - # - ########################################################### - def on_cbb_conf_event_changed(self, widget, *args): - if self.get_widget('cbb_conf_event').get_active() == 0: - for i in range (4): - self.get_widget('cbb_conf_type').remove_text(0) - self.get_widget('cbb_conf_type').append_text(_me.string('conf_lblDrop')) - self.get_widget('cbb_conf_type').append_text(_me.string('conf_lblRaise')) - self.get_widget('cbb_conf_type').append_text(_me.string('conf_lblChangeD')) - self.get_widget('cbb_conf_type').append_text(_me.string('conf_lblChangeU')) - self.get_widget('cbb_conf_type').set_active(0) - else: - for i in range (4): - self.get_widget('cbb_conf_type').remove_text(0) - self.get_widget('cbb_conf_type').append_text(_me.string('conf_lblIncrease')) - self.get_widget('cbb_conf_type').append_text(_me.string('conf_lblDecrease')) - self.get_widget('cbb_conf_type').append_text(_me.string('conf_lblBoth')) - self.get_widget('cbb_conf_type').set_active(0) - ''' - - - - - - - ''' - ########################################################### - # - # On Clear path button clicked - # - ########################################################### - def on_btnBehavior_clicked(self, widget, *args): - self.get_widget('conf_behavior').set_filename('None') - index = self.value_list.get_value(self.__iter, 0) - self.measure.event_tab[index-1][6] = None - - self.value_list.clear() - for i in range(len(self.measure.event_tab)): - self.add_row(i) - ''' - ''' - ########################################################### - # - # Verify the value - # - ########################################################### - def verify_value(self): - if self.get_widget('cbb_conf_event').get_active() == 0: - maximum = 2.5 - minimum = 0.025 - else: - maximum = 6.5 - minimum = 4.0 - try: - float(self.get_widget('txt_conf_time').get_text()) - except: - self.get_widget('txt_conf_time').set_text('0.1') - - if float(self.get_widget('txt_conf_time').get_text()) < self.measure.rate: - self.get_widget('txt_conf_time').set_text(str(self.measure.rate)) - if float(self.get_widget('txt_conf_time').get_text()) > self.measure.rate * self.measure.sample: - self.get_widget('txt_conf_time').set_text(str(self.measure.rate * self.measure.sample)) - - try: - float(self.get_widget('txt_conf_value').get_text()) - except: - self.get_widget('txt_conf_value').set_text(str(minimum)) - - if float(self.get_widget('txt_conf_value').get_text()) < minimum: - self.get_widget('txt_conf_value').set_text(str(minimum)) - if float(self.get_widget('txt_conf_value').get_text()) > maximum: - self.get_widget('txt_conf_value').set_text(str(maximum)) - ''' Modified: software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/other.glade =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/other.glade 2007-11-30 14:38:46 UTC (rev 745) +++ software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/other.glade 2007-12-03 07:52:57 UTC (rev 746) @@ -46,444 +46,388 @@ </child> <child> - <widget class="GtkExpander" id="expander2"> + <widget class="GtkFixed" id="fixed10"> + <property name="width_request">400</property> + <property name="height_request">46</property> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="expanded">True</property> - <property name="spacing">0</property> - <signal name="activate" handler="on_expander_activate" last_modification_time="Wed, 10 Oct 2007 09:25:14 GMT"/> <child> - <widget class="GtkFrame" id="frame2"> - <property name="border_width">5</property> - <property name="width_request">400</property> + <widget class="GtkComboBox" id="cbbType"> + <property name="width_request">152</property> + <property name="height_request">28</property> <property name="visible">True</property> - <property name="label_xalign">0</property> - <property name="label_yalign">0.5</property> - <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property> + <property name="items" translatable="yes"></property> + <property name="add_tearoffs">False</property> + <property name="focus_on_click">True</property> + <signal name="changed" handler="on_cbbType_changed" last_modification_time="Sun, 02 Dec 2007 13:24:18 GMT"/> + </widget> + <packing> + <property name="x">8</property> + <property name="y">8</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + <child> + <widget class="GtkNotebook" id="notebook"> + <property name="visible">True</property> + <property name="show_tabs">False</property> + <property name="show_border">False</property> + <property name="tab_pos">GTK_POS_TOP</property> + <property name="scrollable">False</property> + <property name="enable_popup">False</property> + + <child> + <widget class="GtkFixed" id="fixed11"> + <property name="visible">True</property> + <child> - <widget class="GtkAlignment" id="alignment3"> + <widget class="GtkCheckButton" id="chkDogDefault"> + <property name="width_request">184</property> + <property name="height_request">24</property> <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">checkbutton3</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="x">40</property> + <property name="y">96</property> + </packing> + </child> + + <child> + <widget class="GtkFileChooserButton" id="fileDogBehavior"> + <property name="width_request">144</property> + <property name="height_request">24</property> + <property name="visible">True</property> + <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> + </widget> + <packing> + <property name="x">232</property> + <property name="y">96</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="lblDogLevel"> + <property name="width_request">136</property> + <property name="height_request">16</property> + <property name="visible">True</property> + <property name="label" translatable="yes">label12</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</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="xscale">1</property> - <property name="yscale">1</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">12</property> - <property name="right_padding">0</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">8</property> + <property name="y">40</property> + </packing> + </child> - <child> - <widget class="GtkFixed" id="fixed10"> - <property name="width_request">373</property> - <property name="height_request">197</property> - <property name="visible">True</property> + <child> + <widget class="GtkCheckButton" id="chkDogBehavior"> + <property name="width_request">232</property> + <property name="height_request">24</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">checkbutton2</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="x">8</property> + <property name="y">64</property> + </packing> + </child> - <child> - <widget class="GtkEntry" id="txtValue"> - <property name="width_request">80</property> - <property name="height_request">24</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char">●</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="x">200</property> - <property name="y">35</property> - </packing> - </child> + <child> + <widget class="GtkCheckButton" id="chkDog"> + <property name="width_request">376</property> + <property name="height_request">20</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">checkbutton1</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="x">8</property> + <property name="y">8</property> + </packing> + </child> - <child> - <widget class="GtkEntry" id="txtTime"> - <property name="width_request">80</property> - <property name="height_request">24</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char">●</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="x">284</property> - <property name="y">35</property> - </packing> - </child> + <child> + <widget class="GtkSpinButton" id="spinbutton1"> + <property name="width_request">72</property> + <property name="height_request">26</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="climb_rate">1</property> + <property name="digits">0</property> + <property name="numeric">True</property> + <property name="update_policy">GTK_UPDATE_ALWAYS</property> + <property name="snap_to_ticks">False</property> + <property name="wrap">False</property> + <property name="adjustment">1 1 100 1 10 10</property> + <signal name="changed" handler="on_spinbutton1_changed" last_modification_time="Sun, 02 Dec 2007 14:41:29 GMT"/> + <signal name="change_value" handler="on_spinbutton1_changed" last_modification_time="Sun, 02 Dec 2007 14:48:42 GMT"/> + </widget> + <packing> + <property name="x">112</property> + <property name="y">32</property> + </packing> + </child> + </widget> + <packing> + <property name="tab_expand">False</property> + <property name="tab_fill">True</property> + </packing> + </child> - <child> - <widget class="GtkComboBox" id="cbbType"> - <property name="width_request">88</property> - <property name="height_request">30</property> - <property name="visible">True</property> - <property name="items" translatable="yes"></property> - <property name="add_tearoffs">False</property> - <property name="focus_on_click">True</property> - </widget> - <packing> - <property name="x">104</property> - <property name="y">32</property> - </packing> - </child> + <child> + <widget class="GtkLabel" id="label9"> + <property name="visible">True</property> + <property name="label" translatable="yes">label9</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</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="type">tab</property> + </packing> + </child> - <child> - <widget class="GtkLabel" id="lblType"> - <property name="width_request">88</property> - <property name="height_request">16</property> - <property name="visible">True</property> - <property name="label" translatable="yes">Type</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</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">104</property> - <property name="y">8</property> - </packing> - </child> + <child> + <widget class="GtkFixed" id="fixed12"> + <property name="visible">True</property> - <child> - <widget class="GtkLabel" id="lblValue"> - <property name="width_request">80</property> - <property name="height_request">16</property> - <property name="visible">True</property> - <property name="label" translatable="yes">Value</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</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">200</property> - <property name="y">8</property> - </packing> - </child> + <child> + <widget class="GtkFixed" id="fixed13"> + <property name="width_request">0</property> + <property name="height_request">0</property> + <property name="visible">True</property> - <child> - <widget class="GtkLabel" id="lblTime"> - <property name="width_request">80</property> - <property name="height_request">16</property> - <property name="visible">True</property> - <property name="label" translatable="yes">Time</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</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">284</property> - <property name="y">8</property> - </packing> - </child> + <child> + <widget class="GtkLabel" id="lblSpyLevel"> + <property name="width_request">136</property> + <property name="height_request">16</property> + <property name="visible">True</property> + <property name="label" translatable="yes">label12</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</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">8</property> + <property name="y">40</property> + </packing> + </child> - <child> - <widget class="GtkLabel" id="lblNotify"> - <property name="width_request">96</property> - <property name="height_request">16</property> - <property name="visible">True</property> - <property name="label" translatable="yes">Notified?</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</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">72</property> - </packing> - </child> + <child> + <widget class="GtkCheckButton" id="chkSpy"> + <property name="width_request">376</property> + <property name="height_request">20</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">checkbutton1</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="x">8</property> + <property name="y">8</property> + </packing> + </child> - <child> - <widget class="GtkLabel" id="lblScript"> - <property name="width_request">144</property> - <property name="height_request">16</property> - <property name="visible">True</property> - <property name="label" translatable="yes">Behavior script</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</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">120</property> - <property name="y">72</property> - </packing> - </child> + <child> + <widget class="GtkCheckButton" id="chkSpyRecord"> + <property name="width_request">224</property> + <property name="height_request">24</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">checkbutton2</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="x">8</property> + <property name="y">64</property> + </packing> + </child> - <child> - <widget class="GtkFileChooserButton" id="Behavior"> - <property name="width_request">144</property> - <property name="height_request">30</property> - <property name="visible">True</property> - <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> - </widget> - <packing> - <property name="x">120</property> - <property name="y">96</property> - </packing> - </child> + <child> + <widget class="GtkSpinButton" id="spinbutton2"> + <property name="width_request">72</property> + <property name="height_request">26</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="climb_rate">1</property> + <property name="digits">0</property> + <property name="numeric">False</property> + <property name="update_policy">GTK_UPDATE_ALWAYS</property> + <property name="snap_to_ticks">False</property> + <property name="wrap">False</property> + <property name="adjustment">1 1 100 1 10 10</property> + <signal name="changed" handler="on_spinbutton2_changed" last_modification_time="Sun, 02 Dec 2007 14:42:55 GMT"/> + <signal name="change_value" handler="on_spinbutton2_changed" last_modification_time="Sun, 02 Dec 2007 14:49:04 GMT"/> + </widget> + <packing> + <property name="x">112</property> + <property name="y">32</property> + </packing> + </child> + </widget> + <packing> + <property name="x">0</property> + <property name="y">0</property> + </packing> + </child> + </widget> + <packing> + <property name="tab_expand">False</property> + <property name="tab_fill">True</property> + </packing> + </child> - <child> - <widget class="GtkCheckButton" id="chkNotify"> - <property name="width_request">24</property> - <property name="height_request">24</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">False</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> + <child> + <widget class="GtkLabel" id="label10"> + <property name="visible">True</property> + <property name="label" translatable="yes">label10</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</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="type">tab</property> + </packing> + </child> - <child> - <placeholder/> - </child> - </widget> - <packing> - <property name="x">32</property> - <property name="y">96</property> - </packing> - </child> + <child> + <widget class="GtkFrame" id="frame3"> + <property name="border_width">5</property> + <property name="visible">True</property> + <property name="label_xalign">0</property> + <property name="label_yalign">0.5</property> + <property name="shadow_type">GTK_SHADOW_OUT</property> - <child> - <widget class="GtkComboBox" id="cbbEvent"> - <property name="width_request">88</property> - <property name="height_request">30</property> - <property name="visible">True</property> - <property name="items" translatable="yes"></property> - <property name="add_tearoffs">False</property> - <property name="focus_on_click">True</property> - <signal name="changed" handler="on_cbb_conf_event_changed"/> - </widget> - <packing> - <property name="x">8</property> - <property name="y">32</property> - </packing> - </child> + <child> + <widget class="GtkAlignment" id="alignment4"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">12</property> + <property name="right_padding">0</property> - <child> - <widget class="GtkLabel" id="lblEvent"> - <property name="width_request">88</property> - <property name="height_request">16</property> - <property name="visible">True</property> - <property name="label" translatable="yes">Event</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</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">8</property> - <property name="y">8</property> - </packing> - </child> + <child> + <widget class="GtkScrolledWindow" id="scrolledwindow1"> + <property name="height_request">106</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</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> - <widget class="GtkButton" id="btnApply"> - <property name="width_request">144</property> - <property name="height_request">29</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <signal name="clicked" handler="on_btnApply_clicked"/> - - <child> - <widget class="GtkAlignment" id="alignment1"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">0</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">0</property> - <property name="right_padding">0</property> - - <child> - <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="image1"> - <property name="visible">True</property> - <property name="stock">gtk-yes</property> - <property name="icon_size">4</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="lblBtnApply"> - <property name="visible">True</property> - <property name="label" translatable="yes">Apply changes</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</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="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="x">8</property> - <property name="y">160</property> - </packing> + <placeholder/> </child> - - <child> - <widget class="GtkButton" id="btnAdd"> - <property name="width_request">144</property> - <property name="height_request">29</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">button1</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_btnAdd_clicked" last_modification_time="Tue, 09 Oct 2007 18:34:49 GMT"/> - </widget> - <packing> - <property name="x">176</property> - <property name="y">160</property> - </packing> - </child> </widget> </child> </widget> </child> - - <child> - <widget class="GtkLabel" id="label8"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</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="type">label_item</property> - </packing> - </child> </widget> + <packing> + <property name="tab_expand">False</property> + <property name="tab_fill">True</property> + </packing> </child> <child> - <widget class="GtkLabel" id="lblThreshold"> + <widget class="GtkLabel" id="label11"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Test notifications</property> + <property name="label" translatable="yes">label11</property> <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> <property name="wrap">False</property> - <property name="selectable">True</property> + <property name="selectable">False</property> <property name="xalign">0.5</property> <property name="yalign">0.5</property> <property name="xpad">0</property> @@ -494,7 +438,7 @@ <property name="angle">0</property> </widget> <packing> - <property name="type">label_item</property> + <property name="type">tab</property> </packing> </child> </widget> Modified: software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/other.pyp =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/other.pyp 2007-11-30 14:38:46 UTC (rev 745) +++ software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/other.pyp 2007-12-03 07:52:57 UTC (rev 746) @@ -16,41 +16,11 @@ # ########################################################### def new(self): - self.get_widget("window1").set_title(_me.string('name_to_read')) - self.get_widget("lblThreshold").set_text(_me.string('widget_lblTest')) - - self.get_widget("btnAdd").set_label(_me.string('widget_lblSet')) - self.get_widget('txtValue').set_text('50.0') - self.get_widget('txtTime').set_text('0.1') - self.get_widget('txtTime').hide() - - self.get_widget('cbbEvent').append_text(_me.string('conf_lblChange')) - self.get_widget('cbbEvent').append_text(_me.string('conf_lblThreshold')) - self.get_widget('cbbEvent').set_active(0) - - self.get_widget("lblEvent").set_text(_me.string('conf_lblEvent')) - self.get_widget("lblType").set_text(_me.string('conf_lblType')) - self.get_widget("lblValue").set_text(_me.string('conf_lblValue')) - self.get_widget("lblTime").set_text(_me.string('conf_lblTime')) - self.get_widget("lblNotify").set_text(_me.string('conf_lblNotified')) - self.get_widget("lblScript").set_text(_me.string('conf_lblBehavior')) - self.get_widget("lblBtnApply").set_text(_me.string('widget_lblBtnApply')) - - tab = _me.get_param('test_tab') - self.get_widget('cbbType').hide() - self.get_widget('cbbEvent').set_active(tab[0][1]) - self.get_widget('cbbType').set_active(tab[0][2]) - self.get_widget('txtValue').set_text(str(tab[0][3])) - self.get_widget('txtTime').set_text(str(tab[0][4])) - self.get_widget('chkNotify').set_active(tab[0][5]) - if tab[0][6] != None: - self.get_widget('Behavior').set_filename(str(tab[0][6])) - - - + self.get_widget("window1").set_title(_me.string('name_to_read')) thread.start_new_thread(self.update, ()) + ########################################################### # # Update the values @@ -60,15 +30,59 @@ self.measure.changetext = _me.string('conf_lblChange') self.measure.thresholdtext = _me.string('conf_lblThreshold') - ''' - try: - self.graph.battery = _me.string('battery') - self.graph.plugged = _me.string('plugged') - self.graph.charging = _me.string('charging') - except: - print sys.exc_info() - ''' + self.get_widget('cbbType').append_text(_me.string('at_gui_widget_cbbDog')) + self.get_widget('cbbType').append_text(_me.string('at_gui_widget_cbbSpy')) + self.get_widget('cbbType').append_text(_me.string('at_gui_widget_cbbRecord')) + self.get_widget('cbbType').set_active(0) + self.get_widget('chkDog').set_label(_me.string('at_gui_widget_chkDog')) + self.get_widget('chkDogBehavior').set_label(_me.string('at_gui_widget_chkDogDehavior')) + self.get_widget('chkDogDefault').set_label(_me.string('at_gui_widget_chkDogDefault')) + self.get_widget('chkSpy').set_label(_me.string('at_gui_widget_chkSpy')) + self.get_widget('chkSpyRecord').set_label(_me.string('at_gui_widget_chkSpyRecord')) + self.get_widget('lblDogLevel').set_text(_me.string('at_gui_widget_lblDogLevel')) + self.get_widget('lblSpyLevel').set_text(_me.string('at_gui_widget_lblSpyLevel')) + + self.treeview() + + def on_spinbutton1_changed(self, widget, *args): + print widget.get_text() + self.measure.dog_threshold = float(widget.get_text()) + def on_spinbutton2_changed(self, widget, *args): + self.measure.spy_threshold = float(widget.get_text()) + + def treeview(self): + self.index_column = gtk.TreeViewColumn('Index') + self.index_column.set_min_width(80) + self.index_cell = gtk.CellRendererText() + self.index_column.pack_start(self.index_cell, True) + self.index_column.add_attribute(self.index_cell, 'text', 0) + + self.event_column = gtk.TreeViewColumn(_me.string('conf_lblEvent')) + self.event_column.set_min_width(190) + self.event_cell = gtk.CellRendererText() + self.event_column.pack_start(self.event_cell, True) + self.event_column.add_attribute(self.event_cell, 'text', 1) + + self.type_column = gtk.TreeViewColumn(_me.string('conf_lblType')) + self.type_column.set_min_width(80) + self.type_cell = gtk.CellRendererText() + self.type_column.pack_start(self.type_cell, True) + self.type_column.add_attribute(self.type_cell, 'text', 2) + + self.value_list = gtk.TreeStore(str, str, str) + self.gadget_viewer = gtk.TreeView(self.value_list) + self.gadget_viewer.append_column(self.index_column) + self.gadget_viewer.append_column(self.event_column) + self.gadget_viewer.append_column(self.type_column) + + self.get_widget("scrolledwindow1").add(self.gadget_viewer) + self.get_widget("scrolledwindow1").set_size_request(0, 150) + self.get_widget("scrolledwindow1").show_all() + + self.value_list.append(None, ['test', 'test', 'test']) + + ########################################################### # # Event functions @@ -78,94 +92,11 @@ _me.get_param('measure').GUI_on = False self.measure.GUI_on = False - ''' - def on_btnAdd_clicked... [truncated message content] |
Author: Paul_R Date: 2007-11-30 15:38:46 +0100 (Fri, 30 Nov 2007) New Revision: 745 Added: software/gadgets/sound_monitor/ software/gadgets/sound_monitor/branches/ software/gadgets/sound_monitor/tags/ software/gadgets/sound_monitor/trunk/ software/gadgets/sound_monitor/trunk/audio_monitor.tgf software/gadgets/sound_monitor/trunk/audio_monitor/ software/gadgets/sound_monitor/trunk/audio_monitor/Pictures/ software/gadgets/sound_monitor/trunk/audio_monitor/Pictures/Icons/ software/gadgets/sound_monitor/trunk/audio_monitor/Pictures/Icons/gadget.png software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/ software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/ software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/ software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/conf/ software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/conf/other.glade software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/conf/other.pyp software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/ software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/other.glade software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/other.pyp software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/Sound_class.py software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/init.pyp software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/main.pyp software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/notify.pyp software/gadgets/sound_monitor/trunk/audio_monitor/Strings/ software/gadgets/sound_monitor/trunk/audio_monitor/Strings/fr_ALL.xml software/gadgets/sound_monitor/trunk/audio_monitor/about.xml software/gadgets/sound_monitor/trunk/audio_monitor/parts.xml software/gadgets/sound_monitor/trunk/audio_monitor/settings.xml software/gadgets/sound_monitor/trunk/audio_monitor/strings.xml Log: * Added the sound monitor gadget Added: software/gadgets/sound_monitor/trunk/audio_monitor/Pictures/Icons/gadget.png =================================================================== (Binary files differ) Property changes on: software/gadgets/sound_monitor/trunk/audio_monitor/Pictures/Icons/gadget.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/conf/other.glade =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/conf/other.glade (rev 0) +++ software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/conf/other.glade 2007-11-30 14:38:46 UTC (rev 745) @@ -0,0 +1,308 @@ +<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> +<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> + +<glade-interface> + +<widget class="GtkWindow" id="window1"> + <property name="visible">True</property> + <property name="title" translatable="yes">Parameters</property> + <property name="type">GTK_WINDOW_TOPLEVEL</property> + <property name="window_position">GTK_WIN_POS_NONE</property> + <property name="modal">False</property> + <property name="resizable">False</property> + <property name="destroy_with_parent">False</property> + <property name="decorated">True</property> + <property name="skip_taskbar_hint">False</property> + <property name="skip_pager_hint">False</property> + <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> + <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> + <property name="focus_on_map">True</property> + <property name="urgency_hint">False</property> + + <child> + <widget class="GtkVBox" id="vbox1"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkFrame" id="frame5"> + <property name="border_width">5</property> + <property name="visible">True</property> + <property name="label_xalign">0</property> + <property name="label_yalign">0.5</property> + <property name="shadow_type">GTK_SHADOW_IN</property> + + <child> + <widget class="GtkAlignment" id="alignment8"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">12</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkFixed" id="fixed6"> + <property name="height_request">29</property> + <property name="visible">True</property> + + <child> + <widget class="GtkSpinButton" id="delay_spinbutton"> + <property name="width_request">120</property> + <property name="height_request">24</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="climb_rate">1</property> + <property name="digits">0</property> + <property name="numeric">False</property> + <property name="update_policy">GTK_UPDATE_ALWAYS</property> + <property name="snap_to_ticks">False</property> + <property name="wrap">False</property> + <property name="adjustment">1 1 3600 1 10 10</property> + </widget> + <packing> + <property name="x">88</property> + <property name="y">0</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label13"> + <property name="width_request">336</property> + <property name="height_request">16</property> + <property name="visible">True</property> + <property name="label" translatable="yes">Delay (sec) :</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</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">0</property> + </packing> + </child> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GtkLabel" id="label12"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Updates</b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</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="type">label_item</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkFixed" id="fixed3"> + <property name="height_request">44</property> + <property name="visible">True</property> + + <child> + <widget class="GtkButton" id="button2"> + <property name="width_request">96</property> + <property name="height_request">32</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <signal name="clicked" handler="on_accept_clicked"/> + + <child> + <widget class="GtkAlignment" id="alignment4"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">0</property> + <property name="yscale">0</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">0</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkHBox" id="hbox2"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">2</property> + + <child> + <widget class="GtkImage" id="image2"> + <property name="visible">True</property> + <property name="stock">gtk-apply</property> + <property name="icon_size">4</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label5"> + <property name="visible">True</property> + <property name="label" translatable="yes">Accept</property> + <property name="use_underline">True</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</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="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + </child> + </widget> + </child> + </widget> + <packing> + <property name="x">16</property> + <property name="y">8</property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="button3"> + <property name="width_request">96</property> + <property name="height_request">32</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <signal name="clicked" handler="on_cancel_clicked"/> + + <child> + <widget class="GtkAlignment" id="alignment5"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">0</property> + <property name="yscale">0</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">0</property> + <property name="right_padding">0</property> + + <child> + <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="image3"> + <property name="visible">True</property> + <property name="stock">gtk-cancel</property> + <property name="icon_size">4</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label6"> + <property name="visible">True</property> + <property name="label" translatable="yes">Cancel</property> + <property name="use_underline">True</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</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="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + </child> + </widget> + </child> + </widget> + <packing> + <property name="x">144</property> + <property name="y">8</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + </child> +</widget> + +</glade-interface> Added: software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/conf/other.pyp =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/conf/other.pyp (rev 0) +++ software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/conf/other.pyp 2007-11-30 14:38:46 UTC (rev 745) @@ -0,0 +1,473 @@ +bindtextdomain("params", "") + +class Window(SimpleGladeApp): + def __init__(self, + path=_me.get_path('root') + '/Scripts/Python/GUI/conf/other.glade', + root="window1", + domain="params", **kwargs): + SimpleGladeApp.__init__(self, path, root, domain, **kwargs) + + + def new(self): + self.measure = _me.get_param('measure') + #_me.insert_funct('refresh_tree', self.refresh_tree) + #_me.insert_funct('verify_tab', self.verify_tab) + self.updates_commons() + #self.make_viewtree() + #self.update_labels() + + + + + def updates_commons(self): + # Window title + txt = "%s : %s" % (_me.string('name_to_read'), + _me.string('gui_conf_window_title')) + self.get_widget("window1").set_title(txt) + + + # Update Frame + txt = _me.string('gui_conf_update_title') + self.get_widget("label12").set_text(txt) + + txt = "%s : " % _me.string('gui_conf_delay_lb') + self.get_widget("label13").set_text(txt) + + value = _me.get_var('notify_delay') + self.get_widget("delay_spinbutton").set_value(value) + + # Bottom buttons + txt = _me.string('gui_conf_cancel_bt') + self.get_widget("label6").set_text(txt) + + txt = _me.string('gui_conf_accept_bt') + self.get_widget("label5").set_text(txt) + + #self.get_widget('txt_conf_rate').set_text(str(_me.get_param('Rate'))) + #self.get_widget('txt_conf_sample').set_text(str(_me.get_param('Sample'))) + #self.get_widget('txtLowThreshold').set_text(str(_me.get_param('low_threshold'))) + #self.get_widget('txtHighThreshold').set_text(str(_me.get_param('high_threshold'))) + + ########################################################### + # + # On cancel button clicked + # + ########################################################### + def on_cancel_clicked(self, widget, *args): + self.get_widget("window1").destroy() + + + + ########################################################### + # + # On accept button clicked + # + ########################################################### + def on_accept_clicked(self, widget, *args): + _me.set_var('notify_delay', int(self.get_widget("delay_spinbutton").get_value())) + + self.get_widget("window1").destroy() + ''' + _me.set_param('Rate', float(self.get_widget('txt_conf_rate').get_text())) + _me.set_param('Sample',float(self.get_widget('txt_conf_sample').get_text())) + _me.set_param(('MainScript'), str(self.get_widget('mainScript').get_filename())) + _me.set_param(('chkMotors'), self.get_widget('chkMotors').get_active()) + self.measure.chkMotors = self.get_widget('chkMotors').get_active() + self.measure.rate_backup = _me.get_param('Rate') + self.measure.sample_backup = _me.get_param('Sample') + + try: + float(self.get_widget('txtLowThreshold').get_text()) + except: + self.get_widget('txtLowThreshold').set_text('4.8') + + if float(self.get_widget('txtLowThreshold').get_text()) < 4.0: + self.get_widget('txtLowThreshold').set_text('4.0') + if float(self.get_widget('txtLowThreshold').get_text()) > 6.3: + self.get_widget('txtLowThreshold').set_text('6.3') + self.measure.low_threshold = float(self.get_widget('txtLowThreshold').get_text()) + _me.set_param('low_threshold', self.measure.low_threshold) + + try: + float(self.get_widget('txtHighThreshold').get_text()) + except: + self.get_widget('txtHighThreshold').set_text('4.8') + + if float(self.get_widget('txtHighThreshold').get_text()) < self.measure.low_threshold: + self.get_widget('txtHighThreshold').set_text(str(self.measure.low_threshold + 0.1)) + if float(self.get_widget('txtHighThreshold').get_text()) > 6.4: + self.get_widget('txtHighThreshold').set_text('6.4') + + self.measure.high_threshold = float(self.get_widget('txtHighThreshold').get_text()) + _me.set_param('high_threshold', self.measure.high_threshold) + + self.measure.absolute_threshold_high_flag = False + self.measure.absolute_threshold_low_flag = False + ''' + + + ''' + ########################################################### + # + # Battery configuration control + # + ########################################################### + def make_viewtree(self): + self.index_column = gtk.TreeViewColumn('Index') + self.index_column.set_min_width(50) + self.index_cell = gtk.CellRendererText() + self.index_column.pack_start(self.index_cell, True) + self.index_column.add_attribute(self.index_cell, 'text', 0) + + self.event_column = gtk.TreeViewColumn(_me.string('conf_lblEvent')) + self.event_column.set_min_width(100) + self.event_cell = gtk.CellRendererText() + self.event_column.pack_start(self.event_cell, True) + self.event_column.add_attribute(self.event_cell, 'text', 1) + + self.type_column = gtk.TreeViewColumn(_me.string('conf_lblType')) + self.type_column.set_min_width(100) + self.type_cell = gtk.CellRendererText() + self.type_column.pack_start(self.type_cell, True) + self.type_column.add_attribute(self.type_cell, 'text', 2) + + self.value_column = gtk.TreeViewColumn(_me.string('conf_lblValue')) + self.value_column.set_min_width(100) + self.value_cell = gtk.CellRendererText() + self.value_column.pack_start(self.value_cell, True) + self.value_column.add_attribute(self.value_cell, 'text', 3) + + self.time_column = gtk.TreeViewColumn(_me.string('conf_lblTime')) + self.time_column.set_min_width(100) + self.time_cell = gtk.CellRendererText() + self.time_column.pack_start(self.time_cell, True) + self.time_column.add_attribute(self.time_cell, 'text', 4) + + self.notified_column = gtk.TreeViewColumn(_me.string('conf_lblNotified')) + self.notified_column.set_min_width(100) + self.notified_cell = gtk.CellRendererText() + self.notified_column.pack_start(self.notified_cell, True) + self.notified_column.add_attribute(self.notified_cell, 'text', 5) + + self.behavior_column = gtk.TreeViewColumn(_me.string('conf_lblBehavior')) + self.behavior_cell = gtk.CellRendererText() + self.behavior_column.pack_start(self.behavior_cell, True) + self.behavior_column.add_attribute(self.behavior_cell, 'text', 6) + + self.value_list = gtk.TreeStore(int, str, str, str, str, str, str) + self.gadget_viewer = gtk.TreeView(self.value_list) + self.gadget_viewer.append_column(self.index_column) + self.gadget_viewer.append_column(self.event_column) + self.gadget_viewer.append_column(self.type_column) + self.gadget_viewer.append_column(self.value_column) + self.gadget_viewer.append_column(self.time_column) + self.gadget_viewer.append_column(self.notified_column) + self.gadget_viewer.append_column(self.behavior_column) + self.get_widget("scrolledwindow1").add(self.gadget_viewer) + self.get_widget("scrolledwindow1").set_size_request(0, 150) + self.get_widget("scrolledwindow1").show_all() + self.get_widget('cbb_conf_event').set_active(0) + self.get_widget('txt_conf_value').set_text('1.0') + self.get_widget('txt_conf_time').set_text('0.1') + self.get_widget('chkMotors').set_label(_me.string('lblMotors')) + self.get_widget('chkMotors').set_active(_me.get_param('chkMotors')) + self.measure.chkMotors = _me.get_param('chkMotors') + self.gadget_viewer.get_selection().connect("changed",self.on_row_selected) + #self.gadget_viewer.connect("row_activated", self.on_row_selected) + self.measure.event_tab = _me.get_param('config') + self.get_widget('cbb_conf_event').append_text(_me.string('conf_lblChange')) + self.get_widget('cbb_conf_event').append_text(_me.string('conf_lblThreshold')) + self.get_widget('cbb_conf_event').set_active(0) + + + for i in range(len(self.measure.event_tab)): + self.add_row(i) + ''' + + ''' + ########################################################### + # + # Update the labels + # + ########################################################### + def update_labels(self): + #self.get_widget("lbl_conf_event").set_text(_me.string('conf_lblEvent')) + + #self.get_widget("lbl_conf_type").set_text(_me.string('conf_lblType')) + #self.get_widget("lbl_conf_value").set_text(_me.string('conf_lblValue')) + #self.get_widget("lbl_conf_time").set_text(_me.string('conf_lblTime')) + #self.get_widget("lbl_conf_notified").set_text(_me.string('conf_lblNotified')) + #self.get_widget("lbl_conf_behavior").set_text(_me.string('conf_lblBehavior')) + #self.get_widget("btn_conf_add").set_label(_me.string('conf_btnAdd')) + #self.get_widget("btn_conf_remove").set_label(_me.string('conf_btnRemove')) + #self.get_widget("btn_conf_modify").set_label(_me.string('conf_btnModify')) + #self.get_widget("btnBehavior").set_label(_me.string('conf_btnBehavior')) + #self.get_widget("lbl_conf_sample").set_text(_me.string('conf_lblSample')) + #self.get_widget("lbl_conf_rate").set_text(_me.string('conf_lblRate')) + #self.get_widget("lblControlFrame").set_text(_me.string('conf_lblControl')) + #self.get_widget("lblScript").set_text(_me.string('MainBehavior')) + #self.get_widget("lblHighThreshold").set_label(_me.string('lblHighThreshold')) + #self.get_widget("lblLowThreshold").set_label(_me.string('lblLowThreshold')) + ''' + + ''' + ########################################################### + # + # On row selected + # + ########################################################### + def on_row_selected(self, obj): + path = obj.get_selected_rows() + self.__iter = self.value_list.get_iter(path[1][0]) + index = self.value_list.get_value(self.__iter, 0) + event = self.value_list.get_value(self.__iter, 1) + typet = self.value_list.get_value(self.__iter, 2) + value = self.value_list.get_value(self.__iter, 3) + time = self.value_list.get_value(self.__iter, 4) + notify = self.value_list.get_value(self.__iter, 5) + behavior = self.value_list.get_value(self.__iter, 6) + + if event == _me.string('conf_lblChange'): + self.get_widget('cbb_conf_event').set_active(0) + if typet == _me.string('conf_lblDrop'): + self.get_widget('cbb_conf_type').set_active(0) + if typet == _me.string('conf_lblRaise'): + self.get_widget('cbb_conf_type').set_active(1) + if typet == _me.string('conf_lblChangeD'): + self.get_widget('cbb_conf_type').set_active(2) + if typet == _me.string('conf_lblChangeU'): + self.get_widget('cbb_conf_type').set_active(3) + self.get_widget('txt_conf_value').set_text(value) + self.get_widget('txt_conf_time').set_text(time) + + else: + self.get_widget('cbb_conf_event').set_active(1) + if typet == _me.string('conf_lblIncrease'): + self.get_widget('cbb_conf_type').set_active(0) + if typet == _me.string('conf_lblDecrease'): + self.get_widget('cbb_conf_type').set_active(1) + if typet == _me.string('conf_lblBoth'): + self.get_widget('cbb_conf_type').set_active(2) + + self.get_widget('txt_conf_value').set_text(value) + self.get_widget('txt_conf_time').set_text('') + + if notify == _me.string('conf_lblNotifiedBehavior'): + self.get_widget('chk_conf_notified').set_active(True) + else: + self.get_widget('chk_conf_notified').set_active(False) + + if behavior != 'N.A.': + self.get_widget('conf_behavior').set_filename(behavior) + else: + self.get_widget('conf_behavior').set_filename('None') + + + ########################################################### + # + # On row modified + # + ########################################################### + def on_btn_conf_modify_clicked(self, widget, *args): + index = self.value_list.get_value(self.__iter, 0) + + self.measure.event_tab = _me.get_param('config') + length = len(_me.get_param('config')) + self.verify_value() + + value = [] + value = [index, + self.get_widget('cbb_conf_event').get_active(), + self.get_widget('cbb_conf_type').get_active(), + float(self.get_widget('txt_conf_value').get_text()), + float(self.get_widget('txt_conf_time').get_text()), + self.get_widget('chk_conf_notified').get_active(), + str(self.get_widget('conf_behavior').get_filename()), + False, + 0] + self.measure.event_tab = _me.get_param('config') + + if self.verify_tab(value): + self.measure.event_tab[(index-1)] = value + _me.set_param('config', self.measure.event_tab) + self.value_list.clear() + for i in range(len(self.measure.event_tab)): + self.add_row(i) + + ########################################################### + # + # On row deleted + # + ########################################################### + def on_btn_conf_remove_clicked(self, widget, *args): + index = self.value_list.get_value(self.__iter, 0) + self.measure.event_tab =_me.get_param('config') + self.measure.event_tab.pop(index - 1) + _me.set_param('config', self.measure.event_tab) + self.__iter = 0 + self.value_list.clear() + for i in range(len(self.measure.event_tab)): + self.add_row(i) + + ########################################################### + # + # On row added + # + ########################################################### + def on_btn_conf_add_clicked(self, widget, *args): + length = len(_me.get_param('config')) + self.verify_value() + value = [] + value = [(length + 1), + self.get_widget('cbb_conf_event').get_active(), + self.get_widget('cbb_conf_type').get_active(), + float(self.get_widget('txt_conf_value').get_text()), + float(self.get_widget('txt_conf_time').get_text()), + self.get_widget('chk_conf_notified').get_active(), + str(self.get_widget('conf_behavior').get_filename()), + False, + 0] + self.measure.event_tab = _me.get_param('config') + if self.verify_tab(value): + self.measure.event_tab.append(value) + self.refresh_tree() + + def refresh_tree(self): + _me.set_param('config', self.measure.event_tab) + self.value_list.clear() + for i in range(len(self.measure.event_tab)): + self.add_row(i) + + + def verify_tab(self, tab): + for i in range(len(self.measure.event_tab)): + if self.measure.event_tab[i][1] == tab[1]: + if self.measure.event_tab[i][2] == tab[2]: + if self.measure.event_tab[i][3] == tab[3]: + if self.measure.event_tab[i][4] == tab[4]: + if self.measure.event_tab[i][5] == tab[5]: + if self.measure.event_tab[i][6] == tab[6]: + return False + return True + + ########################################################### + # + # Add row function + # + ########################################################### + def add_row(self, tab_index): + self.measure.event_tab = _me.get_param('config') + i = tab_index + + if self.measure.event_tab[i][1] == 0: + Event = _me.string('conf_lblChange') + if self.measure.event_tab[i][2] == 0: + Type = _me.string('conf_lblDrop') + elif self.measure.event_tab[i][2] == 1: + Type = _me.string('conf_lblRaise') + elif self.measure.event_tab[i][2] == 2: + Type = _me.string('conf_lblChangeD') + elif self.measure.event_tab[i][2] == 3: + Type = _me.string('conf_lblChangeU') + Value = str(self.measure.event_tab[i][3]) + Time = str(self.measure.event_tab[i][4]) + else: + Event = _me.string('conf_lblThreshold') + if self.measure.event_tab[i][2] == 0: + Type = _me.string('conf_lblIncrease') + elif self.measure.event_tab[i][2] == 1: + Type = _me.string('conf_lblDecrease') + elif self.measure.event_tab[i][2] == 2: + Type = _me.string('conf_lblBoth') + Value = str(self.measure.event_tab[i][3]) + Time = 'N.A.' + + if self.measure.event_tab[i][5]: + Notify = _me.string('conf_lblNotifiedBehavior') + if self.measure.event_tab[i][6] ==None: + Behavior = _me.string('conf_lblDefaultBehavior') + else: + Behavior = str(self.measure.event_tab[i][6]) + else: + Notify = _me.string('conf_lblNotNotified') + Behavior = 'N.A.' + + self.value_list.append(None,[(i+1), Event, Type, Value, Time, Notify, Behavior]) + ''' + ''' + ########################################################### + # + # On combo box event + # + ########################################################### + def on_cbb_conf_event_changed(self, widget, *args): + if self.get_widget('cbb_conf_event').get_active() == 0: + for i in range (4): + self.get_widget('cbb_conf_type').remove_text(0) + self.get_widget('cbb_conf_type').append_text(_me.string('conf_lblDrop')) + self.get_widget('cbb_conf_type').append_text(_me.string('conf_lblRaise')) + self.get_widget('cbb_conf_type').append_text(_me.string('conf_lblChangeD')) + self.get_widget('cbb_conf_type').append_text(_me.string('conf_lblChangeU')) + self.get_widget('cbb_conf_type').set_active(0) + else: + for i in range (4): + self.get_widget('cbb_conf_type').remove_text(0) + self.get_widget('cbb_conf_type').append_text(_me.string('conf_lblIncrease')) + self.get_widget('cbb_conf_type').append_text(_me.string('conf_lblDecrease')) + self.get_widget('cbb_conf_type').append_text(_me.string('conf_lblBoth')) + self.get_widget('cbb_conf_type').set_active(0) + ''' + + + + + + + ''' + ########################################################### + # + # On Clear path button clicked + # + ########################################################### + def on_btnBehavior_clicked(self, widget, *args): + self.get_widget('conf_behavior').set_filename('None') + index = self.value_list.get_value(self.__iter, 0) + self.measure.event_tab[index-1][6] = None + + self.value_list.clear() + for i in range(len(self.measure.event_tab)): + self.add_row(i) + ''' + ''' + ########################################################### + # + # Verify the value + # + ########################################################### + def verify_value(self): + if self.get_widget('cbb_conf_event').get_active() == 0: + maximum = 2.5 + minimum = 0.025 + else: + maximum = 6.5 + minimum = 4.0 + try: + float(self.get_widget('txt_conf_time').get_text()) + except: + self.get_widget('txt_conf_time').set_text('0.1') + + if float(self.get_widget('txt_conf_time').get_text()) < self.measure.rate: + self.get_widget('txt_conf_time').set_text(str(self.measure.rate)) + if float(self.get_widget('txt_conf_time').get_text()) > self.measure.rate * self.measure.sample: + self.get_widget('txt_conf_time').set_text(str(self.measure.rate * self.measure.sample)) + + try: + float(self.get_widget('txt_conf_value').get_text()) + except: + self.get_widget('txt_conf_value').set_text(str(minimum)) + + if float(self.get_widget('txt_conf_value').get_text()) < minimum: + self.get_widget('txt_conf_value').set_text(str(minimum)) + if float(self.get_widget('txt_conf_value').get_text()) > maximum: + self.get_widget('txt_conf_value').set_text(str(maximum)) + ''' Added: software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/other.glade =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/other.glade (rev 0) +++ software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/other.glade 2007-11-30 14:38:46 UTC (rev 745) @@ -0,0 +1,511 @@ +<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> +<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> + +<glade-interface> + +<widget class="GtkWindow" id="window1"> + <property name="visible">True</property> + <property name="title" translatable="yes">Widget</property> + <property name="type">GTK_WINDOW_TOPLEVEL</property> + <property name="window_position">GTK_WIN_POS_NONE</property> + <property name="modal">False</property> + <property name="default_width">600</property> + <property name="default_height">449</property> + <property name="resizable">False</property> + <property name="destroy_with_parent">False</property> + <property name="decorated">True</property> + <property name="skip_taskbar_hint">False</property> + <property name="skip_pager_hint">False</property> + <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> + <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> + <property name="focus_on_map">True</property> + <property name="urgency_hint">False</property> + <signal name="destroy" handler="on_window1_destroy"/> + + <child> + <widget class="GtkVBox" id="vbox1"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkVBox" id="vbox2"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <placeholder/> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkExpander" id="expander2"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="expanded">True</property> + <property name="spacing">0</property> + <signal name="activate" handler="on_expander_activate" last_modification_time="Wed, 10 Oct 2007 09:25:14 GMT"/> + + <child> + <widget class="GtkFrame" id="frame2"> + <property name="border_width">5</property> + <property name="width_request">400</property> + <property name="visible">True</property> + <property name="label_xalign">0</property> + <property name="label_yalign">0.5</property> + <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property> + + <child> + <widget class="GtkAlignment" id="alignment3"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">12</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkFixed" id="fixed10"> + <property name="width_request">373</property> + <property name="height_request">197</property> + <property name="visible">True</property> + + <child> + <widget class="GtkEntry" id="txtValue"> + <property name="width_request">80</property> + <property name="height_request">24</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">True</property> + <property name="visibility">True</property> + <property name="max_length">0</property> + <property name="text" translatable="yes"></property> + <property name="has_frame">True</property> + <property name="invisible_char">●</property> + <property name="activates_default">False</property> + </widget> + <packing> + <property name="x">200</property> + <property name="y">35</property> + </packing> + </child> + + <child> + <widget class="GtkEntry" id="txtTime"> + <property name="width_request">80</property> + <property name="height_request">24</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">True</property> + <property name="visibility">True</property> + <property name="max_length">0</property> + <property name="text" translatable="yes"></property> + <property name="has_frame">True</property> + <property name="invisible_char">●</property> + <property name="activates_default">False</property> + </widget> + <packing> + <property name="x">284</property> + <property name="y">35</property> + </packing> + </child> + + <child> + <widget class="GtkComboBox" id="cbbType"> + <property name="width_request">88</property> + <property name="height_request">30</property> + <property name="visible">True</property> + <property name="items" translatable="yes"></property> + <property name="add_tearoffs">False</property> + <property name="focus_on_click">True</property> + </widget> + <packing> + <property name="x">104</property> + <property name="y">32</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="lblType"> + <property name="width_request">88</property> + <property name="height_request">16</property> + <property name="visible">True</property> + <property name="label" translatable="yes">Type</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</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">104</property> + <property name="y">8</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="lblValue"> + <property name="width_request">80</property> + <property name="height_request">16</property> + <property name="visible">True</property> + <property name="label" translatable="yes">Value</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</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">200</property> + <property name="y">8</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="lblTime"> + <property name="width_request">80</property> + <property name="height_request">16</property> + <property name="visible">True</property> + <property name="label" translatable="yes">Time</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</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">284</property> + <property name="y">8</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="lblNotify"> + <property name="width_request">96</property> + <property name="height_request">16</property> + <property name="visible">True</property> + <property name="label" translatable="yes">Notified?</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</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">72</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="lblScript"> + <property name="width_request">144</property> + <property name="height_request">16</property> + <property name="visible">True</property> + <property name="label" translatable="yes">Behavior script</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</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">120</property> + <property name="y">72</property> + </packing> + </child> + + <child> + <widget class="GtkFileChooserButton" id="Behavior"> + <property name="width_request">144</property> + <property name="height_request">30</property> + <property name="visible">True</property> + <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> + </widget> + <packing> + <property name="x">120</property> + <property name="y">96</property> + </packing> + </child> + + <child> + <widget class="GtkCheckButton" id="chkNotify"> + <property name="width_request">24</property> + <property name="height_request">24</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">False</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + + <child> + <placeholder/> + </child> + </widget> + <packing> + <property name="x">32</property> + <property name="y">96</property> + </packing> + </child> + + <child> + <widget class="GtkComboBox" id="cbbEvent"> + <property name="width_request">88</property> + <property name="height_request">30</property> + <property name="visible">True</property> + <property name="items" translatable="yes"></property> + <property name="add_tearoffs">False</property> + <property name="focus_on_click">True</property> + <signal name="changed" handler="on_cbb_conf_event_changed"/> + </widget> + <packing> + <property name="x">8</property> + <property name="y">32</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="lblEvent"> + <property name="width_request">88</property> + <property name="height_request">16</property> + <property name="visible">True</property> + <property name="label" translatable="yes">Event</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</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">8</property> + <property name="y">8</property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="btnApply"> + <property name="width_request">144</property> + <property name="height_request">29</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <signal name="clicked" handler="on_btnApply_clicked"/> + + <child> + <widget class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">0</property> + <property name="yscale">0</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">0</property> + <property name="right_padding">0</property> + + <child> + <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="image1"> + <property name="visible">True</property> + <property name="stock">gtk-yes</property> + <property name="icon_size">4</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="lblBtnApply"> + <property name="visible">True</property> + <property name="label" translatable="yes">Apply changes</property> + <property name="use_underline">True</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</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="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + </child> + </widget> + </child> + </widget> + <packing> + <property name="x">8</property> + <property name="y">160</property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="btnAdd"> + <property name="width_request">144</property> + <property name="height_request">29</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">button1</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_btnAdd_clicked" last_modification_time="Tue, 09 Oct 2007 18:34:49 GMT"/> + </widget> + <packing> + <property name="x">176</property> + <property name="y">160</property> + </packing> + </child> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GtkLabel" id="label8"> + <property name="visible">True</property> + <property name="label" translatable="yes"></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</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="type">label_item</property> + </packing> + </child> + </widget> + </child> + + <child> + <widget class="GtkLabel" id="lblThreshold"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Test notifications</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">True</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="type">label_item</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + </child> +</widget> + +</glade-interface> Added: software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/other.pyp =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/other.pyp (rev 0) +++ software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/other.pyp 2007-11-30 14:38:46 UTC (rev 745) @@ -0,0 +1,206 @@ +bindtextdomain("params", "") +sys.path.append(_me.get_path('root') + '/Scripts/Python') +from Sound_class import Sound_Graph + +class Window(SimpleGladeApp): + + def __init__(self, + path=_me.get_path('root') + '/Scripts/Python/GUI/widget/other.glade', + root="window1", + domain="params", **kwargs): + SimpleGladeApp.__init__(self, path, root, domain, **kwargs) + + ########################################################### + # + # Display the new window + # + ########################################################### + def new(self): + self.get_widget("window1").set_title(_me.string('name_to_read')) + self.get_widget("lblThreshold").set_text(_me.string('widget_lblTest')) + + self.get_widget("btnAdd").set_label(_me.string('widget_lblSet')) + + self.get_widget('txtValue').set_text('50.0') + self.get_widget('txtTime').set_text('0.1') + self.get_widget('txtTime').hide() + + self.get_widget('cbbEvent').append_text(_me.string('conf_lblChange')) + self.get_widget('cbbEvent').append_text(_me.string('conf_lblThreshold')) + self.get_widget('cbbEvent').set_active(0) + + self.get_widget("lblEvent").set_text(_me.string('conf_lblEvent')) + self.get_widget("lblType").set_text(_me.string('conf_lblType')) + self.get_widget("lblValue").set_text(_me.string('conf_lblValue')) + self.get_widget("lblTime").set_text(_me.string('conf_lblTime')) + self.get_widget("lblNotify").set_text(_me.string('conf_lblNotified')) + self.get_widget("lblScript").set_text(_me.string('conf_lblBehavior')) + self.get_widget("lblBtnApply").set_text(_me.string('widget_lblBtnApply')) + + tab = _me.get_param('test_tab') + self.get_widget('cbbType').hide() + self.get_widget('cbbEvent').set_active(tab[0][1]) + self.get_widget('cbbType').set_active(tab[0][2]) + self.get_widget('txtValue').set_text(str(tab[0][3])) + self.get_widget('txtTime').set_text(str(tab[0][4])) + self.get_widget('chkNotify').set_active(tab[0][5]) + if tab[0][6] != None: + self.get_widget('Behavior').set_filename(str(tab[0][6])) + + + + thread.start_new_thread(self.update, ()) + + ########################################################### + # + # Update the values + # + ########################################################### + def update_value(self): + + self.measure.changetext = _me.string('conf_lblChange') + self.measure.thresholdtext = _me.string('conf_lblThreshold') + ''' + try: + self.graph.battery = _me.string('battery') + self.graph.plugged = _me.string('plugged') + self.graph.charging = _me.string('charging') + except: + print sys.exc_info() + ''' + + ########################################################### + # + # Event functions + # + ########################################################### + def on_window1_destroy(self, widget, *args): + _me.get_param('measure').GUI_on = False + self.measure.GUI_on = False + + ''' + def on_btnAdd_clicked(self, widget, *args): + length = len(_me.get_param('config')) + self.verify_value() + value = [] + value = [(length + 1), + self.get_widget('cbbEvent').get_active(), + self.get_widget('cbbType').get_active(), + float(self.get_widget('txtValue').get_text()), + float(self.get_widget('txtTime').get... [truncated message content] |
From: Paul_R <c2m...@c2...> - 2007-11-29 11:21:55
|
Author: Paul_R Date: 2007-11-29 12:21:53 +0100 (Thu, 29 Nov 2007) New Revision: 744 Modified: software/gadgets/settings/trunk/settings.tgf software/gadgets/settings/trunk/settings/Scripts/Python/GUI/selftest/other.pyp software/gadgets/settings/trunk/settings/Scripts/Python/GUI/widget/other.pyp software/gadgets/settings/trunk/settings/Scripts/Python/notify.pyp software/gadgets/settings/trunk/settings/Strings/fr_ALL.xml software/gadgets/settings/trunk/settings/about.xml software/gadgets/settings/trunk/settings/settings.xml software/gadgets/settings/trunk/settings/strings.xml Log: * Improved the self test program. Now, it is compatible with the tuxsetup1.2 beta, and with the factory firmwares. * Added a routine to refresh the installed version in the treeview. * Added the compatibility with the tuxsetup1.2 beta. /!\ The sound is not compatible with it ! Modified: software/gadgets/settings/trunk/settings/Scripts/Python/GUI/selftest/other.pyp =================================================================== --- software/gadgets/settings/trunk/settings/Scripts/Python/GUI/selftest/other.pyp 2007-11-29 10:50:21 UTC (rev 743) +++ software/gadgets/settings/trunk/settings/Scripts/Python/GUI/selftest/other.pyp 2007-11-29 11:21:53 UTC (rev 744) @@ -14,6 +14,7 @@ SimpleGladeApp.__init__(self, path, root, domain, **kwargs) self.ok_flag = False self.cancel_flag = False + self.error = [] def new(self): self.get_widget("window1").set_title(_me.string('name_to_read')) @@ -38,9 +39,9 @@ self.view.append_column( self.column ) self.get_widget("scrolledwindow2T").add(self.view) self.get_widget("scrolledwindow2T").show_all() - self.testmode() + def testmode(self): ## Test init self.path = commands.getoutput('echo $USER') @@ -49,7 +50,7 @@ self.tree_store.append(None, [_me.string('Selftest')+'/home/%s/TuxSelftest_%s.txt' %(self.path, self.date)]) self.get_widget('progressbar2T').set_fraction(0) - STEPS = 28.0 + STEPS = 30.0 self.fraction = float(1.0 / STEPS) self.actual_fraction = 0 @@ -72,28 +73,39 @@ self.f.write('%s : ============================================================= \n'%time.asctime()) self.f.write('%s : First step - Reset tux \n'%time.asctime()) self.f.write('%s : ------------------------------------------------------------- \n'%time.asctime()) + self.tree_store.clear() + self.tree_store.append(None, ['Reset Tux ...']) tux.cmd.raw(0x31, 0, 0, 0) tux.cmd.mouth_close() tux.sys.wait(1) + tux.cmd.eyes_close() + tux.sys.wait(1) tux.cmd.eyes_open() self.f.write('%s :\n'%time.asctime()) - - if tux.status.power_plug() == 0: - self.warning(_me.string('Connect')) + try: + if tux.status.charger_state() == 0: + self.warning(_me.string('Connect')) + except: if tux.status.power_plug() == 0: - self.f.write('%s : The power plug is not detected\n'%time.asctime()) - else: - self.f.write('%s : Power plug detected\n'%time.asctime()) - else: - self.f.write('%s : Power plug detected\n'%time.asctime()) + self.warning(_me.string('Connect')) self.progress_bar() - tux.sys.wait(2) - if tux.status.charger_state() == 1: - self.f.write('%s : Battery charger active\n'%time.asctime()) - else: - self.f.write('%s : Battery charger not active ...\n'%time.asctime()) + tux.sys.wait(1) + try: + if tux.status.charger_state() == 1: + self.f.write('%s : Battery charger active\n'%time.asctime()) + elif tux.status.charger_state() == 0: + self.f.write('%s : Power plug not detected\n'%time.asctime()) + elif tux.status.charger_state() == 2: + self.f.write('%s : Trickle mode\n'%time.asctime()) + elif tux.status.charger_state() == 3: + self.f.write('%s : Power plug detected, no charge\n'%time.asctime()) + except: + if tux.status.power_plug() == 0: + self.f.write('%s : Power plug not detected\n'%time.asctime()) + else: + self.f.write('%s : Power plug detected\n'%time.asctime()) self.progress_bar() @@ -101,39 +113,57 @@ self.f.write('%s :\n'%time.asctime()) self.f.write('%s : Second step : Measures\n'%time.asctime()) self.f.write('%s : ------------------------------------------------------------- \n'%time.asctime()) + self.tree_store.clear() level1 = tux.status.light_level() + self.tree_store.append(None, ['Light level with the eyes open : %d'%level1]) self.f.write('%s : Light level with the eyes open : %s\n'%(time.asctime(), level1)) - tux.cmd.eyes_close() - tux.sys.wait(0.5) - level2 = tux.status.light_level() + for i in range(2): + tux.cmd.eyes_close() + tux.sys.wait(0.5) + if tux.status.eyes_closed() == 0: + level2 = tux.status.light_level() + break + + + level2 = tux.status.light_level() + self.tree_store.append(None, ['Light level with the eyes closed : %d'%level2]) self.f.write('%s : Light level with the eyes closed : %s\n'%(time.asctime(), level2)) + if level2 + 10 >= level1: + self.error.append('The light level seems bad') + self.progress_bar() - - level = tux.status.battery_level() - self.f.write('%s : Battery level : %s'%(time.asctime(), level[0])) - if level[1] == True: + tux.sys.wait(1) + level1 = tux.status.battery_level() + self.tree_store.clear() + self.tree_store.append(None, ['Battery level with all motors off : %d'%level1[0]]) + self.f.write('%s : Battery level : %s'%(time.asctime(), level1[0])) + if level1[1] == True: self.f.write(' with all motors off\n') else: self.f.write(' with one or more motor(s) running\n') - + self.progress_bar() tux.cmd.eyes_on(0) - tux.sys.wait(0.5) - level = tux.status.battery_level() + tux.sys.wait(1) + level2 = tux.status.battery_level() + self.tree_store.append(None, ['Battery level with one or more motor(s) on : %d'%level2[0]]) tux.cmd.eyes_off() tux.sys.wait(0.5) - self.f.write('%s : Battery level : %s'%(time.asctime(), level[0])) - if level[1] == True: + self.f.write('%s : Battery level : %s'%(time.asctime(), level2[0])) + if level2[1] == True: self.f.write(' with all motors off\n') else: self.f.write(' with one or more motor(s) running\n') + + if level2[0] <= level1[0] - 30: + self.error.append('The batteries seems bad') self.progress_bar() - tux.cmd.eyes_close() + tux.sys.wait(1) tux.cmd.eyes_open() def buttons_tests(self): @@ -148,7 +178,7 @@ self.progress_bar() self.warning(_me.string('Switch')) - + self.f.write('%s : Test the switches with the wings low\n'%time.asctime()) tux.event.on_head_bt_pushed = self.on_head_bt_pushed tux.event.on_lwing_bt_pushed = self.on_lwing_bt_pushed tux.event.on_rwing_bt_pushed = self.on_rwing_bt_pushed @@ -170,7 +200,47 @@ self.f.write('%s : Right wing pressed : %s\n'%(time.asctime(), str(self.rwing[0]))) self.f.write('%s : Right wing released : %s\n'%(time.asctime(), str(self.rwing[1]))) + if self.head[0] == False or self.head[1] == False: + self.error.append('The head button seems bad') + if self.lwing[0] == False or self.lwing[1] == False: + self.error.append('The left wing button seems bad (low position)') + if self.rwing[0] == False or self.rwing[1] == False: + self.error.append('The right wing button seems bad (low position)') + self.progress_bar() + + try: + tux.cmd.wings_up() + except: + tux.cmd.wings_on(1) + + self.warning(_me.string('Switch')) + self.f.write('%s : Test the switches with the wings up\n'%time.asctime()) + self.head = [False, False] + self.lwing = [False, False] + self.rwing = [False, False] + + timer = time.time() + while time.time() <= timer + 15: + if self.rwing[0] and self.rwing[1] and self.lwing[0] and self.lwing[1] and self.head[0] and self.head[1]: + break + tux.sys.wait(0.5) + + self.progress_bar() + + self.f.write('%s : Head button pressed : %s\n'%(time.asctime(), str(self.head[0]))) + self.f.write('%s : Head button released : %s\n'%(time.asctime(), str(self.head[1]))) + self.f.write('%s : Left wing pressed : %s\n'%(time.asctime(), str(self.lwing[0]))) + self.f.write('%s : Left wing released : %s\n'%(time.asctime(), str(self.lwing[1]))) + self.f.write('%s : Right wing pressed : %s\n'%(time.asctime(), str(self.rwing[0]))) + self.f.write('%s : Right wing released : %s\n'%(time.asctime(), str(self.rwing[1]))) + + if self.head[0] == False or self.head[1] == False: + self.error.append('The head button seems bad') + if self.lwing[0] == False or self.lwing[1] == False: + self.error.append('The left wing button seems bad (high position)') + if self.rwing[0] == False or self.rwing[1] == False: + self.error.append('The right wing button seems bad (high position)') def leds_tests(self): self.f.write('%s :\n'%time.asctime()) @@ -221,8 +291,10 @@ self.f.write('%s : Tux received correctly the remote control signal\n'%time.asctime()) break tux.sys.wait(0.5) + if time.time() >= timer + 15: self.f.write('%s : Tux not received correctly the remote control signal\n'%time.asctime()) + self.error.append('The IR captor seems bad') self.progress_bar() @@ -230,33 +302,63 @@ self.f.write('%s :\n'%time.asctime()) self.f.write('%s : Fifth step : Sound\n'%time.asctime()) self.f.write('%s : ------------------------------------------------------------- \n'%time.asctime()) + if tux.status.sounds_count() == 0: - f.write('%s : The sound flash is empty\n'%time.asctime()) + self.f.write('%s : The sound flash is empty\n'%time.asctime()) + self.tree_store.clear() + self.tree_store.append(None, ['Sound flash empty ...']) + self.error.append('The flash memory is empty') else: + self.tree_store.clear() + self.tree_store.append(None, ['Playing a sound from the flash memory']) tux.cmd.sound_play(1) - while tux.status.sound_play()[0] != 0: - tux.sys.wait(0.5) + try: + while tux.status.sound_play()[0] != 0: + tux.sys.wait(0.5) + except: + while tux.status.flash_status()[0] != 0: + tux.sys.wait(0.5) self.question(_me.string('Sound')) if self.ok_flag != True: self.warning(_me.string('Sound1')) + + self.tree_store.clear() + self.tree_store.append(None, ['Playing a sound from the flash memory']) tux.cmd.sound_play(1) - while tux.status.sound_play()[0] != 0: - tux.sys.wait(0.5) - + try: + while tux.status.sound_play()[0] != 0: + tux.sys.wait(0.5) + except: + while tux.status.flash_status()[0] != 0: + tux.sys.wait(0.5) + self.question(_me.string('Sound')) if self.ok_flag != True: - self.f.write('%s : No sound heard\n'%time.asctime()) + self.f.write('%s : No flash sound heard\n'%time.asctime()) + self.error.append('No flash sound heard') else: - self.f.write('%s : Sound OK at the second time\n'%time.asctime()) + self.f.write('%s : Flash sound OK at the second time\n'%time.asctime()) else: - self.f.write('%s : Sound OK\n'%time.asctime()) + self.f.write('%s : Flash sound OK\n'%time.asctime()) self.progress_bar() + self.tree_store.clear() + self.tree_store.append(None, ['Playing a wav file from the computer']) + tux.wav.play(_me.get_path('sounds')+'/test.wav') + self.question(_me.string('Sound')) + if self.ok_flag != True: + self.f.write('%s : No streaming heard\n'%time.asctime()) + self.error.append('No streaming heard') + else: + self.f.write('%s : Streaming OK\n'%time.asctime()) + self.warning(_me.string('Mic')) + self.tree_store.clear() + self.tree_store.append(None, ['Recording the microphone']) tux.micro.on() tux.cmd.mouth_open() tux.micro.capture_start('/tmp/capture.wav', 3) @@ -264,7 +366,7 @@ tux.micro.off() self.progress_bar() - + self.tree_store.append(None, ['Playing the recorded sound']) tux.wav.play('/tmp/capture.wav') self.question(_me.string('Sound')) @@ -272,12 +374,14 @@ self.f.write('%s : Microphone OK\n'%time.asctime()) else: self.f.write('%s : No micro signal\n'%time.asctime()) + self.error.append('The micro seems bad') self.progress_bar() self.question(_me.string('Out')) tux.sys.wait(0.1) if self.ok_flag == True: + tux.cmd.sound_play(1) self.question(_me.string('Sound')) @@ -285,6 +389,7 @@ self.f.write('%s : Sound output OK\n'%time.asctime()) else: self.f.write('%s : No sound output\n'%time.asctime()) + self.error.append('No sound output ...') else: self.f.write('%s : The sound output has not been tested\n'%time.asctime()) @@ -298,6 +403,7 @@ self.f.write('%s : Sound input OK\n'%time.asctime()) else: self.f.write('%s : No sound input\n'%time.asctime()) + self.error.append('No sound input ...') else: self.f.write('%s : The sound input has not been tested\n'%time.asctime()) @@ -307,8 +413,6 @@ self.f.write('%s :\n'%time.asctime()) self.f.write('%s : Sixth step : Motors\n'%time.asctime()) self.f.write('%s : ------------------------------------------------------------- \n'%time.asctime()) - - self.warning(_me.string('Disconnect')) self.head = [False, False] self.lwing = [False, False] @@ -323,59 +427,120 @@ self.progress_bar() self.f.write('%s : Send a command to raise the wings'%time.asctime()) + self.tree_store.clear() + self.tree_store.append(None, ['Send a command to raise the wings']) self.send_command(tux.cmd.raw(0x39, 0, 0, 0), 0, 0) self.progress_bar() self.f.write('%s : Send a command to lower the wings'%time.asctime()) + self.tree_store.clear() + self.tree_store.append(None, ['Send a command to lower the wings']) self.send_command(tux.cmd.raw(0x3A, 0, 0, 0), 0, 0) self.progress_bar() self.f.write('%s : Move the wings 8 time'%time.asctime()) + self.tree_store.clear() + self.tree_store.append(None, ['Move the wings 8 time']) self.send_command(tux.cmd.wings_on(8), tux.status.wings_counter, 0) self.progress_bar() self.f.write('%s : Left wing pressed : %s\n'%(time.asctime(), str(self.lwing[0]))) self.f.write('%s : Right wing pressed : %s\n'%(time.asctime(), str(self.rwing[0]))) + if self.lwing[0] == True: + self.error.append('Left wing switch pressed while moving') + if self.rwing[0] == True: + self.error.append('Right wing switch pressed while moving') + self.f.write('%s : Send a command to close the eyes'%time.asctime()) tux.cmd.eyes_open() + self.tree_store.clear() + self.tree_store.append(None, ['Send a command to close the eyes']) self.send_command(tux.cmd.eyes_close(), tux.status.eyes_closed, 0) self.progress_bar() + self.question(_me.string('Eyes')) + if self.ok_flag == True: + self.f.write('%s : The eyes are correctly closed\n'%time.asctime()) + else: + self.f.write('%s : The eyes are not correctly closed\n'%time.asctime()) + self.error.append('The eyes are not correctly closed') + + self.progress_bar() + self.f.write('%s : Send a command to open the eyes'%time.asctime()) + self.tree_store.clear() + self.tree_store.append(None, ['Send a command to open the eyes']) self.send_command(tux.cmd.eyes_open(), tux.status.eyes_closed, 1) self.progress_bar() self.f.write('%s : Send a command to open the mouth'%time.asctime()) + self.tree_store.clear() + self.tree_store.append(None, ['Send a command to open the mouth']) self.send_command(tux.cmd.mouth_open(), tux.status.mouth_closed, 1) self.progress_bar() self.f.write('%s : Send a command to close the mouth'%time.asctime()) + self.tree_store.clear() + self.tree_store.append(None, ['Send a command to close the mouth']) self.send_command(tux.cmd.mouth_close(), tux.status.mouth_closed, 0) self.progress_bar() + self.warning(_me.string('Disconnect')) + self.f.write('%s : Send a command to spin right'%time.asctime()) + self.tree_store.clear() + self.tree_store.append(None, ['Send a command to spin right']) self.send_command(tux.cmd.spinr_on(4), tux.status.spin_counter, 0) + self.progress_bar() self.f.write('%s : Send a command to spin left'%time.asctime()) + self.tree_store.clear() + self.tree_store.append(None, ['Send a command to spin left']) self.send_command(tux.cmd.spinl_on(4), tux.status.spin_counter, 0) self.progress_bar() + self.f.write('%s : Send a command to shake Tux'%time.asctime()) + self.tree_store.clear() + self.tree_store.append(None, ['Send a command to shake Tux']) + + tux.sys.wait(1) + + for i in range(4): + tux.cmd.spinl_on_free(0) + tux.sys.wait(0.8) + tux.cmd.spinr_on_free(0) + tux.sys.wait(0.8) + + tux.cmd.spinr_off() + tux.cmd.spinl_off() + self.f.write('%s\n'%time.asctime()) tux.sys.wait(2) - if tux.status.charger_state() == 1: - self.f.write('%s : Battery charger active\n'%time.asctime()) - else: - self.f.write('%s : Battery charger not active\n'%time.asctime()) + + try: + if tux.status.charger_state() == 1: + self.f.write('%s : Battery charger active\n'%time.asctime()) + elif tux.status.charger_state() == 0: + self.f.write('%s : Power plug not detected\n'%time.asctime()) + elif tux.status.charger_state() == 2: + self.f.write('%s : Trickle mode\n'%time.asctime()) + elif tux.status.charger_state() == 3: + self.f.write('%s : Power plug detected, no charge\n'%time.asctime()) + except: + if tux.status.power_plug() == 0: + self.f.write('%s : Power plug not detected\n'%time.asctime()) + else: + self.f.write('%s : Power plug detected\n'%time.asctime()) self.progress_bar() @@ -386,11 +551,26 @@ tux.event.on_lwing_bt_released = None tux.event.on_rwing_bt_released = None + self.f.write('%s : =======================================\n'%time.asctime()) + self.f.write('%s : ERRORS\n'%time.asctime()) + self.f.write('%s : =======================================\n'%time.asctime()) + + self.tree_store.clear() + if len(self.error) == 0: + self.tree_store.append(None, ['No error detected']) + self.f.write('%s :No error detected\n'%time.asctime()) + else: + self.tree_store.append(None, ['--- Errors ---']) + for i in range (len(self.error)): + self.f.write(str(time.asctime())+' : '+self.error[i]+'\n') + self.tree_store.append(None, [self.error[i]]) + + self.f.write("%s : Don't forget to see the motors section\n"%time.asctime()) + self.f.close() self.get_widget('progressbar2T').hide() - self.get_widget('window1').destroy() + self.get_widget('btnStopT').set_label(_me.string('Close')) - def on_btnOKT_clicked(self, widget, *args): self.ok_flag = True @@ -398,8 +578,6 @@ self.cancel_flag = True def on_btnStopT_clicked(self, widget, *args): - #self.f.write('%s : Test aborted by user\n'%time.asctime()) - #self.f.close() self.get_widget('window1').destroy() #----------------------------- @@ -407,27 +585,24 @@ #----------------------------- def on_head_bt_pushed(self): self.head[0] = True - self.tree_store.append(None, ['head pushed']) def on_lwing_bt_pushed(self): self.lwing[0] = True - self.tree_store.append(None, ['left wing pushed']) def on_rwing_bt_pushed(self): self.rwing[0] = True - self.tree_store.append(None, ['right wing pushed']) def on_head_bt_released(self): self.head[1] = True - self.tree_store.append(None, ['head released']) + self.tree_store.append(None, ['Head clicked']) def on_lwing_bt_released(self): self.lwing[1] = True - self.tree_store.append(None, ['left wing released']) + self.tree_store.append(None, ['left wing clicked']) def on_rwing_bt_released(self): self.rwing[1] = True - self.tree_store.append(None, ['right wing released']) + self.tree_store.append(None, ['right wing clicked']) def on_remote(self, key): if key == 1: @@ -447,7 +622,6 @@ def send_command(self, command, status, stat_val): for i in range(2): - timer = time.time() act_time = timer command @@ -456,7 +630,11 @@ act_time = time.time() if timer + 4 >= time.time(): - self.result_control(i) + tux.sys.wait(1) + if status() == stat_val: + self.result_control(i) + else: + self.result_control(2) return self.result_control(-1) @@ -488,10 +666,16 @@ def result_control(self, val): if val == -1: self.f.write(' : fail...\n') + self.tree_store.append(None, ['fail...']) elif val == 0: self.f.write(' : done\n') + self.tree_store.append(None, ['done']) elif val == 1: self.f.write(' : done after the second command\n') + self.tree_store.append(None, ['done after the second command']) + elif val == 2: + self.f.write(' : final position detected, but not maintained...\n') + self.tree_store.append(None, ['final position detected, but not maintained...']) tux.sys.wait(1) def waiting(self, signal, value): Modified: software/gadgets/settings/trunk/settings/Scripts/Python/GUI/widget/other.pyp =================================================================== --- software/gadgets/settings/trunk/settings/Scripts/Python/GUI/widget/other.pyp 2007-11-29 10:50:21 UTC (rev 743) +++ software/gadgets/settings/trunk/settings/Scripts/Python/GUI/widget/other.pyp 2007-11-29 11:21:53 UTC (rev 744) @@ -22,6 +22,7 @@ self.my_dict = {} _me.insert_funct('avoidchannel', self.avoidchannel) _me.insert_funct('searchWifiChannel', self.searchWifiChannel) + _me.insert_funct('refresh_version', self.refresh_version) def new(self): self.widget_window = True @@ -302,7 +303,6 @@ error = '' try: ID = int(self.get_widget('txtIDNum').get_text()) - print ID if ID == 0 or ID >= 65535: thread.start_new_thread(self.popup, (_me.string('Warning'), _me.string('IDErrorOverflow'), False)) else: @@ -431,62 +431,83 @@ self.cpu_tree_store.append( None,(name, version)) name = 'Firmware' - version = tux.hw.firmware_release_get_version() - if version == (0, 0, 0, 0): - version = _me.string('unreleased') - version_table.append([name,version]) - else: - version = str(version[0])+'.'+str(version[1])+'.'+str(version[2]) - version_table.append([name,version]) - tmp = self.cpu_tree_store.append( None,(name, version)) + try: + version = tux.hw.firmware_release_get_version() + if version == (0, 0, 0, 0): + version = _me.string('unreleased') + version_table.append([name,version]) + else: + version = str(version[0])+'.'+str(version[1])+'.'+str(version[2]) + version_table.append([name,version]) + except: + version = _me.string('FVersion') + tmp = self.cpu_tree_store.append( None,(name, version)) + name = 'Tuxcore' - ver = tux.hw.behavior_get_version() - version = str(ver[0])+'.'+str(ver[1])+'.'+str(ver[2]) - if ver[5]: - version = version + ' : ' + _me.string('official') - else: - version = version + ' : SVN Rev %d'%ver[3] + try: + ver = tux.hw.behavior_get_version() + version = str(ver[0])+'.'+str(ver[1])+'.'+str(ver[2]) + if ver[5]: + version = version + ' : ' + _me.string('official') + else: + version = version + ' : SVN Rev %d'%ver[3] + except: + version = _me.string('FVersion') version_table.append([name,version]) self.cpu_tree_store.append( tmp,(name, version)) name = 'Tuxaudio' - ver = tux.hw.audio_get_version() - version = str(ver[0])+'.'+str(ver[1])+'.'+str(ver[2]) - if ver[5]: - version = version + ' : ' + _me.string('official') - else: - version = version + ' : SVN Rev %d'%ver[3] + try: + ver = tux.hw.audio_get_version() + version = str(ver[0])+'.'+str(ver[1])+'.'+str(ver[2]) + if ver[5]: + version = version + ' : ' + _me.string('official') + else: + version = version + ' : SVN Rev %d'%ver[3] + except: + version = _me.string('FVersion') + version_table.append([name,version]) self.cpu_tree_store.append( tmp,(name, version)) name = 'Tux RF' - ver = tux.hw.tuxrf_get_version() - version = str(ver[0])+'.'+str(ver[1])+'.'+str(ver[2]) - if ver[5]: - version = version + ' : ' + _me.string('official') - else: - version = version + ' : SVN Rev %d'%ver[3] + try: + ver = tux.hw.tuxrf_get_version() + version = str(ver[0])+'.'+str(ver[1])+'.'+str(ver[2]) + if ver[5]: + version = version + ' : ' + _me.string('official') + else: + version = version + ' : SVN Rev %d'%ver[3] + except: + version = _me.string('FVersion') version_table.append([name,version]) self.cpu_tree_store.append( tmp,(name, version)) name = 'Fux RF' - ver = tux.hw.fuxrf_get_version() - version = str(ver[0])+'.'+str(ver[1])+'.'+str(ver[2]) - if ver[5]: - version = version + ' : ' + _me.string('official') - else: - version = version + ' : SVN Rev %d'%ver[3] + try: + ver = tux.hw.fuxrf_get_version() + version = str(ver[0])+'.'+str(ver[1])+'.'+str(ver[2]) + if ver[5]: + version = version + ' : ' + _me.string('official') + else: + version = version + ' : SVN Rev %d'%ver[3] + except: + version = _me.string('FVersion') + version_table.append([name,version]) self.cpu_tree_store.append( tmp,(name, version)) name = 'Fux USB' - ver = tux.hw.fuxusb_get_version() - version = str(ver[0])+'.'+str(ver[1])+'.'+str(ver[2]) - if ver[5]: - version = version + ' : ' + _me.string('official') - else: - version = version + ' : SVN Rev %d'%ver[3] + try: + ver = tux.hw.fuxusb_get_version() + version = str(ver[0])+'.'+str(ver[1])+'.'+str(ver[2]) + if ver[5]: + version = version + ' : ' + _me.string('official') + else: + version = version + ' : SVN Rev %d'%ver[3] + except: + version = _me.string('FVersion') version_table.append([name,version]) self.cpu_tree_store.append( tmp,(name, version)) @@ -650,9 +671,6 @@ for i in range (len(new_wav_order)): wavs.add_wav_path(new_wav_order[i]) - print wavs.wav_paths - print len(wavs.wav_paths) - self.refresh_flag = True self.refresh_wav_list() self.refresh_flag = False @@ -790,7 +808,6 @@ tux.cmd.sound_erase() tux.sys.wait(0.1) while tux.status.sound_record()[0] != 0: - print 'waiting' tux.sys.wait(0.1) Modified: software/gadgets/settings/trunk/settings/Scripts/Python/notify.pyp =================================================================== --- software/gadgets/settings/trunk/settings/Scripts/Python/notify.pyp 2007-11-29 10:50:21 UTC (rev 743) +++ software/gadgets/settings/trunk/settings/Scripts/Python/notify.pyp 2007-11-29 11:21:53 UTC (rev 744) @@ -8,12 +8,10 @@ ## Refresh the channels - print 'test window' if _me.get_funct('avoidchannel') != None and _me.get_param('widget_window') == True: - print 'avoid channel' _me.get_funct('avoidchannel')() _me.get_funct('searchWifiChannel')() - print 'end' + _me.get_funct('refresh_version')() # Control the sleep @@ -21,7 +19,7 @@ if _me.get_param('EnableSleep') == True and _me.get_param('timeToSleep') != None: if time.time() >= _me.get_param('timeToSleep'): #Send the sleep command - print 'go to sleep now' + pass return False Modified: software/gadgets/settings/trunk/settings/Strings/fr_ALL.xml =================================================================== --- software/gadgets/settings/trunk/settings/Strings/fr_ALL.xml 2007-11-29 10:50:21 UTC (rev 743) +++ software/gadgets/settings/trunk/settings/Strings/fr_ALL.xml 2007-11-29 11:21:53 UTC (rev 744) @@ -28,7 +28,7 @@ <SVN type='str'>SVN</SVN> <lblSleepDelay type='str'>Activer la veille après une période d'inactivité de </lblSleepDelay> <itemDescription type='str'>Voir la description</itemDescription> - <gui_conf_current_bind_lb type='str'>Assignation</gui_conf_current_bind_lb> + <lblConfigTest type='str'>Auto tests</lblConfigTest> <treeVersionVer type='str'>Version</treeVersionVer> <lblConfigWifi type='str'>Configuration wifi</lblConfigWifi> <Settingsgadget type='str'>Gadget de configuration</Settingsgadget> @@ -38,14 +38,13 @@ <soundProg type='str'>Ecriture du son n° : </soundProg> <soundTOC type='str'>Ecriture des indexes</soundTOC> <Warning type='str'>Attention</Warning> - <chkSleepEnable type='str'>Permettre la mise en veille</chkSleepEnable> + <btnID type='str'>Changer l'ID</btnID> <official type='str'>Version officielle</official> <Disconnect type='str'>Déconnectez l'alimentation de tux puis appuyez sur 'oui'.</Disconnect> <btnSoundAdd type='str'>Ajouter</btnSoundAdd> <gui_conf_accept_bt type='str'>Valider</gui_conf_accept_bt> <lblCurrentIDNum type='str'>L'ID actuel est : </lblCurrentIDNum> - <btnID type='str'>Changer l'ID</btnID> <lblIDName type='str'>Nom du Tux : </lblIDName> <lblSoundExternal type='str'>Lire un wave externe</lblSoundExternal> <lblSoundStore type='str'>Enregistrer des fichiers wave</lblSoundStore> @@ -58,7 +57,7 @@ <unreleased type='str'>Version non officielle</unreleased> <btnSoundRemove type='str'>Enlever</btnSoundRemove> <lblSoundExternalFile type='str'>Fichier :</lblSoundExternalFile> - <lblConfigTest type='str'>Auto tests</lblConfigTest> + <chkSleepEnable type='str'>Permettre la mise en veille</chkSleepEnable> <Start type='str'>Début</Start> <treeFile type='str'>Fichier</treeFile> <lblSoundLocal type='str'>Lire un wave local</lblSoundLocal> @@ -66,6 +65,7 @@ <gui_conf_update_title type='str'>Mise à jour</gui_conf_update_title> <lblTabConfig type='str'>Configuration</lblTabConfig> <gui_conf_cancel_bt type='str'>Annuler</gui_conf_cancel_bt> + <FVersion type='str'>Pas de version trouvée</FVersion> <btnSleepWakeup type='str'>Reveiller</btnSleepWakeup> <btnCancelT type='str'>Non</btnCancelT> <itemChangeLog type='str'>Voir les changements</itemChangeLog> @@ -84,6 +84,7 @@ <Connect type='str'>Connectez l'alimentation de tux puis appuyez sur 'oui'.</Connect> <lblCurrentIDName type='str'>Le nom acteul est : </lblCurrentIDName> + <Close type='str'>Fermer</Close> <Out type='str'>Voulez-vous tester la sortie son de Tux? Vous devez connecter des haut-parleurs dans la prise verte.</Out> @@ -93,7 +94,7 @@ quelque chose à Tux.</Mic> <btnStopT type='str'>Stop</btnStopT> <soundErase type='str'>Effacement de la mémoire ...</soundErase> - <IDErrorOverflow type='str'>L'ID doit être compris entre 1 et 65534</IDErrorOverflow> + <Eyes type='str'>Est-ce que les yeux sont correctement fermés ?</Eyes> <lblSoundExternalPlay type='str'>Lecture</lblSoundExternalPlay> <lblNoChannel type='str'>Pas de connexion wifi trouvée</lblNoChannel> <gui_conf_delay_lb type='str'>Délai (sec)</gui_conf_delay_lb> @@ -106,6 +107,7 @@ <btnSelfTest type='str'>Démarrer les tests</btnSelfTest> <lblSleepStateWork type='str'>Tux n'est pas en veille pour le moment</lblSleepStateWork> <treeVersionProg type='str'>Composant</treeVersionProg> + <gui_conf_current_bind_lb type='str'>Assignation</gui_conf_current_bind_lb> <speaker_name type='str'>Bruno8k</speaker_name> <btnSoundModify type='str'>Modifier</btnSoundModify> <Iwlist type='str'>iwlist n'a pas été trouvée. @@ -115,4 +117,5 @@ <In type='str'>Voulez-vous tester l'entrée son de Tux? Vous devez connecter un périphérique d'entrée dans le connecteur bleu.</In> + <IDErrorOverflow type='str'>L'ID doit être compris entre 1 et 65534</IDErrorOverflow> </strings> Modified: software/gadgets/settings/trunk/settings/about.xml =================================================================== (Binary files differ) Modified: software/gadgets/settings/trunk/settings/settings.xml =================================================================== --- software/gadgets/settings/trunk/settings/settings.xml 2007-11-29 10:50:21 UTC (rev 743) +++ software/gadgets/settings/trunk/settings/settings.xml 2007-11-29 11:21:53 UTC (rev 744) @@ -14,14 +14,14 @@ <visible type='bool'>True</visible> <x type='int'>0</x> </widget> - <conf> - <visible type='bool'>False</visible> - </conf> <selftest> <y type='int'>25</y> <visible type='bool'>True</visible> <x type='int'>0</x> </selftest> + <conf> + <visible type='bool'>False</visible> + </conf> </gui_state> <language type='str'>en_US</language> <notified type='bool'>True</notified> Modified: software/gadgets/settings/trunk/settings/strings.xml =================================================================== --- software/gadgets/settings/trunk/settings/strings.xml 2007-11-29 10:50:21 UTC (rev 743) +++ software/gadgets/settings/trunk/settings/strings.xml 2007-11-29 11:21:53 UTC (rev 744) @@ -3,12 +3,12 @@ <lblLocal type='str'>Available versions</lblLocal> <gui_conf_remote_title type='str'>Remote</gui_conf_remote_title> <Firmware type='str'>Be sure that the firmware updater gadget is correctly installed.</Firmware> - <Selftest type='str'>Ceci est un programme de test pour votre Tux. -Veuillez suivre les étapes en effectuant les -tâches qui vous serons demandée. + <Selftest type='str'>This is a self test program for Tux Droid. -A la fin de ce test, vous trouverez un fichier -de log à l'emplacement suivant : +Please follow the instructions and execute the +requested tasks. + +At the end, a log file can be found here : </Selftest> <help_text type='str'> </help_text> @@ -23,7 +23,7 @@ <Sound1 type='str'>Be sure that the sound volume control is at the maximum.</Sound1> <lblIDNum type='str'>Tux's ID : </lblIDNum> - <SVN type='str'>SVN</SVN> + <Sound type='str'>Have you heard the sound ?</Sound> <lblSleepDelay type='str'>Active the sleep mode after a inactivity period of</lblSleepDelay> <itemDescription type='str'>Show the description</itemDescription> <lblConfigTest type='str'>Self tests</lblConfigTest> @@ -46,7 +46,7 @@ <Connect type='str'>Please connect the power plug and press the 'Yes' button</Connect> <lblSoundExternal type='str'>Play external wave file</lblSoundExternal> - <gui_conf_version_lb type='str'>Version</gui_conf_version_lb> + <lblSoundStore type='str'>Store wave files locally</lblSoundStore> <btnSleepSleep type='str'>Sleep</btnSleepSleep> <gui_conf_remote_set_bt type='str'>Set</gui_conf_remote_set_bt> <lblUsedChannel type='str'>Your wifi use the channel :</lblUsedChannel> @@ -60,10 +60,11 @@ <Start type='str'>Start</Start> <treeFile type='str'>Fichier</treeFile> <lblSoundLocal type='str'>Play local wave files</lblSoundLocal> - <lblSoundStore type='str'>Store wave files locally</lblSoundStore> + <gui_conf_version_lb type='str'>Version</gui_conf_version_lb> <gui_conf_update_title type='str'>Update</gui_conf_update_title> <lblTabConfig type='str'>Configuration</lblTabConfig> <gui_conf_cancel_bt type='str'>Cancel</gui_conf_cancel_bt> + <FVersion type='str'>Version can't be read</FVersion> <btnSleepWakeup type='str'>Wakeup</btnSleepWakeup> <btnCancelT type='str'>No</btnCancelT> <itemChangeLog type='str'>Show ChangeLog</itemChangeLog> @@ -78,15 +79,17 @@ <gui_conf_description_lb type='str'>Description</gui_conf_description_lb> <lblIDName type='str'>Tux's name : </lblIDName> <lblCurrentIDName type='str'>The current name is : </lblCurrentIDName> + <Close type='str'>Close</Close> <Out type='str'>Would you like to test the sound output interface? + To do this, you need to connect loudspeakers in the green connector, and press the 'Yes' button.</Out> - <Sound type='str'>Have you heard the sound ?</Sound> + <SVN type='str'>SVN</SVN> <btnOKT type='str'>Yes</btnOKT> <Mic type='str'>After closing this window, say anything to Tux.</Mic> <btnStopT type='str'>Stop</btnStopT> <soundErase type='str'>Erasing flash ...</soundErase> - <IDErrorOverflow type='str'>The ID must be included between 1 and 65534.</IDErrorOverflow> + <Eyes type='str'>Are the eyes correctly closed ?</Eyes> <lblSoundExternalPlay type='str'>Play</lblSoundExternalPlay> <lblNoChannel type='str'>No wifi connection found</lblNoChannel> <gui_conf_delay_lb type='str'>Delay (sec)</gui_conf_delay_lb> @@ -110,4 +113,5 @@ To do this, you need to connect an input device in the blue connector and then click 'Yes'.</In> + <IDErrorOverflow type='str'>The ID must be included between 1 and 65534.</IDErrorOverflow> </strings> Modified: software/gadgets/settings/trunk/settings.tgf =================================================================== (Binary files differ) |
From: jaguarondi <c2m...@c2...> - 2007-11-29 10:50:22
|
Author: jaguarondi Date: 2007-11-29 11:50:21 +0100 (Thu, 29 Nov 2007) New Revision: 743 Modified: daemon/trunk/libs/USBDaemon_status_table.c Log: * BUG: all buttons status and some others were assigned the old status value instead of the new status received. This has been lying around from the beginning though most values were simple flags so it wasn't really noticeable. Modified: daemon/trunk/libs/USBDaemon_status_table.c =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.c 2007-11-28 19:01:47 UTC (rev 742) +++ daemon/trunk/libs/USBDaemon_status_table.c 2007-11-29 10:50:21 UTC (rev 743) @@ -79,7 +79,8 @@ tux_status.sound_flash.flash_usage = data[2]; log_debug("%d sounds in flash", tux_status.sound_flash.number_of_sounds); - log_debug("the last block used is : %d ", tux_status.sound_flash.flash_usage); + log_debug("the last block used is : %d ", + tux_status.sound_flash.flash_usage); } /** @@ -92,8 +93,8 @@ /* Priority to unplugged. */ if (!tux_status.io.plugged) *state = CHARGER_UNPLUGGED; - /* Plugged, is is charging? */ - else if (!tux_status.io.charger_led_signal) + /* Plugged, is it charging? */ + else if (tux_status.io.charger_led_signal) *state = CHARGER_CHARGING; /* TODO add *state = CHARGER_PLUGGED_NO_POWER; when it will be implemented @@ -165,24 +166,24 @@ /* Left wing button. */ if ((sensors1.Byte & 0x01) != (new_value & 0x01)) { - tux_status.buttons.left_flipper = (sensors1.Byte & 0x01) ? false : true; - log_debug("Left flipper %s", tux_status.buttons.left_flipper ? + tux_status.buttons.left_flipper = (new_value & 0x01) ? true : false; + log_debug("left flipper %s", tux_status.buttons.left_flipper ? "pushed" : "released"); tcp_frame[4] = DATA_STATUS_LEFT_WING_PUSH; - tcp_frame[5] = !sensors1.bits.PB0; + tcp_frame[5] = tux_status.buttons.left_flipper; tcp_server_send_raw(tcp_frame); } /* Right wing button. */ if ((sensors1.Byte & 0x02) != (new_value & 0x02)) { - tux_status.buttons.right_flipper = (sensors1.Byte & 0x02) ? false : true; - log_debug("Right flipper %s", tux_status.buttons.right_flipper ? + tux_status.buttons.right_flipper = (new_value & 0x02) ? true : false; + log_debug("right flipper %s", tux_status.buttons.right_flipper ? "pushed" : "released"); tcp_frame[4] = DATA_STATUS_RIGHT_WING_PUSH; - tcp_frame[5] = !sensors1.bits.PB1; + tcp_frame[5] = tux_status.buttons.right_flipper; tcp_server_send_raw(tcp_frame); } @@ -192,14 +193,14 @@ * pull-up and capacitor slow down the switch detection). */ if ((sensors1.Byte & 0x14) != (new_value & 0x14)) { - tux_status.io.plugged = (sensors1.Byte & 0x04) ? true : false; + tux_status.io.plugged = (new_value & 0x04) ? true : false; log_debug("io: power cable %s", tux_status.io.plugged ? "plugged" : "unplugged"); tux_status.io.charger_led_signal = - (sensors1.Byte & 0x10) ? true : false; + (new_value & 0x10) ? true : false; log_debug("io: charger LED %s", tux_status.io.charger_led_signal ? - "high" : "low"); + "ON (low)" : "OFF (high)"); update_charger_state(); tcp_frame[4] = DATA_STATUS_CHARGER_STATUS; @@ -210,12 +211,12 @@ /* Head button. */ if ((sensors1.Byte & 0x08) != (new_value & 0x08)) { - tux_status.buttons.head = (sensors1.Byte & 0x08) ? false : true; - log_debug("Head button %s", tux_status.buttons.head ? + tux_status.buttons.head = (new_value & 0x08) ? true : false; + log_debug("head button %s", tux_status.buttons.head ? "pressed" : "released"); tcp_frame[4] = DATA_STATUS_HEAD_PUSH_SWITCH; - tcp_frame[5] = !sensors1.bits.PB3; + tcp_frame[5] = tux_status.buttons.head; tcp_server_send_raw(tcp_frame); } @@ -223,7 +224,7 @@ if ((sensors1.Byte & 0x80) != (new_value & 0x80)) { tcp_frame[4] = DATA_STATUS_MUTE_STATUS; - tcp_frame[5] = !sensors1.bits.PB7; + tcp_frame[5] = !!(new_value & 0x80); log_debug("mute status %s", tcp_frame[5] ? "on" : "off"); tcp_server_send_raw(tcp_frame); } |
From: jaguarondi <c2m...@c2...> - 2007-11-28 19:02:03
|
Author: jaguarondi Date: 2007-11-28 20:01:47 +0100 (Wed, 28 Nov 2007) New Revision: 742 Modified: daemon/trunk/libs/USBDaemon_status_table.c daemon/trunk/libs/USBDaemon_status_table.h Log: * Minor stuff. Modified: daemon/trunk/libs/USBDaemon_status_table.c =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.c 2007-11-28 08:58:56 UTC (rev 741) +++ daemon/trunk/libs/USBDaemon_status_table.c 2007-11-28 19:01:47 UTC (rev 742) @@ -192,7 +192,6 @@ * pull-up and capacitor slow down the switch detection). */ if ((sensors1.Byte & 0x14) != (new_value & 0x14)) { - printf("sensors1: %.2x\n",sensors1.Byte); tux_status.io.plugged = (sensors1.Byte & 0x04) ? true : false; log_debug("io: power cable %s", tux_status.io.plugged ? "plugged" : "unplugged"); Modified: daemon/trunk/libs/USBDaemon_status_table.h =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.h 2007-11-28 08:58:56 UTC (rev 741) +++ daemon/trunk/libs/USBDaemon_status_table.h 2007-11-28 19:01:47 UTC (rev 742) @@ -356,7 +356,7 @@ * 'loaded' can be used to filter out 'level' measurements that occurred * when the motors were running as the battery voltage is highly affected * by the load. */ - struct + struct battery_t { unsigned int level; /**< Last battery level measurement (raw data from the ADC) */ |
From: jaguarondi <c2m...@c2...> - 2007-11-28 08:58:59
|
Author: jaguarondi Date: 2007-11-28 09:58:56 +0100 (Wed, 28 Nov 2007) New Revision: 741 Modified: daemon/trunk/libs/USBDaemon_status_table.c daemon/trunk/libs/USBDaemon_status_table.h Log: * BUG: the IR code sent to the API shouldn't include the toggle bit. * BUG: charger status CHARGING and UNPLUGGED were inverted in the API already so I shouldn't have inverted them here, they also makes more sense as they're now: UNPLUGGED=0 and CHARGING=1. Modified: daemon/trunk/libs/USBDaemon_status_table.c =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.c 2007-11-27 16:25:48 UTC (rev 740) +++ daemon/trunk/libs/USBDaemon_status_table.c 2007-11-28 08:58:56 UTC (rev 741) @@ -137,17 +137,16 @@ { tux_status.buttons.RC5_code = code; /* Remove the toggle for logging. */ - log_debug("IR RC5 code : %.2x", code & 0x3F); + log_debug("IR RC5 code : %.2x - T:%d", code & 0x3F, + code & 0x40 ? 1 : 0); tcp_frame_zero(&tcp_frame); - tcp_frame[0] = SOURCE_TUX; tcp_frame[1] = SS_DEFAULT; tcp_frame[2] = DATA_TP_RSP; tcp_frame[3] = SUBDATA_TP_STATUS; tcp_frame[4] = DATA_STATUS_IR_CODE; - tcp_frame[5] = code; - + tcp_frame[5] = code & 0x3F; tcp_server_send_raw(tcp_frame); } } Modified: daemon/trunk/libs/USBDaemon_status_table.h =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.h 2007-11-27 16:25:48 UTC (rev 740) +++ daemon/trunk/libs/USBDaemon_status_table.h 2007-11-28 08:58:56 UTC (rev 741) @@ -287,8 +287,8 @@ /** States of the battery charger */ typedef enum charger_status { - CHARGER_CHARGING = 0, /**< fast charge ongoing */ - CHARGER_UNPLUGGED = 1, /**< unplugged, on batteries */ + CHARGER_UNPLUGGED = 0, /**< unplugged, on batteries */ + CHARGER_CHARGING = 1, /**< fast charge ongoing */ CHARGER_PLUGGED_NO_POWER = 2, /**< transformer plugged on tux but not in the wall socket */ CHARGER_TRICKLE = 3, /**< trickle mode, mainly activated at the end of |
Author: Paul_R Date: 2007-11-27 17:25:48 +0100 (Tue, 27 Nov 2007) New Revision: 740 Added: software/gadgets/settings/trunk/settings/Scripts/Python/GUI/selftest/ software/gadgets/settings/trunk/settings/Scripts/Python/GUI/selftest/other.glade software/gadgets/settings/trunk/settings/Scripts/Python/GUI/selftest/other.pyp software/gadgets/settings/trunk/settings/Scripts/Python/selftest.py Modified: software/gadgets/settings/trunk/settings.tgf software/gadgets/settings/trunk/settings/Scripts/Python/GUI/widget/other.glade software/gadgets/settings/trunk/settings/Scripts/Python/GUI/widget/other.pyp software/gadgets/settings/trunk/settings/Strings/fr_ALL.xml software/gadgets/settings/trunk/settings/settings.xml software/gadgets/settings/trunk/settings/strings.xml Log: * Changed the way to store the sounds on the flash memory, according with the new firmwares (tuxaudio rev 730, tuxcore rev 733). Now, the sounds are stored one by one. A new button to store an external wav at the end of the memory has been added. * Added a new .glade file for the self test sequence. * Switched the Configuration tab with the Sound tab in the widget window. Added: software/gadgets/settings/trunk/settings/Scripts/Python/GUI/selftest/other.glade =================================================================== --- software/gadgets/settings/trunk/settings/Scripts/Python/GUI/selftest/other.glade (rev 0) +++ software/gadgets/settings/trunk/settings/Scripts/Python/GUI/selftest/other.glade 2007-11-27 16:25:48 UTC (rev 740) @@ -0,0 +1,147 @@ +<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> +<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> + +<glade-interface> + +<widget class="GtkWindow" id="window1"> + <property name="visible">True</property> + <property name="title" translatable="yes">Widget</property> + <property name="type">GTK_WINDOW_TOPLEVEL</property> + <property name="window_position">GTK_WIN_POS_NONE</property> + <property name="modal">False</property> + <property name="resizable">False</property> + <property name="destroy_with_parent">False</property> + <property name="decorated">True</property> + <property name="skip_taskbar_hint">False</property> + <property name="skip_pager_hint">False</property> + <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> + <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> + <property name="focus_on_map">True</property> + <property name="urgency_hint">False</property> + + <child> + <widget class="GtkVBox" id="vbox1"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkFixed" id="fixed1"> + <property name="width_request">420</property> + <property name="height_request">200</property> + <property name="visible">True</property> + + <child> + <widget class="GtkProgressBar" id="progressbar2T"> + <property name="width_request">384</property> + <property name="height_request">16</property> + <property name="visible">True</property> + <property name="orientation">GTK_PROGRESS_LEFT_TO_RIGHT</property> + <property name="fraction">0</property> + <property name="pulse_step">0.10000000149</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + </widget> + <packing> + <property name="x">16</property> + <property name="y">176</property> + </packing> + </child> + + <child> + <widget class="GtkScrolledWindow" id="scrolledwindow2T"> + <property name="width_request">384</property> + <property name="height_request">160</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hscrollbar_policy">GTK_POLICY_NEVER</property> + <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</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">16</property> + <property name="y">8</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkFixed" id="fixed2"> + <property name="height_request">49</property> + <property name="visible">True</property> + + <child> + <widget class="GtkButton" id="btnStopT"> + <property name="width_request">100</property> + <property name="height_request">30</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">button3</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_btnStopT_clicked" last_modification_time="Tue, 27 Nov 2007 13:58:00 GMT"/> + </widget> + <packing> + <property name="x">8</property> + <property name="y">8</property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="btnCancelT"> + <property name="width_request">100</property> + <property name="height_request">30</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">button1</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_btnCancelT_clicked" last_modification_time="Tue, 27 Nov 2007 13:58:10 GMT"/> + </widget> + <packing> + <property name="x">192</property> + <property name="y">8</property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="btnOKT"> + <property name="width_request">100</property> + <property name="height_request">30</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">button2</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_btnOKT_clicked" last_modification_time="Tue, 27 Nov 2007 13:58:04 GMT"/> + </widget> + <packing> + <property name="x">296</property> + <property name="y">8</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + </child> +</widget> + +</glade-interface> Added: software/gadgets/settings/trunk/settings/Scripts/Python/GUI/selftest/other.pyp =================================================================== --- software/gadgets/settings/trunk/settings/Scripts/Python/GUI/selftest/other.pyp (rev 0) +++ software/gadgets/settings/trunk/settings/Scripts/Python/GUI/selftest/other.pyp 2007-11-27 16:25:48 UTC (rev 740) @@ -0,0 +1,505 @@ +bindtextdomain("params", "") + +import subprocess +import commands +import time +import threading + +class Window(SimpleGladeApp): + + def __init__(self, + path=_me.get_path('root') + '/Scripts/Python/GUI/selftest/other.glade', + root="window1", + domain="params", **kwargs): + SimpleGladeApp.__init__(self, path, root, domain, **kwargs) + self.ok_flag = False + self.cancel_flag = False + + def new(self): + self.get_widget("window1").set_title(_me.string('name_to_read')) + thread.start_new_thread(self.update,()) + +#================================================================== +# SELF TEST FUNCTIONS +#================================================================== + def update(self): + self.get_widget('btnOKT').set_label(_me.string('Start')) + self.get_widget('btnCancelT').set_label(_me.string('btnCancelT')) + self.get_widget('btnCancelT').hide() + self.get_widget('btnStopT').set_label(_me.string('btnStopT')) + + self.tree_store = gtk.TreeStore(str) + self.view = gtk.TreeView(self.tree_store) + self.renderer = gtk.CellRendererText() + self.column = gtk.TreeViewColumn('', self.renderer, text=0) + self.column.set_min_width(300) + self.column.add_attribute(self.renderer, 'text', 0) + self.view.set_property("headers-visible", False) + self.view.append_column( self.column ) + self.get_widget("scrolledwindow2T").add(self.view) + self.get_widget("scrolledwindow2T").show_all() + + self.testmode() + + def testmode(self): + ## Test init + self.path = commands.getoutput('echo $USER') + y, m, d, h, mn = time.localtime()[0:5] + self.date = ('%i%i%i-%i:%i' %(m, d, y, h, mn)) + self.tree_store.append(None, [_me.string('Selftest')+'/home/%s/TuxSelftest_%s.txt' %(self.path, self.date)]) + self.get_widget('progressbar2T').set_fraction(0) + + STEPS = 28.0 + self.fraction = float(1.0 / STEPS) + self.actual_fraction = 0 + + while(self.ok_flag == False): + tux.sys.wait(0.1) + self.get_widget('btnOKT').hide() + self.get_widget('btnOKT').set_label(_me.string('btnOKT')) + + self.reset_tux() + self.measure_tests() + self.buttons_tests() + self.leds_tests() + self.sound_tests() + self.motors_tests() + + def reset_tux(self): + #Get the local time to create the file + self.f = open('/home/%s/TuxSelftest_%s.txt' %(self.path, self.date), 'w') + self.f.write('%s : Self test start \n'%time.asctime()) + self.f.write('%s : ============================================================= \n'%time.asctime()) + self.f.write('%s : First step - Reset tux \n'%time.asctime()) + self.f.write('%s : ------------------------------------------------------------- \n'%time.asctime()) + tux.cmd.raw(0x31, 0, 0, 0) + tux.cmd.mouth_close() + tux.sys.wait(1) + tux.cmd.eyes_open() + self.f.write('%s :\n'%time.asctime()) + + if tux.status.power_plug() == 0: + self.warning(_me.string('Connect')) + if tux.status.power_plug() == 0: + self.f.write('%s : The power plug is not detected\n'%time.asctime()) + else: + self.f.write('%s : Power plug detected\n'%time.asctime()) + else: + self.f.write('%s : Power plug detected\n'%time.asctime()) + + self.progress_bar() + + tux.sys.wait(2) + if tux.status.charger_state() == 1: + self.f.write('%s : Battery charger active\n'%time.asctime()) + else: + self.f.write('%s : Battery charger not active ...\n'%time.asctime()) + + self.progress_bar() + + def measure_tests(self): + self.f.write('%s :\n'%time.asctime()) + self.f.write('%s : Second step : Measures\n'%time.asctime()) + self.f.write('%s : ------------------------------------------------------------- \n'%time.asctime()) + level1 = tux.status.light_level() + self.f.write('%s : Light level with the eyes open : %s\n'%(time.asctime(), level1)) + tux.cmd.eyes_close() + tux.sys.wait(0.5) + level2 = tux.status.light_level() + self.f.write('%s : Light level with the eyes closed : %s\n'%(time.asctime(), level2)) + + self.progress_bar() + + level = tux.status.battery_level() + self.f.write('%s : Battery level : %s'%(time.asctime(), level[0])) + if level[1] == True: + self.f.write(' with all motors off\n') + else: + self.f.write(' with one or more motor(s) running\n') + + self.progress_bar() + + tux.cmd.eyes_on(0) + tux.sys.wait(0.5) + level = tux.status.battery_level() + tux.cmd.eyes_off() + tux.sys.wait(0.5) + + self.f.write('%s : Battery level : %s'%(time.asctime(), level[0])) + if level[1] == True: + self.f.write(' with all motors off\n') + else: + self.f.write(' with one or more motor(s) running\n') + + self.progress_bar() + + tux.cmd.eyes_close() + tux.cmd.eyes_open() + + def buttons_tests(self): + self.f.write('%s :\n'%time.asctime()) + self.f.write('%s : Third step : Buttons\n'%time.asctime()) + self.f.write('%s : ------------------------------------------------------------- \n'%time.asctime()) + + self.head = [False, False] + self.lwing = [False, False] + self.rwing = [False, False] + + self.progress_bar() + + self.warning(_me.string('Switch')) + + tux.event.on_head_bt_pushed = self.on_head_bt_pushed + tux.event.on_lwing_bt_pushed = self.on_lwing_bt_pushed + tux.event.on_rwing_bt_pushed = self.on_rwing_bt_pushed + tux.event.on_head_bt_released = self.on_head_bt_released + tux.event.on_lwing_bt_released = self.on_lwing_bt_released + tux.event.on_rwing_bt_released = self.on_rwing_bt_released + timer = time.time() + while time.time() <= timer + 15: + if self.rwing[0] and self.rwing[1] and self.lwing[0] and self.lwing[1] and self.head[0] and self.head[1]: + break + tux.sys.wait(0.5) + + self.progress_bar() + + self.f.write('%s : Head button pressed : %s\n'%(time.asctime(), str(self.head[0]))) + self.f.write('%s : Head button released : %s\n'%(time.asctime(), str(self.head[1]))) + self.f.write('%s : Left wing pressed : %s\n'%(time.asctime(), str(self.lwing[0]))) + self.f.write('%s : Left wing released : %s\n'%(time.asctime(), str(self.lwing[1]))) + self.f.write('%s : Right wing pressed : %s\n'%(time.asctime(), str(self.rwing[0]))) + self.f.write('%s : Right wing released : %s\n'%(time.asctime(), str(self.rwing[1]))) + + self.progress_bar() + + def leds_tests(self): + self.f.write('%s :\n'%time.asctime()) + self.f.write('%s : Fourth step : IR and LEDs\n'%time.asctime()) + self.f.write('%s : ------------------------------------------------------------- \n'%time.asctime()) + self.f.write('%s : Switch on the LEDs '%time.asctime()) + tux.cmd.eyes_open() + tux.cmd.leds_on() + tux.sys.wait(0.5) + lled = tux.status.lled() + rled = tux.status.rled() + self.f.write(' - status : left = %i | right = %i \n'%(lled, rled)) + self.f.write('%s : Switch off the right LED '%time.asctime()) + + self.progress_bar() + + tux.cmd.ledr_off() + tux.sys.wait(0.5) + lled = tux.status.lled() + rled = tux.status.rled() + self.f.write(' - status : left = %i | right = %i \n'%(lled, rled)) + self.f.write('%s : Switch off the left LED '%time.asctime()) + + self.progress_bar() + + tux.cmd.ledl_off() + tux.sys.wait(0.5) + lled = tux.status.lled() + rled = tux.status.rled() + self.f.write(' - status : left = %i | right = %i \n'%(lled, rled)) + self.f.write('%s : Blink the led 3x (final state : both on)'%time.asctime()) + tux.cmd.leds_blink(3, 100) + tux.sys.wait(1) + lled = tux.status.lled() + rled = tux.status.rled() + self.f.write(' - status : left = %i | right = %i \n'%(lled, rled)) + + self.progress_bar() + + self.warning(_me.string('IR')) + tux.event.on_remote = self.on_remote + self.key1 = False + self.key2 = False + self.key3 = False + timer = time.time() + while time.time() <= timer + 15: + if self.key1 and self.key2 and self.key3: + self.f.write('%s : Tux received correctly the remote control signal\n'%time.asctime()) + break + tux.sys.wait(0.5) + if time.time() >= timer + 15: + self.f.write('%s : Tux not received correctly the remote control signal\n'%time.asctime()) + + self.progress_bar() + + def sound_tests(self): + self.f.write('%s :\n'%time.asctime()) + self.f.write('%s : Fifth step : Sound\n'%time.asctime()) + self.f.write('%s : ------------------------------------------------------------- \n'%time.asctime()) + if tux.status.sounds_count() == 0: + f.write('%s : The sound flash is empty\n'%time.asctime()) + else: + tux.cmd.sound_play(1) + while tux.status.sound_play()[0] != 0: + tux.sys.wait(0.5) + self.question(_me.string('Sound')) + + + if self.ok_flag != True: + self.warning(_me.string('Sound1')) + tux.cmd.sound_play(1) + while tux.status.sound_play()[0] != 0: + tux.sys.wait(0.5) + + self.question(_me.string('Sound')) + if self.ok_flag != True: + self.f.write('%s : No sound heard\n'%time.asctime()) + else: + self.f.write('%s : Sound OK at the second time\n'%time.asctime()) + else: + self.f.write('%s : Sound OK\n'%time.asctime()) + + self.progress_bar() + + self.warning(_me.string('Mic')) + + tux.micro.on() + tux.cmd.mouth_open() + tux.micro.capture_start('/tmp/capture.wav', 3) + tux.cmd.mouth_close() + tux.micro.off() + + self.progress_bar() + + tux.wav.play('/tmp/capture.wav') + + self.question(_me.string('Sound')) + if self.ok_flag == True: + self.f.write('%s : Microphone OK\n'%time.asctime()) + else: + self.f.write('%s : No micro signal\n'%time.asctime()) + + self.progress_bar() + + self.question(_me.string('Out')) + tux.sys.wait(0.1) + if self.ok_flag == True: + tux.cmd.sound_play(1) + + self.question(_me.string('Sound')) + if self.ok_flag == True: + self.f.write('%s : Sound output OK\n'%time.asctime()) + else: + self.f.write('%s : No sound output\n'%time.asctime()) + else: + self.f.write('%s : The sound output has not been tested\n'%time.asctime()) + + self.progress_bar() + + self.question(_me.string('In')) + if self.ok_flag == True: + tux.sys.wait(5) + self.question(_me.string('Sound')) + if self.ok_flag == True: + self.f.write('%s : Sound input OK\n'%time.asctime()) + else: + self.f.write('%s : No sound input\n'%time.asctime()) + else: + self.f.write('%s : The sound input has not been tested\n'%time.asctime()) + + self.progress_bar() + + def motors_tests(self): + self.f.write('%s :\n'%time.asctime()) + self.f.write('%s : Sixth step : Motors\n'%time.asctime()) + self.f.write('%s : ------------------------------------------------------------- \n'%time.asctime()) + + self.warning(_me.string('Disconnect')) + + self.head = [False, False] + self.lwing = [False, False] + self.rwing = [False, False] + self.f.write('%s : Reset tux ... '%time.asctime()) + tux.cmd.raw(0x31, 0, 0, 0) + tux.cmd.mouth_close() + tux.sys.wait(1) + tux.cmd.eyes_open() + self.f.write('done\n') + + self.progress_bar() + + self.f.write('%s : Send a command to raise the wings'%time.asctime()) + self.send_command(tux.cmd.raw(0x39, 0, 0, 0), 0, 0) + + self.progress_bar() + + self.f.write('%s : Send a command to lower the wings'%time.asctime()) + self.send_command(tux.cmd.raw(0x3A, 0, 0, 0), 0, 0) + + self.progress_bar() + + self.f.write('%s : Move the wings 8 time'%time.asctime()) + self.send_command(tux.cmd.wings_on(8), tux.status.wings_counter, 0) + + self.progress_bar() + + self.f.write('%s : Left wing pressed : %s\n'%(time.asctime(), str(self.lwing[0]))) + self.f.write('%s : Right wing pressed : %s\n'%(time.asctime(), str(self.rwing[0]))) + self.f.write('%s : Send a command to close the eyes'%time.asctime()) + tux.cmd.eyes_open() + self.send_command(tux.cmd.eyes_close(), tux.status.eyes_closed, 0) + + self.progress_bar() + + self.f.write('%s : Send a command to open the eyes'%time.asctime()) + self.send_command(tux.cmd.eyes_open(), tux.status.eyes_closed, 1) + + self.progress_bar() + + self.f.write('%s : Send a command to open the mouth'%time.asctime()) + self.send_command(tux.cmd.mouth_open(), tux.status.mouth_closed, 1) + + self.progress_bar() + + self.f.write('%s : Send a command to close the mouth'%time.asctime()) + self.send_command(tux.cmd.mouth_close(), tux.status.mouth_closed, 0) + + self.progress_bar() + + self.f.write('%s : Send a command to spin right'%time.asctime()) + self.send_command(tux.cmd.spinr_on(4), tux.status.spin_counter, 0) + + self.progress_bar() + + self.f.write('%s : Send a command to spin left'%time.asctime()) + self.send_command(tux.cmd.spinl_on(4), tux.status.spin_counter, 0) + + self.progress_bar() + + self.f.write('%s\n'%time.asctime()) + tux.sys.wait(2) + if tux.status.charger_state() == 1: + self.f.write('%s : Battery charger active\n'%time.asctime()) + else: + self.f.write('%s : Battery charger not active\n'%time.asctime()) + + self.progress_bar() + + tux.event.on_head_bt_pushed = None + tux.event.on_lwing_bt_pushed = None + tux.event.on_rwing_bt_pushed = None + tux.event.on_head_bt_released = None + tux.event.on_lwing_bt_released = None + tux.event.on_rwing_bt_released = None + + self.f.close() + self.get_widget('progressbar2T').hide() + self.get_widget('window1').destroy() + + + def on_btnOKT_clicked(self, widget, *args): + self.ok_flag = True + + def on_btnCancelT_clicked(self, widget, *args): + self.cancel_flag = True + + def on_btnStopT_clicked(self, widget, *args): + #self.f.write('%s : Test aborted by user\n'%time.asctime()) + #self.f.close() + self.get_widget('window1').destroy() + +#----------------------------- +# Specific test functions +#----------------------------- + def on_head_bt_pushed(self): + self.head[0] = True + self.tree_store.append(None, ['head pushed']) + + def on_lwing_bt_pushed(self): + self.lwing[0] = True + self.tree_store.append(None, ['left wing pushed']) + + def on_rwing_bt_pushed(self): + self.rwing[0] = True + self.tree_store.append(None, ['right wing pushed']) + + def on_head_bt_released(self): + self.head[1] = True + self.tree_store.append(None, ['head released']) + + def on_lwing_bt_released(self): + self.lwing[1] = True + self.tree_store.append(None, ['left wing released']) + + def on_rwing_bt_released(self): + self.rwing[1] = True + self.tree_store.append(None, ['right wing released']) + + def on_remote(self, key): + if key == 1: + self.key1 = True + self.f.write("%s : Key '1' pressed\n"%time.asctime()) + self.tree_store.append(None, ['key1 pressed']) + elif key == 2: + self.key2 = True + self.f.write("%s : Key '2' pressed\n"%time.asctime()) + self.tree_store.append(None, ['key2 pressed']) + elif key == 3: + self.key3 = True + self.f.write("%s : Key '3' pressed\n"%time.asctime()) + self.tree_store.append(None, ['key3 pressed']) + else: + self.f.write("%s : Key '%d' pressed\n"%(time.asctime(), key)) + + def send_command(self, command, status, stat_val): + for i in range(2): + + timer = time.time() + act_time = timer + command + if status != 0: + while status() != stat_val and (timer + 4) >= act_time: + act_time = time.time() + + if timer + 4 >= time.time(): + self.result_control(i) + return + + self.result_control(-1) + + def question(self, message): + self.ok_flag = False + self.cancel_flag = False + self.get_widget('btnOKT').show() + self.get_widget('btnCancelT').show() + self.tree_store.clear() + self.tree_store.append(None, [message]) + while self.ok_flag == False and self.cancel_flag == False: + tux.sys.wait(0.1) + self.get_widget('btnOKT').hide() + self.get_widget('btnCancelT').hide() + + + def warning(self, message): + self.ok_flag = False + self.cancel_flag = False + self.get_widget('btnOKT').show() + self.tree_store.clear() + self.tree_store.append(None, [message]) + while self.ok_flag == False: + tux.sys.wait(0.1) + self.get_widget('btnOKT').hide() + + + def result_control(self, val): + if val == -1: + self.f.write(' : fail...\n') + elif val == 0: + self.f.write(' : done\n') + elif val == 1: + self.f.write(' : done after the second command\n') + tux.sys.wait(1) + + def waiting(self, signal, value): + self.wait = False + while signal() == value: + tux.sys.wait(0.1) + self.wait = True + + def progress_bar(self): + self.actual_fraction += self.fraction + self.get_widget('progressbar2T').set_fraction(self.actual_fraction) Modified: software/gadgets/settings/trunk/settings/Scripts/Python/GUI/widget/other.glade =================================================================== --- software/gadgets/settings/trunk/settings/Scripts/Python/GUI/widget/other.glade 2007-11-27 15:39:38 UTC (rev 739) +++ software/gadgets/settings/trunk/settings/Scripts/Python/GUI/widget/other.glade 2007-11-27 16:25:48 UTC (rev 740) @@ -33,939 +33,6 @@ <property name="enable_popup">False</property> <child> - <widget class="GtkVBox" id="vbox1"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkHBox" id="hbox1"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkVBox" id="vbox5"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkFrame" id="frame14"> - <property name="border_width">2</property> - <property name="visible">True</property> - <property name="label_xalign">0</property> - <property name="label_yalign">0.5</property> - <property name="shadow_type">GTK_SHADOW_OUT</property> - - <child> - <widget class="GtkAlignment" id="alignment14"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">1</property> - <property name="yscale">1</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">12</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkFixed" id="fixed13"> - <property name="height_request">0</property> - <property name="visible">True</property> - - <child> - <widget class="GtkLabel" id="lblUsedChannel"> - <property name="width_request">224</property> - <property name="height_request">16</property> - <property name="visible">True</property> - <property name="label" translatable="yes">label5</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">45</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="lblChannel"> - <property name="width_request">152</property> - <property name="height_request">16</property> - <property name="visible">True</property> - <property name="label" translatable="yes">label7</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</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">240</property> - <property name="y">45</property> - </packing> - </child> - - <child> - <widget class="GtkComboBox" id="cbbWifiChannel"> - <property name="width_request">120</property> - <property name="height_request">29</property> - <property name="visible">True</property> - <property name="items" translatable="yes"></property> - <property name="add_tearoffs">False</property> - <property name="focus_on_click">True</property> - <signal name="changed" handler="on_cbbWifiChannel_changed" last_modification_time="Wed, 07 Nov 2007 14:23:17 GMT"/> - </widget> - <packing> - <property name="x">240</property> - <property name="y">11</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="lblWifiAvoidance"> - <property name="width_request">224</property> - <property name="height_request">16</property> - <property name="visible">True</property> - <property name="label" translatable="yes">label4</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">16</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="lblConfigWifi"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>frame14</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</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="type">label_item</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkFrame" id="frame15"> - <property name="border_width">2</property> - <property name="visible">True</property> - <property name="label_xalign">0</property> - <property name="label_yalign">0.5</property> - <property name="shadow_type">GTK_SHADOW_OUT</property> - - <child> - <widget class="GtkAlignment" id="alignment15"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">1</property> - <property name="yscale">1</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">12</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkFixed" id="fixed14"> - <property name="height_request">0</property> - <property name="visible">True</property> - - <child> - <widget class="GtkCheckButton" id="chkSleepEnable"> - <property name="width_request">280</property> - <property name="height_request">24</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">checkbutton1</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_chkSleepEnable_toggled" last_modification_time="Wed, 07 Nov 2007 18:30:05 GMT"/> - </widget> - <packing> - <property name="x">8</property> - <property name="y">8</property> - </packing> - </child> - - <child> - <widget class="GtkSpinButton" id="spinSleepDelay"> - <property name="width_request">72</property> - <property name="height_request">26</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="climb_rate">1</property> - <property name="digits">0</property> - <property name="numeric">False</property> - <property name="update_policy">GTK_UPDATE_ALWAYS</property> - <property name="snap_to_ticks">False</property> - <property name="wrap">False</property> - <property name="adjustment">5 5 240 5 5 5</property> - <signal name="changed" handler="on_spinSleepDelay_changed" last_modification_time="Wed, 07 Nov 2007 18:42:10 GMT"/> - </widget> - <packing> - <property name="x">376</property> - <property name="y">40</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label2"> - <property name="width_request">64</property> - <property name="height_request">25</property> - <property name="visible">True</property> - <property name="label" translatable="yes">minutes.</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</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">456</property> - <property name="y">40</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="lblSleepDelay"> - <property name="width_request">360</property> - <property name="height_request">16</property> - <property name="visible">True</property> - <property name="label" translatable="yes">label1</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">8</property> - <property name="y">44</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="lblSleepState"> - <property name="width_request">360</property> - <property name="height_request">16</property> - <property name="visible">True</property> - <property name="label" translatable="yes">label1</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">8</property> - <property name="y">72</property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="btnSleep"> - <property name="width_request">160</property> - <property name="height_request">28</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">button1</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_btnSleep_clicked" last_modification_time="Thu, 08 Nov 2007 08:59:37 GMT"/> - </widget> - <packing> - <property name="x">8</property> - <property name="y">96</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="lblConfigSleep"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>frame15</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</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="type">label_item</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkFrame" id="frame16"> - <property name="border_width">2</property> - <property name="visible">True</property> - <property name="label_xalign">0</property> - <property name="label_yalign">0.5</property> - <property name="shadow_type">GTK_SHADOW_OUT</property> - - <child> - <widget class="GtkAlignment" id="alignment16"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">1</property> - <property name="yscale">1</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">12</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkFixed" id="fixed15"> - <property name="visible">True</property> - - <child> - <widget class="GtkLabel" id="lblIDNum"> - <property name="width_request">144</property> - <property name="height_request">16</property> - <property name="visible">True</property> - <property name="label" translatable="yes">label3</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</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">8</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="lblIDName"> - <property name="width_request">144</property> - <property name="height_request">16</property> - <property name="visible">True</property> - <property name="label" translatable="yes">label4</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</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">37</property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="txtIDNum"> - <property name="width_request">72</property> - <property name="height_request">24</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char">●</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="x">168</property> - <property name="y">4</property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="txtIDName"> - <property name="width_request">72</property> - <property name="height_request">24</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char">●</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="x">168</property> - <property name="y">32</property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="btnID"> - <property name="width_request">160</property> - <property name="height_request">28</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">button1</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_btnID_clicked" last_modification_time="Mon, 12 Nov 2007 11:35:46 GMT"/> - </widget> - <packing> - <property name="x">8</property> - <property name="y">64</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="lblCurrentIDNum"> - <property name="width_request">224</property> - <property name="height_request">16</property> - <property name="visible">True</property> - <property name="label" translatable="yes">label3</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</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">264</property> - <property name="y">8</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="lblCurrentIDName"> - <property name="width_request">224</property> - <property name="height_request">17</property> - <property name="visible">True</property> - <property name="label" translatable="yes">label4</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</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">264</property> - <property name="y">36</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="lblConfigID"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>frame16</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</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="type">label_item</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkFrame" id="frame17"> - <property name="border_width">2</property> - <property name="visible">True</property> - <property name="label_xalign">0</property> - <property name="label_yalign">0.5</property> - <property name="shadow_type">GTK_SHADOW_OUT</property> - - <child> - <widget class="GtkAlignment" id="alignment17"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">1</property> - <property name="yscale">1</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">12</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkFixed" id="fixed16"> - <property name="visible">True</property> - - <child> - <widget class="GtkProgressBar" id="progressbar2"> - <property name="width_request">416</property> - <property name="height_request">20</property> - <property name="visible">True</property> - <property name="orientation">GTK_PROGRESS_LEFT_TO_RIGHT</property> - <property name="fraction">0</property> - <property name="pulse_step">0.10000000149</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - </widget> - <packing> - <property name="x">192</property> - <property name="y">12</property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="btnSelfTest"> - <property name="width_request">160</property> - <property name="height_request">28</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">button2</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_btnSelfTest_clicked" last_modification_time="Thu, 08 Nov 2007 09:29:07 GMT"/> - </widget> - <packing> - <property name="x">8</property> - <property name="y">8</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="lblConfigTest"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>frame17</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</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="type">label_item</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="tab_expand">False</property> - <property name="tab_fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="lblTabConfig"> - <property name="visible">True</property> - <property name="label" translatable="yes">Configuration</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</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="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox2"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkVBox" id="vbox4"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkFrame" id="frame12"> - <property name="visible">True</property> - <property name="label_xalign">0</property> - <property name="label_yalign">0.5</property> - <property name="shadow_type">GTK_SHADOW_NONE</property> - - <child> - <widget class="GtkAlignment" id="alignment12"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">1</property> - <property name="yscale">1</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">12</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkScrolledWindow" id="scrolledwindow2"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">GTK_POLICY_NEVER</property> - <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="shadow_type">GTK_SHADOW_NONE</property> - <property name="window_placement">GTK_CORNER_TOP_LEFT</property> - - <child> - <placeholder/> - </child> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="lblVersions"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>frame12</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</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="type">label_item</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkFrame" id="frame13"> - <property name="visible">True</property> - <property name="label_xalign">0</property> - <property name="label_yalign">0.5</property> - <property name="shadow_type">GTK_SHADOW_NONE</property> - - <child> - <widget class="GtkAlignment" id="alignment13"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">1</property> - <property name="yscale">1</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">12</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkScrolledWindow" id="scrolledwindow3"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">GTK_POLICY_NEVER</property> - <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="shadow_type">GTK_SHADOW_NONE</property> - <property name="window_placement">GTK_CORNER_TOP_LEFT</property> - - <child> - <placeholder/> - </child> - </widget> - </child> - </... [truncated message content] |
From: jaguarondi <c2m...@c2...> - 2007-11-27 15:39:47
|
Author: jaguarondi Date: 2007-11-27 16:39:38 +0100 (Tue, 27 Nov 2007) New Revision: 739 Modified: firmware/tuxcore/trunk/led.c firmware/tuxcore/trunk/led.h Log: * Minor comment update. Modified: firmware/tuxcore/trunk/led.c =================================================================== --- firmware/tuxcore/trunk/led.c 2007-11-27 15:29:55 UTC (rev 738) +++ firmware/tuxcore/trunk/led.c 2007-11-27 15:39:38 UTC (rev 739) @@ -20,30 +20,30 @@ /* $Id$ */ /** \file led.c - \brief Blue leds control module + \brief Blue LEDs control module \ingroup led */ #include "led.h" -/** Buffer the leds values before being applied on the I/O port. +/** Buffer the LEDs values before being applied on the I/O port. * \ingroup led */ uint8_t leds_buffer = 0; -/** Counter for the delay between 2 toggles of the leds. */ +/** Counter for the delay between 2 toggles of the LEDs. */ static uint8_t led_delay; -/** Delay between 2 toggles of the leds when blinking them. */ +/** Delay between 2 toggles of the LEDs when blinking them. */ static uint8_t led_blinking_pw; -/** Number of times the leds should be toggled when blinking. */ +/** Number of times the LEDs should be toggled when blinking. */ static uint8_t led_blinking_cnt; /** - \brief Blink leds + \brief Blink LEDs \ingroup led \param cnt Number of blinks \param pulse_width Blinking pulse width - The leds will be toggled 'cnt' times. The pulse width can be used to change - the toggle frequency. + The LEDs will be toggled 'cnt' times. The pulse width can be used to change + the toggle frequency. */ void blink_leds(uint8_t cnt, uint8_t pulse_width) { @@ -61,17 +61,20 @@ } /** - \brief Refresh the leds I/O with the buffer value. + \brief Refresh the LEDs I/O with the buffer value. \ingroup led */ void refresh_leds(void) { + /* We should avoid glitches on the LEDs otherwise the IR receiver goes + * crazy. So we can't simply set the output pins to 0 then set them with + * leds_buffer. Only the pin that should be 0 has to be set to 0. */ LED_PT &= ~(leds_buffer ^ LED_MK); LED_PT |= leds_buffer; } /** - \brief Periodic routine that controls the leds. + \brief Periodic routine that controls the LEDs. \ingroup led This function should be called regularly as it controls the blinking. The Modified: firmware/tuxcore/trunk/led.h =================================================================== --- firmware/tuxcore/trunk/led.h 2007-11-27 15:29:55 UTC (rev 738) +++ firmware/tuxcore/trunk/led.h 2007-11-27 15:39:38 UTC (rev 739) @@ -20,12 +20,12 @@ /* $Id$ */ /** \file led.h - \brief Blue leds control interface. + \brief Blue LEDs control interface. \ingroup led */ /** \defgroup led Leds - The led module contains the functions that drive the eye leds. + The led module contains the functions that drive the eye LEDs. */ #ifndef _LED_H_ @@ -36,13 +36,13 @@ extern uint8_t leds_buffer; /** - \brief Turn both leds on. + \brief Turn both LEDs on. \ingroup led */ #define turn_leds_on() (leds_buffer |= LED_MK) /** - \brief Turn both leds off. + \brief Turn both LEDs off. \ingroup led */ #define turn_leds_off() (leds_buffer &= ~LED_MK) @@ -72,13 +72,13 @@ #define turn_right_led_off() (leds_buffer &= ~LED_R_MK) /** - \brief Read the value of the leds. + \brief Read the value of the LEDs. \ingroup led */ #define read_leds() (leds_buffer) /** - \brief Toggle leds. + \brief Toggle LEDs. \ingroup led */ #define toggle_leds() (leds_buffer ^= LED_MK) @@ -96,10 +96,10 @@ #define toggle_right_led() (leds_buffer ^= LED_R_MK) /** - \brief Turn both leds off directly on the I/O port. + \brief Turn both LEDs off directly on the I/O port. \ingroup led - This function is used to switch off the leds when the eyes are closed. + This function is used to switch off the LEDs when the eyes are closed. You shouldn't use this function elsewhere as the I/O port will be refreshed immediately with the leds_buffer value. */ |
From: jaguarondi <c2m...@c2...> - 2007-11-27 15:30:02
|
Author: jaguarondi Date: 2007-11-27 16:29:55 +0100 (Tue, 27 Nov 2007) New Revision: 738 Modified: firmware/tuxcore/trunk/main.c Log: * Using <stdbool.h> instead of a custom bool typedef. Modified: firmware/tuxcore/trunk/main.c =================================================================== --- firmware/tuxcore/trunk/main.c 2007-11-27 15:26:14 UTC (rev 737) +++ firmware/tuxcore/trunk/main.c 2007-11-27 15:29:55 UTC (rev 738) @@ -32,6 +32,7 @@ \image html main_flowchart.png */ +#include <stdbool.h> #include <avr/interrupt.h> #include <avr/io.h> #include <avr/pgmspace.h> @@ -56,13 +57,6 @@ */ DBG_STACK_INIT -/** \brief Bool type. */ -typedef enum -{ - TRUE = 1, - FALSE = 0, -} bool; - /** * \name Software timers * The main tick has a period of 4ms and is driven by a hardware timer @@ -121,15 +115,15 @@ ISR(SIG_OUTPUT_COMPARE2A) { t4ms_cnt++; - t4ms_flag = TRUE; + t4ms_flag = true; if (t4ms_cnt == 25) { t4ms_cnt = 0; - t100ms_flag = TRUE; + t100ms_flag = true; if (++t100ms_cnt == 10) { t100ms_cnt = 0; - t1s_flag = TRUE; + t1s_flag = true; } } } @@ -160,7 +154,7 @@ { if (t4ms_flag) { - t4ms_flag = FALSE; + t4ms_flag = false; motor_control(); if (sensorsUpdate) sensors_control(); @@ -185,7 +179,7 @@ } if (t100ms_flag) { - t100ms_flag = FALSE; + t100ms_flag = false; updateStatusFlag = 1; if (event_timer) { @@ -195,7 +189,7 @@ } if (t1s_flag) { - t1s_flag = FALSE; + t1s_flag = false; /* XXX disabled ir signals for tux greeting as this function needs * to be refactored and was conflicting to the new light * measurement method. */ |
From: jaguarondi <c2m...@c2...> - 2007-11-27 15:26:13
|
Author: jaguarondi Date: 2007-11-27 16:26:14 +0100 (Tue, 27 Nov 2007) New Revision: 737 Modified: firmware/tuxcore/trunk/ir.c Log: * Now sending the ir status 2 times. Without that, you sometimes have a status series without the IR code sent though the remote button is pushed. This produced some discontinuity when receiving the IR codes at the daemon side. This also helps detecting more reliably when the remote button is released (timeout without any IR signal). Modified: firmware/tuxcore/trunk/ir.c =================================================================== --- firmware/tuxcore/trunk/ir.c 2007-11-27 15:19:02 UTC (rev 736) +++ firmware/tuxcore/trunk/ir.c 2007-11-27 15:26:14 UTC (rev 737) @@ -139,7 +139,8 @@ irReceivedCode |= (0x0001 << irRC5SendData.bit); if (irRC5SendData.bit == 0) /* End of reception */ { - ir_f = 1; /* set to send ir status next time TODO add a check so that this flag is set only when the data received is different from the previous one */ + /* We'll send the IR code 2 times to the computer. */ + ir_f = 2; irStatus |= IRSTATUS_END; irStatus &= ~IRSTATUS_RECEIVING; irPulses = SILENCE_PULSES; /* If in end mode, reset timer to wait for silence before receiving next data */ |
From: jaguarondi <c2m...@c2...> - 2007-11-27 15:19:03
|
Author: jaguarondi Date: 2007-11-27 16:19:02 +0100 (Tue, 27 Nov 2007) New Revision: 736 Modified: daemon/trunk/libs/USBDaemon_command_tux.c daemon/trunk/libs/USBDaemon_status_table.c daemon/trunk/libs/USBDaemon_status_table.h Log: * Removed a ducplicate or record_state in the status. Modified: daemon/trunk/libs/USBDaemon_command_tux.c =================================================================== --- daemon/trunk/libs/USBDaemon_command_tux.c 2007-11-27 14:57:05 UTC (rev 735) +++ daemon/trunk/libs/USBDaemon_command_tux.c 2007-11-27 15:19:02 UTC (rev 736) @@ -642,7 +642,7 @@ result[2] = tux_status.audio.streaming; break; case DATA_PROGRAMMING_AUDIO: - result[1] = tux_status.audio.record; + result[1] = tux_status.audio.record_state; result[2] = tux_status.audio.last_block_size; break; case DATA_STATUS_EYES_POSITION_COUNTER: Modified: daemon/trunk/libs/USBDaemon_status_table.c =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.c 2007-11-27 14:57:05 UTC (rev 735) +++ daemon/trunk/libs/USBDaemon_status_table.c 2007-11-27 15:19:02 UTC (rev 736) @@ -660,7 +660,7 @@ break; case STATUS_FLASH_PROG_CMD: - tux_status.audio.record = new_status[1]; + tux_status.audio.record_state = new_status[1]; tux_status.audio.last_block_size = new_status[2]; flash_programming_event(new_status[1], new_status[2]); break; Modified: daemon/trunk/libs/USBDaemon_status_table.h =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.h 2007-11-27 14:57:05 UTC (rev 735) +++ daemon/trunk/libs/USBDaemon_status_table.h 2007-11-27 15:19:02 UTC (rev 736) @@ -377,8 +377,10 @@ link */ bool mute; /**< Set when the amplifier has been muted */ audiorec_status_t record_state; /**< States of the recording process */ - unsigned int record; - unsigned int last_block_size; + unsigned int last_block_size; /**< Size of the last recorded audio + segment. This can be used by the + recording process to determine if the + correct length has been recorded. */ } audio; /** Raw I/O status */ |
From: jaguarondi <c2m...@c2...> - 2007-11-27 14:57:12
|
Author: jaguarondi Date: 2007-11-27 15:57:05 +0100 (Tue, 27 Nov 2007) New Revision: 735 Modified: daemon/trunk/libs/USBDaemon_status_table.c daemon/trunk/libs/USBDaemon_status_table.h Log: * Cleaned the IR status. Added a status to indicate when the remote button is pressed or released. The RC5_code indicates the latest code received, even if the button has been released. * Added a function called each time a new status series is received. Used currently to detect a timeout when the remote button is released. Modified: daemon/trunk/libs/USBDaemon_status_table.c =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.c 2007-11-27 11:20:02 UTC (rev 734) +++ daemon/trunk/libs/USBDaemon_status_table.c 2007-11-27 14:57:05 UTC (rev 735) @@ -46,8 +46,6 @@ unsigned char CMD_status = 0; unsigned char pong_received; unsigned char cmd_status_flag; -static unsigned char last_remote_key = 0xFF; -static unsigned char last_toggle_key = 0xFF; unsigned char sound_flash_count = 0; /** @@ -64,6 +62,15 @@ struct connection_status_t connection_status; /** + * timer used to determine when no IR signal are received anymore. + */ +static unsigned int ir_timeout; +/** Number of status series received without any IR signal before the remote + * button is considered released. '1' obviously doesn't work, you need at least + * to have 2 status series without any IR signal. */ +#define IR_TIMEOUT 2 + +/** * Update tux_status with the given properties of the sound flash. */ static void update_sound_flash_properties(const unsigned char *data) @@ -103,43 +110,36 @@ log_debug("charger state: %d", *state); } +/** + * Get the new value of the IR RC5 code. + */ static void update_ir(const unsigned char *new_status) { - unsigned char code; - unsigned char toggle; - unsigned char check; - unsigned char new_code; + uint8_t code = new_status[1]; tcp_frame_t tcp_frame; - unsigned char i; - code = new_status[1] & 0x3F; - toggle = new_status[1] & 0x40; - check = new_status[1] & 0x80; - - if (last_remote_key == code) + /* This bit should always be 1 in the current protocol when an IR signal is + * received (meaning the remote button is pressed). */ + if ((code & 0x80) == 0) { - if (last_toggle_key == toggle) - new_code = 0; - else - { - last_remote_key = code; - last_toggle_key = toggle; - new_code = 1; - } + /* We consider the button to be released otherwise. */ + tux_status.buttons.RC5_receiving = false; + return; } - else - { - last_remote_key = code; - last_toggle_key = toggle; - new_code = 1; - } - if (new_code) + tux_status.buttons.RC5_receiving = true; + ir_timeout = IR_TIMEOUT; + + /* Keep toggle and value. */ + code &= 0x7F; + + if (code != tux_status.buttons.RC5_code) { - log_debug("Remote code : %.2x", code); + tux_status.buttons.RC5_code = code; + /* Remove the toggle for logging. */ + log_debug("IR RC5 code : %.2x", code & 0x3F); - for (i = 0; i < sizeof(tcp_frame); i++) - tcp_frame[i] = '\0'; + tcp_frame_zero(&tcp_frame); tcp_frame[0] = SOURCE_TUX; tcp_frame[1] = SS_DEFAULT; @@ -607,6 +607,23 @@ tcp_server_send_raw(tcp_frame); } +/** + * Called each time there's a new status series sent by tux. + * This function can be used to defer operations after a couple of status. + */ +static void new_status_from_tux(void) +{ + if (ir_timeout) + if (!--ir_timeout) + { + unsigned char tmp[] = {0, 0, 0}; + /* Sending 0 here indicates that the button is not pressed anymore. + * Other parameters are not taken into account so sending 0 is + * enough. */ + update_ir(tmp); + } +} + /************************************************************************ */ /* update_raw_status_table() */ /************************************************************************ */ @@ -631,9 +648,12 @@ break; case STATUS_SENSORS1_CMD: + /* This is the first status sent by tux when sending all status each + * 100ms approximately. */ + new_status_from_tux(); if (sensors1.Byte != new_status[1]) sensors1_changed(new_status[1]); - + tux_status.audio.play_internal_sound = new_status[2]; tux_status.audio.streaming = new_status[3]; audio_event(new_status[2], new_status[3]); @@ -649,6 +669,9 @@ { int light_level; light_level = (new_status[1] << 8) + new_status[2]; + /* This combines the 2 light level types of measurement into one + * single value (there are 2 values for the polarizing resistor of + * the photodiode. */ if (new_status[3] == 0) light_level = light_level / 8 + 1000; /* 1128 is the maximum value when there is no light Modified: daemon/trunk/libs/USBDaemon_status_table.h =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.h 2007-11-27 11:20:02 UTC (rev 734) +++ daemon/trunk/libs/USBDaemon_status_table.h 2007-11-27 14:57:05 UTC (rev 735) @@ -296,7 +296,9 @@ CHARGER_INHIBITED = 4, /**< the CPU has inhibited the charger */ } charger_status_t; -/** States of the battery level */ +/** States of the battery level + * \todo TODO write the function that would compute the battery state depending + * on the battery voltage, load and charger status */ typedef enum battery_status { FULL, @@ -305,7 +307,6 @@ EMPTY, } battery_status_t; - /** * Tux status table. * @@ -351,8 +352,6 @@ space remaining in the flash */ } sound_flash; - - /** Battery status. * 'loaded' can be used to filter out 'level' measurements that occurred * when the motors were running as the battery voltage is highly affected @@ -377,8 +376,7 @@ bool streaming; /**< Set when audio data is streamed through the RF link */ bool mute; /**< Set when the amplifier has been muted */ - audiorec_status_t record_state; /**< XXX need to define the enum for - the states */ + audiorec_status_t record_state; /**< States of the recording process */ unsigned int record; unsigned int last_block_size; } audio; @@ -389,6 +387,18 @@ bool head; /**< Head push button */ bool left_flipper; /**< Left flipper push button */ bool right_flipper; /**< Right flipper push button */ + uint8_t RC5_code; /**< Last code of the Tuxdroid remote button pressed. + - Bit 6 is the toggle bit, it's toggled each time you + press a remote key and should be used to + differentiate successive key presses of the same + button. + - Bits 5-0 are the 6 bits RC5 command code. */ + bool RC5_receiving; /**< Set when the remote button is pressed, cleared + when released. If you're clicking the remote + buttons very quickly, RC5_receiving will miss the + button releases in between. You should use the + toggle bit of the remote code to differentiate + successive key presses. */ } buttons; /** Raw I/O status */ |
From: jaguarondi <c2m...@c2...> - 2007-11-27 11:20:04
|
Author: jaguarondi Date: 2007-11-27 12:20:02 +0100 (Tue, 27 Nov 2007) New Revision: 734 Modified: daemon/trunk/libs/USBDaemon_status_table.c daemon/trunk/libs/USBDaemon_status_table.h Log: * Update the status of the charger, now the charger state is correctly detected. * Added push buttons to the status. * Added some raw io to the status that are necessary to compute other status but shouldn't be sent to clients as is (like the LED charger pin, inhibit signal, power plug switch, etc.) Modified: daemon/trunk/libs/USBDaemon_status_table.c =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.c 2007-11-27 10:18:44 UTC (rev 733) +++ daemon/trunk/libs/USBDaemon_status_table.c 2007-11-27 11:20:02 UTC (rev 734) @@ -75,6 +75,34 @@ log_debug("the last block used is : %d ", tux_status.sound_flash.flash_usage); } +/** + * Update the charger state according to the current status and previous state. + */ +static void update_charger_state(void) +{ + charger_status_t *state = &tux_status.battery.charger_state; + + /* Priority to unplugged. */ + if (!tux_status.io.plugged) + *state = CHARGER_UNPLUGGED; + /* Plugged, is is charging? */ + else if (!tux_status.io.charger_led_signal) + *state = CHARGER_CHARGING; + + /* TODO add *state = CHARGER_PLUGGED_NO_POWER; when it will be implemented + * in firmware. + * Plugged, not charging, do we have power? */ + + /* There's power but doesn't fast charge, is charge inhibited? */ + else if (tux_status.io.charge_inhibit) + *state = CHARGER_INHIBITED; + /* We should be in trickle mode then. */ + else + *state = CHARGER_TRICKLE; + + log_debug("charger state: %d", *state); +} + static void update_ir(const unsigned char *new_status) { unsigned char code; @@ -135,67 +163,65 @@ tcp_frame[2] = DATA_TP_RSP; tcp_frame[3] = SUBDATA_TP_STATUS; - /* Left wing push */ + /* Left wing button. */ if ((sensors1.Byte & 0x01) != (new_value & 0x01)) { + tux_status.buttons.left_flipper = (sensors1.Byte & 0x01) ? false : true; + log_debug("Left flipper %s", tux_status.buttons.left_flipper ? + "pushed" : "released"); + tcp_frame[4] = DATA_STATUS_LEFT_WING_PUSH; tcp_frame[5] = !sensors1.bits.PB0; - log_debug("Left wing button %s", tcp_frame[5] ? "Down" : "Up"); tcp_server_send_raw(tcp_frame); } - /* Right wing push */ + /* Right wing button. */ if ((sensors1.Byte & 0x02) != (new_value & 0x02)) { + tux_status.buttons.right_flipper = (sensors1.Byte & 0x02) ? false : true; + log_debug("Right flipper %s", tux_status.buttons.right_flipper ? + "pushed" : "released"); + tcp_frame[4] = DATA_STATUS_RIGHT_WING_PUSH; tcp_frame[5] = !sensors1.bits.PB1; - log_debug("Right wing button %s", tcp_frame[5] ? "Down" : "Up"); tcp_server_send_raw(tcp_frame); } - /* power plug insertion switch */ - if ((sensors1.Byte & 0x04) != (new_value & 0x04)) + /* Power plug insertion switch and LED signal of the charger. + * Note that due to the capacitor on the plug switch, the LED signal is + * changed (meaning charging) slightly before the plug is detected (the + * pull-up and capacitor slow down the switch detection). */ + if ((sensors1.Byte & 0x14) != (new_value & 0x14)) { - tcp_frame[4] = DATA_STATUS_POWER_PLUG_SWITCH; - tcp_frame[5] = !sensors1.bits.PB2; - log_debug("power plug insertion switch %s", - tcp_frame[5] ? "off" : "on"); + printf("sensors1: %.2x\n",sensors1.Byte); + tux_status.io.plugged = (sensors1.Byte & 0x04) ? true : false; + log_debug("io: power cable %s", + tux_status.io.plugged ? "plugged" : "unplugged"); + + tux_status.io.charger_led_signal = + (sensors1.Byte & 0x10) ? true : false; + log_debug("io: charger LED %s", tux_status.io.charger_led_signal ? + "high" : "low"); + update_charger_state(); + + tcp_frame[4] = DATA_STATUS_CHARGER_STATUS; + tcp_frame[5] = tux_status.battery.charger_state; tcp_server_send_raw(tcp_frame); } - /* Head push */ + /* Head button. */ if ((sensors1.Byte & 0x08) != (new_value & 0x08)) { + tux_status.buttons.head = (sensors1.Byte & 0x08) ? false : true; + log_debug("Head button %s", tux_status.buttons.head ? + "pressed" : "released"); + tcp_frame[4] = DATA_STATUS_HEAD_PUSH_SWITCH; tcp_frame[5] = !sensors1.bits.PB3; - log_debug("Head button %s", tcp_frame[5] ? "Down" : "Up"); tcp_server_send_raw(tcp_frame); } - /* Led charger */ - if ((sensors1.Byte & 0x10) != (new_value & 0x10)) - { - tcp_frame[4] = DATA_STATUS_CHARGER_STATUS; - - /* XXX should be removed when charger status will be added in firmware, - * now using this simplified status. */ - if (sensors1.bits.PB4) - { - tux_status.battery.charger_state = CHARGER_UNPLUGGED; - tcp_frame[5] = CHARGER_UNPLUGGED; - } - else - { - tux_status.battery.charger_state = CHARGER_CHARGING; - tcp_frame[5] = CHARGER_CHARGING; - } - - /*tcp_frame[5] = sensors1.bits.PB4;*/ - log_debug("Charger led %d", tcp_frame[5]); - tcp_server_send_raw(tcp_frame); - } - - /* mute status */ + /* Mute status. */ if ((sensors1.Byte & 0x80) != (new_value & 0x80)) { tcp_frame[4] = DATA_STATUS_MUTE_STATUS; @@ -369,6 +395,18 @@ tcp_server_send_raw(tcp_frame); } + /* The head push button is sampled by both tuxcore (here) and tuxaudio + * (sensors1) so we don't have to reprocess it here. */ + + /* Charge inhibit signal */ + if ((portb.Byte & 0x40) != (new_value & 0x40)) + { + tux_status.io.charge_inhibit = (portb.Byte & 0x40) ? true : false; + log_debug("io: charge %s", tux_status.io.charge_inhibit ? + "inhibitted" : "allowed"); + update_charger_state(); + } + portb.Byte = new_value; } Modified: daemon/trunk/libs/USBDaemon_status_table.h =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.h 2007-11-27 10:18:44 UTC (rev 733) +++ daemon/trunk/libs/USBDaemon_status_table.h 2007-11-27 11:20:02 UTC (rev 734) @@ -366,6 +366,7 @@ float voltage; /**< Mean battery voltage */ battery_status_t status;/**< Battery level status (low, high, etc.) */ charger_status_t charger_state; /**<Battery charger state. */ + } battery; /** Audio status */ @@ -381,6 +382,26 @@ unsigned int record; unsigned int last_block_size; } audio; + + /** Raw I/O status */ + struct buttons_t + { + bool head; /**< Head push button */ + bool left_flipper; /**< Left flipper push button */ + bool right_flipper; /**< Right flipper push button */ + } buttons; + + /** Raw I/O status */ + struct io_t + { + bool plugged; /**< Power plug insertion switch, set when the + transformer is plugged to tux */ + bool charger_led_signal; /**< LED signal of the BQ2002T IC charger. + Goes low when fast charging, high otherwise + (trickle, not charging, init, etc. See the + datasheet for details. */ + bool charge_inhibit; + } io; }; /** |
From: Paul_R <c2m...@c2...> - 2007-11-27 10:18:42
|
Author: Paul_R Date: 2007-11-27 11:18:44 +0100 (Tue, 27 Nov 2007) New Revision: 733 Modified: firmware/tuxcore/trunk/global.h firmware/tuxcore/trunk/main.c firmware/tuxcore/trunk/parser.c Log: * Changed the names of the audio statuses's received from tuxaudio to send them to the PC. Modified: firmware/tuxcore/trunk/global.h =================================================================== --- firmware/tuxcore/trunk/global.h 2007-11-27 09:53:50 UTC (rev 732) +++ firmware/tuxcore/trunk/global.h 2007-11-27 10:18:44 UTC (rev 733) @@ -165,6 +165,8 @@ uint8_t ir; /* IR RC5 code received from tux's remote */ uint8_t pos; /* Poitionning */ uint8_t mot; + uint8_t audio_play; + uint8_t audio_status; } GSTATUS; Modified: firmware/tuxcore/trunk/main.c =================================================================== --- firmware/tuxcore/trunk/main.c 2007-11-27 09:53:50 UTC (rev 732) +++ firmware/tuxcore/trunk/main.c 2007-11-27 10:18:44 UTC (rev 733) @@ -271,8 +271,8 @@ statusFifoFlag = 1; FifoPut(statusFifo, STATUS_SENSORS1_CMD); FifoPut(statusFifo, gStatus.sw); - FifoPut(statusFifo, gStatus.mic); - FifoPut(statusFifo, gStatus.bat); + FifoPut(statusFifo, gStatus.audio_play); + FifoPut(statusFifo, gStatus.audio_status); FifoPut(statusFifo, STATUS_PORTS_CMD); FifoPut(statusFifo, PINB); FifoPut(statusFifo, PINC); Modified: firmware/tuxcore/trunk/parser.c =================================================================== --- firmware/tuxcore/trunk/parser.c 2007-11-27 09:53:50 UTC (rev 732) +++ firmware/tuxcore/trunk/parser.c 2007-11-27 10:18:44 UTC (rev 733) @@ -62,8 +62,8 @@ if (!(command[1] & STATUS_RF_MK) && (gStatus.sw & GSTATUS_RF_MK)) cond_flags.rf_disconn = 1; gStatus.sw = command[1]; - gStatus.mic = command[2]; - gStatus.bat = command[3]; + gStatus.audio_play = command[2]; + gStatus.audio_status = command[3]; return; } |
From: Paul_R <c2m...@c2...> - 2007-11-27 09:53:49
|
Author: Paul_R Date: 2007-11-27 10:53:50 +0100 (Tue, 27 Nov 2007) New Revision: 732 Modified: api/python/trunk/tuxapi_class.py api/python/trunk/tuxapi_const.py Log: * Added two three new commands to store the sounds in the flash memory : tux.cmd.sound_erase() - Erase the flash tux.cmd.sound_storing() - Store a sound in the flash memory tux.cmd.sound_confirm(bool) - Confirm the storage. ... and two new status : tux.status.sound_play() - return the track number played from the flash memory, or 0 - return a True as second parameter if tux is playing sounds (from TTS, flash or streaming) tux.status.sound_record() - return the recording state - return the size of the last track written when the program is waiting for the confirmation. Note : This API version isn't compatible with tuxaudio firmware < SVN Rev 730 Modified: api/python/trunk/tuxapi_class.py =================================================================== --- api/python/trunk/tuxapi_class.py 2007-11-27 09:45:14 UTC (rev 731) +++ api/python/trunk/tuxapi_class.py 2007-11-27 09:53:50 UTC (rev 732) @@ -1761,8 +1761,9 @@ tux.cmd.sleep_off tux.cmd.sleep_on tux.cmd.sound_play - tux.cmd.sound_store_index + tux.cmd.sound_confirm tux.cmd.sound_storing + tux.cmd.sound_erase tux.cmd.sound_test tux.cmd.spinl_off tux.cmd.spinl_on @@ -2510,39 +2511,46 @@ #-------------------------------------------------------------------------- # Send a command to tux for storing a sound collection in the memory flash #-------------------------------------------------------------------------- - def sound_storing(self,number): + def sound_storing(self): """ - Send a command to tux for storing a sound collection in the - memory flash + Send a command to tux for storing a sound in the memory flash - Parameters: - "number" as integer : number of sounds to be stored - Example: - >>> tux.cmd.sound_storing(10) + >>> tux.cmd.sound_storing() """ self.last_ack=self.structured(TUX_CMD_STRUCT_SOUND, \ - TUX_CMD_STRUCT_SUB_STORING,number,0,0) + TUX_CMD_STRUCT_SUB_STORING,0,0,0) #-------------------------------------------------------------------------- - # Send a command to tux for indexing the sound + # Send a command to tux to confirm the writing process #-------------------------------------------------------------------------- - def sound_store_index(self,highAdd,middleAdd,lowAdd): + def sound_confirm(self, write): """ - Send a command to tux for indexing the sound + Send a command to tux to confirm the writing process Parameters: - "highAdd" as integer : high byte address of the sound - "middleAdd" as integer : middle byte address of the sound - "lowAdd" as integer : low byte address of the sound + "write" as boolean : True to confirm, False to erase the sound. Example: - >>> tux.cmd.sound_store_index(0x00,0x04,0x00) + >>> tux.cmd.sound_confirm(True) """ self.last_ack=self.structured(TUX_CMD_STRUCT_SOUND, \ - TUX_CMD_STRUCT_SUB_STORE_INDEX,highAdd,middleAdd,lowAdd) + TUX_CMD_STRUCT_SUB_CONFIRM, write, 0, 0) #-------------------------------------------------------------------------- + # Send a command to tux to erase the flash memory + #-------------------------------------------------------------------------- + def sound_erase(self): + """ + Send a command to erase the flash memory. + + Example: + >>> tux.cmd.sound_erase() + """ + self.last_ack=self.structured(TUX_CMD_STRUCT_SOUND, \ + TUX_CMD_STRUCT_SUB_ERASE, 0, 0, 0) + + #-------------------------------------------------------------------------- # Send a command to tux for testing the sound in tux #-------------------------------------------------------------------------- def sound_test(self): @@ -2652,7 +2660,6 @@ Functions list for the users: tux.status.charger_state - tux.status.flash_status tux.status.eyes_closed tux.status.eyes_counter tux.status.eyes_motor @@ -2675,6 +2682,8 @@ tux.status.rwing_bt tux.status.sounds_count tux.status.sound_muted + tux.status.sound_play + tux.status.sound_record tux.status.spin_backward tux.status.spin_bt tux.status.spin_counter @@ -2815,6 +2824,12 @@ if status[4]==DATAS_STATUS_PONG: line=line+"Pong-> Received : %d Remaining : %d Average : %.0f %s" \ %(status[6],status[5],((status[6]*100)/(200-status[5])),'%') + if status[4]==DATAS_STATUS_AUDIO: + line=line+"Sound played from flash-> %d Playback status-> %d" \ + %(status[5], status[6]) + if status[4]==DATAS_STATUS_PROGRAMMING_AUDIO: + line=line+"Programming state-> %d nb of block used-> %d" \ + %(status[5], status[6]) value_type=value_np #-- Write value if value_type==value_onoff: @@ -3407,18 +3422,18 @@ #-------------------------------------------------------------------------- # Get the last state of sound status #-------------------------------------------------------------------------- - def flash_status(self): + def sound_play(self): """ - Get the last sound flash status + Get the last playback status Return a tupple with the audio flash status: - (play state, record state, sound number) - play state : Return the sound number or 0 if no sound is played - record state : Return the recording state - sound number : Return the track which is recorded. + sound number : Return the sound number played from the flash + memory. + status : Return 1 if tux is playing sound (flash, TTS or + streaming) Example: - >>> (play_state, record_state, sound_number) = tux.status.flash_status() + >>> (numSound, playback_status) = tux.status.sound_play() """ if not self.parent.daemon.connected: @@ -3426,13 +3441,47 @@ frame = self.get(0x26) try: if len(frame) > 0: - return (ord(frame[5]), ord(frame[6]), ord(frame[7])) + return (ord(frame[5]), ord(frame[6])) else: return 0 except: return 0 + #-------------------------------------------------------------------------- + # Get the last state of sound status + #-------------------------------------------------------------------------- + def sound_record(self): + """ + Get the last sound flash status + Return a tupple with the programming status: + 1st parameter : The programming state : + 0 : Standby + 1 : Programming in progress + 2 : Waiting for confirmation + 3 : Writing indexes + 4 : Erasing the last sound + 5 : The flash is full, the programming cycle is + stopped + 6 : No sound received + 2nd parameter : The 4kB block size of the last sound recorded. + (only when the state == 2) + + Example: + >>> (record_state, block) = tux.status.sound_record() + + """ + if not self.parent.daemon.connected: + return 0 + frame = self.get(DATAS_STATUS_PROGRAMMING_AUDIO) + try: + if len(frame) > 0: + return (ord(frame[5]), ord(frame[6])) + else: + return 0 + except: + return 0 + #-------------------------------------------------------------------------- # Get the last state of eyes position counter status #-------------------------------------------------------------------------- Modified: api/python/trunk/tuxapi_const.py =================================================================== --- api/python/trunk/tuxapi_const.py 2007-11-27 09:45:14 UTC (rev 731) +++ api/python/trunk/tuxapi_const.py 2007-11-27 09:53:50 UTC (rev 732) @@ -161,6 +161,7 @@ DATAS_STATUS_FLASH_USAGE = 0x27 DATAS_STATUS_AVAILABLE_RECORD_TIME = 0x28 DATAS_STATUS_SOUND_FLASH = 0x29 +DATAS_STATUS_PROGRAMMING_AUDIO = 0x2A STATUS_WINGS_MOTOR_BACKWARD = 0x01 STATUS_SPIN_MOTOR_BACKWARD = 0x02 @@ -199,6 +200,7 @@ STATUS_PONG = 0x24 STATUS_BATTERY = 0x25 STATUS_AUDIO = 0x26 +STATUS_PROGRAMMING_AUDIO = 0x2A STATUS_MICRO_ENERGY = 0xF0 # Tux connection commands @@ -302,7 +304,7 @@ TUX_CMD_STRUCT_SUB_SEND = 0x04 TUX_CMD_STRUCT_SUB_PLAY = 0x05 TUX_CMD_STRUCT_SUB_STORING = 0x06 -TUX_CMD_STRUCT_SUB_STORE_INDEX = 0x07 +TUX_CMD_STRUCT_SUB_CONFIRM = 0x07 TUX_CMD_STRUCT_SUB_TEST = 0x08 TUX_CMD_STRUCT_SUB_BLINK = 0x09 TUX_CMD_STRUCT_SUB_CH_GENERAL = 0x0A @@ -311,6 +313,7 @@ TUX_CMD_STRUCT_SUB_UP = 0x0C TUX_CMD_STRUCT_SUB_CLOSE = 0x0D TUX_CMD_STRUCT_SUB_DOWN = 0x0D +TUX_CMD_STRUCT_SUB_ERASE = 0x0E # Tux request information TUX_REQ_INFO_VERSION = 0x01 |
From: Paul_R <c2m...@c2...> - 2007-11-27 09:45:14
|
Author: Paul_R Date: 2007-11-27 10:45:14 +0100 (Tue, 27 Nov 2007) New Revision: 731 Modified: daemon/trunk/libs/USBDaemon_command_tux.c daemon/trunk/libs/USBDaemon_status_table.c daemon/trunk/libs/USBDaemon_status_table.h Log: * Added the commands and the statuses to be compatible with the new tuxaudio firmware. Note : This version isn't compatible with tuxaudio < SVN Rev 730. Modified: daemon/trunk/libs/USBDaemon_command_tux.c =================================================================== --- daemon/trunk/libs/USBDaemon_command_tux.c 2007-11-27 09:38:35 UTC (rev 730) +++ daemon/trunk/libs/USBDaemon_command_tux.c 2007-11-27 09:45:14 UTC (rev 731) @@ -493,11 +493,14 @@ ACK = send_usb_tux_cmd(PLAY_SOUND_CMD, data[2], data[3], 0); break; case TUX_CMD_STRUCT_SUB_STORING: - ACK = send_usb_tux_cmd(STORE_SOUND_CMD, data[2], 0, 0); + ACK = send_usb_tux_cmd(STORE_SOUND_CMD, 0, 0, 0); break; - case TUX_CMD_STRUCT_SUB_STORE_INDEX: - ACK = send_usb_tux_cmd(STORE_INDEX_CMD, data[2], data[3], data[4]); + case TUX_CMD_STRUCT_SUB_CONFIRM: + ACK = send_usb_tux_cmd(CONFIRM_STORAGE_CMD, data[2], 0, 0); break; + case TUX_CMD_STRUCT_SUB_ERASE: + ACK = send_usb_tux_cmd(ERASE_FLASH_CMD, 0, 0, 0); + break; case TUX_CMD_STRUCT_SUB_TEST: ACK = send_usb_tux_cmd(TEST_SOUND_CMD, 0, 0, 0); break; @@ -635,10 +638,13 @@ result[3] = tux_status.battery.loaded; break; case DATA_STATUS_AUDIO: - result[1] = audio.play; - result[2] = audio.record; - result[3] = audio.status; + result[1] = tux_status.audio.play_internal_sound; + result[2] = tux_status.audio.streaming; break; + case DATA_PROGRAMMING_AUDIO: + result[1] = tux_status.audio.record; + result[2] = tux_status.audio.last_block_size; + break; case DATA_STATUS_EYES_POSITION_COUNTER: result[1] = position1.eyes_position.Byte; break; Modified: daemon/trunk/libs/USBDaemon_status_table.c =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.c 2007-11-27 09:38:35 UTC (rev 730) +++ daemon/trunk/libs/USBDaemon_status_table.c 2007-11-27 09:45:14 UTC (rev 731) @@ -69,8 +69,10 @@ static void update_sound_flash_properties(const unsigned char *data) { tux_status.sound_flash.number_of_sounds = data[1]; + tux_status.sound_flash.flash_usage = data[2]; log_debug("%d sounds in flash", tux_status.sound_flash.number_of_sounds); + log_debug("the last block used is : %d ", tux_status.sound_flash.flash_usage); } static void update_ir(const unsigned char *new_status) @@ -249,7 +251,7 @@ tcp_server_send_raw(tcp_frame); } -static void audio_event(int play, int record, int status) +static void flash_programming_event(int numSound, int status) { tcp_frame_t tcp_frame; @@ -260,16 +262,34 @@ tcp_frame[2] = DATA_TP_RSP; tcp_frame[3] = SUBDATA_TP_STATUS; - tcp_frame[4] = DATA_STATUS_AUDIO; + tcp_frame[4] = DATA_PROGRAMMING_AUDIO; - tcp_frame[5] = play; - tcp_frame[6] = record; - tcp_frame[7] = status; + tcp_frame[5] = numSound; + tcp_frame[6] = status; tcp_server_send_raw(tcp_frame); } +static void audio_event(int numSound, int status) +{ + tcp_frame_t tcp_frame; + + tcp_frame_zero(&tcp_frame); + + tcp_frame[0] = SOURCE_TUX; + tcp_frame[1] = SS_DEFAULT; + tcp_frame[2] = DATA_TP_RSP; + tcp_frame[3] = SUBDATA_TP_STATUS; + + tcp_frame[4] = DATA_STATUS_AUDIO; + + tcp_frame[5] = numSound; + tcp_frame[6] = status; + tcp_server_send_raw(tcp_frame); +} + + static void pong_event(unsigned char pong_number, unsigned char pong_received) { tcp_frame_t tcp_frame; @@ -575,8 +595,18 @@ case STATUS_SENSORS1_CMD: if (sensors1.Byte != new_status[1]) sensors1_changed(new_status[1]); + + tux_status.audio.play_internal_sound = new_status[2]; + tux_status.audio.streaming = new_status[3]; + audio_event(new_status[2], new_status[3]); break; + case STATUS_FLASH_PROG_CMD: + tux_status.audio.record = new_status[1]; + tux_status.audio.last_block_size = new_status[2]; + flash_programming_event(new_status[1], new_status[2]); + break; + case STATUS_LIGHT_CMD: { int light_level; @@ -601,21 +631,6 @@ } break; - case STATUS_AUDIO_CMD: - { - int play; - int record; - int status; - play = new_status[1]; - record = new_status[2]; - status = new_status[3]; - audio.play = play; - audio.record = record; - audio.status = status; - audio_event(play, record, status); - } - break; - case STATUS_POSITION1_CMD: if (position1.eyes_position.Byte != new_status[1] || position1.mouth_position.Byte != new_status[2] Modified: daemon/trunk/libs/USBDaemon_status_table.h =================================================================== --- daemon/trunk/libs/USBDaemon_status_table.h 2007-11-27 09:38:35 UTC (rev 730) +++ daemon/trunk/libs/USBDaemon_status_table.h 2007-11-27 09:45:14 UTC (rev 731) @@ -131,7 +131,7 @@ #define TUX_CMD_STRUCT_SUB_SEND 0x04 #define TUX_CMD_STRUCT_SUB_PLAY 0x05 #define TUX_CMD_STRUCT_SUB_STORING 0x06 -#define TUX_CMD_STRUCT_SUB_STORE_INDEX 0x07 +#define TUX_CMD_STRUCT_SUB_CONFIRM 0x07 #define TUX_CMD_STRUCT_SUB_TEST 0x08 #define TUX_CMD_STRUCT_SUB_BLINK 0x09 #define TUX_CMD_STRUCT_SUB_CH_GENERAL 0x0A @@ -140,6 +140,7 @@ #define TUX_CMD_STRUCT_SUB_UP 0x0C #define TUX_CMD_STRUCT_SUB_CLOSE 0x0D #define TUX_CMD_STRUCT_SUB_DOWN 0x0D +#define TUX_CMD_STRUCT_SUB_ERASE 0x0E /* Tux request information */ #define TUX_REQ_INFO_VERSION 0x01 @@ -182,6 +183,7 @@ #define DATA_STATUS_BATTERY 0x25 #define DATA_STATUS_AUDIO 0x26 #define DATA_STATUS_SOUND_FLASH 0x29 +#define DATA_PROGRAMMING_AUDIO 0x2A /* tux connection commands available on the usb dongle */ typedef enum @@ -249,11 +251,12 @@ } sensors2; struct { - int play; - int record; + int numSound; int status; } audio; + + struct { _PORT_BYTE_ eyes_position; @@ -302,11 +305,6 @@ EMPTY, } battery_status_t; -/** States of the audio recording (flash programming) process */ -typedef enum audiorec_status -{ - NOP, /**< XXX to be defined */ -} audiorec_status_t; /** * Tux status table. @@ -353,6 +351,8 @@ space remaining in the flash */ } sound_flash; + + /** Battery status. * 'loaded' can be used to filter out 'level' measurements that occurred * when the motors were running as the battery voltage is highly affected @@ -378,6 +378,8 @@ bool mute; /**< Set when the amplifier has been muted */ audiorec_status_t record_state; /**< XXX need to define the enum for the states */ + unsigned int record; + unsigned int last_block_size; } audio; }; |