1
0
mirror of https://github.com/gryf/wicd.git synced 2026-02-03 14:55:50 +01:00

experimental:

- Some minor cleanup/formatting fixes
- Add a missing DetectWiredInterfaces() method to networking.py
This commit is contained in:
imdano
2008-08-24 08:15:24 +00:00
parent 0844386017
commit 37838ba057
4 changed files with 14 additions and 11 deletions

View File

@@ -1402,7 +1402,6 @@ def main(argv):
sys.exit(2)
no_poll = False
scan_interval = "120000"
for o, a in opts:
if o in ('-h', '--help'):
usage()
@@ -1437,8 +1436,7 @@ def main(argv):
gobject.threads_init()
if not no_poll:
(child_pid, x, x, x) = gobject.spawn_async([wpath.bin + "monitor.py",
scan_interval],
(child_pid, x, x, x) = gobject.spawn_async([wpath.bin + "monitor.py"],
flags=gobject.SPAWN_CHILD_INHERITS_STDIN)
signal.signal(signal.SIGTERM, sigterm_caught)

View File

@@ -407,7 +407,7 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
if ID == -1:
self.combo_encryption.set_active(0)
ID = 0
opts = methods[ID][2]
for x in opts:
box = None
@@ -417,9 +417,9 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
box = LabelEntry(opts[x][0].replace('_',' '))
box.set_auto_hidden(True)
self.vbox_encrypt_info.pack_start(box)
#add the data to any array, so that the information
#can be easily accessed by giving the name of the wanted
#data
# Add the data to any array, so that the information
# can be easily accessed by giving the name of the wanted
# data.
self.encryption_info[opts[x][1]] = box.entry
box.entry.set_text(noneToBlankString(

View File

@@ -800,6 +800,13 @@ class Wired(Controller):
self.connecting_thread.setDaemon(True)
self.connecting_thread.start()
return True
def DetectWiredInterface(self):
""" Attempts to automatically detect a wired interface. """
try:
return wnettools.GetWiredInterfaces()[0]
except IndexError:
return None
def GetIP(self, fast=False):
""" Get the IP of the interface.

View File

@@ -80,10 +80,10 @@ SIOCGIWAP = 0x8B15
def _sanitize_string(string):
blacklist = [';', '`', '$', '!', '*', '|', '>', '<']
new_string = []
if not string:
return string
for c in string:
if c in blacklist:
new_string.append("\\" + c)
@@ -273,8 +273,6 @@ class Interface(object):
client = "pump"
return client
print 'checking dhcp...'
if self.DHCP_CLIENT:
dhcp_client = get_client_name(self.DHCP_CLIENT)
dhcp_path = self._find_client_path(dhcp_client)