[tuxdroid-svn] r565 - 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-02 10:08:58
|
Author: Paul_R Date: 2007-10-02 12:08:22 +0200 (Tue, 02 Oct 2007) New Revision: 565 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/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/about.xml software/gadgets/light_monitor/trunk/Light_monitor/settings.xml Log: * Reorganize some function in light_measure class. * Protect the entry box of the widget window against false format. Only accepted format are numbers. The wrong value are corrected when the Apply button is pressed. 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-01 14:34:44 UTC (rev 564) +++ software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/GUI/conf/other.pyp 2007-10-02 10:08:22 UTC (rev 565) @@ -65,8 +65,8 @@ txt = _me.string('gui_conf_accept_bt') self.get_widget("label5").set_text(txt) - self.get_widget('txt_conf_rate').set_text(_me.get_param('Rate')) - self.get_widget('txt_conf_sample').set_text(_me.get_param('Sample')) + self.get_widget('txt_conf_rate').set_text(str(_me.get_param('Rate'))) + self.get_widget('txt_conf_sample').set_text(str(_me.get_param('Sample'))) def updates_specifics(self): @@ -128,7 +128,6 @@ self.gadget_viewer.append_column(self.time_column) self.gadget_viewer.append_column(self.notified_column) self.gadget_viewer.append_column(self.behavior_column) - #self.gadget_viewer.set_reorderable(True) self.get_widget("scrolledwindow1").add(self.gadget_viewer) self.get_widget("scrolledwindow1").set_size_request(0, 150) self.get_widget("scrolledwindow1").show_all() @@ -137,25 +136,25 @@ self.get_widget('txt_conf_time').set_text('0.1') self.gadget_viewer.connect("row_activated", self.on_row_selected) self.measure.event_tab = _me.get_param('config') - self.get_widget('cbb_conf_event').append_text(_me.string('conf_lblChange')) + 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) + self.get_widget('cbb_conf_event').set_active(0) for i in range(len(self.measure.event_tab)): self.add_row(i) - self.get_widget("lbl_conf_event").set_text(_me.string('conf_lblEvent')) - self.get_widget("lbl_conf_type").set_text(_me.string('conf_lblType')) - self.get_widget("lbl_conf_value").set_text(_me.string('conf_lblValue')) - self.get_widget("lbl_conf_time").set_text(_me.string('conf_lblTime')) - self.get_widget("lbl_conf_notified").set_text(_me.string('conf_lblNotified')) - self.get_widget("lbl_conf_behavior").set_text(_me.string('conf_lblBehavior')) - 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("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')) + self.get_widget("lbl_conf_event").set_text(_me.string('conf_lblEvent')) + self.get_widget("lbl_conf_type").set_text(_me.string('conf_lblType')) + self.get_widget("lbl_conf_value").set_text(_me.string('conf_lblValue')) + self.get_widget("lbl_conf_time").set_text(_me.string('conf_lblTime')) + self.get_widget("lbl_conf_notified").set_text(_me.string('conf_lblNotified')) + self.get_widget("lbl_conf_behavior").set_text(_me.string('conf_lblBehavior')) + 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("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')) 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-01 14:34:44 UTC (rev 564) +++ software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/GUI/widget/other.pyp 2007-10-02 10:08:22 UTC (rev 565) @@ -1,11 +1,7 @@ bindtextdomain("params", "") sys.path.append(_me.get_path('root') + '/Scripts/Python') -try: - from lightGraph_class import lightGraph -except: - print sys.exc_info() +from lightGraph_class import lightGraph - class Window(SimpleGladeApp): def __init__(self, @@ -13,7 +9,12 @@ root="window1", domain="params", **kwargs): SimpleGladeApp.__init__(self, path, root, domain, **kwargs) - + + ########################################################### + # + # Display the new window + # + ########################################################### def new(self): #Fill the text box with the previous values self.get_widget("valDrop_percent").set_text(str(_me.get_param('drop'))) @@ -62,50 +63,51 @@ thread.start_new_thread(self.update, ()) - def on_window1_destroy(self, widget, *args): - _me.get_param('measure').GUI_on = False - self.light_measure.GUI_on = False - #tux.monitoring.remove(self.monitor_id) - - def on_btnApply_clicked(self, widget, *args): - #Store the new values - _me.set_param('drop', self.get_widget('valDrop_percent').get_text()) - _me.set_param('raise', self.get_widget('valRaise_percent').get_text()) - _me.set_param('changeD', self.get_widget('valChangeD_percent').get_text()) - _me.set_param('changeU', self.get_widget('valChangeU_percent').get_text()) - _me.set_param('drop_time', self.get_widget('valDrop_time').get_text()) - _me.set_param('raise_time', self.get_widget('valRaise_time').get_text()) - _me.set_param('changeD_time', self.get_widget('valChangeD_time').get_text()) - _me.set_param('changeU_time', self.get_widget('valChangeU_time').get_text()) - _me.set_param('threshold', self.get_widget('valThreshold').get_text()) - _me.set_param('Rate', self.get_widget('txtRate').get_text()) - _me.set_param('Sample', self.get_widget('txtSample').get_text()) + ########################################################### + # + # Update the values + # + ########################################################### + def update_value(self): + #Rate + _me.set_param('Rate', self.light_measure.rate) + self.get_widget("txtRate").set_text(str(_me.get_param('Rate'))) - #Store the new radio buttons status - _me.set_param('drop_rad', self.get_widget('radDrop').get_active()) - _me.set_param('raise_rad', self.get_widget('radRaise').get_active()) - _me.set_param('changeD_rad', self.get_widget('radChangeD').get_active()) - _me.set_param('changeU_rad', self.get_widget('radChangeU').get_active()) - _me.set_param('increase_rad', self.get_widget('radIncrease').get_active()) - _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()) + #Sample + _me.set_param('Sample', self.light_measure.sample) + self.get_widget("txtSample").set_text(str(_me.get_param('Sample'))) - #Update value for the current graphic - self.update_value() - - def update_value(self): - #update the values - self.light_measure.val_drop = float(_me.get_param('drop')) - self.light_measure.val_raise = float(_me.get_param('raise')) - self.light_measure.val_changeD = float(_me.get_param('changeD')) - self.light_measure.val_changeU = float(_me.get_param('changeU')) - self.light_measure.val_drop_time = float(_me.get_param('drop_time')) - self.light_measure.val_raise_time = float(_me.get_param('raise_time')) - self.light_measure.val_changeD_time = float(_me.get_param('changeD_time')) - self.light_measure.val_changeU_time = float(_me.get_param('changeU_time')) - self.light_measure.val_threshold = float(_me.get_param('threshold')) + self.light_measure.change_control() + #Drop + _me.set_param('drop', self.light_measure.val_drop) + self.get_widget("valDrop_percent").set_text(str(_me.get_param('drop'))) + _me.set_param('drop_time', self.light_measure.val_drop_time) + self.get_widget("valDrop_time").set_text(str(_me.get_param('drop_time'))) + + #Raise + _me.set_param('raise', self.light_measure.val_raise) + self.get_widget("valRaise_percent").set_text(str(_me.get_param('raise'))) + _me.set_param('raise_time', self.light_measure.val_raise_time) + self.get_widget("valRaise_time").set_text(str(_me.get_param('raise_time'))) + + #Drop and raise + _me.set_param('changeD', self.light_measure.val_changeD) + self.get_widget("valChangeD_percent").set_text(str(_me.get_param('changeD'))) + _me.set_param('changeD_time', self.light_measure.val_changeD_time) + self.get_widget("valChangeD_time").set_text(str(_me.get_param('changeD_time'))) + + #Raise and drop + _me.set_param('changeU', self.light_measure.val_changeU) + self.get_widget("valChangeU_percent").set_text(str(_me.get_param('changeU'))) + _me.set_param('changeU_time', self.light_measure.val_changeU_time) + self.get_widget("valChangeU_time").set_text(str(_me.get_param('changeU_time'))) + + #Threshold + _me.set_param('threshold', self.light_measure.val_threshold) + 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') @@ -117,20 +119,58 @@ self.light_measure.changetext = _me.string('conf_lblChange') self.light_measure.thresholdtext = _me.string('conf_lblThreshold') - # '' the check boxes self.light_measure.threshold_chk = _me.get_param('threshold_chk') - # update the sample and rate values - if _me.get_param('Rate') != (0.0 or None or '') and float(_me.get_param('Rate')) != self.light_measure.rate: + + + + + ########################################################### + # + # Event functions + # + ########################################################### + def on_window1_destroy(self, widget, *args): + _me.get_param('measure').GUI_on = False + self.light_measure.GUI_on = False + + def on_btnApply_clicked(self, widget, *args): + #Store the new radio buttons status + _me.set_param('drop_rad', self.get_widget('radDrop').get_active()) + _me.set_param('raise_rad', self.get_widget('radRaise').get_active()) + _me.set_param('changeD_rad', self.get_widget('radChangeD').get_active()) + _me.set_param('changeU_rad', self.get_widget('radChangeU').get_active()) + _me.set_param('increase_rad', self.get_widget('radIncrease').get_active()) + _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()) + + #sample and rate param + if self.check_float_value(self.get_widget('txtRate').get_text(), 0.1, 36000) != self.light_measure.rate or self.check_float_value(self.get_widget('txtSample').get_text(), 1, 100000) != self.light_measure.sample: + self.light_measure.tick = 1 - self.light_measure.rate = float(_me.get_param('Rate')) - if _me.get_param('Sample') != (0 or None or '' or '1') and float(_me.get_param('Sample')) != self.light_measure.sample: - self.light_measure.val_table = [0] * (int(_me.get_param('Sample'))+1) - self.light_measure.sample = float(_me.get_param('Sample')) - - self.light_measure.change_control() - + self.light_measure.rate = self.check_float_value(self.get_widget('txtRate').get_text(), 0.1, 36000) + self.light_measure.sample = self.check_float_value(self.get_widget('txtSample').get_text(), 1, 100000) + self.light_measure.val_table = [0] * (int(self.light_measure.sample)+1) + + + + max_time = self.light_measure.rate * self.light_measure.sample + + self.light_measure.val_drop = self.check_float_value(self.get_widget('valDrop_percent').get_text(), 1, 100) + self.light_measure.val_drop_time = self.check_float_value(self.get_widget('valDrop_time').get_text(), self.light_measure.rate, max_time) + self.light_measure.val_raise = self.check_float_value(self.get_widget('valRaise_percent').get_text(), 1, 100) + self.light_measure.val_raise_time = self.check_float_value(self.get_widget('valRaise_time').get_text(), self.light_measure.rate, max_time) + self.light_measure.val_changeD = self.check_float_value(self.get_widget('valChangeD_percent').get_text(), 1, 100) + self.light_measure.val_changeD_time = self.check_float_value(self.get_widget('valChangeD_time').get_text(), self.light_measure.rate, max_time) + self.light_measure.val_changeU = self.check_float_value(self.get_widget('valChangeU_percent').get_text(), 1, 100) + self.light_measure.val_changeU_time = self.check_float_value(self.get_widget('valChangeU_time').get_text(), self.light_measure.rate, max_time) + self.light_measure.val_threshold = self.check_float_value(self.get_widget('valThreshold').get_text(), 0, 100) + + #Update values + self.update_value() + def on_threshold_selection_changed(self, widget, *args): filename = widget.get_filename() print filename @@ -142,7 +182,26 @@ _me.set_param('behavior_file_change', filename) _me.get_param('measure').change_behavior = _me.get_param('behavior_file_change') + + ########################################################### + # + # Value integrity control + # + ########################################################### + def check_float_value(self, value, minimum, maximum): + try: + print value + value = float(value) + except: + print 'value error' + value = float(minimum) + if value < float(minimum): + value = float(minimum) + elif value > float(maximum): + value = float(maximum) + return value + def update(self): self.light_graph = lightGraph() _me.set_param('graph', self.light_graph) @@ -151,9 +210,9 @@ _me.get_param('measure').light_graph_measure = self.light_graph _me.get_param('graph').light_measure_graph = self.light_measure _me.get_param('measure').GUI_on = True + self.update_value() self.light_graph.set_size_request(600, 300) gtk.gdk.threads_enter() - self.update_value() layout = self.get_widget('vbox2') layout.add(self.light_graph) layout.show_all() 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-01 14:34:44 UTC (rev 564) +++ software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/lightGraph_class.py 2007-10-02 10:08:22 UTC (rev 565) @@ -136,81 +136,24 @@ # Events control # ########################################################### - def event_control(self): for i in range (len(self.event_tab)): - if self.event_tab[i][1] == 1: - if self.event_tab[i][7] == False: - - if self.event_tab[i][2] == 0: - #Increasing threshold control - if self.Increase_control(self.event_tab[i][3]) == True: - self.event_tab[i][7] = True - - elif self.event_tab[i][2] == 1: - #Decreasing threshold control - if self.Decrease_control(self.event_tab[i][3]) == True: - self.event_tab[i][7] = True - - elif self.event_tab[i][2] == 2: - #Both direction theshold control - if self.Both_control(self.event_tab[i][3]) == True: - self.event_tab[i][7] = True + self.Threshold_control(i) + self.Change_control(i) - #Changements control - else: - 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] == False: - # Drop change part : - if self.event_tab[i][2] == 0: - if self.Drop_control(time, self.event_tab[i][3], self.event_tab[i][8], i) == True: - self.event_tab[i][7] = True - # Raise change part - if self.event_tab[i][2] == 1: - if self.Raise_control(time, self.event_tab[i][3], self.event_tab[i][8], i) == True: - self.event_tab[i][7] = True - # Drop and Raise change - if self.event_tab[i][2] == 2: - if self.ChangeD_control(time, self.event_tab[i][3], self.event_tab[i][8], i) == True: - self.event_tab[i][7] = True - # Raise and Drop change - if self.event_tab[i][2] == 3: - if self.ChangeU_control(time, self.event_tab[i][3], self.event_tab[i][8], i) == True: - self.event_tab[i][7] = True - #Gadget or test notifications if self.GUI_on: - #Decrease threshold control - if self.decrease: - self.threshold_event = self.Decrease_control(self.val_threshold) - #Increasing threshold control - if self.increase: - self.threshold_event = self.Increase_control(self.val_threshold) - #Both direction theshold control - if self.both: - self.threshold_event = self.Both_control(self.val_threshold) - - #Changements control - if self.change_event != True: - # Drop change part : - if self.drop == True and self.val_drop_time > 0.0: - self.change_event = self.Drop_control(self.val_drop_time, self.val_drop, self.timeout, 0) - # Raise change part - if self.raising == True and self.val_raise_time > 0.0: - self.change_event = self.Raise_control(self.val_raise_time, self.val_raise, self.timeout, 0) - # Drop and Raise change - if self.changeD == True and self.val_changeD_time > 0.0: - self.change_event = self.ChangeD_control(self.val_changeD_time, self.val_changeD, self.timeout, 0) - # Raise and Drop change - if self.changeU == True and self.val_changeU_time > 0.0: - self.change_event = self.ChangeU_control(self.val_changeU_time, self.val_changeU, self.timeout, 0) - + self.test_func() #disable gadget notifications self.notify = False - #goto test notification - self.test_notification() - + + #goto test notification every sec. + if self.wait == 0: + self.wait = 10 + self.test_notification() + else: + self.wait -= 1 + # To prevent notifications at startup if self.start_flag == True: self.change_event = False @@ -224,17 +167,13 @@ pts_per_sec = self.sample / (self.rate * self.sample) self.timeout = 0 if self.val_drop_time >= 0.1 and self.val_drop > 0: - self.val_drop_time = (self.val_drop_time * pts_per_sec) - self.timeout = int(self.val_drop_time) + self.val_drop_time = int(self.val_drop_time * pts_per_sec) if self.val_raise_time >= 0.1 and self.val_raise > 0: - self.val_raise_time = self.val_raise_time * pts_per_sec - self.timeout = int(self.val_raise_time) + self.val_raise_time = int(self.val_raise_time * pts_per_sec) if self.val_changeD_time >= 0.1 and self.val_changeD > 0: - self.val_changeD_time = self.val_changeD_time * pts_per_sec - self.timeout = int(self.val_changeD_time) + self.val_changeD_time = int(self.val_changeD_time * pts_per_sec) if self.val_changeU_time >= 0.1 and self.val_changeU > 0: - self.val_changeU_time = self.val_changeU_time * pts_per_sec - self.timeout = int(self.val_changeU_time) + self.val_changeU_time = int(self.val_changeU_time * pts_per_sec) ########################################################### @@ -242,6 +181,22 @@ # Threshold control # ########################################################### + def Threshold_control(self, index): + if self.event_tab[index][1] == 1: + if self.event_tab[index][7] != True: + if self.event_tab[index][2] == 0: + #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: + #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: + #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): 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 @@ -267,10 +222,33 @@ # Changes control # ########################################################### + def Change_control(self, i): + #Changements control + if self.event_tab[i][1] == 0: + 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: + if self.Drop_control(time, self.event_tab[i][3], self.event_tab[i][8], i) == True: + self.event_tab[i][7] = True + # Raise change part + if self.event_tab[i][2] == 1: + if self.Raise_control(time, self.event_tab[i][3], self.event_tab[i][8], i) == True: + self.event_tab[i][7] = True + # Drop and Raise change + if self.event_tab[i][2] == 2: + if self.ChangeD_control(time, self.event_tab[i][3], self.event_tab[i][8], i) == True: + self.event_tab[i][7] = True + # Raise and Drop change + if self.event_tab[i][2] == 3: + if self.ChangeU_control(time, self.event_tab[i][3], self.event_tab[i][8], i) == True: + self.event_tab[i][7] = True + def Drop_control(self, time, val, timeout, index): #timeout control : to prevent multiple notifications with the same event if timeout != 0: - timeout -= 1 + timeout -= 1 init_val = len(self.val_table) - 1 - int(time) + timeout maximum = max(self.val_table[init_val:len(self.val_table)-1]) if maximum >= self.val_table[len(self.val_table)-1] + ((val/100)*1124): @@ -279,6 +257,8 @@ else: self.timeout = int(time) return True + elif self.GUI_on: + self.timeout = timeout def Raise_control(self, time, val, timeout, index): if timeout != 0: @@ -291,6 +271,8 @@ else: self.timeout = int(time) return True + elif self.GUI_on: + self.timeout = timeout def ChangeD_control(self, time, val, timeout, index): if timeout != 0: @@ -306,8 +288,9 @@ else: self.timeout = int(time) return True - - + if self.GUI_on: + self.timeout = timeout + def ChangeU_control(self, time, val, timeout, index): if timeout != 0: timeout -= 1 @@ -321,36 +304,62 @@ else: self.timeout = int(time) return True - + if self.GUI_on: + self.timeout = timeout + ########################################################### # - # Test notifications + # Test functions # ########################################################### + def test_func(self): + if self.threshold_event != True: + #Decrease threshold control + if self.decrease: + self.threshold_event = self.Decrease_control(self.val_threshold) + #Increasing threshold control + if self.increase: + self.threshold_event = self.Increase_control(self.val_threshold) + #Both direction theshold control + if self.both: + self.threshold_event = self.Both_control(self.val_threshold) + + #Changements control + if self.change_event != True: + # Drop change part : + if self.drop == True and self.val_drop_time > 0.0: + self.change_event = self.Drop_control(self.val_drop_time, self.val_drop, self.timeout, 0) + # Raise change part + if self.raising == True and self.val_raise_time > 0.0: + self.change_event = self.Raise_control(self.val_raise_time, self.val_raise, self.timeout, 0) + # Drop and Raise change + if self.changeD == True and self.val_changeD_time > 0.0: + self.change_event = self.ChangeD_control(self.val_changeD_time, self.val_changeD, self.timeout, 0) + # Raise and Drop change + if self.changeU == True and self.val_changeU_time > 0.0: + self.change_event = self.ChangeU_control(self.val_changeU_time, self.val_changeU, self.timeout, 0) + + def test_notification(self): - #if self.wait != 0: - # self.wait -= 1 if self.threshold_event == True: - if os.path.exists(self.threshold_behavior): - if os.path.isfile(self.threshold_behavior): - self.threshold_event = False - tux.sys.shell_free(self.threshold_behavior) - else: - self.threshold_event = False - tux.cmd.mouth_open() - tux.tts.speak(self.thresholdtext) - tux.cmd.mouth_close() - + if os.path.isfile(self.threshold_behavior): + self.threshold_event = False + tux.sys.shell_free(self.threshold_behavior) + else: + self.threshold_event = False + tux.cmd.mouth_open() + tux.tts.speak(self.thresholdtext) + tux.cmd.mouth_close() + elif self.change_event == True: - if os.path.exists(self.change_behavior): - if os.path.isfile(self.change_behavior): - self.change_event = False - tux.sys.shell_free(self.change_behavior) - else: - self.change_event = False - tux.cmd.mouth_open() - tux.tts.speak(self.changetext) - tux.cmd.mouth_close() + if os.path.isfile(self.change_behavior): + self.change_event = False + tux.sys.shell_free(self.change_behavior) + else: + self.change_event = False + tux.cmd.mouth_open() + tux.tts.speak(self.changetext) + tux.cmd.mouth_close() ########################################################### # 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-01 14:34:44 UTC (rev 564) +++ software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/notify.pyp 2007-10-02 10:08:22 UTC (rev 565) @@ -5,8 +5,8 @@ temp = measure.event_tab[i][7] if temp == True: return True - else: - return False + else: + return False @@ -43,5 +43,6 @@ event[i][7] = False else: event[i][7] = False + print 'notification done' break Modified: software/gadgets/light_monitor/trunk/Light_monitor/about.xml =================================================================== --- software/gadgets/light_monitor/trunk/Light_monitor/about.xml 2007-10-01 14:34:44 UTC (rev 564) +++ software/gadgets/light_monitor/trunk/Light_monitor/about.xml 2007-10-02 10:08:22 UTC (rev 565) @@ -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_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> </about> Modified: software/gadgets/light_monitor/trunk/Light_monitor/settings.xml =================================================================== --- software/gadgets/light_monitor/trunk/Light_monitor/settings.xml 2007-10-01 14:34:44 UTC (rev 564) +++ software/gadgets/light_monitor/trunk/Light_monitor/settings.xml 2007-10-02 10:08:22 UTC (rev 565) @@ -1,27 +1,27 @@ <?xml version='1.0' encoding='UTF-8'?> <settings> <parameters> - <drop type='str'>10</drop> + <drop type='float'>10.0</drop> <increase_rad type='bool'>True</increase_rad> - <changeU_time type='str'>1</changeU_time> + <changeU_time type='float'>1.0</changeU_time> <changeD_rad type='bool'>False</changeD_rad> - <threshold type='str'>50</threshold> + <threshold type='float'>50.0</threshold> <decrease_rad type='bool'>False</decrease_rad> <behavior_file_threshold type='str'>/home/</behavior_file_threshold> - <raise type='str'>10</raise> + <raise type='float'>10.0</raise> <changeU_rad type='bool'>False</changeU_rad> <config type='list'>[]</config> <behavior_file_change type='str'>/home/</behavior_file_change> <raise_rad type='bool'>False</raise_rad> - <changeD type='str'>10</changeD> - <drop_time type='str'>1</drop_time> - <changeU type='str'>10</changeU> - <raise_time type='str'>1</raise_time> + <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_rad type='bool'>True</drop_rad> - <Sample type='str'>500</Sample> + <Sample type='str'>500.0</Sample> <threshold_chk type='bool'>False</threshold_chk> <Rate type='str'>0.1</Rate> - <changeD_time type='str'>1</changeD_time> + <changeD_time type='float'>1.0</changeD_time> <both_rad type='bool'>False</both_rad> </parameters> <general> Modified: software/gadgets/light_monitor/trunk/Light_monitor.tgf =================================================================== (Binary files differ) |