[tuxdroid-svn] r634 - 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-18 14:41:04
|
Author: Paul_R Date: 2007-10-18 16:41:03 +0200 (Thu, 18 Oct 2007) New Revision: 634 Modified: software/gadgets/light_monitor/trunk/Light_monitor.tgf 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/main.pyp software/gadgets/light_monitor/trunk/Light_monitor/Strings/fr_ALL.xml software/gadgets/light_monitor/trunk/Light_monitor/about.xml software/gadgets/light_monitor/trunk/Light_monitor/strings.xml Log: * Fix a bug which crash the gadget with python < 2.5: 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-18 13:50:51 UTC (rev 633) +++ software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/GUI/widget/other.pyp 2007-10-18 14:41:03 UTC (rev 634) @@ -1,6 +1,9 @@ bindtextdomain("params", "") -sys.path.append(_me.get_path('root') + '/Scripts/Python') -from lightGraph_class import lightGraph +try: + sys.path.append(_me.get_path('root') + '/Scripts/Python') + from lightGraph_class import lightGraph +except: + print sys.exc_info() class Window(SimpleGladeApp): @@ -108,7 +111,7 @@ self.light_measure.val_table = [0] * int(self.light_measure.sample+1) self.light_measure.light_search = True self.light_measure.light_value = 3000 - self.light_measure.search_event = [_me.string('light1'), _me.string('light2'), _me.string('light3'),_me.string('light4')] + self.light_measure.search_event = [_me.string('light1'), _me.string('light2'), _me.string('light3'),_me.string('light4'), _me.string('light5')] print self.light_measure.search_event self.config_light_search() @@ -117,7 +120,7 @@ self.light_measure.val_table = [-1] * int(self.light_measure.sample+1) self.light_measure.light_search = False self.light_measure.light_value = 0 - self.light_measure.search_event = [_me.string('dark1'), _me.string('dark2'), _me.string('dark3'),_me.string('dark4')] + self.light_measure.search_event = [_me.string('dark1'), _me.string('dark2'), _me.string('dark3'),_me.string('dark4'), _me.string('dark5')] self.config_light_search() def config_light_search(self): 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-18 13:50:51 UTC (rev 633) +++ software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/lightGraph_class.py 2007-10-18 14:41:03 UTC (rev 634) @@ -1,11 +1,15 @@ -import gtk import sys -import time -import os -import threading -import thread -sys.path.append('/opt/tuxdroid/api/python') -from tux import * +try: + import cairo + import gtk + import time + import os + import threading + import thread + sys.path.append('/opt/tuxdroid/api/python') + from tux import * +except: + print sys.exc_info() class lightGraph(gtk.DrawingArea): def __init__(self): @@ -157,7 +161,7 @@ self.context.move_to(x, y) self.context.set_source_rgb(1, 0, 0) -class lightMeasure(): +class lightMeasure(object): def __init__(self): #Initial value self.sample = 500.0 @@ -172,7 +176,7 @@ self.event = 0 self.txtsearch = ' ' self.search_event = [] - + self.__fault = False self.GUI_on = False self.start_flag = True @@ -465,6 +469,7 @@ ########################################################### 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 @@ -492,6 +497,11 @@ self.test_default_behavior(self.search_event[3]) self.search_light_flag = False self.light_search_state = 0 + + if self.__fault: + self.test_default_behavior(self.search_event[4]) + self.search_light_flag = False + self.light_search_state = 0 def timer_control(self): self.timer -= 1 @@ -503,8 +513,10 @@ self.test_default_behavior(self.search_event[1]) if self.count == 70: self.test_default_behavior(self.search_event[2]) + if self.count == 600: + self.__fault = True + - if self.timer > 2: return True Modified: software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/main.pyp =================================================================== --- software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/main.pyp 2007-10-18 13:50:51 UTC (rev 633) +++ software/gadgets/light_monitor/trunk/Light_monitor/Scripts/Python/main.pyp 2007-10-18 14:41:03 UTC (rev 634) @@ -17,7 +17,7 @@ measure.light_search_state = 0 measure.timer = 0 measure.count = 0 - measure.search_event = [_me.string('light1'), _me.string('light2'), _me.string('light3'),_me.string('light4')] + measure.search_event = [_me.string('light1'), _me.string('light2'), _me.string('light3'),_me.string('light4'),_me.string('light5')] tux.cmd.spinl_on_free(8, 1) count = 0 while measure.search_light_flag: Modified: software/gadgets/light_monitor/trunk/Light_monitor/Strings/fr_ALL.xml =================================================================== --- software/gadgets/light_monitor/trunk/Light_monitor/Strings/fr_ALL.xml 2007-10-18 13:50:51 UTC (rev 633) +++ software/gadgets/light_monitor/trunk/Light_monitor/Strings/fr_ALL.xml 2007-10-18 14:41:03 UTC (rev 634) @@ -3,7 +3,6 @@ <conf_lblIncrease type='str'>Augmente</conf_lblIncrease> <conf_lblThreshold type='str'>Seuil</conf_lblThreshold> <gui_conf_remote_title type='str'>Contrôle</gui_conf_remote_title> - <dark3 type='str'>hmm, il fait toujours plus sombre ...</dark3> <conf_lblRaise type='str'>Accroissement</conf_lblRaise> <widget_lblTest type='str'>Notifications</widget_lblTest> <gui_conf_description_lb type='str'>Description</gui_conf_description_lb> @@ -18,7 +17,6 @@ <conf_lblChange type='str'>Changement</conf_lblChange> <conf_lblBoth type='str'>Deux directions</conf_lblBoth> <widget_lblBtnApply type='str'>Appliquer</widget_lblBtnApply> - <dark4 type='str'>C'est l'endroit le plus sombre !</dark4> <widget_lblChangeU type='str'>Changement sup.</widget_lblChangeU> <conf_lblDecrease type='str'>Diminue</conf_lblDecrease> <gui_conf_version_lb type='str'>Version</gui_conf_version_lb> @@ -27,10 +25,10 @@ <gui_conf_cancel_bt type='str'>Annuler</gui_conf_cancel_bt> <MainBehavior type='str'>Comportement principal</MainBehavior> <gui_conf_rate_lb type='str'>Taux de rafraichissement :</gui_conf_rate_lb> + <Threshold type='str'>La lumière a atteint le seuil</Threshold> <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> - <conf_lblNotNotified type='str'>Non notifié</conf_lblNotNotified> <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> @@ -41,21 +39,24 @@ <Change type='str'>La lumière a changé</Change> <Both type='str'>La lumière a passé le seuil</Both> <conf_btnModify type='str'>Modifier</conf_btnModify> - <widget_lblEvent type='str'>Evènement</widget_lblEvent> + <widget_lblDrop type='str'>Chute</widget_lblDrop> <widget_lblNotified type='str'>Notifé</widget_lblNotified> <dark1 type='str'>Il fait sombre ici !</dark1> <widget_lblIncrease type='str'>Accroissement</widget_lblIncrease> - <widget_lblRaise type='str'>Augmentation</widget_lblRaise> + <dark3 type='str'>hmm, il fait toujours plus sombre ...</dark3> <conf_btnAdd type='str'>Ajouter</conf_btnAdd> + <dark5 type='str'>Je ne peux pas trouver l'endroit le plus sombre ...</dark5> + <dark4 type='str'>C'est l'endroit le plus sombre !</dark4> + <gui_conf_sample_lb type='str'>Nombre de points :</gui_conf_sample_lb> <widget_lblDecrease type='str'>Decroissance</widget_lblDecrease> - <gui_conf_sample_lb type='str'>Nombre de points :</gui_conf_sample_lb> - <gui_conf_current_bind_lb type='str'>Assignation</gui_conf_current_bind_lb> + <widget_lblEvent type='str'>Evènement</widget_lblEvent> <conf_lblNotifiedBehavior type='str'>Notifié</conf_lblNotifiedBehavior> <light2 type='str'>J'en vois encore plus ici !</light2> <gui_conf_author_lb type='str'>Auteur</gui_conf_author_lb> - <widget_lblDrop type='str'>Chute</widget_lblDrop> - <ChangeD type='str'>La lumière a chuté puis augmenté</ChangeD> + <widget_lblRaise type='str'>Augmentation</widget_lblRaise> + <gui_conf_window_title type='str'>Paramètres</gui_conf_window_title> <widget_lblBoth type='str'>Deux directions</widget_lblBoth> + <gui_conf_current_bind_lb type='str'>Assignation</gui_conf_current_bind_lb> <conf_lblDefaultBehavior type='str'>Comportement pas défaut</conf_lblDefaultBehavior> <widget_lblDisplayThreshold type='str'>Afficher le seuil sur le graph.</widget_lblDisplayThreshold> <conf_lblBehavior type='str'>Comportement</conf_lblBehavior> @@ -65,11 +66,12 @@ <widget_lblChange type='str'>Changement</widget_lblChange> <widget_lblLight type='str'>Trouver lumière</widget_lblLight> <name_to_read type='str'>Moniteur de lumière</name_to_read> - <gui_conf_window_title type='str'>Paramètres</gui_conf_window_title> + <conf_lblNotNotified type='str'>Non notifié</conf_lblNotNotified> <Drop type='str'>La lumière a chuté</Drop> <conf_lblDrop type='str'>Chute</conf_lblDrop> - <widget_lblBehavior type='str'>Activer le script</widget_lblBehavior> + <ChangeD type='str'>La lumière a chuté puis augmenté</ChangeD> <Raise type='str'>La lumière a augmenté</Raise> + <widget_lblThreshold type='str'>Seuil</widget_lblThreshold> <conf_lblNotified type='str'>Notifié ?</conf_lblNotified> <widget_lblSet type='str'>Ajouter a la config.</widget_lblSet> <light3 type='str'>ou ici ?</light3> @@ -78,10 +80,10 @@ <conf_lblValue type='str'>Valeur (%)</conf_lblValue> <light4 type='str'>Je pense que la lumière vient de cette direction</light4> <conf_lblRate type='str'>Taux de rafraichissement</conf_lblRate> - <Threshold type='str'>La lumière a atteint le seuil</Threshold> + <widget_lblBehavior type='str'>Activer le script</widget_lblBehavior> <widget_lblChangeD type='str'>Changement inf.</widget_lblChangeD> <conf_lblTime type='str'>Temps (sec.)</conf_lblTime> <conf_lblControl type='str'>Contrôle</conf_lblControl> <widget_lblDark type='str'>Trouver ombre</widget_lblDark> - <widget_lblThreshold type='str'>Seuil</widget_lblThreshold> + <light5 type='str'>Je ne peux pas trouver d'où vient la lumière...</light5> </strings> Modified: software/gadgets/light_monitor/trunk/Light_monitor/about.xml =================================================================== --- software/gadgets/light_monitor/trunk/Light_monitor/about.xml 2007-10-18 13:50:51 UTC (rev 633) +++ software/gadgets/light_monitor/trunk/Light_monitor/about.xml 2007-10-18 14:41:03 UTC (rev 634) @@ -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/strings.xml =================================================================== --- software/gadgets/light_monitor/trunk/Light_monitor/strings.xml 2007-10-18 13:50:51 UTC (rev 633) +++ software/gadgets/light_monitor/trunk/Light_monitor/strings.xml 2007-10-18 14:41:03 UTC (rev 634) @@ -18,7 +18,7 @@ <conf_lblChange type='str'>Change</conf_lblChange> <conf_lblBoth type='str'>Both</conf_lblBoth> <widget_lblBtnApply type='str'>Apply changes</widget_lblBtnApply> - <dark4 type='str'>This is the darkest spot.</dark4> + <conf_lblRate type='str'>Refresh rate</conf_lblRate> <widget_lblChangeU type='str'>Raise and drop</widget_lblChangeU> <conf_lblDecrease type='str'>Decrease</conf_lblDecrease> <gui_conf_version_lb type='str'>Version</gui_conf_version_lb> @@ -26,9 +26,10 @@ <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> + <Threshold type='str'>The light reached the threshold</Threshold> <mainscript type='str'>I've found the light !</mainscript> - <dark3 type='str'>hmm, but it's even more dark over here!</dark3> <gui_conf_delay_lb type='str'>Delay (sec)</gui_conf_delay_lb> + <widget_lblDrop type='str'>Drop</widget_lblDrop> <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> @@ -45,18 +46,19 @@ <widget_lblNotified type='str'>Notified</widget_lblNotified> <dark1 type='str'>It's pretty dark here.</dark1> <widget_lblIncrease type='str'>Increasing</widget_lblIncrease> - <widget_lblRaise type='str'>Raise</widget_lblRaise> + <dark3 type='str'>hmm, but it's even more dark over here!</dark3> <conf_btnAdd type='str'>Add</conf_btnAdd> + <dark5 type='str'>I can't find the darkest spot...</dark5> + <dark4 type='str'>This is the darkest spot.</dark4> + <gui_conf_sample_lb type='str'>Sample :</gui_conf_sample_lb> <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> - <widget_lblBehavior type='str'>Enable behavior script</widget_lblBehavior> <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> + <widget_lblRaise type='str'>Raise</widget_lblRaise> <conf_lblNotified type='str'>Notified ?</conf_lblNotified> <gui_conf_window_title type='str'>Parameters</gui_conf_window_title> <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> <conf_lblChangeU type='str'>Raise and drop</conf_lblChangeU> <dark2 type='str'>And darker here.</dark2> @@ -77,8 +79,8 @@ <Decrease type='str'>The light level passed below the threshold</Decrease> <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> + <light5 type='str'>I can't find the direction of the light.</light5> + <widget_lblBehavior type='str'>Enable behavior script</widget_lblBehavior> <MainBehavior type='str'>Main behavior</MainBehavior> <ChangeU type='str'>The light level raised and dropped</ChangeU> <conf_lblControl type='str'>Control</conf_lblControl> Modified: software/gadgets/light_monitor/trunk/Light_monitor.tgf =================================================================== (Binary files differ) |