aboutsummaryrefslogtreecommitdiff
path: root/lib/python
diff options
context:
space:
mode:
authoracid-burn <acidburn@opendreambox.org>2009-02-17 16:45:43 +0100
committeracid-burn <acidburn@opendreambox.org>2009-02-17 16:45:43 +0100
commit18d5fedc236e3374f8a31af5e312d12bb16fd31d (patch)
treefae4339f0a974210768b6f5efdcac776a74416c1 /lib/python
parent6e7778ae1b3e258bc53e6ddd2a4635a84d07a92b (diff)
downloadenigma2-18d5fedc236e3374f8a31af5e312d12bb16fd31d.tar.gz
enigma2-18d5fedc236e3374f8a31af5e312d12bb16fd31d.zip
follow Console() changes
add WHERE_NETWORKCONFIG_READ to Plugin Descriptor make Reichi happy ;-)
Diffstat (limited to 'lib/python')
-rwxr-xr-xlib/python/Components/Network.py44
-rwxr-xr-x[-rw-r--r--]lib/python/Plugins/Plugin.py3
2 files changed, 36 insertions, 11 deletions
diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py
index f32a648c..c0b799ba 100755
--- a/lib/python/Components/Network.py
+++ b/lib/python/Components/Network.py
@@ -3,6 +3,8 @@ from re import compile as re_compile, search as re_search
from socket import *
from enigma import eConsoleAppContainer
from Components.Console import Console
+from Components.PluginComponent import plugins
+from Plugins.Plugin import PluginDescriptor
class Network:
def __init__(self):
@@ -22,6 +24,7 @@ class Network:
self.activateConsole = Console()
self.resetNetworkConsole = Console()
self.DnsConsole = Console()
+ self.config_ready = None
self.getInterfaces()
def getInterfaces(self, callback = None):
@@ -222,6 +225,8 @@ class Network:
self.loadNameserverConfig()
print "read configured interfac:", ifaces
print "self.ifaces after loading:", self.ifaces
+ self.config_ready = True
+ self.msgPlugins()
if callback is not None:
callback(True)
@@ -418,6 +423,8 @@ class Network:
def restartNetwork(self,callback = None):
self.restartConsole = Console()
+ self.config_ready = False
+ self.msgPlugins()
self.commands = []
self.commands.append("/etc/init.d/avahi-daemon stop")
for iface in self.ifaces.keys():
@@ -448,24 +455,34 @@ class Network:
def stopLinkStateConsole(self):
if self.LinkConsole is not None:
- self.LinkConsole = None
-
+ if len(self.LinkConsole.appContainers):
+ for name in self.LinkConsole.appContainers.keys():
+ self.LinkConsole.kill(name)
+
def stopDNSConsole(self):
if self.DnsConsole is not None:
- self.DnsConsole = None
-
+ if len(self.DnsConsole.appContainers):
+ for name in self.DnsConsole.appContainers.keys():
+ self.DnsConsole.kill(name)
+
def stopRestartConsole(self):
if self.restartConsole is not None:
- self.restartConsole = None
-
+ if len(self.restartConsole.appContainers):
+ for name in self.restartConsole.appContainers.keys():
+ self.restartConsole.kill(name)
+
def stopGetInterfacesConsole(self):
if self.Console is not None:
- self.Console = None
-
+ if len(self.Console.appContainers):
+ for name in self.Console.appContainers.keys():
+ self.Console.kill(name)
+
def stopDeactivateInterfaceConsole(self):
- if self.deactivateInterfaceConsole:
- self.deactivateInterfaceConsole = None
-
+ if self.deactivateInterfaceConsole is not None:
+ if len(self.deactivateInterfaceConsole.appContainers):
+ for name in self.deactivateInterfaceConsole.appContainers.keys():
+ self.deactivateInterfaceConsole.kill(name)
+
def checkforInterface(self,iface):
if self.getAdapterAttribute(iface, 'up') is True:
return True
@@ -547,6 +564,11 @@ class Network:
netmask = str(inet_ntoa(pack('>L', nm)))
return netmask
+ def msgPlugins(self):
+ if self.config_ready is not None:
+ for p in plugins.getPlugins(PluginDescriptor.WHERE_NETWORKCONFIG_READ):
+ p(reason=self.config_ready)
+
iNetwork = Network()
def InitNetwork():
diff --git a/lib/python/Plugins/Plugin.py b/lib/python/Plugins/Plugin.py
index 53e7b0b8..d7fc6898 100644..100755
--- a/lib/python/Plugins/Plugin.py
+++ b/lib/python/Plugins/Plugin.py
@@ -49,6 +49,9 @@ class PluginDescriptor:
# or return a function which is called with session and the interface name for extended setup of this interface
WHERE_EVENTINFO = 11
+ # reason (True: Networkconfig read finished, False: Networkconfig reload initiated )
+ WHERE_NETWORKCONFIG_READ = 12
+
def __init__(self, name = "Plugin", where = [ ], description = "", icon = None, fnc = None, wakeupfnc = None, internal = False):
self.name = name
self.internal = internal