[tuxdroid-svn] r631 - in software/gadgets/battery_monitor/trunk: . Battery_monitor_svn Battery_moni
Status: Beta
Brought to you by:
ks156
From: Paul_R <c2m...@c2...> - 2007-10-17 13:54:46
|
Author: Paul_R Date: 2007-10-17 15:54:44 +0200 (Wed, 17 Oct 2007) New Revision: 631 Modified: software/gadgets/battery_monitor/trunk/Battery_monitor.tgf software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Scripts/Python/Battery_class.py software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Scripts/Python/main.pyp software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Strings/fr_ALL.xml software/gadgets/battery_monitor/trunk/Battery_monitor_svn/about.xml software/gadgets/battery_monitor/trunk/Battery_monitor_svn/settings.xml software/gadgets/battery_monitor/trunk/Battery_monitor_svn/strings.xml Log: * Added a main script which is executed when the 'OK' button is pressed. This script indicate the battery level (low, OK, full) * I've changed the absolute threshold from 4.6V to 4.75V Modified: software/gadgets/battery_monitor/trunk/Battery_monitor.tgf =================================================================== (Binary files differ) Modified: software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Scripts/Python/Battery_class.py =================================================================== --- software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Scripts/Python/Battery_class.py 2007-10-17 13:07:03 UTC (rev 630) +++ software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Scripts/Python/Battery_class.py 2007-10-17 13:54:44 UTC (rev 631) @@ -97,7 +97,7 @@ def draw_threshold(self): coeff_y = float(self.rect.height / self.measure_graph.RANGE) - y = self.measure_graph.convert_value([0, 1, 0, 4.625]) + y = self.measure_graph.convert_value([0, 1, 0, 4.75]) y = (y * 3.4) self.context.set_source_rgb(0.8, 0, 0) @@ -291,14 +291,15 @@ def absolute_threshold(self): if self.absolute_threshold_flag == False: - val = self.convert_value([0, 1, 0, 4.625]) + val = self.convert_value([0, 1, 0, 4.75]) + print ((val* self.RANGE) / 100) val_act = (self.val_table[len(self.val_table)-1]*100) / self.RANGE val_prev = (self.val_table[len(self.val_table)-2]*100) / self.RANGE if val_prev >= val and val_act < val: self.absolute_threshold_flag = True return True else: - val = self.convert_value([0, 1, 0, 4.7]) + val = self.convert_value([0, 1, 0, 4.9]) val_act = (self.val_table[len(self.val_table)-1]*100) / self.RANGE val_prev = (self.val_table[len(self.val_table)-2]*100) / self.RANGE if val_prev <= val and val_act > val: Modified: software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Scripts/Python/main.pyp =================================================================== --- software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Scripts/Python/main.pyp 2007-10-17 13:07:03 UTC (rev 630) +++ software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Scripts/Python/main.pyp 2007-10-17 13:54:44 UTC (rev 631) @@ -1,3 +1,25 @@ def update_informations(): pass +def battery_level(): + measure = _me.get_param('measure') + val = measure.val_table[len(measure.val_table)-1] + + if val <= 102: + tux.cmd.mouth_open() + txt = _me.string('low') + tux.tts.speak(str(txt)) + tux.cmd.mouth_close() + + elif val >= 306: + tux.cmd.mouth_open() + txt = _me.string('full') + tux.tts.speak(str(txt)) + tux.cmd.mouth_close() + else: + tux.cmd.mouth_open() + txt = _me.string('normal') + tux.tts.speak(str(txt)) + tux.cmd.mouth_close() + +battery_level() Modified: software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Strings/fr_ALL.xml =================================================================== --- software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Strings/fr_ALL.xml 2007-10-17 13:07:03 UTC (rev 630) +++ software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Strings/fr_ALL.xml 2007-10-17 13:54:44 UTC (rev 631) @@ -9,6 +9,7 @@ <gui_conf_description_lb type='str'>Description</gui_conf_description_lb> <conf_lblEvent type='str'>Evènement</conf_lblEvent> <widget_lblControl type='str'>Contrôle</widget_lblControl> + <full type='str'>Les batteries sont pleines</full> <gui_conf_accept_bt type='str'>Valider</gui_conf_accept_bt> <help_text type='str'> </help_text> @@ -16,13 +17,14 @@ <conf_lblBoth type='str'>Deux directions</conf_lblBoth> <widget_lblBtnApply type='str'>Appliquer</widget_lblBtnApply> <widget_lblChangeU type='str'>Changement sup.</widget_lblChangeU> - <conf_lblDecrease type='str'>Diminue</conf_lblDecrease> + <widget_lblNotified type='str'>Notifé</widget_lblNotified> <gui_conf_version_lb type='str'>Version</gui_conf_version_lb> <gui_conf_update_title type='str'>Mise à jour</gui_conf_update_title> <conf_lblChangeU type='str'>Augmente et chute</conf_lblChangeU> <gui_conf_cancel_bt type='str'>Annuler</gui_conf_cancel_bt> <widget_lblBoth type='str'>Deux directions</widget_lblBoth> <gui_conf_rate_lb type='str'>Taux de rafraichissement :</gui_conf_rate_lb> + <widget_lblValue type='str'>Valeur (V)</widget_lblValue> <mainscript type='str'>J'ai trouvé la lumière !</mainscript> <conf_btnRemove type='str'>Enlever</conf_btnRemove> <gui_conf_delay_lb type='str'>Délai (sec)</gui_conf_delay_lb> @@ -30,14 +32,14 @@ <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 (V)</widget_lblValue> + <low type='str'>Le niveau des batteries est faible</low> <speaker_name type='str'>Bruno8k</speaker_name> <conf_lblSample type='str'>Points</conf_lblSample> - <conf_lblType type='str'>Type</conf_lblType> + <charging type='str'>En charge</charging> <widget_lblDisplayThreshold type='str'>Afficher le seuil sur le graph.</widget_lblDisplayThreshold> <conf_btnModify type='str'>Modifier</conf_btnModify> <widget_lblEvent type='str'>Evènement</widget_lblEvent> - <widget_lblNotified type='str'>Notifé</widget_lblNotified> + <normal type='str'>Le niveau des batteries est bon</normal> <widget_lblIncrease type='str'>Accroissement</widget_lblIncrease> <widget_lblRaise type='str'>Augmentation</widget_lblRaise> <conf_btnAdd type='str'>Ajouter</conf_btnAdd> @@ -50,6 +52,7 @@ <MainBehavior type='str'>Comportement principal</MainBehavior> <absolute_threshold type='str'>Batteries faibles</absolute_threshold> <lblMotors type='str'>Rejeter les mesures lorsque les moteurs fonctionnent</lblMotors> + <conf_lblDecrease type='str'>Diminue</conf_lblDecrease> <conf_lblDefaultBehavior type='str'>Comportement pas défaut</conf_lblDefaultBehavior> <conf_lblBehavior type='str'>Comportement</conf_lblBehavior> <gui_conf_remote_set_bt type='str'>Set</gui_conf_remote_set_bt> @@ -58,7 +61,7 @@ <conf_lblNotNotified type='str'>Non notifié</conf_lblNotNotified> <conf_lblDrop type='str'>Chute</conf_lblDrop> <gui_conf_window_title type='str'>Paramètres</gui_conf_window_title> - <charging type='str'>En charge</charging> + <conf_lblType type='str'>Type</conf_lblType> <widget_lblSet type='str'>Ajouter a la config.</widget_lblSet> <conf_lblValue type='str'>Valeur (V)</conf_lblValue> <conf_lblRate type='str'>Taux de rafraichissement</conf_lblRate> Modified: software/gadgets/battery_monitor/trunk/Battery_monitor_svn/about.xml =================================================================== --- software/gadgets/battery_monitor/trunk/Battery_monitor_svn/about.xml 2007-10-17 13:07:03 UTC (rev 630) +++ software/gadgets/battery_monitor/trunk/Battery_monitor_svn/about.xml 2007-10-17 13:54:44 UTC (rev 631) @@ -1,7 +1,7 @@ <?xml version='1.0' encoding='UTF-8'?> <about> - <gadget_name type='str'>battery_monitor</gadget_name> <gadget_author type='str'>Paul Rathgeb</gadget_author> + <gadget_version type='str'>0.0.1</gadget_version> <gadget_description type='str'>Battery monitor for tux droid</gadget_description> - <gadget_version type='str'>0.0.1</gadget_version> + <gadget_name type='str'>battery_monitor</gadget_name> </about> Modified: software/gadgets/battery_monitor/trunk/Battery_monitor_svn/settings.xml =================================================================== --- software/gadgets/battery_monitor/trunk/Battery_monitor_svn/settings.xml 2007-10-17 13:07:03 UTC (rev 630) +++ software/gadgets/battery_monitor/trunk/Battery_monitor_svn/settings.xml 2007-10-17 13:54:44 UTC (rev 631) @@ -1,10 +1,10 @@ <?xml version='1.0' encoding='UTF-8'?> <settings> <parameters> - <test_tab type='list'>[[1, 0, 0, 0.10000000000000001, 20.0, True, 'None', False, 0]]</test_tab> + <Sample type='float'>600.0</Sample> <chkMotors type='bool'>True</chkMotors> <MainScript type='str'>None</MainScript> - <Sample type='float'>600.0</Sample> + <test_tab type='list'>[[1, 0, 0, 0.10000000000000001, 20.0, True, 'None', False, 0]]</test_tab> <Rate type='float'>10.0</Rate> <config type='list'>[]</config> </parameters> Modified: software/gadgets/battery_monitor/trunk/Battery_monitor_svn/strings.xml =================================================================== --- software/gadgets/battery_monitor/trunk/Battery_monitor_svn/strings.xml 2007-10-17 13:07:03 UTC (rev 630) +++ software/gadgets/battery_monitor/trunk/Battery_monitor_svn/strings.xml 2007-10-17 13:54:44 UTC (rev 631) @@ -5,67 +5,70 @@ <gui_conf_remote_title type='str'>Control</gui_conf_remote_title> <battery type='str'>On battery</battery> <conf_lblRaise type='str'>Raise</conf_lblRaise> - <widget_lblTest type='str'>Notifications</widget_lblTest> <gui_conf_description_lb type='str'>Description</gui_conf_description_lb> <conf_lblEvent type='str'>Event</conf_lblEvent> <widget_lblControl type='str'>Control</widget_lblControl> + <full type='str'>The level of the batteries is full</full> <gui_conf_accept_bt type='str'>Accept</gui_conf_accept_bt> - <gui_conf_remote_set_bt type='str'>Set</gui_conf_remote_set_bt> - <lblMotors type='str'>Disable measure when the motors are running</lblMotors> + <conf_lblChangeU type='str'>Raise and drop</conf_lblChangeU> <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> <widget_lblChangeU type='str'>Raise and drop</widget_lblChangeU> - <conf_lblDecrease type='str'>Decrease</conf_lblDecrease> + <widget_lblNotified type='str'>Notified</widget_lblNotified> <gui_conf_version_lb type='str'>Version</gui_conf_version_lb> <gui_conf_update_title type='str'>Update</gui_conf_update_title> <widget_lblValue type='str'>Value (V)</widget_lblValue> <gui_conf_cancel_bt type='str'>Cancel</gui_conf_cancel_bt> <widget_lblBoth type='str'>Both direction</widget_lblBoth> + <gui_conf_rate_lb type='str'>Refresh rate :</gui_conf_rate_lb> + <normal type='str'>The level of the batteries is good</normal> <mainscript type='str'>I've found the light !</mainscript> + <conf_btnRemove type='str'>Remove</conf_btnRemove> <gui_conf_delay_lb type='str'>Delay (sec)</gui_conf_delay_lb> <plugged type='str'>Plugged</plugged> <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> - <widget_lblChangeD type='str'>Drop and raise</widget_lblChangeD> + <low type='str'>The level of the batteries is weak</low> <speaker_name type='str'>Ryan8k</speaker_name> <conf_lblSample type='str'>Samples</conf_lblSample> - <conf_lblType type='str'>Type</conf_lblType> + <charging type='str'>Charging</charging> <widget_lblDisplayThreshold type='str'>Display threshold on graph</widget_lblDisplayThreshold> <conf_btnModify type='str'>Modify</conf_btnModify> <widget_lblEvent type='str'>Event</widget_lblEvent> - <widget_lblNotified type='str'>Notified</widget_lblNotified> + <conf_lblDecrease type='str'>Decrease</conf_lblDecrease> <widget_lblIncrease type='str'>Increasing</widget_lblIncrease> <widget_lblRaise type='str'>Raise</widget_lblRaise> <conf_btnAdd type='str'>Add</conf_btnAdd> <widget_lblDecrease type='str'>Decreasing</widget_lblDecrease> <gui_conf_sample_lb type='str'>Sample :</gui_conf_sample_lb> <gui_conf_current_bind_lb type='str'>Current</gui_conf_current_bind_lb> + <conf_lblType type='str'>Type</conf_lblType> <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> - <conf_lblNotified type='str'>Notified ?</conf_lblNotified> - <gui_conf_rate_lb type='str'>Refresh rate :</gui_conf_rate_lb> + <MainBehavior type='str'>Main behavior</MainBehavior> + <absolute_threshold type='str'>Weak batteries </absolute_threshold> + <lblMotors type='str'>Disable measure when the motors are running</lblMotors> <conf_lblDefaultBehavior type='str'>Default behavior</conf_lblDefaultBehavior> - <conf_lblChangeU type='str'>Raise and drop</conf_lblChangeU> - <absolute_threshold type='str'>Weak batteries </absolute_threshold> + <conf_lblBehavior type='str'>Behavior script</conf_lblBehavior> + <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'>Battery monitor</name_to_read> <conf_lblNotNotified type='str'>Not notified</conf_lblNotNotified> <conf_lblDrop type='str'>Drop</conf_lblDrop> <gui_conf_window_title type='str'>Parameters</gui_conf_window_title> - <charging type='str'>Charging</charging> + <conf_lblNotified type='str'>Notified ?</conf_lblNotified> <widget_lblSet type='str'>Add to config</widget_lblSet> <conf_lblValue type='str'>Value (V)</conf_lblValue> <conf_lblRate type='str'>Refresh rate</conf_lblRate> <widget_lblBehavior type='str'>Enable behavior script</widget_lblBehavior> - <MainBehavior type='str'>Main behavior</MainBehavior> + <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_btnRemove type='str'>Remove</conf_btnRemove> + <widget_lblTest type='str'>Notifications</widget_lblTest> <widget_lblThreshold type='str'>Threshold</widget_lblThreshold> </strings> |