mirror of
https://github.com/gryf/wicd.git
synced 2026-01-05 21:34:16 +01:00
More work on bubbling the reason for connection failures up to the UI.
Refactor Wireless/Wired classes in networking module and daemon so that they don't need to reference each other. Wired objects don't know about Wireless objects and vice versa. This also means connecting to a wired/wireless network will only clear the connection on whichever network type you're connecting to.
This commit is contained in:
@@ -83,10 +83,8 @@ class WicdDaemon(dbus.service.Object):
|
||||
self.wired = networking.Wired()
|
||||
self.config = ConfigManager(os.path.join(wpath.etc,
|
||||
"manager-settings.conf"))
|
||||
self.wired_bus= WiredDaemon(bus_name, self, wired=self.wired,
|
||||
wifi=self.wifi)
|
||||
self.wireless_bus = WirelessDaemon(bus_name, self, wired=self.wired,
|
||||
wifi=self.wifi)
|
||||
self.wired_bus= WiredDaemon(bus_name, self, wired=self.wired)
|
||||
self.wireless_bus = WirelessDaemon(bus_name, self, wifi=self.wifi)
|
||||
self.forced_disconnect = False
|
||||
self.need_profile_chooser = False
|
||||
self.current_interface = None
|
||||
@@ -107,11 +105,6 @@ class WicdDaemon(dbus.service.Object):
|
||||
# need a fresh scan, just feed them the old one. A fresh scan
|
||||
# can be done by calling Scan(fresh=True).
|
||||
self.LastScan = ''
|
||||
|
||||
# Kind of hackish way to set correct wnettools interfaces.
|
||||
#TODO remove the need for this.
|
||||
self.wifi.liface = self.wired.liface
|
||||
self.wired.wiface = self.wifi.wiface
|
||||
|
||||
signal.signal(signal.SIGTERM, self.DaemonClosing)
|
||||
self.DaemonStarting()
|
||||
@@ -147,7 +140,6 @@ class WicdDaemon(dbus.service.Object):
|
||||
""" Sets the wired interface for the daemon to use. """
|
||||
print "setting wired interface %s" % (str(interface))
|
||||
self.wired.wired_interface = noneToBlankString(interface)
|
||||
self.wifi.wired_interface = noneToBlankString(interface)
|
||||
self.config.set("Settings", "wired_interface", interface, True)
|
||||
|
||||
@dbus.service.method('org.wicd.daemon')
|
||||
@@ -155,7 +147,6 @@ class WicdDaemon(dbus.service.Object):
|
||||
""" Sets the wireless interface the daemon will use. """
|
||||
print "setting wireless interface %s" % (str(interface))
|
||||
self.wifi.wireless_interface = noneToBlankString(interface)
|
||||
self.wired.wireless_interface = noneToBlankString(interface)
|
||||
self.config.set("Settings", "wireless_interface", interface, True)
|
||||
|
||||
@dbus.service.method('org.wicd.daemon')
|
||||
@@ -359,10 +350,11 @@ class WicdDaemon(dbus.service.Object):
|
||||
self.wifi.connecting_thread.should_die = True
|
||||
self.wifi.StopDHCP()
|
||||
self.wifi.StopWPA()
|
||||
self.wifi.connecting_thread.connect_result = 'aborted'
|
||||
if self.wired.connecting_thread:
|
||||
self.wired.connecting_thread.should_die = True
|
||||
self.wired.StopDHCP()
|
||||
#misc.Run("killall dhclient pump dhcpcd-bin dhclient3 wpa_supplicant")
|
||||
self.wired.connecting_thread.connect_result = 'aborted'
|
||||
|
||||
@dbus.service.method('org.wicd.daemon')
|
||||
def GetCurrentInterface(self):
|
||||
@@ -726,7 +718,7 @@ class WicdDaemon(dbus.service.Object):
|
||||
|
||||
@dbus.service.signal(dbus_interface="org.wicd.daemon",signature='s')
|
||||
def ConnectResultsSent(self, result):
|
||||
print "Sending connectiong attempt result %s" % result
|
||||
print "Sending connection attempt result %s" % result
|
||||
|
||||
@dbus.service.signal(dbus_interface='org.wicd.daemon', signature='')
|
||||
def LaunchChooser(self):
|
||||
@@ -845,13 +837,12 @@ class WicdDaemon(dbus.service.Object):
|
||||
|
||||
class WirelessDaemon(dbus.service.Object):
|
||||
""" DBus interface for wireless connection operations. """
|
||||
def __init__(self, bus_name, daemon, wired=None, wifi=None, debug=False):
|
||||
def __init__(self, bus_name, daemon, wifi=None, debug=False):
|
||||
""" Intitialize the wireless DBus interface. """
|
||||
dbus.service.Object.__init__(self, bus_name=bus_name,
|
||||
object_path='/org/wicd/daemon/wireless')
|
||||
self.hidden_essid = None
|
||||
self.daemon = daemon
|
||||
self.wired = wired
|
||||
self.wifi = wifi
|
||||
self.debug_mode = debug
|
||||
self.forced_disconnect = False
|
||||
@@ -906,8 +897,7 @@ class WirelessDaemon(dbus.service.Object):
|
||||
def CreateAdHocNetwork(self, essid, channel, ip, enctype, key, encused,
|
||||
ics):
|
||||
""" Creates an ad-hoc network using user inputted settings. """
|
||||
self.wifi.CreateAdHocNetwork(essid, channel, ip, enctype, key, encused,
|
||||
ics)
|
||||
self.wifi.CreateAdHocNetwork(essid, channel, ip, enctype, key, encused)
|
||||
|
||||
@dbus.service.method('org.wicd.daemon.wireless')
|
||||
def GetKillSwitchEnabled(self):
|
||||
@@ -1197,13 +1187,12 @@ class WirelessDaemon(dbus.service.Object):
|
||||
|
||||
class WiredDaemon(dbus.service.Object):
|
||||
""" DBus interface for wired connection operations. """
|
||||
def __init__(self, bus_name, daemon, wired=None, wifi=None, debug=False):
|
||||
def __init__(self, bus_name, daemon, wired=None, debug=False):
|
||||
""" Intitialize the wireless DBus interface. """
|
||||
dbus.service.Object.__init__(self, bus_name=bus_name,
|
||||
object_path="/org/wicd/daemon/wired")
|
||||
self.daemon = daemon
|
||||
self.wired = wired
|
||||
self.wifi = wifi
|
||||
self.debug_mode = debug
|
||||
self.forced_disconnect = False
|
||||
self.WiredNetwork = {}
|
||||
|
||||
Reference in New Issue
Block a user