mirror of
https://github.com/gryf/wicd.git
synced 2025-12-20 04:48:00 +01:00
* Completely reworked the gui/tray system. gui.py and edgy/dapper/tray.py are now all run from the same wicd.py file.
* Added a connection_lost_counter to prevent the wicd frontend from trying to automatically reconnect too quickly if signal strength is briefly lost. * Added some code to hopefully fix some of the dbus-related encoding problems caused by essids with weird characters. (Might still need work). * The tray/gui will now show up in the process manager under the name wicd (along with the wicd icon), instead of just python. * Added a GetCurrentInterface() method to the daemon that will eventually be used in the VPN plugin. * Fixed a possible crash caused by signal strength not being returned correctly. * Split the Wired Profile Chooser from the appGui class, so they are now called separately within wicd.py. When the profile chooser is called from the daemon, it sets a flag as well as sending a dbus signal, so the chooser will still launch if the wicd frontend isn't running yet. * Added some docstrings, comments, etc. Probably a few other small changes I'm forgetting.
This commit is contained in:
30
wnettools.py
30
wnettools.py
@@ -260,9 +260,9 @@ class WirelessInterface(Interface):
|
||||
results = misc.Run(cmd)
|
||||
|
||||
# Split the networks apart, using Cell as our split point
|
||||
# this way we can look at only one network at a time
|
||||
# this way we can look at only one network at a time.
|
||||
networks = results.split( ' Cell ' )
|
||||
|
||||
|
||||
# Get available network info from iwpriv get_site_survey
|
||||
# if we're using a ralink card (needed to get encryption info)
|
||||
if self.wpa_driver == 'ralink legacy':
|
||||
@@ -294,7 +294,7 @@ class WirelessInterface(Interface):
|
||||
The channel number, or None if not found.
|
||||
|
||||
"""
|
||||
if freq == '2.412 GHz': return 1
|
||||
if freq == '2.412 GHz': return 1
|
||||
elif freq == '2.417 GHz': return 2
|
||||
elif freq == '2.422 GHz': return 3
|
||||
elif freq == '2.427 GHz': return 4
|
||||
@@ -314,11 +314,11 @@ class WirelessInterface(Interface):
|
||||
|
||||
def _GetRalinkInfo(self):
|
||||
""" Get a network info list used for ralink drivers
|
||||
|
||||
|
||||
Calls iwpriv <wireless interface> get_site_survey, which
|
||||
on some ralink cards will return encryption and signal
|
||||
strength info for wireless networks in the area.
|
||||
|
||||
|
||||
"""
|
||||
iwpriv = misc.Run('iwpriv ' + self.iface + ' get_site_survey')
|
||||
lines = iwpriv.splitlines()
|
||||
@@ -334,7 +334,7 @@ class WirelessInterface(Interface):
|
||||
for ralink cards.
|
||||
|
||||
Returns:
|
||||
|
||||
|
||||
A dictionary containing the cell networks properties.
|
||||
|
||||
"""
|
||||
@@ -399,21 +399,21 @@ class WirelessInterface(Interface):
|
||||
ap['strength'] = -1
|
||||
|
||||
return ap
|
||||
|
||||
|
||||
def _ParseRalinkAccessPoint(self, ap, ralink_info, cell):
|
||||
""" Parse encryption and signal strength info for ralink cards
|
||||
|
||||
|
||||
Keyword arguments:
|
||||
ap -- array containing info about the current access point
|
||||
ralink_info -- string containing available network info
|
||||
cell -- string containing cell information
|
||||
|
||||
|
||||
Returns:
|
||||
Updated array containing info about the current access point
|
||||
|
||||
|
||||
"""
|
||||
lines = ralink_info
|
||||
for x in lines: # Iterate through all networks found
|
||||
for x in lines: # Iterate through all networks found
|
||||
info = x.split()
|
||||
# Make sure we read in a valid entry
|
||||
if len(info) < 5 or info == None or info == '':
|
||||
@@ -532,7 +532,7 @@ class WirelessInterface(Interface):
|
||||
if len(info) < 5:
|
||||
break
|
||||
if info[2] == network.get('essid'):
|
||||
if info[5] == 'WEP' or (info[5] == 'OPEN' and info[4] == 'WEP'): # Needs to be tested
|
||||
if info[5] == 'WEP' or (info[5] == 'OPEN' and info[4] == 'WEP'):
|
||||
print 'Setting up WEP'
|
||||
cmd = 'iwconfig ' + self.iface + ' key ' + network.get('key')
|
||||
if self.verbose: print cmd
|
||||
@@ -610,5 +610,7 @@ class WirelessInterface(Interface):
|
||||
cmd = 'iwconfig ' + self.iface
|
||||
if self.verbose: print cmd
|
||||
output = misc.Run(cmd)
|
||||
return misc.RunRegex(re.compile('.*ESSID:"(.*?)"',re.DOTALL | re.I | re.M | re.S), output)
|
||||
|
||||
network = misc.RunRegex(re.compile('.*ESSID:"(.*?)"',re.DOTALL | re.I | re.M | re.S), output)
|
||||
if network is not None:
|
||||
network = network.encode('utf-8')
|
||||
return network
|
||||
|
||||
Reference in New Issue
Block a user