1
0
mirror of https://github.com/gryf/wicd.git synced 2026-01-07 14:24:22 +01:00

Merged with r262 of mainline 1.6, which adds some bugfixes and the translations I need for my next commit.

This commit is contained in:
Andrew Psaltis
2009-01-26 23:43:40 -05:00
5 changed files with 40 additions and 19 deletions

View File

@@ -484,7 +484,7 @@ class WirelessInterface(Interface, wnettools.BaseWirelessInterface):
if self.verbose: print cmd
misc.Run(cmd)
def GetBSSID(self):
def GetBSSID(self, iwconfig=None):
""" Get the MAC address for the interface. """
if not self.iface: return ""
data = (self.iface + '\0' * 32)[:32]

View File

@@ -527,6 +527,7 @@ class appGui(object):
instruct_label = self.wTree.get_widget("label_instructions")
if num_networks > 0:
instruct_label.show()
dbus_ifaces = dbusmanager.get_dbus_ifaces()
for x in range(0, num_networks):
if printLine:
sep = gtk.HSeparator()
@@ -535,7 +536,7 @@ class appGui(object):
sep.show()
else:
printLine = True
tempnet = WirelessNetworkEntry(x, dbusmanager.get_dbus_ifaces())
tempnet = WirelessNetworkEntry(x, dbus_ifaces)
self.network_list.pack_start(tempnet, False, False)
tempnet.connect_button.connect("button-press-event",
self.connect, "wireless", x,

View File

@@ -292,7 +292,7 @@ def noneToString(text):
return "None"
else:
return str(text)
def get_gettext():
""" Set up gettext for translations. """
# Borrowed from an excellent post on how to do this at
@@ -541,9 +541,20 @@ def get_language_list_gui():
"This typically means there was a problem starting the daemon. " + \
"Check the wicd log for more info")
language['lost_dbus'] = _("The wicd daemon has shut down, the UI will not function properly until it is restarted.")
language['configuring_wireless'] = ("Configuring preferences for wireless network \"$A\" ($B)")
language['configuring_wired'] = ("Configuring preferences for wired profile \"$A\"")
language['configuring_wireless'] = _("Configuring preferences for wireless network \"$A\" ($B)")
language['configuring_wired'] = _("Configuring preferences for wired profile \"$A\"")
language['scan'] = _('Scan')
language['always_switch_to_wired'] = _("Always switch to wired connection when available")
language['wired_autoconnect_settings'] = _("Wired Autoconnect Settings")
language['always_use_wext'] = _("You should almost always use wext as the WPA supplicant driver")
language['debugging'] = _("Debugging")
language['wpa_supplicant'] = _("WPA Supplicant")
language['automatic_reconnection'] = _("Automatic Reconnection")
language['global_dns_servers'] = _("Global DNS servers")
language['network_interfaces'] = _("Network Interfaces")
language['connecting_to_daemon'] = _("Connecting to daemon...")
langauge['cannot_connect_to_daemon'] = _("Can't connect to the daemon, trying to start it automatically...")
language['could_not_connect'] = _("Could not connect to wicd's D-Bus interface. Check the wicd log for error messages.")
return language
def get_language_list_tray():

View File

@@ -174,16 +174,12 @@ class Controller(object):
"""
return self.iface.GetIP(ifconfig)
def Disconnect(self):
def Disconnect(self, *args, **kargs):
""" Disconnect from the network. """
iface = self.iface
if self.disconnect_script != None:
print 'Running wired disconnect script'
iwconfig = self.GetIwconfig()
misc.ExecuteScript(expand_script_macros(self.disconnect_script, 'disconnection',
self.wiface.GetBSSID( iwconfig ),
self.wiface.GetCurrentNetwork( iwconfig ) ))
print 'Running disconnect script'
misc.ExecuteScript(expand_script_macros(self.disconnect_script, 'disconnection', *args))
iface.ReleaseDHCP()
iface.SetAddress('0.0.0.0')
iface.Down()
@@ -685,7 +681,14 @@ class Wireless(Controller):
Resets it's IP address, and puts the interface down then up.
"""
Controller.Disconnect(self)
if BACKEND.NeedsExternalCalls():
iwconfig = self.GetIwconfig()
else:
iwconfig = None
bssid = self.wiface.GetBSSID(iwconfig),
essid = self.wiface.GetCurrentNetwork(iwconfig)
Controller.Disconnect(self, bssid, essid)
self.StopWPA()
def SetWPADriver(self, driver):
@@ -894,6 +897,9 @@ class Wired(Controller):
self.connecting_thread.start()
return self.connecting_thread
def Disconnect(self):
Controller.Disconnect(self, 'wired', 'wired')
def DetectWiredInterface(self):
""" Attempts to automatically detect a wired interface. """
try:

View File

@@ -483,12 +483,15 @@ class BaseInterface(object):
def FlushRoutes(self):
""" Flush all network routes. """
if not self.iface: return False
if self.IP_FOUND and self.flush_tool != misc.ROUTE:
cmd = "ip route flush dev " + self.iface
if self.IP_FOUND and self.flush_tool == misc.IP:
#cmd = "ip route flush dev " + self.iface
cmds = ['ip route flush all']
else:
cmd = 'route del dev ' + self.iface
if self.verbose: print cmd
misc.Run(cmd)
cmds = ['route del default']
cmds.append('route del dev %s' % self.iface)
for cmd in cmds:
if self.verbose: print cmd
misc.Run(cmd)
def SetDefaultRoute(self, gw):
""" Add a default route with the specified gateway.