mirror of
https://github.com/gryf/wicd.git
synced 2026-02-13 04:15:51 +01:00
Fixed crash bug in script configuration dialog when a network doesn't have script options written in the config file yet.
Refactored networking.py to not have to create a new wnettools interface every time a method gets called. Now it reuses the same one and makes changes to the iface name/driver as needed. Refactored a few methods in wnettools.py to be organized more logically and reduce external program calls. In experimental branch, added a few methods to networking/wnettools that can be used for enabling/disabling interfaces, as well as unloading/loading the driver associated with an interface. Added a check for mii-tool/ethtool that gets run when wicd starts, so it can decide which to use to check for a wired connection. Added a check for ip, to decide how to flush the routing tables. Rewrote some of the DHCP client checking code. Added a method (that's currently unused) to release a dhcp lease for each of the supported clients.
This commit is contained in:
@@ -82,6 +82,12 @@ def blank_to_none(text):
|
||||
return "None"
|
||||
else:
|
||||
return str(text)
|
||||
|
||||
def get_val(con, network, val, default="None"):
|
||||
if not con.has_option(network, val):
|
||||
con.set(network, val, default)
|
||||
return con.get(network, val)
|
||||
|
||||
|
||||
def get_script_info(network, network_type):
|
||||
""" Read script info from disk and load it into the configuration dialog """
|
||||
@@ -90,17 +96,16 @@ def get_script_info(network, network_type):
|
||||
if network_type == "wired":
|
||||
con.read(wired_conf)
|
||||
if con.has_section(network):
|
||||
info["pre_entry"] = con.get(network, "beforescript")
|
||||
info["post_entry"] = con.get(network, "afterscript")
|
||||
info["disconnect_entry"] = con.get(network, "disconnectscript")
|
||||
info["pre_entry"] = get_val(con, network, "beforescript")
|
||||
info["post_entry"] = get_val(con, network, "afterscript")
|
||||
info["disconnect_entry"] = get_val(con, network, "disconnectscript")
|
||||
else:
|
||||
bssid = wireless.GetWirelessProperty(int(network), "bssid")
|
||||
con.read(wireless_conf)
|
||||
if con.has_section(bssid):
|
||||
info["pre_entry"] = con.get(bssid, "beforescript")
|
||||
info["post_entry"] = con.get(bssid, "afterscript")
|
||||
info["disconnect_entry"] = con.get(bssid, "disconnectscript")
|
||||
|
||||
info["pre_entry"] = get_val(con, bssid, "beforescript")
|
||||
info["post_entry"] = get_val(con, bssid, "afterscript")
|
||||
info["disconnect_entry"] = get_val(con, bssid, "disconnectscript")
|
||||
return info
|
||||
|
||||
def write_scripts(network, network_type, script_info):
|
||||
|
||||
Reference in New Issue
Block a user