mirror of
https://github.com/gryf/wicd.git
synced 2026-01-09 07:14:13 +01:00
improved autoreconnect code
This commit is contained in:
22
edgy.py
22
edgy.py
@@ -122,20 +122,22 @@ def set_signal_image():
|
|||||||
tr.set_from_file("images/bad-signal" + lock + ".png")
|
tr.set_from_file("images/bad-signal" + lock + ".png")
|
||||||
elif signal == 0:
|
elif signal == 0:
|
||||||
tr.set_from_file("images/no-signal.png")
|
tr.set_from_file("images/no-signal.png")
|
||||||
#Auto-reconnect code - not sure how well this works. I know that without the ForcedDisconnect check it reconnects you when
|
#Auto-reconnect code - not sure how well this works. I know that without the ForcedDisconnect check it reconnects you when
|
||||||
#a disconnect is forced. People who have disconnection problems need to test it to determine if it actually works.
|
#a disconnect is forced. People who have disconnection problems need to test it to determine if it actually works.
|
||||||
#First it will attempt to reconnect to the last known wireless network, and if that fails it should run a scan and try to
|
#First it will attempt to reconnect to the last known wireless network, and if that fails it should run a scan and try to
|
||||||
#connect to any network set to autoconnect. It will continuously rescan until a network is found or the user manually reconnects
|
#connect to any network set to autoconnect.
|
||||||
#This behavior could prove to be annoying, so we'll keep it in the experimental build for now
|
if wireless.GetAutoReconnect() == True and wireless.CheckIfWirelessConnecting() == False and wireless.GetForcedDisconnect() == False:
|
||||||
if wireless.GetAutoReconnect() == True and wireless.CheckIfWirelessConnecting() == False and wireless.GetForcedDisconnect() == False:
|
curNetID = wireless.GetCurrentNetworkID()
|
||||||
curNetID = wireless.GetCurrentNetworkID()
|
if curNetID > -1:
|
||||||
if curNetID > -1: #value of -1 is typically caused by hibernation and breaks the tray if passed to daemon
|
wireless.ConnectWireless(wireless.GetCurrentNetworkID())
|
||||||
wireless.ConnectWireless(wireless.GetCurrentNetworkID())
|
print 'Trying to autoreconnect'
|
||||||
|
while wireless.CheckIfWirelessConnecting() == True:
|
||||||
|
time.sleep(1)
|
||||||
if wireless.GetCurrentSignalStrength() != 0:
|
if wireless.GetCurrentSignalStrength() != 0:
|
||||||
print "Successfully autoreconnected."
|
print "Successfully autoreconnected."
|
||||||
else:
|
else:
|
||||||
print "Couldn't reconnect to last used network, scanning for an autoconnect network..."
|
print "Couldn't reconnect to last used network, scanning for an autoconnect network..."
|
||||||
print wireless.AutoConnect(True)
|
print wireless.AutoConnect(True)
|
||||||
|
|
||||||
elif wireless_ip == None:
|
elif wireless_ip == None:
|
||||||
tr.set_from_file("images/no-signal.png")
|
tr.set_from_file("images/no-signal.png")
|
||||||
|
|||||||
Reference in New Issue
Block a user