mirror of
https://github.com/gryf/wicd.git
synced 2026-01-29 20:05:45 +01:00
experimental:
- Add UPDATE_INTERVAL as a required attribute for backends, and used by monitor.py - Update Copyright stuff in a few files - Remove/update some scripts and configuration files.
This commit is contained in:
@@ -7,9 +7,8 @@ Manages and loads the pluggable backends for wicd.
|
||||
"""
|
||||
|
||||
#
|
||||
# Copyright (C) 2007 Adam Blackburn
|
||||
# Copyright (C) 2007 Dan O'Reilly
|
||||
# Copyright (C) 2007 Byron Hillis
|
||||
# Copyright (C) 2008 Adam Blackburn
|
||||
# Copyright (C) 2008 Dan O'Reilly
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License Version 2 as
|
||||
@@ -44,7 +43,7 @@ class BackendManager(object):
|
||||
be_file.endswith(".py"))
|
||||
|
||||
def get_current_backend(self):
|
||||
if self.__loaded_backend and not self.__loaded_backend is None:
|
||||
if self.__loaded_backend:
|
||||
return self.__loaded_backend.NAME
|
||||
else:
|
||||
return None
|
||||
@@ -68,7 +67,9 @@ class BackendManager(object):
|
||||
"""
|
||||
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
|
||||
backend_path = os.path.join(self.backend_dir,
|
||||
'be-' + backend_name + '.py')
|
||||
@@ -80,15 +81,17 @@ class BackendManager(object):
|
||||
return None
|
||||
|
||||
if not backend.NAME:
|
||||
fail(backend_name, 'Missing NAME declaration.')
|
||||
return None
|
||||
|
||||
failed = fail(backend_name, 'Missing NAME attribute.')
|
||||
if not backend.UPDATE_INTERVAL:
|
||||
failed = fail(backend_name, "Missing UPDATE_INTERVAL attribute.")
|
||||
if not backend.NeedsExternalCalls:
|
||||
failed = fail(backend_name, "Missing NeedsExternalCalls method.")
|
||||
if not backend.WiredInterface:
|
||||
fail(backend_name, "Missing WiredInterface class")
|
||||
return None
|
||||
|
||||
failed = fail(backend_name, "Missing WiredInterface class.")
|
||||
if not backend.WirelessInterface:
|
||||
fail(backend_name, "Missing WirelessInterface class")
|
||||
failed = fail(backend_name, "Missing WirelessInterface class.")
|
||||
|
||||
if failed:
|
||||
return None
|
||||
|
||||
self.__loaded_backend = backend
|
||||
|
||||
@@ -14,9 +14,8 @@ class WirelessInterface() -- Control a wireless network interface.
|
||||
"""
|
||||
|
||||
#
|
||||
# Copyright (C) 2007 Adam Blackburn
|
||||
# Copyright (C) 2007 Dan O'Reilly
|
||||
# Copyright (C) 2007 Byron Hillis
|
||||
# Copyright (C) 2008 Adam Blackburn
|
||||
# Copyright (C) 2008 Dan O'Reilly
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License Version 2 as
|
||||
@@ -41,6 +40,7 @@ import time
|
||||
|
||||
|
||||
NAME = "external"
|
||||
UPDATE_INTERVAL = 4
|
||||
DESCRIPTION = """External app (slow) backend
|
||||
|
||||
This backend uses external program calls like ifconfig and
|
||||
|
||||
@@ -15,9 +15,8 @@ class WirelessInterface() -- Control a wireless network interface.
|
||||
"""
|
||||
|
||||
#
|
||||
# Copyright (C) 2007 Adam Blackburn
|
||||
# Copyright (C) 2007 Dan O'Reilly
|
||||
# Copyright (C) 2007 Byron Hillis
|
||||
# Copyright (C) 2008 Adam Blackburn
|
||||
# Copyright (C) 2008 Dan O'Reilly
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License Version 2 as
|
||||
@@ -49,6 +48,7 @@ import array
|
||||
|
||||
|
||||
NAME = "ioctl"
|
||||
UPDATE_INTERVAL = 3
|
||||
DESCRIPTION = """IOCTL (fast) backend
|
||||
|
||||
This backend uses IOCTL calls and python libraries to query
|
||||
|
||||
@@ -8,8 +8,8 @@ reusable for other purposes as well.
|
||||
"""
|
||||
|
||||
#
|
||||
# Copyright (C) 2007 Adam Blackburn
|
||||
# Copyright (C) 2007 Dan O'Reilly
|
||||
# Copyright (C) 2008 Adam Blackburn
|
||||
# Copyright (C) 2008 Dan O'Reilly
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License Version 2 as
|
||||
|
||||
@@ -10,8 +10,8 @@ run as the current user.
|
||||
"""
|
||||
|
||||
#
|
||||
# Copyright (C) 2007 Adam Blackburn
|
||||
# Copyright (C) 2007 Dan O'Reilly
|
||||
# Copyright (C) 2007-2008 Adam Blackburn
|
||||
# Copyright (C) 2007-2008 Dan O'Reilly
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License Version 2 as
|
||||
|
||||
@@ -7,8 +7,8 @@ A module for storing wicd's dbus interfaces.
|
||||
"""
|
||||
|
||||
#
|
||||
# Copyright (C) 2007 Adam Blackburn
|
||||
# Copyright (C) 2007 Dan O'Reilly
|
||||
# Copyright (C) 2008 Adam Blackburn
|
||||
# Copyright (C) 2008 Dan O'Reilly
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License Version 2 as
|
||||
|
||||
@@ -289,10 +289,7 @@ def main():
|
||||
|
||||
"""
|
||||
monitor = ConnectionStatus()
|
||||
if daemon.GetCurrentBackend() == "ioctl":
|
||||
to_time = 3
|
||||
else:
|
||||
to_time = 4
|
||||
to_time = daemon.GetBackendUpdateInterval()
|
||||
try:
|
||||
gobject.timeout_add_seconds(to_time, monitor.update_connection_status)
|
||||
except:
|
||||
|
||||
@@ -63,6 +63,12 @@ def get_backend_list():
|
||||
else:
|
||||
return BACKEND_MGR.get_available_backends()
|
||||
|
||||
def get_backend_update_interval():
|
||||
if not BACKEND_MGR:
|
||||
return 4
|
||||
else:
|
||||
return BACKEND_MGR.UPDATE_INTERVAL
|
||||
|
||||
def get_current_backend():
|
||||
if not BACKEND_MGR:
|
||||
return None
|
||||
|
||||
@@ -193,6 +193,11 @@ class WicdDaemon(dbus.service.Object):
|
||||
""" Returns the currently loaded backend. """
|
||||
return networking.get_current_backend()
|
||||
|
||||
@dbus.server.method('org.wicd.daemon')
|
||||
def GetBackendUpdateInterval('org.wicd.daemon'):
|
||||
""" Returns status update interval for the loaded backend. """
|
||||
return networking.get_backend_update_interval()
|
||||
|
||||
@dbus.service.method('org.wicd.daemon')
|
||||
def GetSavedBackend(self):
|
||||
""" Returns the backend saved to disk. """
|
||||
|
||||
Reference in New Issue
Block a user