mirror of
https://github.com/gryf/wicd.git
synced 2025-12-24 15:12:31 +01:00
Merge r416 of mainline 1.6.
This commit is contained in:
@@ -93,6 +93,7 @@ class PrefsDialog(urwid.WidgetWrap):
|
||||
dhcp1_t = 'dhclient'
|
||||
dhcp2_t = 'dhcpcd'
|
||||
dhcp3_t = 'pump'
|
||||
dhcp4_t = 'udhcpc'
|
||||
|
||||
wired_detect_header_t = ('header',language["wired_detect"])
|
||||
wired1_t = 'ethtool'
|
||||
@@ -185,7 +186,8 @@ class PrefsDialog(urwid.WidgetWrap):
|
||||
self.dhcp1 = DynRadioButton(self.dhcp_l,dhcp1_t)
|
||||
self.dhcp2 = DynRadioButton(self.dhcp_l,dhcp2_t)
|
||||
self.dhcp3 = DynRadioButton(self.dhcp_l,dhcp3_t)
|
||||
self.dhcp_l = [self.dhcp0,self.dhcp1,self.dhcp2,self.dhcp3]
|
||||
self.dhcp4 = DynRadioButton(self.dhcp_l,dhcp4_t)
|
||||
self.dhcp_l = [self.dhcp0,self.dhcp1,self.dhcp2,self.dhcp3,self.dhcp4]
|
||||
|
||||
self.wired_l = []
|
||||
self.wired_detect_header = urwid.Text(wired_detect_header_t)
|
||||
@@ -202,7 +204,7 @@ class PrefsDialog(urwid.WidgetWrap):
|
||||
self.flush_l = [self.flush0,self.flush1,self.flush2]
|
||||
|
||||
externalLB = urwid.ListBox([self.dhcp_header,
|
||||
self.dhcp0,self.dhcp2,self.dhcp3,self.dhcp1,
|
||||
self.dhcp0,self.dhcp2,self.dhcp3,self.dhcp1,self.dhcp4,
|
||||
_blank,
|
||||
self.wired_detect_header,
|
||||
self.wired0,self.wired1,self.wired2,
|
||||
@@ -351,8 +353,10 @@ class PrefsDialog(urwid.WidgetWrap):
|
||||
dhcp_client = misc.DHCLIENT
|
||||
elif self.dhcp2.get_state():
|
||||
dhcp_client = misc.DHCPCD
|
||||
else:
|
||||
elif self.dhcp3.get_state():
|
||||
dhcp_client = misc.PUMP
|
||||
else:
|
||||
dhcp_client = misc.UDHCPC
|
||||
daemon.SetDHCPClient(dhcp_client)
|
||||
|
||||
if self.wired0.get_state():
|
||||
|
||||
@@ -1171,6 +1171,21 @@ is already active.</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="udhcpc_radio">
|
||||
<property name="label" translatable="yes">udhcpc</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">dhclient_radio</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.TH WICD-CLIENT "1" "February 2009" "wicd-client " "User Commands"
|
||||
.TH WICD-CLIENT "1" "June 2009" "wicd-client " "User Commands"
|
||||
.SH NAME
|
||||
wicd-client \- manual page for wicd-client
|
||||
wicd-client \- frontend to the WICD daemon
|
||||
.SH DESCRIPTION
|
||||
wireless (and wired) connection daemon front\-end.
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
[Desktop Entry]
|
||||
Categories=Application;Network;
|
||||
Encoding=UTF-8
|
||||
Exec=wicd-client --no-tray
|
||||
GenericName=Network Manager
|
||||
Icon=wicd-client
|
||||
|
||||
@@ -49,6 +49,7 @@ AUTO = 0
|
||||
DHCLIENT = 1
|
||||
DHCPCD = 2
|
||||
PUMP = 3
|
||||
UDHCPC = 4
|
||||
|
||||
# Link detection tools
|
||||
ETHTOOL = 1
|
||||
@@ -446,7 +447,7 @@ def choose_sudo_prog(prog_num=0):
|
||||
paths = []
|
||||
|
||||
if desktop_env == "kde":
|
||||
progs = ["kdesu", "kdesudo", "ktusss"]
|
||||
progs = ["kdesu", "kdesudo", "ktsuss"]
|
||||
else:
|
||||
progs = ["gksudo", "gksu", "ktsuss"]
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ class ConnectionStatus(object):
|
||||
# try to reconnect.
|
||||
self.connection_lost_counter += 1
|
||||
print self.connection_lost_counter
|
||||
if self.connection_lost_counter >= 4:
|
||||
if self.connection_lost_counter >= 4 and daemon.GetAutoReconnect():
|
||||
wireless.DisconnectWireless()
|
||||
self.connection_lost_counter = 0
|
||||
return False
|
||||
|
||||
@@ -45,14 +45,20 @@ def setup_dbus():
|
||||
wired = dbusmanager.get_interface('wired')
|
||||
|
||||
class AdvancedSettingsDialog(gtk.Dialog):
|
||||
def __init__(self):
|
||||
def __init__(self, network_name=None):
|
||||
""" Build the base advanced settings dialog.
|
||||
|
||||
This class isn't used by itself, instead it is used as a parent for
|
||||
the WiredSettingsDialog and WirelessSettingsDialog.
|
||||
|
||||
"""
|
||||
gtk.Dialog.__init__(self, title=language['properties'],
|
||||
# if no network name was passed, just use Properties as the title
|
||||
if network_name:
|
||||
title = '%s - %s' % (network_name, language['properties'])
|
||||
else:
|
||||
title = language['properties']
|
||||
|
||||
gtk.Dialog.__init__(self, title=title,
|
||||
flags=gtk.DIALOG_MODAL, buttons=(gtk.STOCK_CANCEL,
|
||||
gtk.RESPONSE_REJECT,
|
||||
gtk.STOCK_OK,
|
||||
@@ -236,7 +242,7 @@ class AdvancedSettingsDialog(gtk.Dialog):
|
||||
class WiredSettingsDialog(AdvancedSettingsDialog):
|
||||
def __init__(self, name):
|
||||
""" Build the wired settings dialog. """
|
||||
AdvancedSettingsDialog.__init__(self)
|
||||
AdvancedSettingsDialog.__init__(self, language['wired_network'])
|
||||
self.des = self.connect("destroy", self.destroy_called)
|
||||
self.script_button.connect("clicked", self.edit_scripts)
|
||||
self.prof_name = name
|
||||
@@ -294,7 +300,7 @@ class WiredSettingsDialog(AdvancedSettingsDialog):
|
||||
class WirelessSettingsDialog(AdvancedSettingsDialog):
|
||||
def __init__(self, networkID):
|
||||
""" Build the wireless settings dialog. """
|
||||
AdvancedSettingsDialog.__init__(self)
|
||||
AdvancedSettingsDialog.__init__(self, wireless.GetWirelessProperty(networkID, 'essid'))
|
||||
# Set up encryption stuff
|
||||
self.networkID = networkID
|
||||
self.combo_encryption = gtk.combo_box_new_text()
|
||||
|
||||
@@ -315,6 +315,13 @@ class ConnectThread(threading.Thread):
|
||||
|
||||
self.SetStatus('interface_down')
|
||||
|
||||
def run(self):
|
||||
self.connect_result = "Failed"
|
||||
try:
|
||||
self._connect()
|
||||
finally:
|
||||
self.is_connecting = False
|
||||
|
||||
def set_should_die(self, val):
|
||||
self.lock.acquire()
|
||||
try:
|
||||
@@ -794,7 +801,7 @@ class WirelessConnectThread(ConnectThread):
|
||||
self.wpa_driver = wpa_driver
|
||||
|
||||
|
||||
def run(self):
|
||||
def _connect(self):
|
||||
""" The main function of the connection thread.
|
||||
|
||||
This function performs the necessary calls to connect to the
|
||||
@@ -1006,7 +1013,7 @@ class WiredConnectThread(ConnectThread):
|
||||
after_script, disconnect_script, gdns1, gdns2,
|
||||
gdns3, gdns_dom, gsearch_dom, liface, debug)
|
||||
|
||||
def run(self):
|
||||
def _connect(self):
|
||||
""" The main function of the connection thread.
|
||||
|
||||
This function performs the necessary calls to connect to the
|
||||
|
||||
@@ -82,7 +82,7 @@ class PreferencesDialog(object):
|
||||
self.preferwiredcheckbox.set_active(daemon.GetPreferWiredNetwork())
|
||||
|
||||
dhcp_list = [self.dhcpautoradio, self.dhclientradio, self.dhcpcdradio,
|
||||
self.pumpradio]
|
||||
self.pumpradio, self.udhcpcradio]
|
||||
self._setup_external_app_radios(dhcp_list, daemon.GetDHCPClient,
|
||||
daemon.SetDHCPClient)
|
||||
|
||||
@@ -210,8 +210,10 @@ class PreferencesDialog(object):
|
||||
dhcp_client = misc.DHCLIENT
|
||||
elif self.dhcpcdradio.get_active():
|
||||
dhcp_client = misc.DHCPCD
|
||||
else:
|
||||
elif self.pumpradio.get_active():
|
||||
dhcp_client = misc.PUMP
|
||||
else:
|
||||
dhcp_client = misc.UDHCPC
|
||||
daemon.SetDHCPClient(dhcp_client)
|
||||
|
||||
if self.linkautoradio.get_active():
|
||||
@@ -347,6 +349,7 @@ class PreferencesDialog(object):
|
||||
self.dhclientradio = self.wTree.get_widget("dhclient_radio")
|
||||
self.pumpradio = self.wTree.get_widget("pump_radio")
|
||||
self.dhcpcdradio = self.wTree.get_widget("dhcpcd_radio")
|
||||
self.udhcpcradio = self.wTree.get_widget("udhcpc_radio")
|
||||
|
||||
# Wired Link Detection Apps
|
||||
self.linkautoradio = setup_label("link_auto_radio", 'wicd_auto_config')
|
||||
|
||||
@@ -250,6 +250,9 @@ class BaseInterface(object):
|
||||
cmd = self.dhclient_cmd
|
||||
if self.dhclient_needs_verbose:
|
||||
cmd += ' -v'
|
||||
elif self.udhcpc_cmd and cl in [misc.UDHCPC, misc.AUTO]:
|
||||
client = "udhcpc"
|
||||
cmd = self.udhcpc_cmd
|
||||
else:
|
||||
client = None
|
||||
cmd = ""
|
||||
@@ -257,20 +260,25 @@ class BaseInterface(object):
|
||||
|
||||
client_dict = {
|
||||
"dhclient" :
|
||||
{'connect' : r"%s %s",
|
||||
'release' : r"%s -r %s",
|
||||
{'connect' : r"%(cmd)s %(iface)s",
|
||||
'release' : r"%(cmd)s -r %(iface)s",
|
||||
'id' : misc.DHCLIENT,
|
||||
},
|
||||
"pump" :
|
||||
{ 'connect' : r"%s -i %s",
|
||||
'release' : r"%s -r -i %s",
|
||||
{ 'connect' : r"%(cmd)s -i %(iface)s",
|
||||
'release' : r"%(cmd)s -r -i %(iface)s",
|
||||
'id' : misc.PUMP,
|
||||
},
|
||||
"dhcpcd" :
|
||||
{'connect' : r"%s %s",
|
||||
'release' : r"%s -k %s",
|
||||
{'connect' : r"%(cmd)s %(iface)s",
|
||||
'release' : r"%(cmd)s -k %(iface)s",
|
||||
'id' : misc.DHCPCD,
|
||||
},
|
||||
"udhcpc":
|
||||
{'connect' : r"%(cmd)s -n -i %(iface)s",
|
||||
'release' : r"killall -SIGUSR2 %(cmd)s",
|
||||
'id' : misc.UDHCPC,
|
||||
},
|
||||
}
|
||||
(client_name, cmd) = get_client_name(self.DHCP_CLIENT)
|
||||
if not client_name or not cmd:
|
||||
@@ -278,9 +286,9 @@ class BaseInterface(object):
|
||||
return ""
|
||||
|
||||
if flavor == "connect":
|
||||
return client_dict[client_name]['connect'] % (cmd, self.iface)
|
||||
return client_dict[client_name]['connect'] % {"cmd":cmd, "iface":self.iface}
|
||||
elif flavor == "release":
|
||||
return client_dict[client_name]['release'] % (cmd, self.iface)
|
||||
return client_dict[client_name]['release'] % {"cmd":cmd, "iface":self.iface}
|
||||
else:
|
||||
return client_dict[client_name]['id']
|
||||
|
||||
@@ -327,6 +335,7 @@ class BaseInterface(object):
|
||||
self.dhclient_needs_verbose = False
|
||||
self.dhcpcd_cmd = self._find_program_path("dhcpcd")
|
||||
self.pump_cmd = self._find_program_path("pump")
|
||||
self.udhcpc_cmd = self._find_program_path("udhcpc")
|
||||
|
||||
def CheckWiredTools(self):
|
||||
""" Check for the existence of ethtool and mii-tool. """
|
||||
@@ -431,7 +440,7 @@ class BaseInterface(object):
|
||||
if line == '': # Empty string means dhclient is done.
|
||||
dhclient_complete = True
|
||||
else:
|
||||
print line.strip('\n')
|
||||
print misc.to_unicode(line.strip('\n'))
|
||||
if line.startswith('bound'):
|
||||
dhclient_success = True
|
||||
dhclient_complete = True
|
||||
@@ -458,7 +467,7 @@ class BaseInterface(object):
|
||||
elif line.strip().lower().startswith('Operation failed.'):
|
||||
pump_success = False
|
||||
pump_complete = True
|
||||
print line
|
||||
print misc.to_unicode(line)
|
||||
|
||||
return self._check_dhcp_result(pump_success)
|
||||
|
||||
@@ -482,10 +491,34 @@ class BaseInterface(object):
|
||||
dhcpcd_complete = True
|
||||
elif line == '':
|
||||
dhcpcd_complete = True
|
||||
print line
|
||||
print misc.to_unicode(line)
|
||||
|
||||
return self._check_dhcp_result(dhcpcd_success)
|
||||
|
||||
|
||||
def _parse_udhcpc(self, pipe):
|
||||
""" Determines if obtaining an IP using udhcpc succeeded.
|
||||
|
||||
Keyword arguments:
|
||||
pipe -- stdout pipe to the dhcpcd process.
|
||||
|
||||
Returns:
|
||||
'success' if successful, an error code string otherwise.
|
||||
|
||||
"""
|
||||
udhcpc_complete = False
|
||||
udhcpc_success = True
|
||||
|
||||
while not udhcpc_complete:
|
||||
line = pipe.readline()
|
||||
if line.endswith("failing"):
|
||||
udhcpc_success = False
|
||||
udhcpc_complete = True
|
||||
elif line == '':
|
||||
udhcpc_complete = True
|
||||
print line
|
||||
|
||||
return self._check_dhcp_result(udhcpc_success)
|
||||
|
||||
def _check_dhcp_result(self, success):
|
||||
""" Print and return the correct DHCP connection result.
|
||||
|
||||
@@ -524,6 +557,8 @@ class BaseInterface(object):
|
||||
return self._parse_pump(pipe)
|
||||
elif DHCP_CLIENT == misc.DHCPCD:
|
||||
return self._parse_dhcpcd(pipe)
|
||||
elif DHCP_CLIENT == misc.UDHCPC:
|
||||
return self._parse_udhcpc(pipe)
|
||||
else:
|
||||
print 'ERROR no dhclient found!'
|
||||
|
||||
@@ -1106,15 +1141,21 @@ class BaseWirelessInterface(BaseInterface):
|
||||
|
||||
# An array for the access points
|
||||
access_points = []
|
||||
access_points = {}
|
||||
for cell in networks:
|
||||
# Only use sections where there is an ESSID.
|
||||
if 'ESSID:' in cell:
|
||||
# Add this network to the list of networks
|
||||
entry = self._ParseAccessPoint(cell, ralink_info)
|
||||
if entry is not None:
|
||||
access_points.append(entry)
|
||||
# Normally we only get duplicate bssids with hidden
|
||||
# networks. If we hit this, we only want the entry
|
||||
# with the real essid to be in the network list.
|
||||
if (entry['bssid'] not in access_points
|
||||
or not entry['hidden']):
|
||||
access_points[entry['bssid']] = entry
|
||||
|
||||
return access_points
|
||||
return access_points.values()
|
||||
|
||||
def _ParseAccessPoint(self, cell, ralink_info):
|
||||
""" Parse a single cell from the output of iwlist.
|
||||
|
||||
Reference in New Issue
Block a user