mirror of
https://github.com/gryf/wicd.git
synced 2026-01-03 12:24:14 +01:00
Initial work on automatic switchover to wired networks (no UI work yet)
actually use "write=True" instead of just "True" everywhere we do config writes explicitly. Fix the scripts dialog not working for wired connections. Force the monitor to update state after triggering a disconnect or connect. Remove an unneeded Scan call from autoconnect.py
This commit is contained in:
@@ -49,7 +49,6 @@ def error_handler(*args):
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
wireless.Scan(True)
|
|
||||||
daemon.SetSuspend(False)
|
daemon.SetSuspend(False)
|
||||||
if not daemon.CheckIfConnecting():
|
if not daemon.CheckIfConnecting():
|
||||||
daemon.AutoConnect(True, reply_handler=handler, error_handler=handler)
|
daemon.AutoConnect(True, reply_handler=handler, error_handler=handler)
|
||||||
|
|||||||
@@ -376,9 +376,8 @@ class WirelessInterface(Interface, wnettools.BaseWirelessInterface):
|
|||||||
False otherwise.
|
False otherwise.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
def error():
|
error= "Unable to find ctrl_interface for wpa_supplicant. " + \
|
||||||
print "Unable to find ctrl_interface for wpa_supplicant. " + \
|
"Could not validate authentication."
|
||||||
"Could not validate authentication."
|
|
||||||
|
|
||||||
# Right now there's no way to do this for ralink drivers
|
# Right now there's no way to do this for ralink drivers
|
||||||
if self.wpa_driver == RALINK_DRIVER:
|
if self.wpa_driver == RALINK_DRIVER:
|
||||||
@@ -389,7 +388,7 @@ class WirelessInterface(Interface, wnettools.BaseWirelessInterface):
|
|||||||
socket = [os.path.join(ctrl_iface, s) \
|
socket = [os.path.join(ctrl_iface, s) \
|
||||||
for s in os.listdir(ctrl_iface) if s == self.iface][0]
|
for s in os.listdir(ctrl_iface) if s == self.iface][0]
|
||||||
except OSError:
|
except OSError:
|
||||||
error()
|
print error
|
||||||
return True
|
return True
|
||||||
|
|
||||||
wpa = wpactrl.WPACtrl(socket)
|
wpa = wpactrl.WPACtrl(socket)
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class ConfigManager(RawConfigParser):
|
|||||||
""" Returns the path to the loaded config file. """
|
""" Returns the path to the loaded config file. """
|
||||||
return self.config_file
|
return self.config_file
|
||||||
|
|
||||||
def set_option(self, section, option, value, save=False):
|
def set_option(self, section, option, value, write=False):
|
||||||
""" Wrapper around ConfigParser.set
|
""" Wrapper around ConfigParser.set
|
||||||
|
|
||||||
Adds the option to write the config file change right away.
|
Adds the option to write the config file change right away.
|
||||||
@@ -65,7 +65,7 @@ class ConfigManager(RawConfigParser):
|
|||||||
value = "%(ws)s%(value)s%(ws)s" % {"value" : value,
|
value = "%(ws)s%(value)s%(ws)s" % {"value" : value,
|
||||||
"ws" : self.mrk_ws}
|
"ws" : self.mrk_ws}
|
||||||
RawConfigParser.set(self, section, str(option), value)
|
RawConfigParser.set(self, section, str(option), value)
|
||||||
if save:
|
if write:
|
||||||
self.write()
|
self.write()
|
||||||
|
|
||||||
def set(self, *args, **kargs):
|
def set(self, *args, **kargs):
|
||||||
@@ -98,7 +98,7 @@ class ConfigManager(RawConfigParser):
|
|||||||
else:
|
else:
|
||||||
if default != "__None__":
|
if default != "__None__":
|
||||||
print 'did not find %s in configuration, setting default %s' % (option, str(default))
|
print 'did not find %s in configuration, setting default %s' % (option, str(default))
|
||||||
self.set(section, option, str(default), save=True)
|
self.set(section, option, str(default), write=True)
|
||||||
ret = default
|
ret = default
|
||||||
else:
|
else:
|
||||||
ret = None
|
ret = None
|
||||||
|
|||||||
@@ -706,15 +706,14 @@ class appGui(object):
|
|||||||
[width, height] = self.window.get_size()
|
[width, height] = self.window.get_size()
|
||||||
try:
|
try:
|
||||||
daemon.WriteWindowSize(width, height, "main")
|
daemon.WriteWindowSize(width, height, "main")
|
||||||
except:
|
daemon.SetGUIOpen(False)
|
||||||
|
except dbusmanager.DBusException:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if self.standalone:
|
if self.standalone:
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
self.is_visible = False
|
self.is_visible = False
|
||||||
daemon.SetGUIOpen(False)
|
|
||||||
self.wait_for_events()
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def show_win(self):
|
def show_win(self):
|
||||||
|
|||||||
@@ -63,20 +63,29 @@ class ConnectionStatus(object):
|
|||||||
self.last_reconnect_time = time.time()
|
self.last_reconnect_time = time.time()
|
||||||
self.signal_changed = False
|
self.signal_changed = False
|
||||||
self.iwconfig = ""
|
self.iwconfig = ""
|
||||||
|
self.trigger_reconnect = False
|
||||||
|
|
||||||
bus = dbusmanager.get_bus()
|
bus = dbusmanager.get_bus()
|
||||||
bus.add_signal_receiver(self._force_update_connection_status,
|
bus.add_signal_receiver(self._force_update_connection_status,
|
||||||
"UpdateState", "org.wicd.daemon")
|
"UpdateState", "org.wicd.daemon")
|
||||||
|
|
||||||
def check_for_wired_connection(self, wired_ip):
|
def check_for_wired_connection(self, wired_ip):
|
||||||
""" Checks for an active wired connection.
|
""" Checks for a wired connection.
|
||||||
|
|
||||||
Checks for and updates the tray icon for an active wired connection
|
Checks for two states:
|
||||||
Returns True if wired connection is active, false if inactive.
|
1) A wired connection is not in use, but a cable is plugged
|
||||||
|
in, and the user has chosen to switch to a wired connection
|
||||||
|
whenever its available, even if already connected to a
|
||||||
|
wireless network
|
||||||
|
|
||||||
|
2) A wired connection is currently active.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
if not wired_ip and daemon.GetPreferWiredNetwork():
|
||||||
|
if not daemon.GetForcedDisconnect() and wired.CheckPluggedIn():
|
||||||
|
self.trigger_reconnect = True
|
||||||
|
|
||||||
if wired_ip and wired.CheckPluggedIn():
|
elif wired_ip and wired.CheckPluggedIn():
|
||||||
# Only change the interface if it's not already set for wired
|
# Only change the interface if it's not already set for wired
|
||||||
if not self.still_wired:
|
if not self.still_wired:
|
||||||
daemon.SetCurrentInterface(daemon.GetWiredInterface())
|
daemon.SetCurrentInterface(daemon.GetWiredInterface())
|
||||||
@@ -89,14 +98,17 @@ class ConnectionStatus(object):
|
|||||||
def check_for_wireless_connection(self, wireless_ip):
|
def check_for_wireless_connection(self, wireless_ip):
|
||||||
""" Checks for an active wireless connection.
|
""" Checks for an active wireless connection.
|
||||||
|
|
||||||
Checks for and updates the tray icon for an active
|
Checks for an active wireless connection. Also notes
|
||||||
wireless connection. Returns True if wireless connection
|
if the signal strength is 0, and if it remains there
|
||||||
is active, and False otherwise.
|
for too long, triggers a wireless disconnect.
|
||||||
|
|
||||||
|
Returns True if wireless connection is active, and
|
||||||
|
False otherwise.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Make sure we have an IP before we do anything else.
|
# Make sure we have an IP before we do anything else.
|
||||||
if wireless_ip is None:
|
if not wireless_ip:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if daemon.NeedsExternalCalls():
|
if daemon.NeedsExternalCalls():
|
||||||
@@ -158,6 +170,15 @@ class ConnectionStatus(object):
|
|||||||
# Check for wired.
|
# Check for wired.
|
||||||
wired_ip = wired.GetWiredIP("")
|
wired_ip = wired.GetWiredIP("")
|
||||||
wired_found = self.check_for_wired_connection(wired_ip)
|
wired_found = self.check_for_wired_connection(wired_ip)
|
||||||
|
# Trigger an AutoConnect if we're plugged in, not connected
|
||||||
|
# to a wired network, and the "autoswitch to wired" option
|
||||||
|
# is on.
|
||||||
|
if self.trigger_reconnect:
|
||||||
|
self.trigger_reconnect = False
|
||||||
|
wireless.DisconnectWireless()
|
||||||
|
daemon.AutoConnect(False, reply_handler=lambda:None,
|
||||||
|
error_handler=lambda:None)
|
||||||
|
return True
|
||||||
if wired_found:
|
if wired_found:
|
||||||
self.update_state(misc.WIRED, wired_ip=wired_ip)
|
self.update_state(misc.WIRED, wired_ip=wired_ip)
|
||||||
return True
|
return True
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ class WiredSettingsDialog(AdvancedSettingsDialog):
|
|||||||
|
|
||||||
def edit_scripts(self, widget=None, event=None):
|
def edit_scripts(self, widget=None, event=None):
|
||||||
""" Launch the script editting dialog. """
|
""" Launch the script editting dialog. """
|
||||||
profile = self.combo_profile_names.get_active_text()
|
profile = self.prof_name
|
||||||
cmdend = [os.path.join(wpath.lib, "configscript.py"), profile, "wired"]
|
cmdend = [os.path.join(wpath.lib, "configscript.py"), profile, "wired"]
|
||||||
if os.getuid() != 0:
|
if os.getuid() != 0:
|
||||||
cmdbase = misc.get_sudo_cmd(language['scripts_need_pass'])
|
cmdbase = misc.get_sudo_cmd(language['scripts_need_pass'])
|
||||||
@@ -695,6 +695,7 @@ class WiredNetworkEntry(NetworkEntry):
|
|||||||
return
|
return
|
||||||
|
|
||||||
profile_name = self.combo_profile_names.get_active_text()
|
profile_name = self.combo_profile_names.get_active_text()
|
||||||
|
self.advanced_dialog.prof_name = profile_name
|
||||||
wired.ReadWiredNetworkProfile(profile_name)
|
wired.ReadWiredNetworkProfile(profile_name)
|
||||||
|
|
||||||
self.advanced_dialog.txt_ip.set_text(self.format_entry("ip"))
|
self.advanced_dialog.txt_ip.set_text(self.format_entry("ip"))
|
||||||
|
|||||||
@@ -741,7 +741,8 @@ class WirelessConnectThread(ConnectThread):
|
|||||||
self.is_connecting = True
|
self.is_connecting = True
|
||||||
|
|
||||||
# Run pre-connection script.
|
# Run pre-connection script.
|
||||||
self.run_script_if_needed(self.before_script, 'pre-connection', self.network['bssid'], self.network['essid'])
|
self.run_script_if_needed(self.before_script, 'pre-connection',
|
||||||
|
self.network['bssid'], self.network['essid'])
|
||||||
|
|
||||||
|
|
||||||
# Take down interface and clean up previous connections.
|
# Take down interface and clean up previous connections.
|
||||||
@@ -783,7 +784,8 @@ class WirelessConnectThread(ConnectThread):
|
|||||||
self.set_dns_addresses()
|
self.set_dns_addresses()
|
||||||
|
|
||||||
# Run post-connection script.
|
# Run post-connection script.
|
||||||
self.run_script_if_needed(self.after_script, 'post-connection', self.network['bssid'], self.network['essid'])
|
self.run_script_if_needed(self.after_script, 'post-connection',
|
||||||
|
self.network['bssid'], self.network['essid'])
|
||||||
|
|
||||||
self.SetStatus('done')
|
self.SetStatus('done')
|
||||||
print 'Connecting thread exiting.'
|
print 'Connecting thread exiting.'
|
||||||
@@ -947,7 +949,8 @@ class WiredConnectThread(ConnectThread):
|
|||||||
self.is_connecting = True
|
self.is_connecting = True
|
||||||
|
|
||||||
# Run pre-connection script.
|
# Run pre-connection script.
|
||||||
self.run_script_if_needed(self.before_script, 'pre-connection', 'wired', 'wired')
|
self.run_script_if_needed(self.before_script, 'pre-connection', 'wired',
|
||||||
|
'wired')
|
||||||
|
|
||||||
# Take down interface and clean up previous connections.
|
# Take down interface and clean up previous connections.
|
||||||
self.put_iface_down(liface)
|
self.put_iface_down(liface)
|
||||||
@@ -965,7 +968,8 @@ class WiredConnectThread(ConnectThread):
|
|||||||
self.set_dns_addresses()
|
self.set_dns_addresses()
|
||||||
|
|
||||||
# Run post-connection script.
|
# Run post-connection script.
|
||||||
self.run_script_if_needed(self.after_script, 'post-connection', 'wired', 'wired')
|
self.run_script_if_needed(self.after_script, 'post-connection', 'wired',
|
||||||
|
'wired')
|
||||||
|
|
||||||
self.SetStatus('done')
|
self.SetStatus('done')
|
||||||
print 'Connecting thread exiting.'
|
print 'Connecting thread exiting.'
|
||||||
|
|||||||
@@ -141,28 +141,28 @@ class WicdDaemon(dbus.service.Object):
|
|||||||
""" Sets the wired interface for the daemon to use. """
|
""" Sets the wired interface for the daemon to use. """
|
||||||
print "setting wired interface %s" % (str(interface))
|
print "setting wired interface %s" % (str(interface))
|
||||||
self.wired.wired_interface = noneToBlankString(interface)
|
self.wired.wired_interface = noneToBlankString(interface)
|
||||||
self.config.set("Settings", "wired_interface", interface, True)
|
self.config.set("Settings", "wired_interface", interface, write=True)
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon')
|
@dbus.service.method('org.wicd.daemon')
|
||||||
def SetWirelessInterface(self, interface):
|
def SetWirelessInterface(self, interface):
|
||||||
""" Sets the wireless interface the daemon will use. """
|
""" Sets the wireless interface the daemon will use. """
|
||||||
print "setting wireless interface %s" % (str(interface))
|
print "setting wireless interface %s" % (str(interface))
|
||||||
self.wifi.wireless_interface = noneToBlankString(interface)
|
self.wifi.wireless_interface = noneToBlankString(interface)
|
||||||
self.config.set("Settings", "wireless_interface", interface, True)
|
self.config.set("Settings", "wireless_interface", interface, write=True)
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon')
|
@dbus.service.method('org.wicd.daemon')
|
||||||
def SetWPADriver(self, driver):
|
def SetWPADriver(self, driver):
|
||||||
""" Sets the wpa driver the wpa_supplicant will use. """
|
""" Sets the wpa driver the wpa_supplicant will use. """
|
||||||
print "setting wpa driver", str(driver)
|
print "setting wpa driver", str(driver)
|
||||||
self.wifi.wpa_driver = driver
|
self.wifi.wpa_driver = driver
|
||||||
self.config.set("Settings", "wpa_driver", driver, True)
|
self.config.set("Settings", "wpa_driver", driver, write=True)
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon')
|
@dbus.service.method('org.wicd.daemon')
|
||||||
def SetUseGlobalDNS(self, use):
|
def SetUseGlobalDNS(self, use):
|
||||||
""" Sets a boolean which determines if global DNS is enabled. """
|
""" Sets a boolean which determines if global DNS is enabled. """
|
||||||
print 'setting use global dns to', use
|
print 'setting use global dns to', use
|
||||||
use = misc.to_bool(use)
|
use = misc.to_bool(use)
|
||||||
self.config.set("Settings", "use_global_dns", use, True)
|
self.config.set("Settings", "use_global_dns", use, write=True)
|
||||||
self.use_global_dns = use
|
self.use_global_dns = use
|
||||||
self.wifi.use_global_dns = use
|
self.wifi.use_global_dns = use
|
||||||
self.wired.use_global_dns = use
|
self.wired.use_global_dns = use
|
||||||
@@ -197,12 +197,11 @@ class WicdDaemon(dbus.service.Object):
|
|||||||
print 'search domain is %s' % search_dom
|
print 'search domain is %s' % search_dom
|
||||||
self.config.write()
|
self.config.write()
|
||||||
|
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon')
|
@dbus.service.method('org.wicd.daemon')
|
||||||
def SetBackend(self, backend):
|
def SetBackend(self, backend):
|
||||||
""" Sets a new backend. """
|
""" Sets a new backend. """
|
||||||
print "setting backend to %s" % backend
|
print "setting backend to %s" % backend
|
||||||
self.config.set("Settings", "backend", backend, True)
|
self.config.set("Settings", "backend", backend, write=True)
|
||||||
if backend != self.GetCurrentBackend():
|
if backend != self.GetCurrentBackend():
|
||||||
self.suspended = True
|
self.suspended = True
|
||||||
self.wifi.LoadBackend(backend)
|
self.wifi.LoadBackend(backend)
|
||||||
@@ -272,7 +271,7 @@ class WicdDaemon(dbus.service.Object):
|
|||||||
@dbus.service.method('org.wicd.daemon')
|
@dbus.service.method('org.wicd.daemon')
|
||||||
def SetDebugMode(self, debug):
|
def SetDebugMode(self, debug):
|
||||||
""" Sets if debugging mode is on or off. """
|
""" Sets if debugging mode is on or off. """
|
||||||
self.config.set("Settings", "debug_mode", debug, True)
|
self.config.set("Settings", "debug_mode", debug, write=True)
|
||||||
self.debug_mode = misc.to_bool(debug)
|
self.debug_mode = misc.to_bool(debug)
|
||||||
self.wifi.debug = self.debug_mode
|
self.wifi.debug = self.debug_mode
|
||||||
self.wired.debug = self.debug_mode
|
self.wired.debug = self.debug_mode
|
||||||
@@ -352,7 +351,8 @@ class WicdDaemon(dbus.service.Object):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
print 'setting automatically reconnect when connection drops %s' % value
|
print 'setting automatically reconnect when connection drops %s' % value
|
||||||
self.config.set("Settings", "auto_reconnect", misc.to_bool(value), True)
|
self.config.set("Settings", "auto_reconnect", misc.to_bool(value),
|
||||||
|
write=True)
|
||||||
self.auto_reconnect = misc.to_bool(value)
|
self.auto_reconnect = misc.to_bool(value)
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon')
|
@dbus.service.method('org.wicd.daemon')
|
||||||
@@ -453,7 +453,7 @@ class WicdDaemon(dbus.service.Object):
|
|||||||
@dbus.service.method('org.wicd.daemon')
|
@dbus.service.method('org.wicd.daemon')
|
||||||
def SetSignalDisplayType(self, value):
|
def SetSignalDisplayType(self, value):
|
||||||
""" Sets the signal display type and writes it the wicd config file. """
|
""" Sets the signal display type and writes it the wicd config file. """
|
||||||
self.config.set("Settings", "signal_display_type", value, True)
|
self.config.set("Settings", "signal_display_type", value, write=True)
|
||||||
self.signal_display_type = int(value)
|
self.signal_display_type = int(value)
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon')
|
@dbus.service.method('org.wicd.daemon')
|
||||||
@@ -483,7 +483,7 @@ class WicdDaemon(dbus.service.Object):
|
|||||||
def SetAlwaysShowWiredInterface(self, value):
|
def SetAlwaysShowWiredInterface(self, value):
|
||||||
""" Sets always_show_wired_interface to the given value. """
|
""" Sets always_show_wired_interface to the given value. """
|
||||||
self.config.set("Settings", "always_show_wired_interface",
|
self.config.set("Settings", "always_show_wired_interface",
|
||||||
misc.to_bool(value), True)
|
misc.to_bool(value), write=True)
|
||||||
self.always_show_wired_interface = misc.to_bool(value)
|
self.always_show_wired_interface = misc.to_bool(value)
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon')
|
@dbus.service.method('org.wicd.daemon')
|
||||||
@@ -497,7 +497,8 @@ class WicdDaemon(dbus.service.Object):
|
|||||||
# 1 = default profile
|
# 1 = default profile
|
||||||
# 2 = show list
|
# 2 = show list
|
||||||
# 3 = last used profile
|
# 3 = last used profile
|
||||||
self.config.set("Settings","wired_connect_mode", int(method), True)
|
self.config.set("Settings","wired_connect_mode", int(method),
|
||||||
|
write=True)
|
||||||
self.wired_connect_mode = int(method)
|
self.wired_connect_mode = int(method)
|
||||||
self.wired_bus.connect_mode = int(method)
|
self.wired_bus.connect_mode = int(method)
|
||||||
|
|
||||||
@@ -505,9 +506,8 @@ class WicdDaemon(dbus.service.Object):
|
|||||||
def GetWiredAutoConnectMethod(self):
|
def GetWiredAutoConnectMethod(self):
|
||||||
""" Returns the wired autoconnect method. """
|
""" Returns the wired autoconnect method. """
|
||||||
return int(self.wired_connect_mode)
|
return int(self.wired_connect_mode)
|
||||||
|
|
||||||
|
@dbus.service.method('org.wicd.daemon')
|
||||||
@dbus.service.method('org.wicd.dameon')
|
|
||||||
def GetPreferWiredNetwork(self):
|
def GetPreferWiredNetwork(self):
|
||||||
""" Returns True if wired network preference is set.
|
""" Returns True if wired network preference is set.
|
||||||
|
|
||||||
@@ -520,6 +520,7 @@ class WicdDaemon(dbus.service.Object):
|
|||||||
@dbus.service.method('org.wicd.daemon')
|
@dbus.service.method('org.wicd.daemon')
|
||||||
def SetPreferWiredNetwork(self, value):
|
def SetPreferWiredNetwork(self, value):
|
||||||
""" Sets the prefer_wired state. """
|
""" Sets the prefer_wired state. """
|
||||||
|
self.config.set("Settings", "prefer_wired", bool(value), write=True)
|
||||||
self.prefer_wired = bool(value)
|
self.prefer_wired = bool(value)
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon')
|
@dbus.service.method('org.wicd.daemon')
|
||||||
@@ -589,7 +590,7 @@ class WicdDaemon(dbus.service.Object):
|
|||||||
self.dhcp_client = int(client)
|
self.dhcp_client = int(client)
|
||||||
self.wifi.dhcp_client = int(client)
|
self.wifi.dhcp_client = int(client)
|
||||||
self.wired.dhcp_client = int(client)
|
self.wired.dhcp_client = int(client)
|
||||||
self.config.set("Settings", "dhcp_client", client, True)
|
self.config.set("Settings", "dhcp_client", client, write=True)
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon')
|
@dbus.service.method('org.wicd.daemon')
|
||||||
def GetLinkDetectionTool(self):
|
def GetLinkDetectionTool(self):
|
||||||
@@ -609,7 +610,7 @@ class WicdDaemon(dbus.service.Object):
|
|||||||
"""
|
"""
|
||||||
self.link_detect_tool = int(link_tool)
|
self.link_detect_tool = int(link_tool)
|
||||||
self.wired.link_tool = int(link_tool)
|
self.wired.link_tool = int(link_tool)
|
||||||
self.config.set("Settings", "link_detect_tool", link_tool, True)
|
self.config.set("Settings", "link_detect_tool", link_tool, write=True)
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon')
|
@dbus.service.method('org.wicd.daemon')
|
||||||
def GetFlushTool(self):
|
def GetFlushTool(self):
|
||||||
@@ -628,7 +629,7 @@ class WicdDaemon(dbus.service.Object):
|
|||||||
self.flush_tool = int(flush_tool)
|
self.flush_tool = int(flush_tool)
|
||||||
self.wired.flush_tool = int(flush_tool)
|
self.wired.flush_tool = int(flush_tool)
|
||||||
self.wifi.flush_tool = int(flush_tool)
|
self.wifi.flush_tool = int(flush_tool)
|
||||||
self.config.set("Settings", "flush_tool", flush_tool, True)
|
self.config.set("Settings", "flush_tool", flush_tool, write=True)
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon')
|
@dbus.service.method('org.wicd.daemon')
|
||||||
def WriteWindowSize(self, width, height, win_name):
|
def WriteWindowSize(self, width, height, win_name):
|
||||||
@@ -1018,6 +1019,7 @@ class WirelessDaemon(dbus.service.Object):
|
|||||||
""" Disconnects the wireless network. """
|
""" Disconnects the wireless network. """
|
||||||
self.SetForcedDisconnect(True)
|
self.SetForcedDisconnect(True)
|
||||||
self.wifi.Disconnect()
|
self.wifi.Disconnect()
|
||||||
|
self.daemon.UpdateState()
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon.wireless')
|
@dbus.service.method('org.wicd.daemon.wireless')
|
||||||
def GetForcedDisconnect(self):
|
def GetForcedDisconnect(self):
|
||||||
@@ -1100,6 +1102,7 @@ class WirelessDaemon(dbus.service.Object):
|
|||||||
'disconnectscript')
|
'disconnectscript')
|
||||||
print 'Connecting to wireless network ' + self.LastScan[id]['essid']
|
print 'Connecting to wireless network ' + self.LastScan[id]['essid']
|
||||||
conthread = self.wifi.Connect(self.LastScan[id], debug=self.debug_mode)
|
conthread = self.wifi.Connect(self.LastScan[id], debug=self.debug_mode)
|
||||||
|
self.daemon.UpdateState()
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon.wireless')
|
@dbus.service.method('org.wicd.daemon.wireless')
|
||||||
def CheckIfWirelessConnecting(self):
|
def CheckIfWirelessConnecting(self):
|
||||||
@@ -1354,6 +1357,7 @@ class WiredDaemon(dbus.service.Object):
|
|||||||
""" Disconnects the wired network. """
|
""" Disconnects the wired network. """
|
||||||
self.SetForcedDisconnect(True)
|
self.SetForcedDisconnect(True)
|
||||||
self.wired.Disconnect()
|
self.wired.Disconnect()
|
||||||
|
self.daemon.UpdateState()
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon.wired')
|
@dbus.service.method('org.wicd.daemon.wired')
|
||||||
def CheckPluggedIn(self):
|
def CheckPluggedIn(self):
|
||||||
@@ -1402,6 +1406,7 @@ class WiredDaemon(dbus.service.Object):
|
|||||||
self.wired.after_script = self.GetWiredProperty("afterscript")
|
self.wired.after_script = self.GetWiredProperty("afterscript")
|
||||||
self.wired.disconnect_script = self.GetWiredProperty("disconnectscript")
|
self.wired.disconnect_script = self.GetWiredProperty("disconnectscript")
|
||||||
self.wired.Connect(self.WiredNetwork, debug=self.debug_mode)
|
self.wired.Connect(self.WiredNetwork, debug=self.debug_mode)
|
||||||
|
self.daemon.UpdateState()
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon.wired')
|
@dbus.service.method('org.wicd.daemon.wired')
|
||||||
def CreateWiredNetworkProfile(self, profilename, default=False):
|
def CreateWiredNetworkProfile(self, profilename, default=False):
|
||||||
@@ -1474,6 +1479,7 @@ class WiredDaemon(dbus.service.Object):
|
|||||||
self.config.set(prof, script, None)
|
self.config.set(prof, script, None)
|
||||||
|
|
||||||
if profilename == "":
|
if profilename == "":
|
||||||
|
self.config.write()
|
||||||
return "500: Bad Profile name"
|
return "500: Bad Profile name"
|
||||||
profilename = misc.to_unicode(profilename)
|
profilename = misc.to_unicode(profilename)
|
||||||
self.config.remove_section(profilename)
|
self.config.remove_section(profilename)
|
||||||
|
|||||||
Reference in New Issue
Block a user