mirror of
https://github.com/gryf/wicd.git
synced 2025-12-20 21:08:06 +01:00
Merged mainline r297 of 1.6.
This commit is contained in:
@@ -897,7 +897,7 @@ def main():
|
|||||||
('green','dark green','default'),
|
('green','dark green','default'),
|
||||||
('blue','dark blue','default'),
|
('blue','dark blue','default'),
|
||||||
('red','dark red','default'),
|
('red','dark red','default'),
|
||||||
('bold','white','default','bold')])
|
('bold','white','black','bold')])
|
||||||
# This is a wrapper around a function that calls another a function that is a
|
# This is a wrapper around a function that calls another a function that is a
|
||||||
# wrapper around a infinite loop. Fun.
|
# wrapper around a infinite loop. Fun.
|
||||||
ui.run_wrapper(run)
|
ui.run_wrapper(run)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
.\" Written by Robby Workman <rworkman@slackware.com>
|
.\" Written by Robby Workman <rworkman@slackware.com>
|
||||||
.TH WICD-MANAGER-SETTINGS.CONF 5 "June 2008" "wicd-%VERSION%"
|
.TH WICD-MANAGER-SETTINGS.CONF 5 "wicd-%VERSION%"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
wicd-manager-settings.conf \- contains settings that control Wicd's behavior
|
wicd-manager-settings.conf \- contains settings that control Wicd's behavior
|
||||||
|
|
||||||
@@ -26,6 +26,9 @@ This file is located at %ETC%manager-settings.conf
|
|||||||
.br
|
.br
|
||||||
2 = route
|
2 = route
|
||||||
.TP
|
.TP
|
||||||
|
.BI "backend = " <ioctl|external>
|
||||||
|
Default is ioctl backend.
|
||||||
|
.TP
|
||||||
.BI "signal_display_type = " <0|1>
|
.BI "signal_display_type = " <0|1>
|
||||||
0 = Show signal strength as a percentage
|
0 = Show signal strength as a percentage
|
||||||
.br
|
.br
|
||||||
@@ -37,8 +40,18 @@ This file is located at %ETC%manager-settings.conf
|
|||||||
1 = dhclient
|
1 = dhclient
|
||||||
.br
|
.br
|
||||||
2 = dhcpcd
|
2 = dhcpcd
|
||||||
|
.br
|
||||||
3 = pump
|
3 = pump
|
||||||
.TP
|
.TP
|
||||||
|
.BI "sudo_app = " <0|1|2|3>
|
||||||
|
0 = autodetect
|
||||||
|
.br
|
||||||
|
1 = gksu
|
||||||
|
.br
|
||||||
|
2 = kdesu
|
||||||
|
.br
|
||||||
|
3 = ktsuss
|
||||||
|
.TP
|
||||||
.BI "wired_interface = " <interface_name>
|
.BI "wired_interface = " <interface_name>
|
||||||
.TP
|
.TP
|
||||||
.BI "always_show_wired_interface = " <True|False>
|
.BI "always_show_wired_interface = " <True|False>
|
||||||
@@ -48,6 +61,11 @@ This file is located at %ETC%manager-settings.conf
|
|||||||
.br
|
.br
|
||||||
1 = do not connect to wired interface automatically
|
1 = do not connect to wired interface automatically
|
||||||
.TP
|
.TP
|
||||||
|
.BI "prefer_wired = " <True|False>
|
||||||
|
True = Switch to wired interface if a link is detected, even if already connected to wireless
|
||||||
|
.br
|
||||||
|
False = Do not switch to wired interface automatically
|
||||||
|
.TP
|
||||||
.BI "wireless_interface = " <name_of_wireless_interface>
|
.BI "wireless_interface = " <name_of_wireless_interface>
|
||||||
.TP
|
.TP
|
||||||
.BI "wpa_driver = " <wext|madwifi|ndiswrapper|hostap|hermes|atmel|broadcom|ipw|ralink legacy>
|
.BI "wpa_driver = " <wext|madwifi|ndiswrapper|hostap|hermes|atmel|broadcom|ipw|ralink legacy>
|
||||||
@@ -60,6 +78,9 @@ This settings determines whether Wicd will attempt to reconnect on connection lo
|
|||||||
If set to "True" and values are specified in the global DNS settings below,
|
If set to "True" and values are specified in the global DNS settings below,
|
||||||
this will cause Wicd to use these DNS settings.
|
this will cause Wicd to use these DNS settings.
|
||||||
.TP
|
.TP
|
||||||
|
.BI "global_dns_dom = " <plaintext_domain_name>
|
||||||
|
This specifies the default search domain to be used by the resolver.
|
||||||
|
.TP
|
||||||
.BI "global_dns_1 = " <ip_address>
|
.BI "global_dns_1 = " <ip_address>
|
||||||
.TP
|
.TP
|
||||||
.BI "global_dns_2 = " <ip_address>
|
.BI "global_dns_2 = " <ip_address>
|
||||||
@@ -86,6 +107,7 @@ This determines the width of the "Preferences" window when launched from the cli
|
|||||||
|
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
.BR wicd (8),
|
.BR wicd (8),
|
||||||
|
.BR wicd-curses (8),
|
||||||
.BR wicd-wired-settings.conf (5),
|
.BR wicd-wired-settings.conf (5),
|
||||||
.BR wicd-wireless-settings.conf (5).
|
.BR wicd-wireless-settings.conf (5).
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
.\" Written by Robby Workman <rworkman@slackware.com>
|
.\" Written by Robby Workman <rworkman@slackware.com>
|
||||||
.TH WICD-WIRED-SETTINGS.CONF 5 "June 2008" "wicd-%VERSION%"
|
.TH WICD-WIRED-SETTINGS.CONF 5 "wicd-%VERSION%"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
wicd-wired-settings.conf \- controls Wicd's wired network settings
|
wicd-wired-settings.conf \- controls Wicd's wired network settings
|
||||||
|
|
||||||
@@ -70,6 +70,7 @@ Static DNS address if "use_static_dns = True" and "use_global_dns = False"
|
|||||||
|
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
.BR wicd (8),
|
.BR wicd (8),
|
||||||
|
.BR wicd-curses (8),
|
||||||
.BR wicd-manager-settings.conf (5),
|
.BR wicd-manager-settings.conf (5),
|
||||||
.BR wicd-wireless-settings.conf (5).
|
.BR wicd-wireless-settings.conf (5).
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
.\" Written by Robby Workman <rworkman@slackware.com>
|
.\" Written by Robby Workman <rworkman@slackware.com>
|
||||||
.TH WICD-WIRELESS-SETTINGS.CONF 5 "June 2008" "wicd-%VERSION%"
|
.TH WICD-WIRELESS-SETTINGS.CONF 5 "wicd-%VERSION%"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
wicd-wired-settings.conf \- controls Wicd's wireless network settings
|
wicd-wired-settings.conf \- controls Wicd's wireless network settings
|
||||||
|
|
||||||
@@ -122,6 +122,7 @@ of the stanza will be in this format:
|
|||||||
|
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
.BR wicd (8),
|
.BR wicd (8),
|
||||||
|
.BR wicd-curses (8),
|
||||||
.BR wicd-manager-settings.conf (5),
|
.BR wicd-manager-settings.conf (5),
|
||||||
.BR wicd-wired-settings.conf (5).
|
.BR wicd-wired-settings.conf (5).
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
.\" Written by Robby Workman <rworkman@slackware.com>
|
.\" Written by Robby Workman <rworkman@slackware.com>
|
||||||
.TH WICD 8 "June 2008" "wicd-%VERSION%"
|
.TH WICD 8 "wicd-%VERSION%"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.B Wicd
|
.B Wicd
|
||||||
\- Wired and Wireless Network Connection Manager
|
\- Wired and Wireless Network Connection Manager
|
||||||
@@ -139,6 +139,7 @@ log if you are having connection or other problems.
|
|||||||
.BR wicd-manager-settings.conf (5),
|
.BR wicd-manager-settings.conf (5),
|
||||||
.BR wicd-wired-settings.conf (5),
|
.BR wicd-wired-settings.conf (5),
|
||||||
.BR wicd-wireless-settings.conf (5),
|
.BR wicd-wireless-settings.conf (5),
|
||||||
|
.BR wicd-curses (8),
|
||||||
.BR ifconfig (8),
|
.BR ifconfig (8),
|
||||||
.BR iwconfig (8),
|
.BR iwconfig (8),
|
||||||
.BR wpa_supplicant (8),
|
.BR wpa_supplicant (8),
|
||||||
@@ -155,6 +156,8 @@ log if you are having connection or other problems.
|
|||||||
Adam Blackburn <compwiz18@gmail.com>
|
Adam Blackburn <compwiz18@gmail.com>
|
||||||
.br
|
.br
|
||||||
Dan O'Reilly <oreilldf@gmail.com>
|
Dan O'Reilly <oreilldf@gmail.com>
|
||||||
|
.br
|
||||||
|
Andrew Psaltis <insertmail@here> (curses client)
|
||||||
|
|
||||||
.SH MANPAGE AUTHOR
|
.SH MANPAGE AUTHOR
|
||||||
Robby Workman <rworkman@slackware.com>
|
Robby Workman <rworkman@slackware.com>
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Stop daemon
|
|
||||||
if [ -f %INIT%%INITFILENAME% ]; then
|
|
||||||
%INIT%%INITFILENAME% stop
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Remove Wicd from the boot sequence
|
|
||||||
if which update-rc.d &>/dev/null ; then
|
|
||||||
update-rc.d -f wicd remove
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Remove pyc files
|
|
||||||
# They may exist if you are upgrading Wicd
|
|
||||||
rm -f /opt/wicd/*.pyc
|
|
||||||
|
|
||||||
# Add Wicd to the startup sequence
|
|
||||||
# 80 to make sure that dbus is running when Wicd starts
|
|
||||||
if which update-rc.d &>/dev/null ; then
|
|
||||||
update-rc.d wicd start 80 2 3 4 5 . stop 20 0 1 6 .
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Start the daemon
|
|
||||||
if [ -f %INIT%%INITFILENAME% ]; then
|
|
||||||
%INIT%%INITFILENAME% start
|
|
||||||
fi
|
|
||||||
20
wicd/gui.py
20
wicd/gui.py
@@ -197,6 +197,7 @@ class appGui(object):
|
|||||||
self.connecting = False
|
self.connecting = False
|
||||||
self.refreshing = False
|
self.refreshing = False
|
||||||
self.prev_state = None
|
self.prev_state = None
|
||||||
|
self.update_cb = None
|
||||||
self.network_list.set_sensitive(False)
|
self.network_list.set_sensitive(False)
|
||||||
label = gtk.Label("%s..." % language['scanning'])
|
label = gtk.Label("%s..." % language['scanning'])
|
||||||
self.network_list.pack_start(label)
|
self.network_list.pack_start(label)
|
||||||
@@ -356,10 +357,11 @@ class appGui(object):
|
|||||||
if not self.is_visible:
|
if not self.is_visible:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
daemon.UpdateState()
|
||||||
if self.connecting:
|
if self.connecting:
|
||||||
|
# If we're connecting, don't wait for the monitor to send
|
||||||
|
# us a signal, since it won't until the connection is made.
|
||||||
self._do_statusbar_update(*daemon.GetConnectionStatus())
|
self._do_statusbar_update(*daemon.GetConnectionStatus())
|
||||||
else:
|
|
||||||
daemon.UpdateState()
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _do_statusbar_update(self, state, info):
|
def _do_statusbar_update(self, state, info):
|
||||||
@@ -377,12 +379,16 @@ class appGui(object):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def set_wired_state(self, info):
|
def set_wired_state(self, info):
|
||||||
self._set_not_connecting_state()
|
if self.connecting:
|
||||||
|
# Adjust our state from connecting->connected.
|
||||||
|
self._set_not_connecting_state()
|
||||||
self.set_status(language['connected_to_wired'].replace('$A', info[0]))
|
self.set_status(language['connected_to_wired'].replace('$A', info[0]))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def set_wireless_state(self, info):
|
def set_wireless_state(self, info):
|
||||||
self._set_not_connecting_state()
|
if self.connecting:
|
||||||
|
# Adjust our state from connecting->connected.
|
||||||
|
self._set_not_connecting_state()
|
||||||
self.set_status(language['connected_to_wireless'].replace
|
self.set_status(language['connected_to_wireless'].replace
|
||||||
('$A', info[1]).replace
|
('$A', info[1]).replace
|
||||||
('$B', daemon.FormatSignalForPrinting(info[2])).replace
|
('$B', daemon.FormatSignalForPrinting(info[2])).replace
|
||||||
@@ -391,12 +397,13 @@ class appGui(object):
|
|||||||
|
|
||||||
def set_not_connected_state(self, info):
|
def set_not_connected_state(self, info):
|
||||||
if self.connecting:
|
if self.connecting:
|
||||||
|
# Adjust our state from connecting->not-connected.
|
||||||
self._set_not_connecting_state()
|
self._set_not_connecting_state()
|
||||||
self.set_status(language['not_connected'])
|
self.set_status(language['not_connected'])
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _set_not_connecting_state(self):
|
def _set_not_connecting_state(self):
|
||||||
if self.connecting:
|
if self.connecting and self.update_cb:
|
||||||
gobject.source_remove(self.update_cb)
|
gobject.source_remove(self.update_cb)
|
||||||
self.update_cb = misc.timeout_add(2, self.update_statusbar)
|
self.update_cb = misc.timeout_add(2, self.update_statusbar)
|
||||||
self.connecting = False
|
self.connecting = False
|
||||||
@@ -408,7 +415,7 @@ class appGui(object):
|
|||||||
gobject.idle_add(self.status_bar.remove, 1, self.statusID)
|
gobject.idle_add(self.status_bar.remove, 1, self.statusID)
|
||||||
|
|
||||||
def set_connecting_state(self, info):
|
def set_connecting_state(self, info):
|
||||||
if not self.connecting:
|
if not self.connecting and self.update_cb:
|
||||||
gobject.source_remove(self.update_cb)
|
gobject.source_remove(self.update_cb)
|
||||||
self.update_cb = misc.timeout_add(500, self.update_statusbar,
|
self.update_cb = misc.timeout_add(500, self.update_statusbar,
|
||||||
milli=True)
|
milli=True)
|
||||||
@@ -661,6 +668,7 @@ class appGui(object):
|
|||||||
"""
|
"""
|
||||||
widget.hide()
|
widget.hide()
|
||||||
networkentry.connect_button.show()
|
networkentry.connect_button.show()
|
||||||
|
daemon.SetForcedDisconnect(True)
|
||||||
if nettype == "wired":
|
if nettype == "wired":
|
||||||
wired.DisconnectWired()
|
wired.DisconnectWired()
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -53,7 +53,8 @@ def diewithdbus(func):
|
|||||||
ret = func(self, *__args, **__kargs)
|
ret = func(self, *__args, **__kargs)
|
||||||
self.__lost_dbus_count = 0
|
self.__lost_dbus_count = 0
|
||||||
return ret
|
return ret
|
||||||
except dbusmanager.DBusException:
|
except dbusmanager.DBusException, e:
|
||||||
|
print "Caught exception %e" % str(e)
|
||||||
if not hasattr(self, "__lost_dbus_count"):
|
if not hasattr(self, "__lost_dbus_count"):
|
||||||
self.__lost_dbus_count = 0
|
self.__lost_dbus_count = 0
|
||||||
if self.__lost_dbus_count > 3:
|
if self.__lost_dbus_count > 3:
|
||||||
@@ -102,6 +103,7 @@ class ConnectionStatus(object):
|
|||||||
2) A wired connection is currently active.
|
2) A wired connection is currently active.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
self.trigger_reconnect = False
|
||||||
if not wired_ip and daemon.GetPreferWiredNetwork():
|
if not wired_ip and daemon.GetPreferWiredNetwork():
|
||||||
if not daemon.GetForcedDisconnect() and wired.CheckPluggedIn():
|
if not daemon.GetForcedDisconnect() and wired.CheckPluggedIn():
|
||||||
self.trigger_reconnect = True
|
self.trigger_reconnect = True
|
||||||
@@ -196,15 +198,6 @@ class ConnectionStatus(object):
|
|||||||
# Check for wired.
|
# Check for wired.
|
||||||
wired_ip = wired.GetWiredIP("")
|
wired_ip = wired.GetWiredIP("")
|
||||||
wired_found = self.check_for_wired_connection(wired_ip)
|
wired_found = self.check_for_wired_connection(wired_ip)
|
||||||
# Trigger an AutoConnect if we're plugged in, not connected
|
|
||||||
# to a wired network, and the "autoswitch to wired" option
|
|
||||||
# is on.
|
|
||||||
if self.trigger_reconnect:
|
|
||||||
self.trigger_reconnect = False
|
|
||||||
wireless.DisconnectWireless()
|
|
||||||
daemon.AutoConnect(False, reply_handler=lambda:None,
|
|
||||||
error_handler=lambda:None)
|
|
||||||
return True
|
|
||||||
if wired_found:
|
if wired_found:
|
||||||
self.update_state(misc.WIRED, wired_ip=wired_ip)
|
self.update_state(misc.WIRED, wired_ip=wired_ip)
|
||||||
return True
|
return True
|
||||||
@@ -214,6 +207,22 @@ class ConnectionStatus(object):
|
|||||||
self.signal_changed = False
|
self.signal_changed = False
|
||||||
wireless_found = self.check_for_wireless_connection(wifi_ip)
|
wireless_found = self.check_for_wireless_connection(wifi_ip)
|
||||||
if wireless_found:
|
if wireless_found:
|
||||||
|
if self.trigger_reconnect:
|
||||||
|
# If we made it here, that means we want to switch
|
||||||
|
# to a wired network whenever possible, but a wireless
|
||||||
|
# connection is active. So we kill the wireless connection
|
||||||
|
# so the autoconnect logic will connect to the wired network.
|
||||||
|
self.trigger_reconnect = False
|
||||||
|
|
||||||
|
# Don't trigger it if the gui is open, because autoconnect
|
||||||
|
# is disabled while it's open.
|
||||||
|
if not daemon.GetGUIOpen():
|
||||||
|
print 'Killing wireless connection to switch to wired...'
|
||||||
|
wireless.DisconnectWireless()
|
||||||
|
daemon.AutoConnect(False, reply_handler=lambda:None,
|
||||||
|
error_handler=lambda:None)
|
||||||
|
self.update_state(misc.NOT_CONNECTED)
|
||||||
|
return True
|
||||||
self.update_state(misc.WIRELESS, wifi_ip=wifi_ip)
|
self.update_state(misc.WIRELESS, wifi_ip=wifi_ip)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
@@ -218,6 +218,7 @@ class Controller(object):
|
|||||||
|
|
||||||
def KillDHCP(self):
|
def KillDHCP(self):
|
||||||
""" Kill the managed DHCP client if its in a connecting state. """
|
""" Kill the managed DHCP client if its in a connecting state. """
|
||||||
|
print 'running kill dhcp.'
|
||||||
if (self.connecting_thread.is_connecting and
|
if (self.connecting_thread.is_connecting and
|
||||||
self.iface.dhcp_object):
|
self.iface.dhcp_object):
|
||||||
if self.iface.dhcp_object.poll() is None:
|
if self.iface.dhcp_object.poll() is None:
|
||||||
|
|||||||
@@ -323,12 +323,15 @@ class WicdDaemon(dbus.service.Object):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
print "Autoconnecting..."
|
print "Autoconnecting..."
|
||||||
|
if self.CheckIfConnecting():
|
||||||
|
if self.debug_mode:
|
||||||
|
print 'Already connecting, doing nothing.'
|
||||||
|
return
|
||||||
# We don't want to rescan/connect if the gui is open.
|
# We don't want to rescan/connect if the gui is open.
|
||||||
if self.gui_open:
|
if self.gui_open:
|
||||||
if self.debug_mode:
|
if self.debug_mode:
|
||||||
print "Skipping autoconnect because GUI is open."
|
print "Skipping autoconnect because GUI is open."
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.wired_bus.CheckPluggedIn():
|
if self.wired_bus.CheckPluggedIn():
|
||||||
if self.debug_mode:
|
if self.debug_mode:
|
||||||
print "Starting wired autoconnect..."
|
print "Starting wired autoconnect..."
|
||||||
@@ -388,6 +391,7 @@ class WicdDaemon(dbus.service.Object):
|
|||||||
if self.wired.connecting_thread:
|
if self.wired.connecting_thread:
|
||||||
self.wired.connecting_thread.should_die = True
|
self.wired.connecting_thread.should_die = True
|
||||||
self.wired.ReleaseDHCP()
|
self.wired.ReleaseDHCP()
|
||||||
|
self.wired.KillDHCP()
|
||||||
self.wired.connecting_thread.connect_result = 'aborted'
|
self.wired.connecting_thread.connect_result = 'aborted'
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon')
|
@dbus.service.method('org.wicd.daemon')
|
||||||
@@ -425,9 +429,7 @@ class WicdDaemon(dbus.service.Object):
|
|||||||
@dbus.service.method('org.wicd.daemon')
|
@dbus.service.method('org.wicd.daemon')
|
||||||
def GetForcedDisconnect(self):
|
def GetForcedDisconnect(self):
|
||||||
""" Returns the forced_disconnect status. See SetForcedDisconnect. """
|
""" Returns the forced_disconnect status. See SetForcedDisconnect. """
|
||||||
return (bool(self.forced_disconnect) or
|
return bool(self.forced_disconnect)
|
||||||
bool(self.wireless_bus.GetForcedDisconnect()) or
|
|
||||||
bool(self.wired_bus.GetForcedDisconnect()))
|
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon')
|
@dbus.service.method('org.wicd.daemon')
|
||||||
def SetForcedDisconnect(self, value):
|
def SetForcedDisconnect(self, value):
|
||||||
@@ -440,8 +442,6 @@ class WicdDaemon(dbus.service.Object):
|
|||||||
"""
|
"""
|
||||||
if self.debug_mode and value: print "Forced disconnect on"
|
if self.debug_mode and value: print "Forced disconnect on"
|
||||||
self.forced_disconnect = bool(value)
|
self.forced_disconnect = bool(value)
|
||||||
self.wireless_bus.SetForcedDisconnect(bool(value))
|
|
||||||
self.wired_bus.SetForcedDisconnect(bool(value))
|
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon')
|
@dbus.service.method('org.wicd.daemon')
|
||||||
def GetSignalDisplayType(self):
|
def GetSignalDisplayType(self):
|
||||||
@@ -923,7 +923,6 @@ class WirelessDaemon(dbus.service.Object):
|
|||||||
self.daemon = daemon
|
self.daemon = daemon
|
||||||
self.wifi = wifi
|
self.wifi = wifi
|
||||||
self._debug_mode = debug
|
self._debug_mode = debug
|
||||||
self.forced_disconnect = False
|
|
||||||
self._scanning = False
|
self._scanning = False
|
||||||
self.LastScan = []
|
self.LastScan = []
|
||||||
self.config = ConfigManager(os.path.join(wpath.etc,
|
self.config = ConfigManager(os.path.join(wpath.etc,
|
||||||
@@ -1041,26 +1040,9 @@ class WirelessDaemon(dbus.service.Object):
|
|||||||
@dbus.service.method('org.wicd.daemon.wireless')
|
@dbus.service.method('org.wicd.daemon.wireless')
|
||||||
def DisconnectWireless(self):
|
def DisconnectWireless(self):
|
||||||
""" Disconnects the wireless network. """
|
""" Disconnects the wireless network. """
|
||||||
self.SetForcedDisconnect(True)
|
|
||||||
self.wifi.Disconnect()
|
self.wifi.Disconnect()
|
||||||
self.daemon.UpdateState()
|
self.daemon.UpdateState()
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon.wireless')
|
|
||||||
def GetForcedDisconnect(self):
|
|
||||||
""" Returns the forced_disconnect status. See SetForcedDisconnect. """
|
|
||||||
return bool(self.forced_disconnect)
|
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon.wireless')
|
|
||||||
def SetForcedDisconnect(self, value):
|
|
||||||
""" Sets the forced_disconnect status.
|
|
||||||
|
|
||||||
Set to True when a user manually disconnects or cancels a connection.
|
|
||||||
It gets set to False as soon as the connection process is manually
|
|
||||||
started.
|
|
||||||
|
|
||||||
"""
|
|
||||||
self.forced_disconnect = bool(value)
|
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon.wireless')
|
@dbus.service.method('org.wicd.daemon.wireless')
|
||||||
def IsWirelessUp(self):
|
def IsWirelessUp(self):
|
||||||
""" Returns a boolean specifying if wireless is up or down. """
|
""" Returns a boolean specifying if wireless is up or down. """
|
||||||
@@ -1119,13 +1101,13 @@ class WirelessDaemon(dbus.service.Object):
|
|||||||
# Will returned instantly, that way we don't hold up dbus.
|
# Will returned instantly, that way we don't hold up dbus.
|
||||||
# CheckIfWirelessConnecting can be used to test if the connection
|
# CheckIfWirelessConnecting can be used to test if the connection
|
||||||
# is done.
|
# is done.
|
||||||
self.SetForcedDisconnect(False)
|
|
||||||
self.wifi.before_script = self.GetWirelessProperty(id, 'beforescript')
|
self.wifi.before_script = self.GetWirelessProperty(id, 'beforescript')
|
||||||
self.wifi.after_script = self.GetWirelessProperty(id, 'afterscript')
|
self.wifi.after_script = self.GetWirelessProperty(id, 'afterscript')
|
||||||
self.wifi.disconnect_script = self.GetWirelessProperty(id,
|
self.wifi.disconnect_script = self.GetWirelessProperty(id,
|
||||||
'disconnectscript')
|
'disconnectscript')
|
||||||
print 'Connecting to wireless network ' + self.LastScan[id]['essid']
|
print 'Connecting to wireless network ' + self.LastScan[id]['essid']
|
||||||
self.daemon.wired_bus.DisconnectWired()
|
self.daemon.wired_bus.wired.Disconnect()
|
||||||
|
self.daemon.SetForcedDisconnect(False)
|
||||||
conthread = self.wifi.Connect(self.LastScan[id], debug=self.debug_mode)
|
conthread = self.wifi.Connect(self.LastScan[id], debug=self.debug_mode)
|
||||||
self.daemon.UpdateState()
|
self.daemon.UpdateState()
|
||||||
|
|
||||||
@@ -1298,7 +1280,6 @@ class WiredDaemon(dbus.service.Object):
|
|||||||
self.daemon = daemon
|
self.daemon = daemon
|
||||||
self.wired = wired
|
self.wired = wired
|
||||||
self._debug_mode = debug
|
self._debug_mode = debug
|
||||||
self.forced_disconnect = False
|
|
||||||
self.WiredNetwork = {}
|
self.WiredNetwork = {}
|
||||||
self.config = ConfigManager(os.path.join(wpath.etc,
|
self.config = ConfigManager(os.path.join(wpath.etc,
|
||||||
"wired-settings.conf"),
|
"wired-settings.conf"),
|
||||||
@@ -1378,7 +1359,6 @@ class WiredDaemon(dbus.service.Object):
|
|||||||
@dbus.service.method('org.wicd.daemon.wired')
|
@dbus.service.method('org.wicd.daemon.wired')
|
||||||
def DisconnectWired(self):
|
def DisconnectWired(self):
|
||||||
""" Disconnects the wired network. """
|
""" Disconnects the wired network. """
|
||||||
self.SetForcedDisconnect(True)
|
|
||||||
self.wired.Disconnect()
|
self.wired.Disconnect()
|
||||||
self.daemon.UpdateState()
|
self.daemon.UpdateState()
|
||||||
|
|
||||||
@@ -1405,30 +1385,14 @@ class WiredDaemon(dbus.service.Object):
|
|||||||
""" Calls a method to disable the wired interface. """
|
""" Calls a method to disable the wired interface. """
|
||||||
return self.wired.DisableInterface()
|
return self.wired.DisableInterface()
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon.wired')
|
|
||||||
def GetForcedDisconnect(self):
|
|
||||||
""" Returns the forced_disconnect status. See SetForcedDisconnect. """
|
|
||||||
return bool(self.forced_disconnect)
|
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon.wired')
|
|
||||||
def SetForcedDisconnect(self, value):
|
|
||||||
""" Sets the forced_disconnect status.
|
|
||||||
|
|
||||||
Set to True when a user manually disconnects or cancels a connection.
|
|
||||||
It gets set to False as soon as the connection process is manually
|
|
||||||
started.
|
|
||||||
|
|
||||||
"""
|
|
||||||
self.forced_disconnect = bool(value)
|
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon.wired')
|
@dbus.service.method('org.wicd.daemon.wired')
|
||||||
def ConnectWired(self):
|
def ConnectWired(self):
|
||||||
""" Connects to a wired network. """
|
""" Connects to a wired network. """
|
||||||
self.SetForcedDisconnect(False)
|
|
||||||
self.wired.before_script = self.GetWiredProperty("beforescript")
|
self.wired.before_script = self.GetWiredProperty("beforescript")
|
||||||
self.wired.after_script = self.GetWiredProperty("afterscript")
|
self.wired.after_script = self.GetWiredProperty("afterscript")
|
||||||
self.wired.disconnect_script = self.GetWiredProperty("disconnectscript")
|
self.wired.disconnect_script = self.GetWiredProperty("disconnectscript")
|
||||||
self.daemon.wireless_bus.DisconnectWireless()
|
self.daemon.wireless_bus.wifi.Disconnect()
|
||||||
|
self.daemon.SetForcedDisconnect(False)
|
||||||
self.wired.Connect(self.WiredNetwork, debug=self.debug_mode)
|
self.wired.Connect(self.WiredNetwork, debug=self.debug_mode)
|
||||||
self.daemon.UpdateState()
|
self.daemon.UpdateState()
|
||||||
|
|
||||||
|
|||||||
@@ -217,15 +217,22 @@ class BaseInterface(object):
|
|||||||
cmd = ""
|
cmd = ""
|
||||||
return (client, cmd)
|
return (client, cmd)
|
||||||
|
|
||||||
connect_dict = {
|
client_dict = {
|
||||||
"dhclient" : r"%s %s",
|
"dhclient" :
|
||||||
"pump" : r"%s -i %s",
|
{'connect' : r"%s %s",
|
||||||
"dhcpcd" : r"%s %s",
|
'release' : r"%s -r %s",
|
||||||
}
|
'id' : misc.DHCLIENT,
|
||||||
release_dict = {
|
},
|
||||||
"dhclient" : r"%s -r %s",
|
"pump" :
|
||||||
"pump" : r"%s -r -i %s",
|
{ 'connect' : r"%s -i %s",
|
||||||
"dhcpcd" : r"%s -k %s",
|
'release' : r"%s -r -i %s",
|
||||||
|
'id' : misc.PUMP,
|
||||||
|
},
|
||||||
|
"dhcpcd" :
|
||||||
|
{'connect' : r"%s %s",
|
||||||
|
'release' : r"%s -k %s",
|
||||||
|
'id' : misc.DHCPCD,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
(client_name, cmd) = get_client_name(self.DHCP_CLIENT)
|
(client_name, cmd) = get_client_name(self.DHCP_CLIENT)
|
||||||
if not client_name or not cmd:
|
if not client_name or not cmd:
|
||||||
@@ -233,11 +240,11 @@ class BaseInterface(object):
|
|||||||
return ""
|
return ""
|
||||||
|
|
||||||
if flavor == "connect":
|
if flavor == "connect":
|
||||||
return connect_dict[client_name] % (cmd, self.iface)
|
return client_dict[client_name]['connect'] % (cmd, self.iface)
|
||||||
elif flavor == "release":
|
elif flavor == "release":
|
||||||
return release_dict[client_name] % (cmd, self.iface)
|
return client_dict[client_name]['release'] % (cmd, self.iface)
|
||||||
else:
|
else:
|
||||||
return str(cmd)
|
return client_dict[client_name]['id']
|
||||||
|
|
||||||
def AppAvailable(self, app):
|
def AppAvailable(self, app):
|
||||||
""" Return whether a given app is available.
|
""" Return whether a given app is available.
|
||||||
@@ -451,18 +458,19 @@ class BaseInterface(object):
|
|||||||
if not self.iface: return False
|
if not self.iface: return False
|
||||||
|
|
||||||
cmd = self._get_dhcp_command('connect')
|
cmd = self._get_dhcp_command('connect')
|
||||||
#cmd = self.DHCP_CMD + " " + self.iface
|
|
||||||
if self.verbose: print cmd
|
if self.verbose: print cmd
|
||||||
self.dhcp_object = misc.Run(cmd, include_stderr=True, return_obj=True)
|
self.dhcp_object = misc.Run(cmd, include_stderr=True, return_obj=True)
|
||||||
pipe = self.dhcp_object.stdout
|
pipe = self.dhcp_object.stdout
|
||||||
|
|
||||||
DHCP_CLIENT = self.DHCP_CLIENT
|
DHCP_CLIENT = self._get_dhcp_command()
|
||||||
if DHCP_CLIENT == misc.DHCLIENT:
|
if DHCP_CLIENT == misc.DHCLIENT:
|
||||||
return self._parse_dhclient(pipe)
|
return self._parse_dhclient(pipe)
|
||||||
elif DHCP_CLIENT == misc.PUMP:
|
elif DHCP_CLIENT == misc.PUMP:
|
||||||
return self._parse_pump(pipe)
|
return self._parse_pump(pipe)
|
||||||
elif DHCP_CLIENT == misc.DHCPCD:
|
elif DHCP_CLIENT == misc.DHCPCD:
|
||||||
return self._parse_dhcpcd(pipe)
|
return self._parse_dhcpcd(pipe)
|
||||||
|
else:
|
||||||
|
print 'ERROR no dhclient found!'
|
||||||
|
|
||||||
def ReleaseDHCP(self):
|
def ReleaseDHCP(self):
|
||||||
""" Release the DHCP lease for this interface. """
|
""" Release the DHCP lease for this interface. """
|
||||||
|
|||||||
Reference in New Issue
Block a user