[tuxdroid-svn] r592 - 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-09 12:46:43
|
Author: Paul_R Date: 2007-10-09 14:46:31 +0200 (Tue, 09 Oct 2007) New Revision: 592 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/about.xml software/gadgets/light_monitor/trunk/Light_monitor/strings.xml Log: * Added a protection to not add a config already in the setting table. 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-09 09:30:03 UTC (rev 591) +++ software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/GUI/conf/other.pyp 2007-10-09 12:46:31 UTC (rev 592) @@ -129,7 +129,6 @@ for i in range(len(self.measure.event_tab)): self.add_row(i) - ########################################################### # # Update the labels @@ -225,11 +224,13 @@ False, 0] self.measure.event_tab = _me.get_param('config') - 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) + 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) ########################################################### # @@ -265,15 +266,29 @@ False, 0] self.measure.event_tab = _me.get_param('config') - self.measure.event_tab.append(value) - self.refresh_tree() + if self.verify_tab(value): + self.measure.event_tab.append(value) + self.refresh_tree() def refresh_tree(self): - print 'refresh tree =========================================================' _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]: + print '1' + if self.measure.event_tab[i][2] == tab[2]: + print '2' + if self.measure.event_tab[i][3] == tab[3]: + print '3' + if self.measure.event_tab[i][4] == tab[4]: + print '4' + return False + return True ########################################################### # 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-09 09:30:03 UTC (rev 591) +++ software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/lightGraph_class.py 2007-10-09 12:46:31 UTC (rev 592) @@ -150,19 +150,14 @@ def event_control(self): if self.GUI_on == False: for i in range (len(self.event_tab)): - print 'goto threshold control' self.Threshold_control(i) - print 'goto change control' self.Change_control(i) #Gadget or test notifications else: - print 'GUI on' if self.search_light_flag: - print 'search light' self.search_light(self.light_search) else: - print 'goto test function' self.test_func() #disable gadget notifications self.notify = False @@ -170,14 +165,12 @@ #goto test notification every sec. if self.wait == 0: self.wait = 10 - print 'goto notifications' self.test_notification() else: self.wait -= 1 # To prevent notifications at startup if self.start_flag == True: - print 'start flag' self.change_event = False self.threshold_event = False self.start_flag = False @@ -187,7 +180,6 @@ def change_control(self): # Determine how many point must be checked for changes events - print 'Enter change control' pts_per_sec = self.sample / (self.rate * self.sample) if self.val_drop_time >= 0.1 and self.val_drop > 0: @@ -202,7 +194,6 @@ if self.val_changeU_time >= 0.1 and self.val_changeU > 0: self.changeU_point = int(self.val_changeU_time * pts_per_sec) self.set_timeout(self.changeU_point) - print 'exiting change control' ########################################################### @@ -214,45 +205,36 @@ if self.event_tab[index][1] == 1: if self.event_tab[index][7] != True: if self.event_tab[index][2] == 0: - print 'increase detected' #Increasing threshold control if self.Increase_control(self.event_tab[index][3]) == True: self.event_tab[index][7] = True elif self.event_tab[index][2] == 1: - print 'decrease detected' #Decreasing threshold control if self.Decrease_control(self.event_tab[index][3]) == True: self.event_tab[index][7] = True elif self.event_tab[index][2] == 2: - print 'both detected' #Both direction theshold control if self.Both_control(self.event_tab[index][3]) == True: self.event_tab[index][7] = True def Increase_control(self, value): - print 'enter increase control' val_act = (self.val_table[len(self.val_table)-1]*100) / 1124.0 val_prev = (self.val_table[len(self.val_table)-2]*100) / 1124.0 if val_prev <= value and val_act > value: return True - print 'leave increase control' def Decrease_control(self, val): - print 'enter decrease control' val_act = (self.val_table[len(self.val_table)-1]*100) / 1124.0 val_prev = (self.val_table[len(self.val_table)-2]*100) / 1124.0 if val_prev >= val and val_act < val: return True - print 'leave decrease control' def Both_control(self, val): - print 'enter both control' val_act = (self.val_table[int(len(self.val_table)-1)]*100) / 1124.0 val_prev = (self.val_table[int(len(self.val_table)-2)]*100) / 1124.0 if val_prev <= val and val_act > val or val_prev >= val and val_act < val: return True - print 'leave both control' ########################################################### @@ -263,37 +245,27 @@ def Change_control(self, i): #Changements control if self.event_tab[i][1] == 0: - print 'change detected' pts_per_sec = self.sample / (self.rate * self.sample) time = int(self.event_tab[i][4] * pts_per_sec) if self.event_tab[i][7] != True: # Drop change part : if self.event_tab[i][2] == 0: - print 'drop detected' if self.Drop_control(time, self.event_tab[i][3], self.event_tab[i][8], i) == True: self.event_tab[i][7] = True - print 'dropped' # Raise change part if self.event_tab[i][2] == 1: - print 'raise detected' if self.Raise_control(time, self.event_tab[i][3], self.event_tab[i][8], i) == True: self.event_tab[i][7] = True - print 'raised' # Drop and Raise change if self.event_tab[i][2] == 2: - print 'drop and raise detected' if self.ChangeD_control(time, self.event_tab[i][3], self.event_tab[i][8], i) == True: self.event_tab[i][7] = True - print 'drop and raise event !' # Raise and Drop change if self.event_tab[i][2] == 3: - print 'raise and drop detected' if self.ChangeU_control(time, self.event_tab[i][3], self.event_tab[i][8], i) == True: self.event_tab[i][7] = True - print 'raise and drop event !' def Drop_control(self, time, val, timeout, index): - print 'enter drop control' #timeout control : to prevent multiple notifications with the same event if timeout != 0: timeout -= 1 @@ -315,10 +287,8 @@ self.set_timeout(timeout) else: self.event_tab[index][8] = timeout - print 'leave drop control' def Raise_control(self, time, val, timeout, index): - print 'enter raise control' if timeout != 0: timeout -= 1 init_val = len(self.val_table) - 1 - int(time) + timeout @@ -340,10 +310,8 @@ self.set_timeout(timeout) else: self.event_tab[index][8] = timeout - print 'leave raise control' def ChangeD_control(self, time, val, timeout, index): - print 'enter drop and raise control' if timeout != 0: timeout -= 1 init_val = len(self.val_table) - 1 - int(time) + timeout @@ -366,12 +334,10 @@ self.set_timeout(timeout) else: self.event_tab[index][8] = timeout - print 'leave drop and raise control' return False def ChangeU_control(self, time, val, timeout, index): - print 'enter raise and drop control' if timeout != 0: timeout -= 1 init_val = len(self.val_table) - 1 - int(time) + timeout @@ -394,7 +360,6 @@ self.set_timeout(timeout) else: self.event_tab[index][8] = timeout - print 'leave raise and drop control' return False @@ -405,68 +370,50 @@ ########################################################### def test_func(self): if self.threshold_event != True: - print 'test threshold control' #Decrease threshold control if self.decrease: - print 'test decrease' if self.Decrease_control(self.val_threshold) == True: self.threshold_event = True - print 'test decrease event' #Increasing threshold control if self.increase: - print 'test increase' if self.Increase_control(self.val_threshold) == True: self.threshold_event = True - print 'test increase event' #Both direction theshold control if self.both: - print 'test both' if self.Both_control(self.val_threshold) == True: self.threshold_event = True - print 'test both event' #Changements control if self.change_event != True: timeout = self.get_timeout() - print 'test change control' # Drop change part : if self.drop == True and self.val_drop_time > 0.0: - print 'test drop detected' if self.Drop_control(self.drop_point, self.val_drop, timeout, 0) == True: self.change_event = True - print 'test drop event' # Raise change part if self.raising == True and self.val_raise_time > 0.0: - print 'test raise detected' if self.Raise_control(self.raise_point, self.val_raise, timeout, 0) == True: self.change_event = True - print 'test raise event' # Drop and Raise change if self.changeD == True and self.val_changeD_time > 0.0: - print 'test drop and raise detected' if self.ChangeD_control(self.changeD_point, self.val_changeD, timeout, 0) == True: self.change_event = True - print 'test drop and raise event' # Raise and Drop change if self.changeU == True and self.val_changeU_time > 0.0: - print 'test raise and drop detected' if self.ChangeU_control(self.changeU_point, self.val_changeU, timeout, 0) == True: self.change_event = True - print 'test raise and drop event' + def test_notification(self): - print 'enter test notifications' if self.threshold_event == True: if self.threshold_notified: path = self.change_behavior path = "'%s'" % path if self.threshold_behavior_chk and os.path.isfile(self.threshold_behavior) and os.path.exists(self.threshold_behavior): - print 'threshold behavior script' self.threshold_event = False tux.sys.shell_free(path) else: - print 'threshold default behavior' self.threshold_event = False thread.start_new_thread(self.test_default_behavior, (self.thresholdtext,)) else: @@ -477,11 +424,9 @@ path = self.change_behavior path = "'%s'" % path if self.change_behavior_chk and os.path.isfile(self.change_behavior) and os.path.exists(self.change_behavior): - print 'change behavior script' self.change_event = False tux.sys.shell_free(path) else: - print 'change default behavior' self.change_event = False thread.start_new_thread(self.test_default_behavior, (self.changetext,)) else: Modified: software/gadgets/light_monitor/trunk/Light_monitor/about.xml =================================================================== --- software/gadgets/light_monitor/trunk/Light_monitor/about.xml 2007-10-09 09:30:03 UTC (rev 591) +++ software/gadgets/light_monitor/trunk/Light_monitor/about.xml 2007-10-09 12:46:31 UTC (rev 592) @@ -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'>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> </about> Modified: software/gadgets/light_monitor/trunk/Light_monitor/strings.xml =================================================================== --- software/gadgets/light_monitor/trunk/Light_monitor/strings.xml 2007-10-09 09:30:03 UTC (rev 591) +++ software/gadgets/light_monitor/trunk/Light_monitor/strings.xml 2007-10-09 12:46:31 UTC (rev 592) @@ -10,7 +10,6 @@ <gui_conf_accept_bt type='str'>Accept</gui_conf_accept_bt> <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> @@ -20,11 +19,13 @@ <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> - <widget_lblBoth type='str'>Both direction</widget_lblBoth> + <gui_conf_rate_lb type='str'>Refresh rate :</gui_conf_rate_lb> + <conf_btnRemove type='str'>Remove</conf_btnRemove> <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> @@ -41,10 +42,9 @@ <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> + <widget_lblBoth type='str'>Both direction</widget_lblBoth> <conf_lblDefaultBehavior type='str'>Default behavior</conf_lblDefaultBehavior> - <conf_lblChangeU type='str'>Raise and drop</conf_lblChangeU> + <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> <widget_lblLight type='str'>Search light</widget_lblLight> @@ -60,6 +60,6 @@ <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> + <conf_lblNotified type='str'>Notified ?</conf_lblNotified> <widget_lblThreshold type='str'>Threshold</widget_lblThreshold> </strings> Modified: software/gadgets/light_monitor/trunk/Light_monitor.tgf =================================================================== (Binary files differ) |