From: acid-burn Date: Thu, 17 Dec 2009 11:09:54 +0000 (+0100) Subject: Components/Network.py, Screens/NetworkSetup.py: - fix possible crash when closing... X-Git-Tag: 2.7.0~32^2~1^2 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/075c89b1e624ce80fa02aa789a319d84cbe928b4 Components/Network.py, Screens/NetworkSetup.py: - fix possible crash when closing network config --- diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py index f65d6090..bd10d9c3 100755 --- a/lib/python/Components/Network.py +++ b/lib/python/Components/Network.py @@ -24,6 +24,7 @@ class Network: self.activateConsole = Console() self.resetNetworkConsole = Console() self.DnsConsole = Console() + self.PingConsole = Console() self.config_ready = None self.getInterfaces() @@ -475,10 +476,17 @@ class Network: def getLinkStateFinished(self, result, retval,extra_args): (callback) = extra_args + if self.LinkConsole is not None: if len(self.LinkConsole.appContainers) == 0: callback(result) + def stopPingConsole(self): + if self.PingConsole is not None: + if len(self.PingConsole.appContainers): + for name in self.PingConsole.appContainers.keys(): + self.PingConsole.kill(name) + def stopLinkStateConsole(self): if self.LinkConsole is not None: if len(self.LinkConsole.appContainers): diff --git a/lib/python/Screens/NetworkSetup.py b/lib/python/Screens/NetworkSetup.py index e16f26f3..b32ebaf6 100755 --- a/lib/python/Screens/NetworkSetup.py +++ b/lib/python/Screens/NetworkSetup.py @@ -712,7 +712,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): self.onClose.append(self.cleanup) def ok(self): - self.stopCheckNetworkConsole() + self.cleanup() if self["menulist"].getCurrent()[1] == 'edit': if self.iface == 'wlan0' or self.iface == 'ath0': try: @@ -927,7 +927,11 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): self.LinkState = True else: self.LinkState = False - iNetwork.checkNetworkState(self.checkNetworkCB) + if self.LinkState == True: + iNetwork.checkNetworkState(self.checkNetworkCB) + else: + self["statuspic"].setPixmapNum(1) + self["statuspic"].show() def showErrorMessage(self): self.session.open(MessageBox, self.errortext, type = MessageBox.TYPE_INFO,timeout = 10 ) @@ -935,7 +939,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): def cleanup(self): iNetwork.stopLinkStateConsole() iNetwork.stopDeactivateInterfaceConsole() - self.stopCheckNetworkConsole() + iNetwork.stopPingConsole() try: from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus except ImportError: @@ -944,14 +948,17 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): iStatus.stopWlanConsole() def getInfoCB(self,data,status): + self.LinkState = None if data is not None: if data is True: if status is not None: if status[self.iface]["acesspoint"] == "No Connection" or status[self.iface]["acesspoint"] == "Not-Associated" or status[self.iface]["acesspoint"] == False: + self.LinkState = False self["statuspic"].setPixmapNum(1) + self["statuspic"].show() else: - self["statuspic"].setPixmapNum(0) - self["statuspic"].show() + self.LinkState = True + iNetwork.checkNetworkState(self.checkNetworkCB) def checkNetworkCB(self,data): if iNetwork.getAdapterAttribute(self.iface, "up") is True: @@ -960,17 +967,14 @@ class AdapterSetupConfiguration(Screen, HelpableScreen): self["statuspic"].setPixmapNum(0) else: self["statuspic"].setPixmapNum(1) + self["statuspic"].show() else: self["statuspic"].setPixmapNum(1) + self["statuspic"].show() else: self["statuspic"].setPixmapNum(1) - self["statuspic"].show() + self["statuspic"].show() - def stopCheckNetworkConsole(self): - if iNetwork.PingConsole is not None: - if len(iNetwork.PingConsole.appContainers): - for name in iNetwork.PingConsole.appContainers.keys(): - iNetwork.PingConsole.kill(name) class NetworkAdapterTest(Screen): def __init__(self, session,iface): @@ -1389,4 +1393,4 @@ class NetworkAdapterTest(Screen): pass else: iStatus.stopWlanConsole() - +