[tuxdroid-svn] r571 - in software/gadgets/light_monitor/trunk: . Light_monitor Light_monitor/Script
Status: Beta
Brought to you by:
ks156
Author: Paul_R Date: 2007-10-02 17:03:33 +0200 (Tue, 02 Oct 2007) New Revision: 571 Modified: software/gadgets/light_monitor/trunk/Light_monitor.tgf software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/GUI/conf/other.glade software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/GUI/conf/other.pyp software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/GUI/widget/other.glade software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/GUI/widget/other.pyp software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/lightGraph_class.py software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/notify.pyp software/gadgets/light_monitor/trunk/Light_monitor/Strings/fr_ALL.xml software/gadgets/light_monitor/trunk/Light_monitor/about.xml software/gadgets/light_monitor/trunk/Light_monitor/settings.xml software/gadgets/light_monitor/trunk/Light_monitor/strings.xml Log: * Added a button in the settings window to clear the path of the behavior script. Added two check boxes in the widget window to active/deactive the behavior script. Modified: software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/GUI/conf/other.glade =================================================================== --- software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/GUI/conf/other.glade 2007-10-02 13:35:54 UTC (rev 570) +++ software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/GUI/conf/other.glade 2007-10-02 15:03:33 UTC (rev 571) @@ -295,24 +295,6 @@ </child> <child> - <widget class="GtkFileChooserButton" id="conf_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">480</property> - <property name="y">32</property> - </packing> - </child> - - <child> <widget class="GtkComboBox" id="cbb_conf_type"> <property name="width_request">88</property> <property name="height_request">30</property> @@ -468,6 +450,24 @@ <property name="y">32</property> </packing> </child> + + <child> + <widget class="GtkFileChooserButton" id="conf_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">480</property> + <property name="y">32</property> + </packing> + </child> </widget> <packing> <property name="padding">0</property> @@ -534,6 +534,24 @@ <property name="y">8</property> </packing> </child> + + <child> + <widget class="GtkButton" id="btnBehavior"> + <property name="width_request">100</property> + <property name="height_request">29</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Clear path</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_btnBehavior_clicked" last_modification_time="Tue, 02 Oct 2007 13:52:46 GMT"/> + </widget> + <packing> + <property name="x">502</property> + <property name="y">8</property> + </packing> + </child> </widget> <packing> <property name="padding">0</property> Modified: software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/GUI/conf/other.pyp =================================================================== --- software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/GUI/conf/other.pyp 2007-10-02 13:35:54 UTC (rev 570) +++ software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/GUI/conf/other.pyp 2007-10-02 15:03:33 UTC (rev 571) @@ -144,6 +144,7 @@ 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')) @@ -207,8 +208,8 @@ ########################################################### 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() @@ -298,7 +299,6 @@ elif self.measure.event_tab[i][2] == 1: Type = _me.string('conf_lblDecrease') elif self.measure.event_tab[i][2] == 2: - print ' tick' Type = _me.string('conf_lblBoth') Value = str(self.measure.event_tab[i][3]) Time = 'N.A.' @@ -362,9 +362,24 @@ def on_cancel_clicked(self, widget, *args): self.get_widget("window1").destroy() - ########################################################### # + # 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) + print self.measure.event_tab[index][6] + self.measure.event_tab[index-1][6] = None + print self.measure.event_tab[index][6] + + self.value_list.clear() + for i in range(len(self.measure.event_tab)): + self.add_row(i) + + ########################################################### + # # Verify the value # ########################################################### Modified: software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/GUI/widget/other.glade =================================================================== --- software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/GUI/widget/other.glade 2007-10-02 13:35:54 UTC (rev 570) +++ software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/GUI/widget/other.glade 2007-10-02 15:03:33 UTC (rev 571) @@ -432,6 +432,26 @@ <property name="y">72</property> </packing> </child> + + <child> + <widget class="GtkCheckButton" id="chk_ChangeBehavior"> + <property name="width_request">168</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> + </widget> + <packing> + <property name="x">328</property> + <property name="y">48</property> + </packing> + </child> </widget> </child> </widget> @@ -695,6 +715,26 @@ <property name="y">64</property> </packing> </child> + + <child> + <widget class="GtkCheckButton" id="chk_ThresholdBehavior"> + <property name="width_request">168</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">328</property> + <property name="y">40</property> + </packing> + </child> </widget> </child> </widget> Modified: software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/GUI/widget/other.pyp =================================================================== --- software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/GUI/widget/other.pyp 2007-10-02 13:35:54 UTC (rev 570) +++ software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/GUI/widget/other.pyp 2007-10-02 15:03:33 UTC (rev 571) @@ -40,9 +40,12 @@ #Restore the check boxes self.get_widget('chkThreshold').set_active(_me.get_param('threshold_chk')) + self.get_widget('chk_ThresholdBehavior').set_active(_me.get_param('chk_ThresholdBehavior')) + self.get_widget('chk_ChangeBehavior').set_active(_me.get_param('chk_ChangeBehavior')) self.get_widget("window1").set_title(_me.string('name_to_read')) #Set the labels + print 'tick' self.get_widget("radBoth").set_label(_me.string('widget_lblBoth')) self.get_widget("lblBtnApply").set_text(_me.string('widget_lblBtnApply')) self.get_widget("lblChange").set_text(_me.string('widget_lblChange')) @@ -58,6 +61,8 @@ self.get_widget("lblValue").set_text(_me.string('widget_lblValue')) self.get_widget("lblControl").set_text(_me.string('widget_lblControl')) self.get_widget("chkThreshold").set_label(_me.string('widget_lblDisplayThreshold')) + self.get_widget('chk_ThresholdBehavior').set_label(_me.string('widget_lblBehavior')) + self.get_widget('chk_ChangeBehavior').set_label(_me.string('widget_lblBehavior')) self.get_widget("lblRate").set_text(_me.string('gui_conf_rate_lb')) self.get_widget("lblSample").set_text(_me.string('gui_conf_sample_lb')) @@ -77,8 +82,6 @@ _me.set_param('Sample', self.light_measure.sample) self.get_widget("txtSample").set_text(str(_me.get_param('Sample'))) - - #Drop _me.set_param('drop', self.light_measure.val_drop) self.get_widget("valDrop_percent").set_text(str(_me.get_param('drop'))) @@ -109,6 +112,7 @@ self.get_widget("valThreshold").set_text(str(_me.get_param('threshold'))) + #update the radio button status self.light_measure.drop = _me.get_param('drop_rad') self.light_measure.raising = _me.get_param('raise_rad') @@ -122,6 +126,9 @@ self.light_measure.thresholdtext = _me.string('conf_lblThreshold') # '' the check boxes self.light_measure.threshold_chk = _me.get_param('threshold_chk') + print _me.get_param('chk_ThresholdBehavior') + self.light_measure.threshold_behavior_chk = _me.get_param('chk_ThresholdBehavior') + self.light_measure.change_behavior_chk = _me.get_param('chk_ChangeBehavior') self.light_measure.change_control() @@ -146,6 +153,9 @@ _me.set_param('decrease_rad', self.get_widget('radDecrease').get_active()) _me.set_param('both_rad', self.get_widget('radBoth').get_active()) _me.set_param('threshold_chk', self.get_widget('chkThreshold').get_active()) + _me.set_param('chk_ThresholdBehavior', self.get_widget('chk_ThresholdBehavior').get_active()) + _me.set_param('chk_ChangeBehavior', self.get_widget('chk_ChangeBehavior').get_active()) + print _me.get_param('chk_ChangeBehavior') temp_rate = self.check_float_value(self.get_widget('txtRate').get_text(), 0.1, 36000) temp_sample = self.check_float_value(self.get_widget('txtSample').get_text(), 1, 100000) Modified: software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/lightGraph_class.py =================================================================== --- software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/lightGraph_class.py 2007-10-02 13:35:54 UTC (rev 570) +++ software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/lightGraph_class.py 2007-10-02 15:03:33 UTC (rev 571) @@ -138,7 +138,6 @@ ########################################################### def event_control(self): for i in range (len(self.event_tab)): - print self.event_tab[i][0] self.Threshold_control(i) self.Change_control(i) @@ -348,7 +347,7 @@ def test_notification(self): if self.threshold_event == True: - if os.path.isfile(self.threshold_behavior): + if self.threshold_behavior_chk and os.path.isfile(self.threshold_behavior): self.threshold_event = False tux.sys.shell_free(self.threshold_behavior) else: @@ -358,9 +357,13 @@ tux.cmd.mouth_close() elif self.change_event == True: - if os.path.isfile(self.change_behavior): - self.change_event = False - tux.sys.shell_free(self.change_behavior) + print self.change_behavior + print os.path.isfile(self.change_behavior) + if self.change_behavior_chk: + if os.path.isfile(self.change_behavior): + print 'test' + self.change_event = False + tux.sys.shell_free(self.change_behavior) else: self.change_event = False tux.cmd.mouth_open() Modified: software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/notify.pyp =================================================================== --- software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/notify.pyp 2007-10-02 13:35:54 UTC (rev 570) +++ software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/notify.pyp 2007-10-02 15:03:33 UTC (rev 571) @@ -34,7 +34,7 @@ if event[i][7]: if event[i][5]: - if os.path.exists(str(event[i][6])): + if os.path.isfile(str(event[i][6])): tux.sys.shell_free(event[i][6]) event[i][7] = False else: Modified: software/gadgets/light_monitor/trunk/Light_monitor/Strings/fr_ALL.xml =================================================================== --- software/gadgets/light_monitor/trunk/Light_monitor/Strings/fr_ALL.xml 2007-10-02 13:35:54 UTC (rev 570) +++ software/gadgets/light_monitor/trunk/Light_monitor/Strings/fr_ALL.xml 2007-10-02 15:03:33 UTC (rev 571) @@ -8,9 +8,8 @@ <conf_lblEvent type='str'>Evènement</conf_lblEvent> <widget_lblControl type='str'>Contrôle</widget_lblControl> <gui_conf_accept_bt type='str'>Valider</gui_conf_accept_bt> - <help_text type='str'>Bla bla bla - -bla</help_text> + <help_text type='str'> + </help_text> <conf_lblChange type='str'>Changement</conf_lblChange> <conf_lblBoth type='str'>Deux directions</conf_lblBoth> <widget_lblBtnApply type='str'>Appliquer</widget_lblBtnApply> @@ -23,6 +22,7 @@ <gui_conf_rate_lb type='str'>Taux de rafraichissement :</gui_conf_rate_lb> <conf_btnRemove type='str'>Enlever</conf_btnRemove> <gui_conf_delay_lb type='str'>Délai (sec)</gui_conf_delay_lb> + <conf_btnBehavior type='str'>Supprimer</conf_btnBehavior> <gui_conf_about_title type='str'>A propos</gui_conf_about_title> <conf_lblChangeD type='str'>Chute et augmente</conf_lblChangeD> <widget_lblValue type='str'>Valeur (%)</widget_lblValue> @@ -53,7 +53,7 @@ <widget_lblThreshold type='str'>Seuil</widget_lblThreshold> <conf_lblValue type='str'>Valeur (%)</conf_lblValue> <conf_lblRate type='str'>Taux de rafraichissement</conf_lblRate> - <widget_lblBehavior type='str'>Activer le comportement</widget_lblBehavior> + <widget_lblBehavior type='str'>Activer le script</widget_lblBehavior> <widget_lblChangeD type='str'>Changement inf.</widget_lblChangeD> <conf_lblTime type='str'>Temps (sec.)</conf_lblTime> <conf_lblControl type='str'>Contrôle</conf_lblControl> Modified: software/gadgets/light_monitor/trunk/Light_monitor/about.xml =================================================================== --- software/gadgets/light_monitor/trunk/Light_monitor/about.xml 2007-10-02 13:35:54 UTC (rev 570) +++ software/gadgets/light_monitor/trunk/Light_monitor/about.xml 2007-10-02 15:03:33 UTC (rev 571) @@ -1,7 +1,7 @@ <?xml version='1.0' encoding='UTF-8'?> <about> + <gadget_description type='str'>Light monitor for tux droid</gadget_description> <gadget_author type='str'>Paul Rathgeb</gadget_author> + <gadget_name type='str'>light_monitor</gadget_name> <gadget_version type='str'>0.0.1</gadget_version> - <gadget_name type='str'>light_monitor</gadget_name> - <gadget_description type='str'>Light monitor for tux droid</gadget_description> </about> Modified: software/gadgets/light_monitor/trunk/Light_monitor/settings.xml =================================================================== --- software/gadgets/light_monitor/trunk/Light_monitor/settings.xml 2007-10-02 13:35:54 UTC (rev 570) +++ software/gadgets/light_monitor/trunk/Light_monitor/settings.xml 2007-10-02 15:03:33 UTC (rev 571) @@ -1,8 +1,9 @@ <?xml version='1.0' encoding='UTF-8'?> <settings> <parameters> - <drop_rad type='bool'>True</drop_rad> + <chk_ThresholdBehavior type='bool'>False</chk_ThresholdBehavior> <increase_rad type='bool'>True</increase_rad> + <chk_ChangeBehavior type='bool'>False</chk_ChangeBehavior> <changeU_time type='int'>1</changeU_time> <changeD_rad type='bool'>False</changeD_rad> <threshold type='float'>50.0</threshold> @@ -12,6 +13,7 @@ <changeU_rad type='bool'>False</changeU_rad> <config type='list'>[]</config> <behavior_file_change type='str'>/home/</behavior_file_change> + <drop_rad type='bool'>True</drop_rad> <raise_rad type='bool'>False</raise_rad> <changeD type='float'>10.0</changeD> <drop_time type='int'>1</drop_time> Modified: software/gadgets/light_monitor/trunk/Light_monitor/strings.xml =================================================================== --- software/gadgets/light_monitor/trunk/Light_monitor/strings.xml 2007-10-02 13:35:54 UTC (rev 570) +++ software/gadgets/light_monitor/trunk/Light_monitor/strings.xml 2007-10-02 15:03:33 UTC (rev 571) @@ -8,7 +8,9 @@ <conf_lblEvent type='str'>Event</conf_lblEvent> <widget_lblControl type='str'>Control</widget_lblControl> <gui_conf_accept_bt type='str'>Accept</gui_conf_accept_bt> - <help_text type='str'>Bla bla bla bla</help_text> + <help_text type='str'> + </help_text> + <conf_lblBehavior type='str'>Behavior script</conf_lblBehavior> <conf_lblChange type='str'>Change</conf_lblChange> <conf_lblBoth type='str'>Both</conf_lblBoth> <widget_lblBtnApply type='str'>Apply changes</widget_lblBtnApply> @@ -18,12 +20,11 @@ <gui_conf_update_title type='str'>Update</gui_conf_update_title> <widget_lblValue type='str'>Value (%)</widget_lblValue> <gui_conf_cancel_bt type='str'>Cancel</gui_conf_cancel_bt> - <gui_conf_rate_lb type='str'>Refresh rate :</gui_conf_rate_lb> - <conf_btnRemove type='str'>Remove</conf_btnRemove> + <widget_lblBoth type='str'>Both direction</widget_lblBoth> <gui_conf_delay_lb type='str'>Delay (sec)</gui_conf_delay_lb> + <conf_btnBehavior type='str'>Clear path</conf_btnBehavior> <gui_conf_about_title type='str'>About</gui_conf_about_title> <conf_lblChangeD type='str'>Drop and raise</conf_lblChangeD> - <conf_lblChangeU type='str'>Raise and drop</conf_lblChangeU> <speaker_name type='str'>Ryan8k</speaker_name> <conf_lblSample type='str'>Samples</conf_lblSample> <conf_lblType type='str'>Type</conf_lblType> @@ -39,9 +40,10 @@ <conf_lblNotifiedBehavior type='str'>Notified</conf_lblNotifiedBehavior> <gui_conf_author_lb type='str'>Author</gui_conf_author_lb> <widget_lblDrop type='str'>Drop</widget_lblDrop> - <widget_lblBoth type='str'>Both direction</widget_lblBoth> + <conf_lblNotified type='str'>Notified ?</conf_lblNotified> + <gui_conf_rate_lb type='str'>Refresh rate :</gui_conf_rate_lb> <conf_lblDefaultBehavior type='str'>Default behavior</conf_lblDefaultBehavior> - <conf_lblBehavior type='str'>Behavior script</conf_lblBehavior> + <conf_lblChangeU type='str'>Raise and drop</conf_lblChangeU> <gui_conf_remote_set_bt type='str'>Set</gui_conf_remote_set_bt> <widget_lblChange type='str'>Change</widget_lblChange> <name_to_read type='str'>Light monitor</name_to_read> @@ -51,9 +53,9 @@ <widget_lblThreshold type='str'>Threshold</widget_lblThreshold> <conf_lblValue type='str'>Value (%)</conf_lblValue> <conf_lblRate type='str'>Refresh rate</conf_lblRate> - <widget_lblBehavior type='str'>Enable behavior</widget_lblBehavior> + <widget_lblBehavior type='str'>Enable behavior script</widget_lblBehavior> <widget_lblChangeD type='str'>Drop and raise</widget_lblChangeD> <conf_lblTime type='str'>Time (sec.)</conf_lblTime> <conf_lblControl type='str'>Control</conf_lblControl> - <conf_lblNotified type='str'>Notified ?</conf_lblNotified> + <conf_btnRemove type='str'>Remove</conf_btnRemove> </strings> Modified: software/gadgets/light_monitor/trunk/Light_monitor.tgf =================================================================== (Binary files differ) |