mirror of
https://github.com/gryf/wicd.git
synced 2026-01-04 04:44:12 +01:00
Merged with r294 of mainline 1.6.
This commit is contained in:
0
in/init=default=wicd.in
Normal file → Executable file
0
in/init=default=wicd.in
Normal file → Executable file
17
wicd/gui.py
17
wicd/gui.py
@@ -390,23 +390,29 @@ class appGui(object):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def set_not_connected_state(self, info):
|
def set_not_connected_state(self, info):
|
||||||
self.connecting = False
|
if self.connecting:
|
||||||
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):
|
||||||
self.connecting = False
|
if self.connecting:
|
||||||
|
gobject.source_remove(self.update_cb)
|
||||||
|
self.update_cb = misc.timeout_add(2, self.update_statusbar)
|
||||||
|
self.connecting = False
|
||||||
if self.pulse_active:
|
if self.pulse_active:
|
||||||
self.pulse_active = False
|
self.pulse_active = False
|
||||||
gobject.idle_add(self.network_list.set_sensitive, True)
|
gobject.idle_add(self.network_list.set_sensitive, True)
|
||||||
gobject.idle_add(self.status_area.hide_all)
|
gobject.idle_add(self.status_area.hide_all)
|
||||||
|
|
||||||
if self.statusID:
|
if self.statusID:
|
||||||
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):
|
||||||
self.connecting = True
|
if not self.connecting:
|
||||||
|
gobject.source_remove(self.update_cb)
|
||||||
|
self.update_cb = misc.timeout_add(500, self.update_statusbar,
|
||||||
|
milli=True)
|
||||||
|
self.connecting = True
|
||||||
if not self.pulse_active:
|
if not self.pulse_active:
|
||||||
self.pulse_active = True
|
self.pulse_active = True
|
||||||
misc.timeout_add(100, self.pulse_progress_bar, milli=True)
|
misc.timeout_add(100, self.pulse_progress_bar, milli=True)
|
||||||
@@ -710,6 +716,7 @@ class appGui(object):
|
|||||||
daemon.SetGUIOpen(True)
|
daemon.SetGUIOpen(True)
|
||||||
self.wait_for_events(0.1)
|
self.wait_for_events(0.1)
|
||||||
gobject.idle_add(self.refresh_clicked)
|
gobject.idle_add(self.refresh_clicked)
|
||||||
|
self._do_statusbar_update(*daemon.GetConnectionStatus())
|
||||||
bus.add_signal_receiver(self._do_statusbar_update, 'StatusChanged',
|
bus.add_signal_receiver(self._do_statusbar_update, 'StatusChanged',
|
||||||
'org.wicd.daemon')
|
'org.wicd.daemon')
|
||||||
self.update_cb = misc.timeout_add(2, self.update_statusbar)
|
self.update_cb = misc.timeout_add(2, self.update_statusbar)
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class WicdError(Exception):
|
|||||||
|
|
||||||
|
|
||||||
__LANG = None
|
__LANG = None
|
||||||
def Run(cmd, include_stderr=False, return_pipe=False):
|
def Run(cmd, include_stderr=False, return_pipe=False, return_obj=False):
|
||||||
""" Run a command.
|
""" Run a command.
|
||||||
|
|
||||||
Runs the given command, returning either the output
|
Runs the given command, returning either the output
|
||||||
@@ -112,6 +112,8 @@ def Run(cmd, include_stderr=False, return_pipe=False):
|
|||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
if return_obj:
|
||||||
|
return f
|
||||||
if return_pipe:
|
if return_pipe:
|
||||||
return f.stdout
|
return f.stdout
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -54,6 +54,8 @@ def diewithdbus(func):
|
|||||||
self.__lost_dbus_count = 0
|
self.__lost_dbus_count = 0
|
||||||
return ret
|
return ret
|
||||||
except dbusmanager.DBusException:
|
except dbusmanager.DBusException:
|
||||||
|
if not hasattr(self, "__lost_dbus_count"):
|
||||||
|
self.__lost_dbus_count = 0
|
||||||
if self.__lost_dbus_count > 3:
|
if self.__lost_dbus_count > 3:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
self.__lost_dbus_count += 1
|
self.__lost_dbus_count += 1
|
||||||
|
|||||||
@@ -44,7 +44,9 @@ class WiredConnectThread() -- Connection thread for wired
|
|||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
import threading
|
import threading
|
||||||
|
import os
|
||||||
import thread
|
import thread
|
||||||
|
from signal import SIGTERM
|
||||||
|
|
||||||
# wicd imports
|
# wicd imports
|
||||||
import misc
|
import misc
|
||||||
@@ -202,7 +204,8 @@ class Controller(object):
|
|||||||
iface = self.iface
|
iface = self.iface
|
||||||
if self.disconnect_script != None:
|
if self.disconnect_script != None:
|
||||||
print 'Running disconnect script'
|
print 'Running disconnect script'
|
||||||
misc.ExecuteScript(expand_script_macros(self.disconnect_script, 'disconnection', *args))
|
misc.ExecuteScript(expand_script_macros(self.disconnect_script,
|
||||||
|
'disconnection', *args))
|
||||||
iface.ReleaseDHCP()
|
iface.ReleaseDHCP()
|
||||||
iface.SetAddress('0.0.0.0')
|
iface.SetAddress('0.0.0.0')
|
||||||
iface.FlushRoutes()
|
iface.FlushRoutes()
|
||||||
@@ -213,6 +216,14 @@ class Controller(object):
|
|||||||
""" Release the DHCP lease for this interface. """
|
""" Release the DHCP lease for this interface. """
|
||||||
return self.iface.ReleaseDHCP()
|
return self.iface.ReleaseDHCP()
|
||||||
|
|
||||||
|
def KillDHCP(self):
|
||||||
|
""" Kill the managed DHCP client if its in a connecting state. """
|
||||||
|
if (self.connecting_thread.is_connecting and
|
||||||
|
self.iface.dhcp_object):
|
||||||
|
if self.iface.dhcp_object.poll() is None:
|
||||||
|
os.kill(self.iface.dhcp_object.pid, SIGTERM)
|
||||||
|
self.iface.dhcp_object = None
|
||||||
|
|
||||||
def IsUp(self):
|
def IsUp(self):
|
||||||
""" Calls the IsUp method for the wired interface.
|
""" Calls the IsUp method for the wired interface.
|
||||||
|
|
||||||
@@ -404,7 +415,8 @@ class ConnectThread(threading.Thread):
|
|||||||
print "Running DHCP"
|
print "Running DHCP"
|
||||||
dhcp_status = iface.StartDHCP()
|
dhcp_status = iface.StartDHCP()
|
||||||
if dhcp_status in ['no_dhcp_offers', 'dhcp_failed']:
|
if dhcp_status in ['no_dhcp_offers', 'dhcp_failed']:
|
||||||
self.abort_connection(dhcp_status)
|
if self.connect_result != "aborted":
|
||||||
|
self.abort_connection(dhcp_status)
|
||||||
return
|
return
|
||||||
|
|
||||||
@abortable
|
@abortable
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ def catchdbus(func):
|
|||||||
try:
|
try:
|
||||||
return func(*args, **kwargs)
|
return func(*args, **kwargs)
|
||||||
except DBusException, e:
|
except DBusException, e:
|
||||||
print "warning: ignoring exception %s" % egg
|
print "warning: ignoring exception %s" % e
|
||||||
return None
|
return None
|
||||||
wrapper.__name__ = func.__name__
|
wrapper.__name__ = func.__name__
|
||||||
wrapper.__module__ = func.__module__
|
wrapper.__module__ = func.__module__
|
||||||
|
|||||||
@@ -380,6 +380,9 @@ class WicdDaemon(dbus.service.Object):
|
|||||||
if self.wifi.connecting_thread:
|
if self.wifi.connecting_thread:
|
||||||
self.wifi.connecting_thread.should_die = True
|
self.wifi.connecting_thread.should_die = True
|
||||||
self.wifi.ReleaseDHCP()
|
self.wifi.ReleaseDHCP()
|
||||||
|
# We have to actually kill dhcp if its still hanging
|
||||||
|
# around. It could still be trying to get a lease.
|
||||||
|
self.wifi.KillDHCP()
|
||||||
self.wifi.StopWPA()
|
self.wifi.StopWPA()
|
||||||
self.wifi.connecting_thread.connect_result = 'aborted'
|
self.wifi.connecting_thread.connect_result = 'aborted'
|
||||||
if self.wired.connecting_thread:
|
if self.wired.connecting_thread:
|
||||||
|
|||||||
@@ -453,7 +453,8 @@ class BaseInterface(object):
|
|||||||
cmd = self._get_dhcp_command('connect')
|
cmd = self._get_dhcp_command('connect')
|
||||||
#cmd = self.DHCP_CMD + " " + self.iface
|
#cmd = self.DHCP_CMD + " " + self.iface
|
||||||
if self.verbose: print cmd
|
if self.verbose: print cmd
|
||||||
pipe = misc.Run(cmd, include_stderr=True, return_pipe=True)
|
self.dhcp_object = misc.Run(cmd, include_stderr=True, return_obj=True)
|
||||||
|
pipe = self.dhcp_object.stdout
|
||||||
|
|
||||||
DHCP_CLIENT = self.DHCP_CLIENT
|
DHCP_CLIENT = self.DHCP_CLIENT
|
||||||
if DHCP_CLIENT == misc.DHCLIENT:
|
if DHCP_CLIENT == misc.DHCLIENT:
|
||||||
|
|||||||
Reference in New Issue
Block a user