[tuxdroid-svn] r645 - in software/gadgets/light_monitor/trunk: . Light_monitor Light_monitor/Script
Status: Beta
Brought to you by:
ks156
From: Paul_R <c2m...@c2...> - 2007-10-29 15:51:28
|
Author: Paul_R Date: 2007-10-29 16:51:15 +0100 (Mon, 29 Oct 2007) New Revision: 645 Modified: software/gadgets/light_monitor/trunk/Light_monitor.tgf software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/GUI/conf/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/about.xml software/gadgets/light_monitor/trunk/Light_monitor/settings.xml software/gadgets/light_monitor/trunk/Light_monitor/strings.xml Log: * Resolved a bug in the main function * Added two scripts 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-29 10:22:14 UTC (rev 644) +++ software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/GUI/conf/other.pyp 2007-10-29 15:51:15 UTC (rev 645) @@ -130,6 +130,9 @@ 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) + path = _me.get_path('data')+'/Data' + self.get_widget('conf_behavior').set_filename(path) + for i in range(len(self.measure.event_tab)): self.add_row(i) 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-29 10:22:14 UTC (rev 644) +++ software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/lightGraph_class.py 2007-10-29 15:51:15 UTC (rev 645) @@ -216,7 +216,7 @@ else: self.event_tab = self.__tab - if self.GUI_on and self.search_light_flag: + if self.search_light_flag: self.search_light(self.light_search) # To prevent notifications at startup @@ -445,31 +445,33 @@ # ########################################################### def search_light(self, light): - self.count += 1 - self.__fault = False - detect = False - if self.light_search_state == 0 and tux.status.spin_counter() == 0 and self.count > 2: - self.light_search_state = 1 - if light == True: - self.light_value = max(self.val_table[len(self.val_table) - self.count: len(self.val_table)]) - self.light_value -= 10 - else: - self.light_value = min(self.val_table[len(self.val_table) - self.count: len(self.val_table)]) - self.light_value += 10 - self.timer = 10 - self.count = 0 + try: + self.count += 1 + self.__fault = False + detect = False + if self.light_search_state == 0 and tux.status.spin_counter() == 0 and self.count > 2: + self.light_search_state = 1 + if light == True: + self.light_value = max(self.val_table[len(self.val_table) - self.count: len(self.val_table)]) + self.light_value -= 10 + else: + self.light_value = min(self.val_table[len(self.val_table) - self.count: len(self.val_table)]) + self.light_value += 10 + print 'done' + self.timer = 10 + self.count = 0 - elif self.light_search_state == 1: - self.timer_control() - if light: - if self.val_table[len(self.val_table)-1] >= (self.light_value): - thread.start_new_thread(tux.cmd.spinl_off, ()) - detect = True - else: - if self.val_table[len(self.val_table)-1] <= (self.light_value): - thread.start_new_thread(tux.cmd.spinl_off, ()) - detect = True - + elif self.light_search_state == 1: + self.timer_control() + if light: + if self.val_table[len(self.val_table)-1] >= (self.light_value): + thread.start_new_thread(tux.cmd.spinl_off, ()) + detect = True + else: + if self.val_table[len(self.val_table)-1] <= (self.light_value): + thread.start_new_thread(tux.cmd.spinl_off, ()) + detect = True + if detect: self.test_default_behavior(self.search_event[3]) self.search_light_flag = False @@ -479,10 +481,14 @@ self.test_default_behavior(self.search_event[4]) self.search_light_flag = False self.light_search_state = 0 + except: + print sys.exc_info() + + def timer_control(self): self.timer -= 1 - self.count += 1 + print self.count if self.count == 10: self.test_default_behavior(self.search_event[0]) 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-29 10:22:14 UTC (rev 644) +++ software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/notify.pyp 2007-10-29 15:51:15 UTC (rev 645) @@ -51,7 +51,7 @@ path = event[i][6] path = path.replace('%20', ' ') if os.path.isfile(path) and os.path.exists(path): - path = "'%s'" % path + path = "python '%s'" % path tux.sys.shell(path) event[i][7] = False else: Modified: software/gadgets/light_monitor/trunk/Light_monitor/about.xml =================================================================== --- software/gadgets/light_monitor/trunk/Light_monitor/about.xml 2007-10-29 10:22:14 UTC (rev 644) +++ software/gadgets/light_monitor/trunk/Light_monitor/about.xml 2007-10-29 15:51:15 UTC (rev 645) @@ -1,7 +1,7 @@ <?xml version='1.0' encoding='UTF-8'?> <about> + <gadget_name type='str'>light_monitor</gadget_name> <gadget_author type='str'>Paul Rathgeb</gadget_author> + <gadget_description type='str'>Light monitor for tux droid</gadget_description> <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-29 10:22:14 UTC (rev 644) +++ software/gadgets/light_monitor/trunk/Light_monitor/settings.xml 2007-10-29 15:51:15 UTC (rev 645) @@ -10,22 +10,22 @@ <changeD_rad type='bool'>False</changeD_rad> <threshold type='float'>50.0</threshold> <decrease_rad type='bool'>False</decrease_rad> - <Sample type='float'>500.0</Sample> + <behavior_file_threshold type='NoneType'>None</behavior_file_threshold> <raise type='float'>10.0</raise> <changeU_rad type='bool'>False</changeU_rad> <threshold_notified type='bool'>False</threshold_notified> <config type='list'>[]</config> <behavior_file_change type='NoneType'>None</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='float'>1.0</drop_time> <changeU type='float'>10.0</changeU> <raise_time type='float'>1.0</raise_time> <drop type='float'>10.0</drop> + <drop_rad type='bool'>True</drop_rad> <MainScript type='str'> </MainScript> - <behavior_file_threshold type='NoneType'>None</behavior_file_threshold> + <Sample type='float'>500.0</Sample> <threshold_chk type='bool'>False</threshold_chk> <Rate type='float'>0.1</Rate> <changeD_time type='float'>1.0</changeD_time> Modified: software/gadgets/light_monitor/trunk/Light_monitor/strings.xml =================================================================== --- software/gadgets/light_monitor/trunk/Light_monitor/strings.xml 2007-10-29 10:22:14 UTC (rev 644) +++ software/gadgets/light_monitor/trunk/Light_monitor/strings.xml 2007-10-29 15:51:15 UTC (rev 645) @@ -3,15 +3,16 @@ <conf_lblIncrease type='str'>Increase</conf_lblIncrease> <conf_lblThreshold type='str'>Threshold</conf_lblThreshold> <gui_conf_remote_title type='str'>Control</gui_conf_remote_title> + <conf_lblTime type='str'>Time (sec.)</conf_lblTime> <conf_lblRaise type='str'>Raise</conf_lblRaise> - <power_supply type='str'>You must disconnect the power supply</power_supply> + <widget_lblSet type='str'>Add to config</widget_lblSet> <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> <Increase type='str'>The light level exceeded the threshold</Increase> <widget_lblBehavior type='str'>Enable behavior script</widget_lblBehavior> - <conf_btnRemove type='str'>Remove</conf_btnRemove> <gui_conf_accept_bt type='str'>Accept</gui_conf_accept_bt> + <speaker_name type='str'>Ryan8k</speaker_name> <help_text type='str'>-- The events: Two main types of events can take place, each containing various options: @@ -38,7 +39,7 @@ Additional custom events with a notification can also be stored here. If no external script is specified, a default behavior will be used. -The events can be modified or removed, simply by selection the event line in the table and selecting the required button. +The events can be modified or removed, simply by selecting the event line in the table and selecting the required button. - The gadget window: This window displays the light graph. @@ -46,7 +47,7 @@ This window makes it possible to try various configurations and to add them in the settings table. In the test part with two buttons you can make Tux search for the light source or darkest spot.</help_text> - <ChangeU type='str'>The light level raised and dropped</ChangeU> + <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> @@ -56,22 +57,21 @@ <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> - <MainBehavior type='str'>Main behavior</MainBehavior> - <gui_conf_rate_lb type='str'>Refresh rate :</gui_conf_rate_lb> + <widget_lblBoth type='str'>Both direction</widget_lblBoth> <mainscript type='str'>I've found the light !</mainscript> - <light2 type='str'>ow wait, even lighter here.</light2> <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> + <widget_lblChangeD type='str'>Drop and raise</widget_lblChangeD> + <power_supply type='str'>You must disconnect the power supply</power_supply> <conf_lblSample type='str'>Samples</conf_lblSample> <conf_lblType type='str'>Type</conf_lblType> <Change type='str'>The light level changed</Change> - <widget_lblDark type='str'>Search darkness</widget_lblDark> + <conf_lblValue type='str'>Value (%)</conf_lblValue> <Both type='str'>The light level reached the threshold</Both> <conf_btnModify type='str'>Modify</conf_btnModify> + <widget_lblTest type='str'>Notifications</widget_lblTest> <widget_lblDrop type='str'>Drop</widget_lblDrop> <widget_lblNotified type='str'>Notified</widget_lblNotified> <dark1 type='str'>It's pretty dark here.</dark1> @@ -86,12 +86,12 @@ <conf_lblNotifiedBehavior type='str'>Notified</conf_lblNotifiedBehavior> <gui_conf_author_lb type='str'>Author</gui_conf_author_lb> <widget_lblRaise type='str'>Raise</widget_lblRaise> + <conf_lblNotified type='str'>Notified ?</conf_lblNotified> <ChangeD type='str'>The light level dropped and raised</ChangeD> - <widget_lblBoth type='str'>Both direction</widget_lblBoth> + <gui_conf_rate_lb type='str'>Refresh rate :</gui_conf_rate_lb> <gui_conf_current_bind_lb type='str'>Current</gui_conf_current_bind_lb> <conf_lblDefaultBehavior type='str'>Default behavior</conf_lblDefaultBehavior> - <widget_lblDisplayThreshold type='str'>Display threshold on graph</widget_lblDisplayThreshold> - <conf_lblBehavior type='str'>Behavior script</conf_lblBehavior> + <conf_lblChangeU type='str'>Raise and drop</conf_lblChangeU> <dark2 type='str'>And darker here.</dark2> <gui_conf_remote_set_bt type='str'>Set</gui_conf_remote_set_bt> <search type='str'>I seek ...</search> @@ -104,18 +104,18 @@ <conf_lblNotNotified type='str'>Not notified</conf_lblNotNotified> <Raise type='str'>The light level raised</Raise> <widget_lblThreshold type='str'>Threshold</widget_lblThreshold> - <conf_lblNotified type='str'>Notified ?</conf_lblNotified> - <widget_lblSet type='str'>Add to config</widget_lblSet> + <widget_lblDark type='str'>Search darkness</widget_lblDark> + <light2 type='str'>ow wait, even lighter here.</light2> <light3 type='str'>or here ...</light3> <light1 type='str'>Seeing more light over here.</light1> <Decrease type='str'>The light level passed below the threshold</Decrease> - <conf_lblValue type='str'>Value (%)</conf_lblValue> + <widget_lblDisplayThreshold type='str'>Display threshold on graph</widget_lblDisplayThreshold> <light4 type='str'>I think the light is coming from this direction.</light4> <conf_lblRate type='str'>Refresh rate</conf_lblRate> <Threshold type='str'>The light reached the threshold</Threshold> - <widget_lblChangeD type='str'>Drop and raise</widget_lblChangeD> - <conf_lblTime type='str'>Time (sec.)</conf_lblTime> + <MainBehavior type='str'>Main behavior</MainBehavior> + <ChangeU type='str'>The light level raised and dropped</ChangeU> <conf_lblControl type='str'>Control</conf_lblControl> - <widget_lblTest type='str'>Notifications</widget_lblTest> + <conf_btnRemove type='str'>Remove</conf_btnRemove> <light5 type='str'>I can't find the direction of the light.</light5> </strings> Modified: software/gadgets/light_monitor/trunk/Light_monitor.tgf =================================================================== (Binary files differ) |