diff --git a/CHANGES b/CHANGES index 437cb5d..06b2a9b 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,159 @@ ------------------------------------------------------------ +revno: 394 +committer: Andrew Psaltis +branch nick: 1.6 +timestamp: Thu 2009-05-14 09:44:28 -0400 +message: + Merged typo fix from r331 of experimental-nacl. + ------------------------------------------------------------ + revno: 202.2.40 + committer: Andrew Psaltis + branch nick: experimental-nacl + timestamp: Wed 2009-05-13 19:03:29 -0400 + message: + Fixed typo in wicd-curses.py. +------------------------------------------------------------ +revno: 393 +committer: Adam Blackburn +branch nick: 1.6 +timestamp: Thu 2009-05-14 19:37:20 +0800 +message: + Fix / tags +------------------------------------------------------------ +revno: 392 +committer: Andrew Psaltis +branch nick: 1.6 +timestamp: Tue 2009-05-12 00:06:38 -0400 +message: + Merged r330 of experimental-nacl. + ------------------------------------------------------------ + revno: 202.2.39 + committer: Andrew Psaltis + branch nick: experimental-nacl + timestamp: Tue 2009-05-12 00:04:43 -0400 + message: + If the screen in wicd-curses is not up and an ui update is requested, abort the + program. + ------------------------------------------------------------ + revno: 202.2.38 + committer: Andrew Psaltis + branch nick: experimental-nacl + timestamp: Mon 2009-05-11 23:52:43 -0400 + message: + Merged with r391 of mainline 1.6. +------------------------------------------------------------ +revno: 391 +committer: Dan O'Reilly +branch nick: experimental +timestamp: Sun 2009-05-10 13:53:54 -0400 +message: + Don't use dbusmanager.DBusException--it doesn't exist. +------------------------------------------------------------ +revno: 390 +committer: Adam Blackburn +branch nick: 1.6 +timestamp: Sun 2009-05-10 22:51:49 +0800 +message: + Made the GUI look better with dark themes +------------------------------------------------------------ +revno: 389 +committer: Adam Blackburn +branch nick: 1.6 +timestamp: Sun 2009-05-10 22:03:52 +0800 +message: + Removed italicized text from the GTK GUI +------------------------------------------------------------ +revno: 388 +committer: Andrew Psaltis +branch nick: 1.6 +timestamp: Sun 2009-05-10 09:51:01 -0400 +message: + Merged with r328 of experimental-nacl. + ------------------------------------------------------------ + revno: 202.2.37 + committer: Andrew Psaltis + branch nick: experimental-nacl + timestamp: Sun 2009-05-10 09:40:38 -0400 + message: + Hopefully fixed bug 355693, related to focus positioning. + ------------------------------------------------------------ + revno: 202.2.36 + committer: Andrew Psaltis + branch nick: experimental-nacl + timestamp: Thu 2009-05-07 00:38:18 -0400 + message: + Redid the decorator to look like the other exception-catching decorators in wicd. + ------------------------------------------------------------ + revno: 202.2.35 + committer: Andrew Psaltis + branch nick: experimental-nacl + timestamp: Thu 2009-05-07 00:37:28 -0400 + message: + Remerge with mainline, doing nothing. + ------------------------------------------------------------ + revno: 202.2.34 + committer: Andrew Psaltis + branch nick: experimental-nacl + timestamp: Thu 2009-05-07 00:30:25 -0400 + message: + Added support for manual distro detection in setup.py. + ------------------------------------------------------------ + revno: 202.2.33 + committer: Andrew Psaltis + branch nick: experimental-nacl + timestamp: Wed 2009-05-06 15:33:12 -0400 + message: + Made scans asynchronous so that users can actually access preferences while the daemon is scanning. + ------------------------------------------------------------ + revno: 202.2.32 + committer: Andrew Psaltis + branch nick: experimental-nacl + timestamp: Wed 2009-05-06 15:19:46 -0400 + message: + Merged r385 of mainline 1.6. + ------------------------------------------------------------ + revno: 202.2.31 + committer: Andrew Psaltis + branch nick: experimental-nacl + timestamp: Sat 2009-05-02 18:45:36 -0400 + message: + Merged r379 of mainline 1.6. +------------------------------------------------------------ +revno: 387 +committer: Dan O'Reilly +branch nick: experimental +timestamp: Sat 2009-05-09 20:53:49 -0400 +message: + Make bitrates regex work when it's the last entry in a cell. +------------------------------------------------------------ +revno: 386 +committer: Andrew Psaltis +branch nick: 1.6 +timestamp: Wed 2009-05-06 18:13:29 -0400 +message: + Fixed missing endquote in wicd-client.py. +------------------------------------------------------------ +revno: 385 +committer: Adam Blackburn +branch nick: 1.6 +timestamp: Tue 2009-05-05 12:56:09 +0800 +message: + Updated translations.py +------------------------------------------------------------ +revno: 384 +committer: Adam Blackburn +branch nick: 1.6 +timestamp: Tue 2009-05-05 12:55:35 +0800 +message: + Added code to debug why pynotify fails +------------------------------------------------------------ +revno: 383 +committer: Adam Blackburn +branch nick: 1.6 +timestamp: Tue 2009-05-05 12:00:22 +0800 +message: + updated CHANGES/NEWS +------------------------------------------------------------ revno: 382 committer: Adam Blackburn branch nick: 1.6 diff --git a/NEWS b/NEWS index e3b0eaf..719fb92 100644 --- a/NEWS +++ b/NEWS @@ -1,19 +1,19 @@ Wicd 1.6.x Branch Major Changes: -- Improved tray icon and gui images (thanks to Martin Sagastume) -- Reorganized network list in the gui for easier navigation +- Improved tray icon and GUI images (thanks to Martin Sagastume) +- Reorganized network list in the GUI for easier navigation - New experimental ioctl backend, which is more cpu-friendly than the previous one - Added a curses client (thanks to Andrew Psaltis) - Added a right-click connection menu to the tray icon -- Added options to specify a dns domain and search domain for static networks +- Added options to specify a DNS domain and search domain for static networks - Reworked the Preferences menu to be more in line with GNOME standards - Added support for global scripts - Made it possible to have optional entries in encryption templates - Added ability to show libnotify notifications on status change -Minor Changes and Other Enchancements: +Minor Changes and Other Enhancements: - Better autoconnection behavior - Tray/GUI will survive the daemon being killed - Reasons for connection failures will now bubble back to the GUI @@ -25,11 +25,11 @@ Minor Changes and Other Enchancements: - Moved scanning to its own thread, which makes GUI and daemon more responsive during scans - Made it possible to specify macros in script entries -- The gui will now display the encryption entry dialog if you attempt to +- The GUI will now display the encryption entry dialog if you attempt to connect to an encrypted network without entering a password - Static gateway entry is now optional - Passwords with leading or trailing whitespace are now stored properly - Many init/config script, man page, and setup.py fixes/updates, including better autodetection of file placement with regard to sleep hooks and - kde autostart files (thanks to Robby Workman) + KDE autostart files (thanks to Robby Workman) diff --git a/curses/wicd-curses.py b/curses/wicd-curses.py index b188b16..4485fed 100755 --- a/curses/wicd-curses.py +++ b/curses/wicd-curses.py @@ -79,17 +79,11 @@ for i in language.keys(): ######################################## ##### SUPPORT CLASSES ######################################## -# A hack to get any errors that pop out of the program to appear ***AFTER*** the -# program exits. -# I also may have been a bit overkill about using this too, I guess I'll find -# that out soon enough. -# I learned about this from this example: -# http://blog.lutzky.net/2007/09/16/exception-handling-decorators-and-python/ -class wrap_exceptions: - def __call__(self, f): - def wrap_exceptions(*args, **kargs): +# Yay for decorators! +def wrap_exceptions(func): + def wrapper(*args, **kargs): try: - return f(*args, **kargs) + return func(*args, **kargs) except KeyboardInterrupt: #gobject.source_remove(redraw_tag) loop.quit() @@ -117,7 +111,11 @@ class wrap_exceptions: #sleep(2) raise - return wrap_exceptions + wrapper.__name__ = func.__name__ + wrapper.__module__ = func.__module__ + wrapper.__dict__ = func.__dict__ + wrapper.__doc__ = func.__doc__ + return wrapper ######################################## ##### SUPPORT FUNCTIONS @@ -125,7 +123,7 @@ class wrap_exceptions: # Look familiar? These two functions are clones of functions found in wicd's # gui.py file, except that now set_status is a function passed to them. -@wrap_exceptions() +@wrap_exceptions def check_for_wired(wired_ip,set_status): """ Determine if wired is active, and if yes, set the status. """ if wired_ip and wired.CheckPluggedIn(): @@ -134,7 +132,7 @@ def check_for_wired(wired_ip,set_status): else: return False -@wrap_exceptions() +@wrap_exceptions def check_for_wireless(iwconfig, wireless_ip, set_status): """ Determine if wireless is active, and if yes, set the status. """ if not wireless_ip: @@ -586,6 +584,7 @@ class appGUI(): self.connecting = False self.screen_locked = False self.do_diag_lock = False + self.scanning = False self.pref = None @@ -593,6 +592,11 @@ class appGUI(): #self.dialog = PrefOverlay(self.frame,self.size) + def doScan(self, sync=False): + self.scanning = True + wireless.Scan(False) + + def init_other_optcols(self): # The "tabbed" preferences dialog self.prefCols = OptCols( [('meta enter','OK'), @@ -631,7 +635,7 @@ class appGUI(): # That dialog will sit there for a while if I don't get rid of it self.update_ui() wireless.SetHiddenNetworkESSID(misc.noneToString(hidden)) - wireless.Scan(True) + wireless.Scan(False) wireless.SetHiddenNetworkESSID("") def update_focusloc(self): @@ -653,7 +657,7 @@ class appGUI(): # Be clunky until I get to a later stage of development. # Update the list of networks. Usually called by DBus. - @wrap_exceptions() + @wrap_exceptions def update_netlist(self,state=None, x=None, force_check=False,firstrun=False): # Don't even try to do this if we are running a dialog if self.diag: @@ -694,7 +698,7 @@ class appGUI(): if self.focusloc[0] == self.WIRED_IDX: self.thePile.get_focus().get_body().set_focus(self.focusloc[1]) else: - if self.wlessLB is not self.no_wlan: + if self.wlessLB != self.no_wlan: self.thePile.get_focus().set_focus(self.focusloc[1]) else: self.thePile.set_focus(self.wiredCB) @@ -715,7 +719,7 @@ class appGUI(): # Update the footer/status bar conn_status = False - @wrap_exceptions() + @wrap_exceptions def update_status(self): wired_connecting = wired.CheckIfWiredConnecting() wireless_connecting = wireless.CheckIfWirelessConnecting() @@ -803,26 +807,28 @@ class appGUI(): # Make sure the screen is still working by providing a pretty counter. # Not necessary in the end, but I will be using footer1 for stuff in # the long run, so I might as well put something there. - #@wrap_exceptions() + #@wrap_exceptions def update_time(self): self.time_label.set_text(strftime('%H:%M:%S')) return True # Yeah, I'm copying code. Anything wrong with that? - #@wrap_exceptions() + #@wrap_exceptions def dbus_scan_finished(self): # I'm pretty sure that I'll need this later. #if not self.connecting: # gobject.idle_add(self.refresh_networks, None, False, None) self.unlock_screen() + self.scanning = False # Same, same, same, same, same, same - #@wrap_exceptions() + #@wrap_exceptions def dbus_scan_started(self): + self.scanning = True self.lock_screen() def restore_primary(self): - if self.do_diag_lock: + if self.do_diag_lock or self.scanning: self.frame.set_body(self.screen_locker) self.do_diag_lock = False else: @@ -839,23 +845,24 @@ class appGUI(): #return False if "f5" in keys or 'R' in keys: self.lock_screen() - wireless.Scan(True) + self.doScan() if "D" in keys: # Disconnect from all networks. daemon.Disconnect() self.update_netlist() if 'right' in keys: - focus = self.thePile.get_focus() - self.frame.set_footer(urwid.Pile([self.confCols,self.footer2])) - if focus == self.wiredCB: - self.diag = WiredSettingsDialog(self.wiredCB.get_body().get_selected_profile()) - self.frame.set_body(self.diag) - else: - # wireless list only other option - wid,pos = self.thePile.get_focus().get_focus() - self.diag = WirelessSettingsDialog(pos,self.frame) - self.diag.ready_widgets(ui,self.frame) - self.frame.set_body(self.diag) + if not self.scanning: + focus = self.thePile.get_focus() + self.frame.set_footer(urwid.Pile([self.confCols,self.footer2])) + if focus == self.wiredCB: + self.diag = WiredSettingsDialog(self.wiredCB.get_body().get_selected_profile()) + self.frame.set_body(self.diag) + else: + # wireless list only other option + wid,pos = self.thePile.get_focus().get_focus() + self.diag = WirelessSettingsDialog(pos,self.frame) + self.diag.ready_widgets(ui,self.frame) + self.frame.set_body(self.diag) # Guess what! I actually need to put this here, else I'll have # tons of references to self.frame lying around. ^_^ if "enter" in keys: @@ -945,7 +952,7 @@ class appGUI(): continue # Redraw the screen - @wrap_exceptions() + @wrap_exceptions def update_ui(self): #self.update_status() canvas = self.frame.render( (self.size),True ) @@ -955,6 +962,10 @@ class appGUI(): # the input. I'll try to get that working at a later time, if people # want that "feature". #canvaso = urwid.CanvasOverlay(self.dialog.render( (80,20),True),canvas,0,1) + # If the screen is turned off for some reason, don't even try to do the + # rest of the stuff. + if not ui._started: + return False ui.draw_screen((self.size),canvas) keys = ui.get_input() self.handle_keys(keys) @@ -988,7 +999,7 @@ def main(): if options.screen == 'raw': import urwid.raw_display ui = urwid.raw_display.Screen() - elif options.screen is 'curses': + elif options.screen == 'curses': import urwid.curses_display ui = urwid.curses_display.Screen() diff --git a/setup.py b/setup.py index fdee577..5f4992c 100755 --- a/setup.py +++ b/setup.py @@ -2,6 +2,7 @@ # # Copyright (C) 2007 - 2009 Adam Blackburn # Copyright (C) 2007 - 2009 Dan O'Reilly +# Copyright (C) 2009 Andrew Psaltis # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License Version 2 as @@ -24,7 +25,7 @@ import subprocess # Be sure to keep this updated! # VERSIONNUMBER -VERSION_NUM = '1.6.0a3' +VERSION_NUM = '1.6.0b1' # REVISION_NUM is automatically updated REVISION_NUM = 'unknown' CURSES_REVNO = 'uimod' @@ -84,6 +85,7 @@ class configure(Command): ('initfile=', None, 'set the init file to use'), ('initfilename=', None, "set the name of the init file (don't use)"), ('wicdgroup=', None, "set the name of the group used for wicd"), + ('distro=', None, 'set the distribution for which wicd will be installed'), # Configure switches ('no-install-init', None, "do not install the init file"), @@ -120,6 +122,7 @@ class configure(Command): self.docdir = '/usr/share/doc/wicd/' self.mandir = '/usr/share/man/' self.kdedir = '/usr/share/autostart/' + self.distro = 'auto' self.no_install_init = False self.no_install_man = False @@ -131,49 +134,38 @@ class configure(Command): self.no_use_notifications = False # Determine the default init file location on several different distros - self.distro_detect_failed = False self.initfile = 'init/default/wicd' + # ddistro is the detected distro if os.path.exists('/etc/redhat-release'): - self.init = '/etc/rc.d/init.d/' - self.initfile = 'init/redhat/wicd' + self.ddistro = 'redhat' elif os.path.exists('/etc/SuSE-release'): - self.init = '/etc/init.d/' - self.initfile = 'init/suse/wicd' + self.ddistro = 'suse' elif os.path.exists('/etc/fedora-release'): - self.init = '/etc/rc.d/init.d/' - self.initfile = 'init/redhat/wicd' + self.ddistro = 'redhat' elif os.path.exists('/etc/gentoo-release'): - self.init = '/etc/init.d/' - self.initfile = 'init/gentoo/wicd' + self.ddistro = 'gentoo' elif os.path.exists('/etc/debian_version'): - self.init = '/etc/init.d/' - self.initfile = 'init/debian/wicd' + self.ddistro = 'debian' elif os.path.exists('/etc/arch-release'): - self.init = '/etc/rc.d/' - self.initfile = 'init/arch/wicd' + self.ddistro = 'arch' elif os.path.exists('/etc/slackware-version') or \ - os.path.exists('/etc/slamd64-version'): - self.init = '/etc/rc.d/' - self.initfile = 'init/slackware/rc.wicd' - self.docdir = '/usr/doc/wicd-%s' % VERSION_NUM - self.mandir = '/usr/man/' - self.no_install_acpi = True + os.path.exists('/etc/slamd64-version') or \ + os.path.exists('/etc/bluewhite64-version'): + self.ddistro = 'slackware' elif os.path.exists('/etc/pld-release'): - self.init = '/etc/rc.d/init.d/' - self.initfile = 'init/pld/wicd' + self.ddistro = 'pld' elif os.path.exists('/usr/bin/crux'): - self.init = '/etc/rc.d/' + self.ddistro = 'crux' elif os.path.exists('/etc/lunar.release'): - self.init='/etc/init.d/' - self.initfile = 'init/lunar/wicd' + self.distro = 'lunar' else: - self.init = 'FAIL' - self.no_install_init = True - self.distro_detect_failed = True + self.ddistro = 'FAIL' + #self.no_install_init = True + #self.distro_detect_failed = True print 'WARNING: Unable to detect the distribution in use. ' + \ - 'If you have specified --init and --initfile, configure will continue. ' + \ + 'If you have specified --distro or --init and --initfile, configure will continue. ' + \ 'Please report this warning, along with the name of your ' + \ 'distribution, to the wicd developers.' @@ -229,7 +221,52 @@ class configure(Command): self.initfilename = os.path.basename(self.initfile) self.wicdgroup = 'users' + def distro_check(self): + print "Distro is: "+self.distro + if self.distro in ['sles','suse']: + self.init = '/etc/init.d/' + self.initfile = 'init/suse/wicd' + elif self.distro in ['redhat','centos','fedora']: + self.init = '/etc/rc.d/init.d/' + self.initfile = 'init/redhat/wicd' + elif self.distro in ['slackware','slamd64','bluewhite64']: + self.init = '/etc/rc.d/' + self.initfile = 'init/slackware/rc.wicd' + self.docdir = '/usr/doc/wicd-%s' % VERSION_NUM + self.mandir = '/usr/man/' + self.no_install_acpi = True + elif self.distro in ['debian']: + self.init = '/etc/init.d/' + self.initfile = 'init/debian/wicd' + elif self.distro in ['arch']: + self.init = '/etc/rc.d/' + self.initfile = 'init/arch/wicd' + elif self.distro in ['gentoo']: + self.init = '/etc/init.d/' + self.initfile = 'init/gentoo/wicd' + elif self.distro in ['pld']: + self.init = '/etc/rc.d/init.d/' + self.initfile = 'init/pld/wicd' + elif self.distro in ['crux']: + self.init = '/etc/rc.d/' + elif self.distro in ['lunar']: + self.init='/etc/init.d/' + self.initfile = 'init/lunar/wicd' + else : + if self.distro == 'auto': + print "NOTICE: Automatic distro detection found: "+self.ddistro+", retrying with that..." + self.distro = self.ddistro + self.distro_check() + else: + print "WARNING: Distro detection failed!" + self.init='init/default/wicd' + self.no_install_init = True + self.distro_detect_failed = True + + + def finalize_options(self): + self.distro_check() if self.distro_detect_failed and not self.no_install_init and \ 'FAIL' in [self.init, self.initfile]: print 'ERROR: Failed to detect distro. Configure cannot continue. ' + \ diff --git a/wicd/guiutil.py b/wicd/guiutil.py index 454f37d..169dcc8 100644 --- a/wicd/guiutil.py +++ b/wicd/guiutil.py @@ -146,5 +146,5 @@ class GreyLabel(gtk.Label): gtk.Label.__init__(self) def set_label(self, text): - self.set_markup("" + text + "") + self.set_markup(text) self.set_alignment(0, 0) diff --git a/wicd/netentry.py b/wicd/netentry.py index 161a45b..3df4f77 100644 --- a/wicd/netentry.py +++ b/wicd/netentry.py @@ -555,7 +555,8 @@ class WiredNetworkEntry(NetworkEntry): self.image.show() self.connect_button.show() - self.name_label.set_label(language['wired_network']) + self.name_label.set_use_markup(True) + self.name_label.set_label("" + language['wired_network'] + "") self.is_full_gui = True @@ -756,7 +757,7 @@ class WirelessNetworkEntry(NetworkEntry): 'encryption_method')) self.set_channel(wireless.GetWirelessProperty(networkID, 'channel')) self.name_label.set_use_markup(True) - self.name_label.set_label("%s %s %s %s" % (self._escape(self.essid), + self.name_label.set_label("%s %s %s %s" % (self._escape(self.essid), self.lbl_strength.get_label(), self.lbl_encryption.get_label(), self.lbl_channel.get_label(), diff --git a/wicd/wicd-client.py b/wicd/wicd-client.py index 7c9d100..4934215 100755 --- a/wicd/wicd-client.py +++ b/wicd/wicd-client.py @@ -753,7 +753,7 @@ def on_exit(): if DBUS_AVAIL: try: daemon.SetGUIOpen(False) - except dbusmanager.DBusException: + except DBusException: pass def handle_no_dbus(): diff --git a/wicd/wnettools.py b/wicd/wnettools.py index d09e8f2..f5d720d 100644 --- a/wicd/wnettools.py +++ b/wicd/wnettools.py @@ -48,7 +48,7 @@ channel_pattern = re.compile('.*Channel:? ?(\d\d?)', _re_mode) strength_pattern = re.compile('.*Quality:?=? ?(\d+)\s*/?\s*(\d*)', _re_mode) altstrength_pattern = re.compile('.*Signal level:?=? ?(\d+)\s*/?\s*(\d*)', _re_mode) signaldbm_pattern = re.compile('.*Signal level:?=? ?(-\d\d*)', _re_mode) -bitrates_pattern = re.compile('.*Bit Rates:(.*?)E', _re_mode) +bitrates_pattern = re.compile('(\d+\s+\S+/s)', _re_mode) mode_pattern = re.compile('.*Mode:(.*?)\n', _re_mode) freq_pattern = re.compile('.*Frequency:(.*?)\n', _re_mode) wep_pattern = re.compile('.*Encryption key:(.*?)\n', _re_mode) @@ -1114,9 +1114,9 @@ class BaseWirelessInterface(BaseInterface): ap['channel'] = self._FreqToChannel(freq) # Bit Rate - ap['bitrates'] = misc.RunRegex(bitrates_pattern, cell).split('\n') - ap['bitrates'] = '; '.join(m.strip() for m in ap['bitrates']).rstrip('; ') - + ap['bitrates'] = misc.RunRegex(bitrates_pattern, + cell.split("Bit Rates")[-1]) + # BSSID ap['bssid'] = misc.RunRegex(ap_mac_pattern, cell)