[tuxdroid-svn] r612 - 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-15 12:05:40
|
Author: Paul_R Date: 2007-10-15 14:05:10 +0200 (Mon, 15 Oct 2007) New Revision: 612 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/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 two line in the graph to indicate the max and min limits 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-15 09:33:39 UTC (rev 611) +++ software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Scripts/Python/Battery_class.py 2007-10-15 12:05:10 UTC (rev 612) @@ -37,6 +37,7 @@ self.draw_space() self.draw_hor_div() self.draw_ver_div() + self.draw_threshold() self.draw_label() self.draw_curve() @@ -92,6 +93,28 @@ txt = str('%.2f' % txt) self.context.show_text(str(txt) + " min.") self.context.stroke() + + 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 = (y * 3.4) + + self.context.set_source_rgb(0.8, 0, 0) + self.context.set_line_width(1) + + self.context.move_to(self.rect.width, self.rect.height - y * coeff_y) + self.context.line_to(0, self.rect.height - y * coeff_y) + self.context.stroke() + + y = self.measure_graph.convert_value([0, 1, 0, 6.25]) + y = (y * 3.4) + self.context.set_source_rgb(0, 0.8, 0) + self.context.set_line_width(1) + self.context.move_to(self.rect.width, self.rect.height - y * coeff_y) + self.context.line_to(0, self.rect.height - y * coeff_y) + + self.context.stroke() def draw_label(self): #display sample and rate @@ -127,13 +150,13 @@ temp_event = 0 for i, val in enumerate(self.measure_graph.val_table): self.context.line_to(self.rect.x + ((i) * coeff_x), self.rect.height - (val * coeff_y)) + if self.measure_graph.val_table_event[i] == 0: self.draw_circle(self.rect.x + ((i) * coeff_x), self.rect.height - (val * coeff_y), [0.2, 0.2, 0.7]) if self.measure_graph.val_table_event[i] == 1: self.draw_square(self.rect.x + ((i) * coeff_x), self.rect.height - (val * coeff_y), [0.2, 0.2, 0.7]) if self.measure_graph.val_table_event[i] == 2: - self.draw_triangle(self.rect.x + ((i) * coeff_x), self.rect.height - (val * coeff_y), [0.2, 0.2, 0.7]) - + self.draw_triangle(self.rect.x + ((i) * coeff_x), self.rect.height - (val * coeff_y), [0.2, 0.2, 0.7]) self.context.line_to(self.rect.x + ((i) * coeff_x), self.rect.height + 5) self.context.stroke() @@ -158,7 +181,6 @@ self.context.move_to(x, y) self.context.set_source_rgb(0, 0, 1) - def draw_circle(self, x, y, color): self.context.stroke() self.context.set_source_rgb(color[0], color[1], color[2]) @@ -166,9 +188,8 @@ self.context.close_path() self.context.fill() self.context.move_to(x, y) - self.context.set_source_rgb(0, 0, 1) + self.context.set_source_rgb(0, 0, 1) - def fill(self, coeff_x, coeff_y): #determine the coefficients to adjust the curve in the window space #Fill... @@ -270,8 +291,7 @@ def absolute_threshold(self): if self.absolute_threshold_flag == False: - val = self.convert_value([0, 1, 0, 4.6]) - + val = self.convert_value([0, 1, 0, 4.625]) 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: @@ -471,6 +491,7 @@ else: val = self.average / self.count val = val - 530 + print val charger_event = -1 #Event control 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-15 09:33:39 UTC (rev 611) +++ software/gadgets/battery_monitor/trunk/Battery_monitor_svn/Strings/fr_ALL.xml 2007-10-15 12:05:10 UTC (rev 612) @@ -33,7 +33,7 @@ <widget_lblValue type='str'>Valeur (V)</widget_lblValue> <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> @@ -58,7 +58,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-15 09:33:39 UTC (rev 611) +++ software/gadgets/battery_monitor/trunk/Battery_monitor_svn/about.xml 2007-10-15 12:05:10 UTC (rev 612) @@ -1,7 +1,7 @@ <?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'>Battery monitor for tux droid</gadget_description> - <gadget_author type='str'>Paul Rathgeb</gadget_author> <gadget_name type='str'>battery_monitor</gadget_name> - <gadget_version type='str'>0.0.1</gadget_version> </about> Modified: software/gadgets/battery_monitor/trunk/Battery_monitor_svn/settings.xml =================================================================== --- software/gadgets/battery_monitor/trunk/Battery_monitor_svn/settings.xml 2007-10-15 09:33:39 UTC (rev 611) +++ software/gadgets/battery_monitor/trunk/Battery_monitor_svn/settings.xml 2007-10-15 12:05:10 UTC (rev 612) @@ -1,11 +1,11 @@ <?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> - <Rate type='float'>1.0</Rate> + <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> <general> Modified: software/gadgets/battery_monitor/trunk/Battery_monitor_svn/strings.xml =================================================================== --- software/gadgets/battery_monitor/trunk/Battery_monitor_svn/strings.xml 2007-10-15 09:33:39 UTC (rev 611) +++ software/gadgets/battery_monitor/trunk/Battery_monitor_svn/strings.xml 2007-10-15 12:05:10 UTC (rev 612) @@ -5,16 +5,12 @@ <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> <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> <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> @@ -25,13 +21,16 @@ <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> + <conf_lblType type='str'>Type</conf_lblType> <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> + <conf_lblChangeU type='str'>Raise and drop</conf_lblChangeU> <speaker_name type='str'>Ryan8k</speaker_name> <conf_lblSample type='str'>Samples</conf_lblSample> <charging type='str'>Charging</charging> @@ -48,24 +47,25 @@ <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> - <conf_lblType type='str'>Type</conf_lblType> + <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> |