[tuxdroid-svn] r698 - in software/gadgets/settings/trunk: . settings settings/Scripts/Python setti
Status: Beta
Brought to you by:
ks156
From: Paul_R <c2m...@c2...> - 2007-11-14 10:24:50
|
Author: Paul_R Date: 2007-11-14 11:24:38 +0100 (Wed, 14 Nov 2007) New Revision: 698 Modified: software/gadgets/settings/trunk/settings.tgf software/gadgets/settings/trunk/settings/Scripts/Python/GUI/widget/other.pyp software/gadgets/settings/trunk/settings/Scripts/Python/notify.pyp software/gadgets/settings/trunk/settings/Strings/fr_ALL.xml software/gadgets/settings/trunk/settings/about.xml software/gadgets/settings/trunk/settings/settings.xml software/gadgets/settings/trunk/settings/strings.xml Log: * Change the Changelog and description window * Added the notify checker part to refresh the wifi channel and control the sleep * Added the link with the firmware updater gadget Modified: software/gadgets/settings/trunk/settings/Scripts/Python/GUI/widget/other.pyp =================================================================== --- software/gadgets/settings/trunk/settings/Scripts/Python/GUI/widget/other.pyp 2007-11-13 16:07:09 UTC (rev 697) +++ software/gadgets/settings/trunk/settings/Scripts/Python/GUI/widget/other.pyp 2007-11-14 10:24:38 UTC (rev 698) @@ -19,6 +19,8 @@ self.__sound_mutex = threading.Lock() self.__tree_mutex = threading.Lock() self.my_dict = {} + _me.insert_funct('avoidchannel', self.avoidchannel) + _me.insert_funct('searchWifiChannel', self.searchWifiChannel) def new(self): self.widget_window = True @@ -28,6 +30,8 @@ def on_window1_destroy(self, widget, *args): self.widget_window = False + if _me.get_param('dialog') != None: + _me.get_param('dialog').destroy() _me.set_param('widget_window', False) #------------------------------------------------------------ @@ -232,18 +236,18 @@ #------------------------------------------------------------ def searchWifiChannel(self): try: - a = commands.getoutput('iwlist channel') + string = commands.getoutput('iwlist channel') except: thread.start_new_thread(self.popup, (_me.string('Warning'), _me.string('Iwlist'), False)) return - if a.rfind('Current Channel') != -1: + if string.rfind('Current Channel') != -1: self.get_widget('lblUsedChannel').set_text(_me.string('lblNoChannel')) self.get_widget('lblChannel').set_text('') self.channel = -1 - elif a.rfind('Current Frequency') != -1: - channel_idx = a.rfind('(Channel ') + 9 - channel = a[channel_idx:channel_idx + 2] + elif string.rfind('Current Frequency') != -1: + channel_idx = string.rfind('(Channel ') + 9 + channel = string[channel_idx:channel_idx + 2] if channel.find(')') != -1: channel = channel[0:1] self.channel = channel @@ -255,8 +259,12 @@ #------------------------------------------------------------ def on_chkSleepEnable_toggled(self, widget, *args): _me.set_param('EnableSleep', widget.get_active()) + self.enablesleep = widget.get_active() - ## Send the active sleep command + + if self.enablesleep == True: + timeToSleep = time.time() + 60 * float(_me.get_param('SleepDelay')) + _me.set_param('timeToSleep', timeToSleep) #------------------------------------------------------------ # on sleep delay spin button @@ -264,7 +272,12 @@ def on_spinSleepDelay_changed(self, widget, *args): self.sleepdelay = self.get_widget('spinSleepDelay').get_text() _me.set_param('SleepDelay', self.sleepdelay) - ## Send the delay + if self.sleepdelay > 5: + return + + if self.enablesleep == True: + timeToSleep = time.time() + 60 * float(self.sleepdelay) + _me.set_param('timeToSleep', timeToSleep) #------------------------------------------------------------ # on sleep button clicked @@ -512,7 +525,7 @@ message = message + '======= Tux RF =======\n' + xml[9] + '\n \n' message = message + '======= Fux RF =======\n' + xml[10] + '\n \n' message = message + '======= Fux USB =======\n' + xml[11] + '\n \n' - dialog = GdgText(title, message, True) + dialog = GdgText(title, message, False) os.system('rm -rf /tmp/tuxdroid-firmware*') #------------------------------------------------------------ @@ -521,12 +534,11 @@ def flashCPU(self, widget): path = '/opt/tuxdroid/firmware/%s'%self.selectedfile print path - try: - gadgets['firmware_updater'].set_param('setting', True) - gadgets['firmware_updater'].set_param('local_path', path) + if gadgets.has_key('firmware_updater'): + gadgets['firmware_updater'].set_param('foreign_path', path) gadgets['firmware_updater'].main() - except: - dialog = GdgDialog('Error', 'Please install the settings gadget in the Tux Droid Manager.\nBe sure that the firmware updater gadget is correctly installed.') + else: + dialog = GdgDialog(_me.string('Warning'), _me.string('Firmware')) def on_local_version_selected(self, obj): path = obj.get_selected_rows() @@ -1322,19 +1334,16 @@ self.message = message self.title = title self.__center_justify = center_justify - if block: - self.__show() - else: - thread.start_new_thread(self.__show_async, ()) + thread.start_new_thread(self.__show_async, ()) def __show_async(self): - gtk.gdk.threads_enter() self.__show() - gtk.gdk.threads_leave() def __show(self): dialogue = gtk.Dialog(self.title, None, gtk.DIALOG_MODAL, ()) - dialogue.set_property("width-request", 600) + _me.set_param('dialog', dialogue) + + dialogue.set_property("width-request", 650) dialogue.set_property("height-request", 400) if gadgets.has_key('Manager'): dialogue.set_icon_from_file(gadgets['Manager'].icons['gadget.png']) @@ -1342,39 +1351,47 @@ def on_click_close(obj): dialogue.destroy() + _me.set_param('dialog', None) bt_alone.connect("clicked", on_click_close) + text_tree_store = gtk.TreeStore(str) + text_view = gtk.TreeView(text_tree_store) + #text_view.set_sensitive(False) + + text_renderer = gtk.CellRendererText() + text_column = gtk.TreeViewColumn('',text_renderer, text=0) + text_column.add_attribute(text_renderer, 'text', 0) + text_view.append_column(text_column) + + + scroll = gtk.ScrolledWindow() + scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_ALWAYS) + scroll.add(text_view) + scroll.show_all() + box = gtk.HBox(spacing = 5) box.set_border_width(5) box.show() dialogue.vbox.pack_start(box) - scroll = gtk.ScrolledWindow() - scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_ALWAYS) + box.pack_start(scroll) - index_column = gtk.TreeViewColumn('') - index_column.set_min_width(50) - index_column.set_property("clickable", False) - index_cell = gtk.CellRendererText() - index_cell.set_property("editable", False) - index_cell.set_property("background", 'white') - index_column.pack_start(index_cell, True) - index_column.add_attribute(index_cell, 'text', 0) - index_column.set_clickable(False) + def __async(): + time.sleep(0.2) + text_tree_store.append(None, [self.message]) + + gtk.gdk.threads_enter() + thread.start_new_thread(__async, ()) + dialogue.run() + gtk.gdk.threads_leave() - - - text = gtk.ListStore(str) - text_viewer = gtk.TreeView(text) - text_viewer.append_column(index_column) - text_viewer.set_headers_visible(False) - text.append([self.message]) + + + + + + + - scroll.add(text_viewer) - scroll.show_all() - - box.pack_start(scroll) - dialogue.run() - Modified: software/gadgets/settings/trunk/settings/Scripts/Python/notify.pyp =================================================================== --- software/gadgets/settings/trunk/settings/Scripts/Python/notify.pyp 2007-11-13 16:07:09 UTC (rev 697) +++ software/gadgets/settings/trunk/settings/Scripts/Python/notify.pyp 2007-11-14 10:24:38 UTC (rev 698) @@ -5,6 +5,24 @@ 'notify_delay' setting. The setting named 'notify_delay' indicate if the loop can run. """ + + + ## Refresh the channels + print 'test window' + if _me.get_funct('avoidchannel') != None and _me.get_param('widget_window') == True: + print 'avoid channel' + _me.get_funct('avoidchannel')() + _me.get_funct('searchWifiChannel')() + print 'end' + + + # Control the sleep + ## Test if tux is already sleeping + if _me.get_param('EnableSleep') == True and _me.get_param('timeToSleep') != None: + if time.time() >= _me.get_param('timeToSleep'): + #Send the sleep command + print 'go to sleep now' + return False def notify_actuator(): Modified: software/gadgets/settings/trunk/settings/Strings/fr_ALL.xml =================================================================== --- software/gadgets/settings/trunk/settings/Strings/fr_ALL.xml 2007-11-13 16:07:09 UTC (rev 697) +++ software/gadgets/settings/trunk/settings/Strings/fr_ALL.xml 2007-11-14 10:24:38 UTC (rev 698) @@ -41,6 +41,7 @@ <lblSoundMic type='str'>Microphone</lblSoundMic> <lblIDNum type='str'>ID de Tux : </lblIDNum> <Sound type='str'>Avez vous correctement entendu le son ?</Sound> + <Firmware type='str'>Assurer-vous que le gadget 'firmware updater' est correctement installé</Firmware> <itemChangeLog type='str'>Voir les changements</itemChangeLog> <lblSoundLocalSelect type='str'>Selectionner un son :</lblSoundLocalSelect> <lblSoundExternal type='str'>Lire un wave externe</lblSoundExternal> Modified: software/gadgets/settings/trunk/settings/about.xml =================================================================== (Binary files differ) Modified: software/gadgets/settings/trunk/settings/settings.xml =================================================================== --- software/gadgets/settings/trunk/settings/settings.xml 2007-11-13 16:07:09 UTC (rev 697) +++ software/gadgets/settings/trunk/settings/settings.xml 2007-11-14 10:24:38 UTC (rev 698) @@ -10,9 +10,7 @@ <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> @@ -26,8 +24,8 @@ <have_widget_part type='bool'>True</have_widget_part> <speaker type='int'>3</speaker> <pitch type='int'>100</pitch> - <have_main_part type='bool'>True</have_main_part> - <main_priority type='int'>4</main_priority> - <notify_priority type='int'>4</notify_priority> + <have_main_part type='bool'>False</have_main_part> + <main_priority type='int'>0</main_priority> + <notify_priority type='int'>0</notify_priority> </general> </settings> Modified: software/gadgets/settings/trunk/settings/strings.xml =================================================================== --- software/gadgets/settings/trunk/settings/strings.xml 2007-11-13 16:07:09 UTC (rev 697) +++ software/gadgets/settings/trunk/settings/strings.xml 2007-11-14 10:24:38 UTC (rev 698) @@ -39,9 +39,9 @@ <lblSleepStateSleep type='str'>Tux is currently sleeping</lblSleepStateSleep> <soundProg type='str'>Sound programming ...</soundProg> <lblSoundMic type='str'>Microphone</lblSoundMic> - <lblSoundStore type='str'>Store wave files locally</lblSoundStore> <lblIDNum type='str'>Tux's ID : </lblIDNum> <Sound type='str'>Have you heard the sound ?</Sound> + <Firmware type='str'>Be sure that the firmware updater gadget is correctly installed.</Firmware> <itemChangeLog type='str'>Show ChangeLog</itemChangeLog> <lblSoundLocalSelect type='str'>Select sound</lblSoundLocalSelect> <lblSoundExternal type='str'>Play external wave file</lblSoundExternal> @@ -54,7 +54,7 @@ <lblSleepStateWork type='str'>Tux isn't in sleep mode</lblSleepStateWork> <Switch type='str'>After closing this window, press on the wings and on the head. You've 15 seconds to perform this task.</Switch> - <gui_conf_author_lb type='str'>Author</gui_conf_author_lb> + <lblSoundStore type='str'>Store wave files locally</lblSoundStore> <lblConfigTest type='str'>Self tests</lblConfigTest> <treeVersionVer type='str'>Version</treeVersionVer> <lblConfigWifi type='str'>Wifi configuration</lblConfigWifi> @@ -76,12 +76,13 @@ <Iwlist type='str'>iwlist package isn't found. Be sure that wireless tools package is instelled on your computer. (http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html#latest)</Iwlist> - <Warning type='str'>Warning</Warning> + <gui_conf_author_lb type='str'>Author</gui_conf_author_lb> <gui_conf_description_lb type='str'>Description</gui_conf_description_lb> <lblIDName type='str'>Tux's name : </lblIDName> <In type='str'>Would you like to test the sound input interface? To do this, you need to connect an input device in the blue connector and then click 'Yes'.</In> <lblConfigID type='str'>ID configuration</lblConfigID> + <Warning type='str'>Warning</Warning> <lblTabVersion type='str'>Versions</lblTabVersion> <lblSleepDelay type='str'>Active the sleep mode after a inactivity period of</lblSleepDelay> <Out type='str'>Would you like to test the sound output interface? Modified: software/gadgets/settings/trunk/settings.tgf =================================================================== (Binary files differ) |