1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-20 04:48:00 +01:00

Altered autoconnection code to fall back to wireless if wired fails because there is no default profile set.

This commit is contained in:
imdano
2008-02-29 22:14:32 +00:00
parent 189dcc698b
commit 08b9f9f993

View File

@@ -351,6 +351,17 @@ class ConnectionWizard(dbus.service.Object):
self.Scan()
#self.AutoConnectScan() # Also scans for hidden networks
if self.CheckPluggedIn():
self._wired_autoconnect()
else:
self._wireless_autoconnect()
def _wired_autoconnect(self):
""" Attempts to autoconnect to a wired network. """
if self.GetWiredInterface() is None:
print 'no wired interface available'
return
if self.GetWiredAutoConnectMethod() == 2 and \
not self.GetNeedWiredProfileChooser():
self.LaunchChooser()
@@ -363,10 +374,15 @@ class ConnectionWizard(dbus.service.Object):
else:
print "Couldn't find a default wired connection, \
wired autoconnect failed"
else:
self._wireless_autoconnect()
def _wireless_autoconnect(self):
print "No wired connection present, attempting to autoconnect \
to wireless network"
if self.GetWirelessInterface() != None:
if self.GetWirelessInterface() is None:
print 'autoconnect failed because wireless interface returned None'
return
for x, network in enumerate(self.LastScan):
if bool(self.LastScan[x]["has_profile"]):
print self.LastScan[x]["essid"] + ' has profile'
@@ -376,8 +392,8 @@ class ConnectionWizard(dbus.service.Object):
time.sleep(1)
return
print "Unable to autoconnect, you'll have to manually connect"
else:
print 'autoconnect failed because wireless interface returned None'
@dbus.service.method('org.wicd.daemon')
def GetAutoReconnect(self):