Make backend combobox tooltip display the active backend's description.
Reverse the order of the OK/Cancel button in the Ad-Hoc connection dialog. Use a new set of icons. Extend the update invervals for all backends by 1 second. Try to use en_US.utf8 instead of C as the LANG in misc.Run if it is available. Add ability to force a network state update. (Currently not used).
1062
data/wicd.glade
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
BIN
images/both-bad-signal-lock.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1022 B |
BIN
images/both-bad-signal.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1022 B |
BIN
images/both-good-signal-lock.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.0 KiB |
BIN
images/both-good-signal.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.0 KiB |
BIN
images/both-high-signal-lock.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 946 B |
BIN
images/both-high-signal.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 946 B |
BIN
images/both-low-signal-lock.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1014 B |
BIN
images/both-low-signal.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1014 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 978 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 978 B |
BIN
images/idle-bad-signal-lock.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.0 KiB |
BIN
images/idle-bad-signal.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
BIN
images/idle-good-signal-lock.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.0 KiB |
BIN
images/idle-good-signal.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.0 KiB |
BIN
images/idle-high-signal-lock.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 978 B |
BIN
images/idle-high-signal.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 978 B |
BIN
images/idle-low-signal-lock.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.0 KiB |
BIN
images/idle-low-signal.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.0 KiB |
BIN
images/receiving-bad-signal-lock.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.0 KiB |
BIN
images/receiving-bad-signal.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.0 KiB |
BIN
images/receiving-good-signal-lock.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.0 KiB |
BIN
images/receiving-good-signal.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.0 KiB |
BIN
images/receiving-high-signal-lock.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 978 B |
BIN
images/receiving-high-signal.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 978 B |
BIN
images/receiving-low-signal-lock.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.0 KiB |
BIN
images/receiving-low-signal.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 894 B After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 863 B After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 890 B After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 850 B After Width: | Height: | Size: 1.8 KiB |
BIN
images/transmitting-bad-signal-lock.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1018 B |
BIN
images/transmitting-bad-signal.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1018 B |
BIN
images/transmitting-good-signal-lock.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.0 KiB |
BIN
images/transmitting-good-signal.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.0 KiB |
BIN
images/transmitting-high-signal-lock.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 941 B |
BIN
images/transmitting-high-signal.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 941 B |
BIN
images/transmitting-low-signal-lock.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.0 KiB |
BIN
images/transmitting-low-signal.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 28 KiB |
@@ -29,6 +29,10 @@ import os
|
|||||||
|
|
||||||
import wicd.wpath as wpath
|
import wicd.wpath as wpath
|
||||||
|
|
||||||
|
def fail(backend_name, reason):
|
||||||
|
print "Failed to load backend %s: %s" % (backend_name, reason)
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
class BackendManager(object):
|
class BackendManager(object):
|
||||||
""" Manages, validates, and loads wicd backends. """
|
""" Manages, validates, and loads wicd backends. """
|
||||||
@@ -39,7 +43,7 @@ class BackendManager(object):
|
|||||||
|
|
||||||
def _valid_backend_file(self, be_file):
|
def _valid_backend_file(self, be_file):
|
||||||
""" Make sure the backend file is valid. """
|
""" Make sure the backend file is valid. """
|
||||||
return (os.access(be_file, os.F_OK) and
|
return (os.path.exists(be_file) and
|
||||||
os.path.basename(be_file).startswith("be-") and
|
os.path.basename(be_file).startswith("be-") and
|
||||||
be_file.endswith(".py"))
|
be_file.endswith(".py"))
|
||||||
|
|
||||||
@@ -65,30 +69,30 @@ class BackendManager(object):
|
|||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def load_backend(self, backend_name):
|
def get_backend_description(self, backend_name):
|
||||||
""" Load and return a backend module.
|
""" Loads a backend and returns its description. """
|
||||||
|
backend = self._load_backend(backend_name)
|
||||||
|
if backend and backend.DESCRIPTION:
|
||||||
|
return backend.DESCRIPTION
|
||||||
|
else:
|
||||||
|
return "No backend data available"
|
||||||
|
|
||||||
Given a backend name be-foo, attempt to load a python module
|
def _load_backend(self, backend_name):
|
||||||
in the backends directory called be-foo.py. The module must
|
""" Imports a backend and returns the loaded module. """
|
||||||
include a certain set of classes and variables to be considered
|
|
||||||
valid.
|
|
||||||
|
|
||||||
"""
|
|
||||||
def fail(backend_name, reason):
|
|
||||||
print "Failed to load backend %s: %s" % (backend_name, reason)
|
|
||||||
return True
|
|
||||||
|
|
||||||
failed = False
|
|
||||||
print 'trying to load backend %s' % backend_name
|
print 'trying to load backend %s' % backend_name
|
||||||
backend_path = os.path.join(self.backend_dir,
|
backend_path = os.path.join(self.backend_dir,
|
||||||
'be-' + backend_name + '.py')
|
'be-' + backend_name + '.py')
|
||||||
if self._valid_backend_file(backend_path):
|
if self._valid_backend_file(backend_path):
|
||||||
sys.path.insert(0, self.backend_dir)
|
sys.path.insert(0, self.backend_dir)
|
||||||
backend = __import__('be-' + backend_name)
|
backend = __import__('be-' + backend_name)
|
||||||
|
return backend
|
||||||
else:
|
else:
|
||||||
fail(backend_name, 'Invalid backend file.')
|
fail(backend_name, 'Invalid backend file.')
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def _validate_backend(self, backend):
|
||||||
|
""" Ensures that a backend module is valid. """
|
||||||
|
failed = False
|
||||||
if not backend.NAME:
|
if not backend.NAME:
|
||||||
failed = fail(backend_name, 'Missing NAME attribute.')
|
failed = fail(backend_name, 'Missing NAME attribute.')
|
||||||
if not backend.UPDATE_INTERVAL:
|
if not backend.UPDATE_INTERVAL:
|
||||||
@@ -99,7 +103,21 @@ class BackendManager(object):
|
|||||||
failed = fail(backend_name, "Missing WiredInterface class.")
|
failed = fail(backend_name, "Missing WiredInterface class.")
|
||||||
if not backend.WirelessInterface:
|
if not backend.WirelessInterface:
|
||||||
failed = fail(backend_name, "Missing WirelessInterface class.")
|
failed = fail(backend_name, "Missing WirelessInterface class.")
|
||||||
|
return failed
|
||||||
|
|
||||||
|
def load_backend(self, backend_name):
|
||||||
|
""" Load and return a backend module.
|
||||||
|
|
||||||
|
Given a backend name be-foo, attempt to load a python module
|
||||||
|
in the backends directory called be-foo.py. The module must
|
||||||
|
include a certain set of classes and variables to be considered
|
||||||
|
valid.
|
||||||
|
|
||||||
|
"""
|
||||||
|
backend = self._load_backend(backend_name)
|
||||||
|
if not backend : return None
|
||||||
|
|
||||||
|
failed = self._validate_backend(backend)
|
||||||
if failed:
|
if failed:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|||||||
@@ -41,13 +41,13 @@ import time
|
|||||||
|
|
||||||
|
|
||||||
NAME = "external"
|
NAME = "external"
|
||||||
UPDATE_INTERVAL = 4
|
UPDATE_INTERVAL = 5
|
||||||
DESCRIPTION = """External app (slow) backend
|
DESCRIPTION = """External app (original) backend
|
||||||
|
|
||||||
This backend uses external program calls like ifconfig and
|
This backend uses external program calls like ifconfig and
|
||||||
iwconfig to query network information. This makes it a bit
|
iwconfig to query network information. This makes it a bit
|
||||||
slower and more CPU intensive than the ioctl backend, but
|
slower and more CPU intensive than the ioctl backend, but
|
||||||
it doesn't require any thirdy party libraries and may be
|
it doesn't require any third party libraries and may be
|
||||||
more stable for some set ups.
|
more stable for some set ups.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|||||||
@@ -48,8 +48,8 @@ import array
|
|||||||
|
|
||||||
|
|
||||||
NAME = "ioctl"
|
NAME = "ioctl"
|
||||||
UPDATE_INTERVAL = 3
|
UPDATE_INTERVAL = 4
|
||||||
DESCRIPTION = """IOCTL (fast) backend
|
DESCRIPTION = """IOCTL (new) backend
|
||||||
|
|
||||||
This backend uses IOCTL calls and python libraries to query
|
This backend uses IOCTL calls and python libraries to query
|
||||||
network information whenever possible. This makes it fast,
|
network information whenever possible. This makes it fast,
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ def get_bus():
|
|||||||
return DBUS_MANAGER.get_bus()
|
return DBUS_MANAGER.get_bus()
|
||||||
|
|
||||||
def set_mainloop():
|
def set_mainloop():
|
||||||
return DBUS_MANAGER.connect_to_mainloop()
|
return DBUS_MANAGER.set_mainloop()
|
||||||
|
|
||||||
def connect_to_dbus():
|
def connect_to_dbus():
|
||||||
return DBUS_MANAGER.connect_to_dbus()
|
return DBUS_MANAGER.connect_to_dbus()
|
||||||
@@ -50,6 +50,7 @@ def connect_to_dbus():
|
|||||||
def threads_init():
|
def threads_init():
|
||||||
dbus.mainloop.glib.threads_init()
|
dbus.mainloop.glib.threads_init()
|
||||||
|
|
||||||
|
|
||||||
class DBusManager(object):
|
class DBusManager(object):
|
||||||
""" Manages the DBus objects used by wicd. """
|
""" Manages the DBus objects used by wicd. """
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@@ -58,10 +59,12 @@ class DBusManager(object):
|
|||||||
|
|
||||||
def get_dbus_ifaces(self):
|
def get_dbus_ifaces(self):
|
||||||
""" Returns a dict of dbus interfaces. """
|
""" Returns a dict of dbus interfaces. """
|
||||||
|
if not self._dbus_ifaces: connect_to_dbus()
|
||||||
return self._dbus_ifaces
|
return self._dbus_ifaces
|
||||||
|
|
||||||
def get_interface(self, iface):
|
def get_interface(self, iface):
|
||||||
""" Returns a DBus Interface. """
|
""" Returns a DBus Interface. """
|
||||||
|
if not self._dbus_ifaces: connect_to_dbus()
|
||||||
return self._dbus_ifaces[iface]
|
return self._dbus_ifaces[iface]
|
||||||
|
|
||||||
def get_bus(self):
|
def get_bus(self):
|
||||||
|
|||||||
@@ -318,7 +318,7 @@ class appGui(object):
|
|||||||
print "Starting the Ad-Hoc Network Creation Process..."
|
print "Starting the Ad-Hoc Network Creation Process..."
|
||||||
dialog = gtk.Dialog(title = language['create_adhoc_network'],
|
dialog = gtk.Dialog(title = language['create_adhoc_network'],
|
||||||
flags = gtk.DIALOG_MODAL,
|
flags = gtk.DIALOG_MODAL,
|
||||||
buttons=(gtk.STOCK_OK, 1, gtk.STOCK_CANCEL, 2))
|
buttons=(gtk.STOCK_CANCEL, 2, gtk.STOCK_OK, 1))
|
||||||
dialog.set_has_separator(False)
|
dialog.set_has_separator(False)
|
||||||
dialog.set_size_request(400, -1)
|
dialog.set_size_request(400, -1)
|
||||||
self.chkbox_use_encryption = gtk.CheckButton(language['use_wep_encryption'])
|
self.chkbox_use_encryption = gtk.CheckButton(language['use_wep_encryption'])
|
||||||
|
|||||||
20
wicd/misc.py
@@ -53,6 +53,7 @@ class WicdError(Exception):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
__LANG = None
|
||||||
def Run(cmd, include_stderr=False, return_pipe=False):
|
def Run(cmd, include_stderr=False, return_pipe=False):
|
||||||
""" Run a command.
|
""" Run a command.
|
||||||
|
|
||||||
@@ -69,6 +70,7 @@ def Run(cmd, include_stderr=False, return_pipe=False):
|
|||||||
one output string from the command.
|
one output string from the command.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
global __LANG
|
||||||
if not isinstance(cmd, list):
|
if not isinstance(cmd, list):
|
||||||
cmd = to_unicode(str(cmd))
|
cmd = to_unicode(str(cmd))
|
||||||
cmd = cmd.split()
|
cmd = cmd.split()
|
||||||
@@ -79,9 +81,14 @@ def Run(cmd, include_stderr=False, return_pipe=False):
|
|||||||
err = None
|
err = None
|
||||||
fds = False
|
fds = False
|
||||||
|
|
||||||
|
# We need to make sure that the results of the command we run
|
||||||
|
# are in English, so we set up a temporary environment.
|
||||||
|
if not __LANG:
|
||||||
|
__LANG = get_good_lang()
|
||||||
tmpenv = os.environ.copy()
|
tmpenv = os.environ.copy()
|
||||||
tmpenv["LC_ALL"] = "C"
|
tmpenv["LC_ALL"] = __LANG
|
||||||
tmpenv["LANG"] = "C"
|
tmpenv["LANG"] = __LANG
|
||||||
|
|
||||||
try:
|
try:
|
||||||
f = Popen(cmd, shell=False, stdout=PIPE, stderr=err, close_fds=fds,
|
f = Popen(cmd, shell=False, stdout=PIPE, stderr=err, close_fds=fds,
|
||||||
cwd='/', env=tmpenv)
|
cwd='/', env=tmpenv)
|
||||||
@@ -89,11 +96,20 @@ def Run(cmd, include_stderr=False, return_pipe=False):
|
|||||||
print "Running command %s failed: %s" % (str(cmd), str(e))
|
print "Running command %s failed: %s" % (str(cmd), str(e))
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
if return_pipe:
|
if return_pipe:
|
||||||
return f.stdout
|
return f.stdout
|
||||||
else:
|
else:
|
||||||
return f.communicate()[0]
|
return f.communicate()[0]
|
||||||
|
|
||||||
|
def get_good_lang():
|
||||||
|
""" Check if en_US.utf8 is an available locale, if not use C. """
|
||||||
|
output = Popen(["locale", "-a"], shell=False, stdout=PIPE).communicate()[0]
|
||||||
|
if "en_US.utf8" in output:
|
||||||
|
return "en_US.utf8"
|
||||||
|
else:
|
||||||
|
return "C"
|
||||||
|
|
||||||
def LaunchAndWait(cmd):
|
def LaunchAndWait(cmd):
|
||||||
""" Launches the given program with the given arguments, then blocks.
|
""" Launches the given program with the given arguments, then blocks.
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ wired = dbus_dict["wired"]
|
|||||||
wireless = dbus_dict["wireless"]
|
wireless = dbus_dict["wireless"]
|
||||||
bus = dbusmanager.get_bus()
|
bus = dbusmanager.get_bus()
|
||||||
|
|
||||||
|
monitor = to_time = update_callback = None
|
||||||
|
|
||||||
class ConnectionStatus(object):
|
class ConnectionStatus(object):
|
||||||
""" Class for monitoring the computer's connection status. """
|
""" Class for monitoring the computer's connection status. """
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@@ -62,6 +64,10 @@ class ConnectionStatus(object):
|
|||||||
self.signal_changed = False
|
self.signal_changed = False
|
||||||
self.iwconfig = ""
|
self.iwconfig = ""
|
||||||
|
|
||||||
|
bus = dbusmanager.get_bus()
|
||||||
|
bus.add_signal_receiver(self._force_update_connection_status,
|
||||||
|
"UpdateState", "org.wicd.daemon")
|
||||||
|
|
||||||
def check_for_wired_connection(self, wired_ip):
|
def check_for_wired_connection(self, wired_ip):
|
||||||
""" Checks for an active wired connection.
|
""" Checks for an active wired connection.
|
||||||
|
|
||||||
@@ -175,6 +181,12 @@ class ConnectionStatus(object):
|
|||||||
print 'Ignoring DBus Error: ' + str(e)
|
print 'Ignoring DBus Error: ' + str(e)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def _force_update_connection_status(self):
|
||||||
|
global update_callback
|
||||||
|
gobject.source_remove(update_callback)
|
||||||
|
self.update_connection_status()
|
||||||
|
add_poll_callback()
|
||||||
|
|
||||||
def update_state(self, state, wired_ip=None, wifi_ip=None):
|
def update_state(self, state, wired_ip=None, wifi_ip=None):
|
||||||
""" Set the current connection state. """
|
""" Set the current connection state. """
|
||||||
# Set our connection state/info.
|
# Set our connection state/info.
|
||||||
@@ -275,6 +287,16 @@ def err_handle(error):
|
|||||||
""" Just a dummy function needed for asynchronous dbus calls. """
|
""" Just a dummy function needed for asynchronous dbus calls. """
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def add_poll_callback():
|
||||||
|
global monitor, to_time, update_callback
|
||||||
|
|
||||||
|
try:
|
||||||
|
update_callback = gobject.timeout_add_seconds(to_time,
|
||||||
|
monitor.update_connection_status)
|
||||||
|
except:
|
||||||
|
update_callback = gobject.timeout_add(to_time * 1000,
|
||||||
|
monitor.update_connection_status)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
""" Starts the connection monitor.
|
""" Starts the connection monitor.
|
||||||
|
|
||||||
@@ -282,15 +304,14 @@ def main():
|
|||||||
an amount of time determined by the active backend.
|
an amount of time determined by the active backend.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
global monitor, to_time
|
||||||
|
|
||||||
monitor = ConnectionStatus()
|
monitor = ConnectionStatus()
|
||||||
to_time = daemon.GetBackendUpdateInterval()
|
to_time = daemon.GetBackendUpdateInterval()
|
||||||
try:
|
add_poll_callback()
|
||||||
gobject.timeout_add_seconds(to_time, monitor.update_connection_status)
|
|
||||||
except:
|
|
||||||
gobject.timeout_add(to_time * 1000, monitor.update_connection_status)
|
|
||||||
|
|
||||||
mainloop = gobject.MainLoop()
|
mainloop = gobject.MainLoop()
|
||||||
mainloop.run()
|
mainloop.run()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ def abortable(func):
|
|||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
def get_backend_list():
|
def get_backend_list():
|
||||||
|
""" Returns a list of available backends. """
|
||||||
if BACKEND_MGR:
|
if BACKEND_MGR:
|
||||||
return BACKEND_MGR.get_available_backends()
|
return BACKEND_MGR.get_available_backends()
|
||||||
else:
|
else:
|
||||||
@@ -83,7 +84,7 @@ def get_backend_update_interval():
|
|||||||
if BACKEND_MGR:
|
if BACKEND_MGR:
|
||||||
return BACKEND_MGR.get_update_interval()
|
return BACKEND_MGR.get_update_interval()
|
||||||
else:
|
else:
|
||||||
return 4 # seconds, this should never happen though.
|
return 5 # Seconds, this should never happen though.
|
||||||
|
|
||||||
def get_current_backend():
|
def get_current_backend():
|
||||||
if BACKEND_MGR:
|
if BACKEND_MGR:
|
||||||
@@ -91,6 +92,16 @@ def get_current_backend():
|
|||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def get_backend_description(backend_name):
|
||||||
|
return BACKEND_MGR.get_backend_description(backend_name)
|
||||||
|
|
||||||
|
def get_backend_description_dict():
|
||||||
|
d = {}
|
||||||
|
for be in get_backend_list():
|
||||||
|
if be:
|
||||||
|
d[be] = get_backend_description(be)
|
||||||
|
return d
|
||||||
|
|
||||||
class Controller(object):
|
class Controller(object):
|
||||||
""" Parent class for the different interface types. """
|
""" Parent class for the different interface types. """
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@@ -598,7 +609,6 @@ class Wireless(Controller):
|
|||||||
enctype -- unused
|
enctype -- unused
|
||||||
key -- key of the ad-hoc network
|
key -- key of the ad-hoc network
|
||||||
enc_used -- encrytion enabled on ad-hoc network
|
enc_used -- encrytion enabled on ad-hoc network
|
||||||
ics -- enable internet connection sharing
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
wiface = self.wiface
|
wiface = self.wiface
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ class PreferencesDialog(object):
|
|||||||
wireless = dbus['wireless']
|
wireless = dbus['wireless']
|
||||||
wired = dbus['wired']
|
wired = dbus['wired']
|
||||||
self.wTree = wTree
|
self.wTree = wTree
|
||||||
self.wpadrivers = None
|
|
||||||
self.prep_settings_diag()
|
self.prep_settings_diag()
|
||||||
self.load_preferences_diag()
|
self.load_preferences_diag()
|
||||||
|
|
||||||
@@ -119,8 +118,6 @@ class PreferencesDialog(object):
|
|||||||
self.dns3Entry.set_sensitive(False)
|
self.dns3Entry.set_sensitive(False)
|
||||||
|
|
||||||
cur_backend = daemon.GetSavedBackend()
|
cur_backend = daemon.GetSavedBackend()
|
||||||
self.backendcombo.set_active(0)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.backendcombo.set_active(self.backends.index(cur_backend))
|
self.backendcombo.set_active(self.backends.index(cur_backend))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
@@ -313,8 +310,10 @@ class PreferencesDialog(object):
|
|||||||
self.dns3Entry = self.wTree.get_widget("pref_dns3_entry")
|
self.dns3Entry = self.wTree.get_widget("pref_dns3_entry")
|
||||||
|
|
||||||
self.backendcombo = build_combobox("pref_backend_combobox")
|
self.backendcombo = build_combobox("pref_backend_combobox")
|
||||||
|
self.backendcombo.connect("changed", self.be_combo_changed)
|
||||||
# Load backend combobox
|
# Load backend combobox
|
||||||
self.backends = daemon.GetBackendList()
|
self.backends = daemon.GetBackendList()
|
||||||
|
self.be_descriptions = daemon.GetBackendDescriptionDict()
|
||||||
# "" is included as a hack for DBus limitations, so we remove it.
|
# "" is included as a hack for DBus limitations, so we remove it.
|
||||||
self.backends.remove("")
|
self.backends.remove("")
|
||||||
|
|
||||||
@@ -322,3 +321,8 @@ class PreferencesDialog(object):
|
|||||||
for x in self.backends:
|
for x in self.backends:
|
||||||
self.backendcombo.append_text(x)
|
self.backendcombo.append_text(x)
|
||||||
|
|
||||||
|
def be_combo_changed(self, combo):
|
||||||
|
""" Update the description label for the given backend. """
|
||||||
|
self.backendcombo.set_tooltip_text(
|
||||||
|
self.be_descriptions[combo.get_active_text()]
|
||||||
|
)
|
||||||
|
|||||||
@@ -210,6 +210,16 @@ class WicdDaemon(dbus.service.Object):
|
|||||||
""" Returns status update interval for the loaded backend. """
|
""" Returns status update interval for the loaded backend. """
|
||||||
return networking.get_backend_update_interval()
|
return networking.get_backend_update_interval()
|
||||||
|
|
||||||
|
@dbus.service.method('org.wicd.daemon')
|
||||||
|
def GetBackendDescription(self, backend_name):
|
||||||
|
""" Returns the description of the given backend. """
|
||||||
|
return networking.get_backend_description(backend_name)
|
||||||
|
|
||||||
|
@dbus.service.method('org.wicd.daemon')
|
||||||
|
def GetBackendDescriptionDict(self):
|
||||||
|
""" Returns a dict of all backend names mapped to their description. """
|
||||||
|
return networking.get_backend_description_dict()
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon')
|
@dbus.service.method('org.wicd.daemon')
|
||||||
def GetSavedBackend(self):
|
def GetSavedBackend(self):
|
||||||
""" Returns the backend saved to disk. """
|
""" Returns the backend saved to disk. """
|
||||||
@@ -720,6 +730,10 @@ class WicdDaemon(dbus.service.Object):
|
|||||||
def ConnectResultsSent(self, result):
|
def ConnectResultsSent(self, result):
|
||||||
print "Sending connection attempt result %s" % result
|
print "Sending connection attempt result %s" % result
|
||||||
|
|
||||||
|
@dbus.service.signal(dbus_interface="org.wicd.daemon", signature='')
|
||||||
|
def UpdateState(self):
|
||||||
|
pass
|
||||||
|
|
||||||
@dbus.service.signal(dbus_interface='org.wicd.daemon', signature='')
|
@dbus.service.signal(dbus_interface='org.wicd.daemon', signature='')
|
||||||
def LaunchChooser(self):
|
def LaunchChooser(self):
|
||||||
""" Emits the wired profile chooser dbus signal. """
|
""" Emits the wired profile chooser dbus signal. """
|
||||||
@@ -1326,8 +1340,7 @@ class WiredDaemon(dbus.service.Object):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
for option in ["ip", "broadcast", "netmask","gateway", "dns1", "dns2",
|
for option in ["ip", "broadcast", "netmask","gateway", "dns1", "dns2",
|
||||||
"dns3", "beforescript", "afterscript",
|
"dns3", "beforescript", "afterscript", "disconnectscript"]:
|
||||||
"disconnectscript"]:
|
|
||||||
self.config.set(profilename, option, None)
|
self.config.set(profilename, option, None)
|
||||||
self.config.set(profilename, "default", default)
|
self.config.set(profilename, "default", default)
|
||||||
self.config.write()
|
self.config.write()
|
||||||
|
|||||||