[tuxdroid-svn] r774 - in software/gadgets/sound_monitor/trunk: . audio_monitor audio_monitor/Script
Status: Beta
Brought to you by:
ks156
From: Paul_R <c2m...@c2...> - 2007-12-10 14:11:19
|
Author: Paul_R Date: 2007-12-10 15:11:11 +0100 (Mon, 10 Dec 2007) New Revision: 774 Added: software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/dialog/ software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/dialog/other.glade software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/dialog/other.pyp Modified: software/gadgets/sound_monitor/trunk/audio_monitor.tgf software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/conf/other.glade software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/other.pyp software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/main.pyp software/gadgets/sound_monitor/trunk/audio_monitor/Strings/fr_ALL.xml software/gadgets/sound_monitor/trunk/audio_monitor/about.xml software/gadgets/sound_monitor/trunk/audio_monitor/settings.xml software/gadgets/sound_monitor/trunk/audio_monitor/strings.xml Log: * Added popup when the gadget start and stop * Changed some strings * Change the graduation in the graph * Minor changes in the conf GUI Modified: software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/conf/other.glade =================================================================== (Binary files differ) Added: software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/dialog/other.glade =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/dialog/other.glade (rev 0) +++ software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/dialog/other.glade 2007-12-10 14:11:11 UTC (rev 774) @@ -0,0 +1,117 @@ +<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> +<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> + +<glade-interface> + +<widget class="GtkDialog" id="window1"> + <property name="visible">True</property> + <property name="title" translatable="yes">dialog1</property> + <property name="type">GTK_WINDOW_TOPLEVEL</property> + <property name="window_position">GTK_WIN_POS_NONE</property> + <property name="modal">False</property> + <property name="resizable">True</property> + <property name="destroy_with_parent">False</property> + <property name="decorated">True</property> + <property name="skip_taskbar_hint">False</property> + <property name="skip_pager_hint">False</property> + <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> + <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> + <property name="focus_on_map">True</property> + <property name="urgency_hint">False</property> + <property name="has_separator">True</property> + <signal name="destroy" handler="on_window1_destroy" last_modification_time="Mon, 10 Dec 2007 10:54:18 GMT"/> + + <child internal-child="vbox"> + <widget class="GtkVBox" id="dialog-vbox1"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child internal-child="action_area"> + <widget class="GtkHButtonBox" id="dialog-action_area1"> + <property name="visible">True</property> + <property name="layout_style">GTK_BUTTONBOX_END</property> + + <child> + <widget class="GtkButton" id="okbutton1"> + <property name="visible">True</property> + <property name="can_default">True</property> + <property name="can_focus">True</property> + <property name="label">gtk-ok</property> + <property name="use_stock">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="response_id">-5</property> + <signal name="clicked" handler="on_okbutton1_clicked" last_modification_time="Mon, 10 Dec 2007 11:12:39 GMT"/> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">GTK_PACK_END</property> + </packing> + </child> + + <child> + <widget class="GtkFixed" id="fixed1"> + <property name="visible">True</property> + + <child> + <widget class="GtkCheckButton" id="checkbutton1"> + <property name="width_request">272</property> + <property name="height_request">24</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">checkbutton1</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="x">16</property> + <property name="y">176</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label1"> + <property name="width_request">280</property> + <property name="height_request">168</property> + <property name="visible">True</property> + <property name="label" translatable="yes"></property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">True</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="x">8</property> + <property name="y">8</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + </child> +</widget> + +</glade-interface> Added: software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/dialog/other.pyp =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/dialog/other.pyp (rev 0) +++ software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/dialog/other.pyp 2007-12-10 14:11:11 UTC (rev 774) @@ -0,0 +1,18 @@ +bindtextdomain("params", "") + +class Window(SimpleGladeApp): + + def __init__(self, + path=_me.get_path('root') + '/Scripts/Python/GUI/dialog/other.glade', + root="window1", + domain="params", **kwargs): + SimpleGladeApp.__init__(self, path, root, domain, **kwargs) + + def new(self): + self.get_widget("window1").set_title(_me.string('name_to_read')) + self.get_widget('label1').set_label(_me.get_param('string')) + self.get_widget('checkbutton1').set_label(_me.get_param('check')) + + def on_okbutton1_clicked(self, widget, *args): + _me.set_param(_me.get_param('param'), self.get_widget('checkbutton1').get_active()) + self.get_widget('window1').destroy() Modified: software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/other.pyp =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/other.pyp 2007-12-10 09:02:04 UTC (rev 773) +++ software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/GUI/widget/other.pyp 2007-12-10 14:11:11 UTC (rev 774) @@ -23,6 +23,11 @@ ########################################################### def new(self): self.get_widget("window1").set_title(_me.string('name_to_read')) + if _me.get_param('Startup') == False: + _me.set_param('string', _me.string('Startup')) + _me.set_param('check', _me.string('Show')) + _me.set_param('param', 'Startup') + _me.gui('dialog').show_from_main() thread.start_new_thread(self.update, ()) @@ -45,12 +50,16 @@ self.get_widget('chkDogDefault').set_label(_me.string('at_gui_widget_chkDogDefault')) self.get_widget('chkDogDefault').set_active(_me.get_param('chkDogDefault')) - self.get_widget('spinDog').set_value(_me.get_param('DogThreshold')) + self.get_widget('spinDog').set_value(_me.get_param('Threshold')) + print _me.get_param('dogBehavior') + if os.path.exists(_me.get_param('dogBehavior')): + print _me.get_param('dogBehavior') + self.get_widget('fileDogBehavior').set_filename(_me.get_param('dogBehavior')) self.get_widget('chkSpy').set_label(_me.string('at_gui_widget_chkSpy')) self.get_widget('chkSpy').set_active(_me.get_param('chkSpy')) - self.get_widget('spinSpy').set_value(_me.get_param('SpyThreshold')) + self.get_widget('spinSpy').set_value(_me.get_param('Threshold')) self.get_widget('lblDogLevel').set_text(_me.string('at_gui_widget_lblDogLevel')) self.get_widget('lblSpyLevel').set_text(_me.string('at_gui_widget_lblSpyLevel')) @@ -155,7 +164,11 @@ # ########################################################### def on_window1_destroy(self, widget, *args): - pass + if _me.get_param('Standby') == False: + _me.set_param('string', _me.string('Standby')) + _me.set_param('check', _me.string('Show')) + _me.set_param('param', 'Standby') + _me.gui('dialog').show_from_main() def on_cbbType_changed(self, widget, *args): if self.get_widget('cbbType').get_active() == 0: @@ -166,12 +179,14 @@ self.get_widget('notebook').set_current_page(2) def on_spinbutton1_changed(self, widget, *args): - self.measure.dog_threshold = float(widget.get_text()) - _me.set_param('DogThreshold', float(widget.get_text())) + self.get_widget('spinSpy').set_value(float(widget.get_text())) + self.measure.threshold = float(widget.get_text()) + _me.set_param('Threshold', float(widget.get_text())) def on_spinbutton2_changed(self, widget, *args): - self.measure.spy_threshold = float(widget.get_text()) - _me.set_param('SpyThreshold', float(widget.get_text())) + self.get_widget('spinDog').set_value(float(widget.get_text())) + self.measure.threshold = float(widget.get_text()) + _me.set_param('Threshold', float(widget.get_text())) def on_chkSpy_toggled(self, widget, *args): _me.set_param('chkSpy', widget.get_active()) @@ -185,8 +200,9 @@ _me.set_param('chkDogDefault', widget.get_active()) def on_fileDogBehavior_selection_changed(self, widget, *args): - + print widget.get_filename() _me.set_param('dogBehavior', widget.get_filename()) + print _me.get_param('dogBehavior') class Sound_Graph(gtk.DrawingArea): def __init__(self): @@ -213,10 +229,8 @@ self.draw_space() self.draw_hor_div() self.draw_ver_div() - if self.measure.dog_enabled: - self.draw_threshold(self.measure.dog_threshold, 1) - if self.measure.spy_enabled: - self.draw_threshold(self.measure.spy_threshold, 2) + if self.measure.dog_enabled or self.measure.spy_enabled: + self.draw_threshold(self.measure.threshold, 1) self.draw_curve() def draw_space(self): @@ -250,9 +264,9 @@ self.context.line_to(0, y) self.context.set_source_rgb(0.15, 0.15, 0.15) if i > 10: - self.context.show_text('-'+str((i - 10.0)/10.0)) + self.context.show_text(str((i - 10.0)*10.0)) elif i < 10: - self.context.show_text(str((10.0 - i)/10.0)) + self.context.show_text(str((10.0 - i)*10.0)) else: self.context.show_text('0') self.context.stroke() @@ -359,11 +373,12 @@ self.val_table_pos = [0] * int(self.sample) self.event_table = [-1] * int(self.sample) - self.dog_threshold = 0 - self.spy_threshold = 0 + self.threshold = 0 self.dog_enabled = False self.spy_enabled = False self.RANGE = 1024.0 + self.__notify = False + self.__timer = time.time() self.notify = False self.actuator = False @@ -376,6 +391,7 @@ self.__start_delay = time.time() + 2 self.__capture_start = False self.__stop = False + self.__dog_stop = False self.__delay_to_stop = time.time() self.__write_mutex = threading.Lock() self.__capture_mutex = threading.Lock() @@ -390,15 +406,27 @@ # ########################################################### def event_control(self): - if self.spy_enabled and self.__capture_start == False and self.actuator == False: - if self.Increase_control(self.spy_threshold): - self.record_sound() + if self.__capture_start == False and self.actuator == False: + if self.Increase_control(self.threshold): + if self.spy_enabled: + self.record_sound() + if self.dog_enabled: + self.__timer = time.time() + 0.5 + self.__notify = True + self.actuator = True - if self.dog_enabled and self.actuator == False and self.__start_timeout == False: - if self.Increase_control(self.dog_threshold): + if self.__notify: + val_act = ((self.val_table_pos[len(self.val_table_pos)-1])*100) / (self.RANGE/2) + if val_act < self.threshold and self.__dog_stop == False: + self.__timer = time.time() + 0.1 + self.__dog_stop = True + elif val_act > self.threshold and self.__dog_stop == True: + self.__dog_stop = False + + if self.__timer <= time.time() and self.__dog_stop: + self.__notify = False self.notify = True - self.actuator = True - + if self.__start_timeout: if self.__start_delay < time.time(): self.__start_timeout = False @@ -429,7 +457,7 @@ if self.__capture_start: self.event_table.append(1) - elif self.actuator: + elif self.actuator and not self.__notify: self.event_table.append(2) else: self.event_table.append(-1) @@ -467,10 +495,10 @@ self.__capture_buffer.append(val) val_act = ((self.val_table_pos[len(self.val_table_pos)-1])*100) / (self.RANGE/2) - if val_act < self.spy_threshold and self.__stop == False: - self.__delay_to_stop = time.time() + 0.2 + if val_act < self.threshold and self.__stop == False: + self.__delay_to_stop = time.time() + 0.1 self.__stop = True - elif val_act > self.spy_threshold and self.__stop: + elif val_act > self.threshold and self.__stop: self.__stop = False if (time.time() >= self.__delay_to_stop) and self.__stop: Modified: software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/main.pyp =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/main.pyp 2007-12-10 09:02:04 UTC (rev 773) +++ software/gadgets/sound_monitor/trunk/audio_monitor/Scripts/Python/main.pyp 2007-12-10 14:11:11 UTC (rev 774) @@ -12,7 +12,9 @@ tux.event.on_remote_bt[K_STANDBY] = None tux.monitoring.remove(_me.get_param('monitor_id')) tux.micro.on_buffer.disconnect(_me.get_param('buffer_idx')) - + while _me.gui('dialog').showed(): + tux.sys.wait(0.5) + _me.gui('widget').hide_from_main() _me.exit_main_loop() @@ -24,9 +26,9 @@ if Gdgname != 'sound_monitor' and Gdgname != 'Manager': gdg_dict[Gdgname] = gadgets[Gdgname].get_var('notified') gadgets[Gdgname].notify.set_active(False) - + gadgets['sound_monitor'].notify.set_active(True) - + tux.cmd.mouth_open() _me.set_param('dict', gdg_dict) tux.event.on_remote_bt[K_STANDBY] = on_standby Modified: software/gadgets/sound_monitor/trunk/audio_monitor/Strings/fr_ALL.xml =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/Strings/fr_ALL.xml 2007-12-10 09:02:04 UTC (rev 773) +++ software/gadgets/sound_monitor/trunk/audio_monitor/Strings/fr_ALL.xml 2007-12-10 14:11:11 UTC (rev 774) @@ -3,7 +3,7 @@ <at_gui_widget_lblSpyLevel type='str'>Niveau</at_gui_widget_lblSpyLevel> <at_gui_widget_chkDog type='str'>Activer le mode chien de garde</at_gui_widget_chkDog> <at_gui_conf_label13 type='str'>Delay (sec) :</at_gui_conf_label13> - <at_gui_conf_label12 type='str'>Updates</at_gui_conf_label12> + <at_gui_conf_label12 type='str'>Configuration</at_gui_conf_label12> <help_text type='str'> </help_text> <vr_Sound type='str'>Sound</vr_Sound> @@ -11,6 +11,8 @@ <at_gui_widget_cbbDog type='str'>Chien de garde</at_gui_widget_cbbDog> <at_gui_conf_label6 type='str'>Cancel</at_gui_conf_label6> <at_gui_conf_label5 type='str'>Accept</at_gui_conf_label5> + <Standby type='str'>Ceci va mettre fin à l'exécution de ce gadget. Toutes les autres notifications vont être réactivées. +Plus aucun événement relatif au son seront notifiés.</Standby> <at_gui_widget_chkDogDefault type='str'>Utiliser un script :</at_gui_widget_chkDogDefault> <at_gui_widget_lblDogLevel type='str'>Niveau</at_gui_widget_lblDogLevel> <Time type='str'>Heure</Time> @@ -18,6 +20,8 @@ <speaker_name type='str'>Bruno8k</speaker_name> <at_gui_widget_cbbRecord type='str'>Sons enregistrés</at_gui_widget_cbbRecord> <name_to_read type='str'>Moniteur de son</name_to_read> + <Show type='str'>Don't show this message again</Show> + <Startup type='str'>Ce gadget a un système de notification exclusif. Tant que la fenêtre de ce gadget est ouverte, toutes les autres notifications sont désactivées.</Startup> <File type='str'>Fichier</File> <at_gui_widget_chkSpy type='str'>Activer le mode espion</at_gui_widget_chkSpy> <Duration type='str'>Durée</Duration> Modified: software/gadgets/sound_monitor/trunk/audio_monitor/about.xml =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/about.xml 2007-12-10 09:02:04 UTC (rev 773) +++ software/gadgets/sound_monitor/trunk/audio_monitor/about.xml 2007-12-10 14:11:11 UTC (rev 774) @@ -2,7 +2,7 @@ <about> <gadget_author type='str'>Paul Rathgeb</gadget_author> <gadget_version type='str'>0.0.1</gadget_version> + <gadget_name type='str'>sound_monitor</gadget_name> <gadget_description type='str'> </gadget_description> - <gadget_name type='str'>sound_monitor</gadget_name> </about> Modified: software/gadgets/sound_monitor/trunk/audio_monitor/settings.xml =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/settings.xml 2007-12-10 09:02:04 UTC (rev 773) +++ software/gadgets/sound_monitor/trunk/audio_monitor/settings.xml 2007-12-10 14:11:11 UTC (rev 774) @@ -1,24 +1,30 @@ <?xml version='1.0' encoding='UTF-8'?> <settings> <parameters> + <dogBehavior type='str'> + </dogBehavior> <Sample type='float'>400.0</Sample> <chkDogBehavior type='bool'>False</chkDogBehavior> <SpyThreshold type='int'>30</SpyThreshold> + <Standby type='bool'>False</Standby> <MainScript type='str'>None</MainScript> <chkSpy type='bool'>False</chkSpy> <chkDog type='bool'>True</chkDog> + <Threshold type='float'>30.0</Threshold> <chkSpyRecord type='bool'>False</chkSpyRecord> <chkDogDefault type='bool'>False</chkDogDefault> - <Path type='str'>None</Path> + <Path type='str'> + </Path> <DogThreshold type='int'>30</DogThreshold> + <Startup type='bool'>False</Startup> + <BehaviorPath type='str'> + </BehaviorPath> </parameters> <general> <have_settings_part type='bool'>True</have_settings_part> <gui_state> <widget> - <y type='int'>25</y> <visible type='bool'>True</visible> - <x type='int'>0</x> </widget> <conf> <visible type='bool'>False</visible> Modified: software/gadgets/sound_monitor/trunk/audio_monitor/strings.xml =================================================================== --- software/gadgets/sound_monitor/trunk/audio_monitor/strings.xml 2007-12-10 09:02:04 UTC (rev 773) +++ software/gadgets/sound_monitor/trunk/audio_monitor/strings.xml 2007-12-10 14:11:11 UTC (rev 774) @@ -1,9 +1,9 @@ <?xml version='1.0' encoding='UTF-8'?> <strings> - <at_gui_widget_lblSpyLevel type='str'>Level</at_gui_widget_lblSpyLevel> - <at_gui_widget_chkDog type='str'>Enable the guard dog mode</at_gui_widget_chkDog> + <at_gui_widget_lblSpyLevel type='str'>Threshold level</at_gui_widget_lblSpyLevel> + <at_gui_widget_chkDog type='str'>Enable guard dog mode</at_gui_widget_chkDog> <at_gui_conf_label13 type='str'>Delay (sec) :</at_gui_conf_label13> - <at_gui_conf_label12 type='str'>Updates</at_gui_conf_label12> + <at_gui_conf_label12 type='str'>Settings</at_gui_conf_label12> <help_text type='str'> </help_text> <vr_Sound type='str'>Sound</vr_Sound> @@ -11,16 +11,20 @@ <at_gui_widget_cbbDog type='str'>Guard dog mode</at_gui_widget_cbbDog> <at_gui_conf_label6 type='str'>Cancel</at_gui_conf_label6> <at_gui_conf_label5 type='str'>Accept</at_gui_conf_label5> + <Standby type='str'>This will stop the gadget execution, and restart all the other notifications. +No more sound events will be notified.</Standby> <at_gui_widget_chkDogDefault type='str'>Use an external script</at_gui_widget_chkDogDefault> - <at_gui_widget_lblDogLevel type='str'>Level</at_gui_widget_lblDogLevel> - <Time type='str'>Hour</Time> + <at_gui_widget_lblDogLevel type='str'>Threshold level</at_gui_widget_lblDogLevel> + <Time type='str'>Time</Time> <at_gui_widget_cbbSpy type='str'>Spy mode</at_gui_widget_cbbSpy> <speaker_name type='str'>Ryan8k</speaker_name> <at_gui_widget_cbbRecord type='str'>Recorded files</at_gui_widget_cbbRecord> <name_to_read type='str'>Audio monitor</name_to_read> + <Show type='str'>Don't show this message again.</Show> + <Startup type='str'>This gadget has an exclusive priority, and all notifications are bypassed when the GUI is open.</Startup> <File type='str'>File</File> - <at_gui_widget_chkSpy type='str'>Enable the spy mode</at_gui_widget_chkSpy> + <at_gui_widget_chkSpy type='str'>Enable spy mode</at_gui_widget_chkSpy> <Duration type='str'>Duration</Duration> - <lblSample type='str'>Sample : </lblSample> - <Location type='str'>Select where the file must be stored.</Location> + <lblSample type='str'>Sample rate : </lblSample> + <Location type='str'>Save recorded files to :</Location> </strings> Modified: software/gadgets/sound_monitor/trunk/audio_monitor.tgf =================================================================== (Binary files differ) |