1
0
mirror of https://github.com/gryf/wicd.git synced 2026-02-12 20:05:49 +01:00

Added support for putting interfaces up/down through the gui.

This commit is contained in:
imdano
2008-03-04 14:06:04 +00:00
parent 7de302fa1c
commit a2dedaaa03
5 changed files with 192 additions and 40 deletions

View File

@@ -392,6 +392,20 @@ class Interface(object):
#if self.verbose: print cmd
output = misc.Run(cmd)
return misc.RunRegex(ip_pattern, output)
def IsUp(self):
""" Determines if the interface is up. """
cmd = "ifconfig " + self.iface
output = misc.Run(cmd)
lines = output.split('\n')
if len(lines) < 5:
return False
for line in lines[1:4]:
if line.strip().startswith('UP'):
return True
return False
class WiredInterface(Interface):
@@ -451,20 +465,6 @@ class WiredInterface(Interface):
return True
else:
return False
def IsUp(self):
""" Determines if the interface is up. """
cmd = "ifconfig " + self.iface
output = misc.Run(cmd)
lines = output.split('\n')
if len(lines) < 5:
return False
for line in lines[1:4]:
if line.strip().startswith('UP'):
return True
return False
class WirelessInterface(Interface):