mirror of
https://github.com/gryf/wicd.git
synced 2025-12-22 14:07:59 +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:
15
misc.py
15
misc.py
@@ -167,8 +167,9 @@ def ParseEncryption(network):
|
||||
x = x.replace("$_" + str(t).upper(), str(network[t]))
|
||||
z = z + "\n" + x
|
||||
y += 1
|
||||
# Write the data to the files
|
||||
# then chmod them so they can't be read by normal users
|
||||
|
||||
# Write the data to the files then chmod them so they can't be read
|
||||
# by normal users.
|
||||
file = open(wpath.networks + network["bssid"].replace(":", "").lower(),
|
||||
"w")
|
||||
os.chmod(wpath.networks + network["bssid"].replace(":", "").lower(), 0600)
|
||||
@@ -207,14 +208,14 @@ def LoadEncryptionMethods():
|
||||
index = -1
|
||||
for current in requiredFields:
|
||||
# The pretty names will start with an * so we can
|
||||
# seperate them with that
|
||||
# separate them with that.
|
||||
if current[0] == "*":
|
||||
# Make underscores spaces
|
||||
# and remove the *
|
||||
encryptionTypes[typeID][2][index][0] = current.replace("_",
|
||||
" ").lstrip("*")
|
||||
else:
|
||||
# Add to the list of things that are required
|
||||
# Add to the list of things that are required.
|
||||
index = len(encryptionTypes[typeID][2])
|
||||
encryptionTypes[typeID][2][index] = {}
|
||||
encryptionTypes[typeID][2][index][1] = current
|
||||
@@ -252,7 +253,6 @@ def get_gettext():
|
||||
_ = lang.gettext
|
||||
return _
|
||||
|
||||
|
||||
def to_unicode(x):
|
||||
""" Attempts to convert a string to unicode """
|
||||
try: # This may never fail, but let's be safe
|
||||
@@ -270,12 +270,13 @@ def to_unicode(x):
|
||||
def error(parent, message):
|
||||
""" Shows an error dialog """
|
||||
dialog = gtk.MessageDialog(parent, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR,
|
||||
gtk.BUTTONS_OK)
|
||||
gtk.BUTTONS_OK)
|
||||
dialog.set_markup(message)
|
||||
dialog.run()
|
||||
dialog.destroy()
|
||||
|
||||
class LogWriter():
|
||||
|
||||
class LogWriter:
|
||||
""" A class to provide timestamped logging. """
|
||||
def __init__(self):
|
||||
self.file = open(wpath.log + 'wicd.log','a')
|
||||
|
||||
Reference in New Issue
Block a user