aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMladen Horvat <acidburn@opendreambox.org>2008-11-05 20:22:38 +0100
committerAndreas Oberritter <obi@saftware.de>2008-11-06 01:47:05 +0100
commit040e658a3f89783e0030392110e87cc992264cdd (patch)
treef009273fd7fa368a621e6916f5f7edbec0a79a52
parentd14da9c99de7d25b8811292e53cc745e30594234 (diff)
downloadenigma2-040e658a3f89783e0030392110e87cc992264cdd.tar.gz
enigma2-040e658a3f89783e0030392110e87cc992264cdd.zip
some fixes
B A A
-rwxr-xr-xlib/python/Components/Network.py5
-rwxr-xr-xlib/python/Screens/NetworkSetup.py102
2 files changed, 73 insertions, 34 deletions
diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py
index e10c6a0e..8e9fc120 100755
--- a/lib/python/Components/Network.py
+++ b/lib/python/Components/Network.py
@@ -20,6 +20,7 @@ class Network:
self.deactivateConsole = Console()
self.activateConsole = Console()
self.resetNetworkConsole = Console()
+ self.DnsConsole = Console()
self.getInterfaces()
def getInterfaces(self, callback = None):
@@ -445,6 +446,10 @@ class Network:
if self.LinkConsole is not None:
self.LinkConsole = None
+ def stopDNSConsole(self):
+ if self.DnsConsole is not None:
+ self.DnsConsole = None
+
def stopRestartConsole(self):
if self.restartConsole is not None:
self.restartConsole = None
diff --git a/lib/python/Screens/NetworkSetup.py b/lib/python/Screens/NetworkSetup.py
index c26302fa..6ace1857 100755
--- a/lib/python/Screens/NetworkSetup.py
+++ b/lib/python/Screens/NetworkSetup.py
@@ -770,7 +770,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen):
ifobj = Wireless(self.iface) # a Wireless NIC Object
self.wlanresponse = ifobj.getStatistics()
if self.wlanresponse[0] != 19:
- self.session.openWithCallback(self.AdapterSetupClosed, WlanStatus,self.iface)
+ self.session.openWithCallback(self.WlanStatusClosed, WlanStatus,self.iface)
else:
# Display Wlan not available Message
self.showErrorMessage()
@@ -830,19 +830,14 @@ class AdapterSetupConfiguration(Screen, HelpableScreen):
if self.iface == 'wlan0' or self.iface == 'ath0':
try:
- from Plugins.SystemPlugins.WirelessLan.Wlan import Wlan
- w = Wlan(self.iface)
- stats = w.getStatus()
- if stats['BSSID'] == "00:00:00:00:00:00":
- self["statuspic"].setPixmapNum(1)
- else:
- self["statuspic"].setPixmapNum(0)
- self["statuspic"].show()
+ from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status
except:
self["statuspic"].setPixmapNum(1)
self["statuspic"].show()
+ else:
+ iStatus.getDataForInterface(self.iface,self.getInfoCB)
else:
- self.getLinkState(self.iface)
+ iNetwork.getLinkState(self.iface,self.dataAvail)
def doNothing(self):
pass
@@ -894,7 +889,7 @@ class AdapterSetupConfiguration(Screen, HelpableScreen):
ifobj = Wireless(self.iface) # a Wireless NIC Object
self.wlanresponse = ifobj.getStatistics()
if self.wlanresponse[0] != 19:
- self.session.openWithCallback(self.AdapterSetupClosed, WlanStatus,self.iface)
+ self.session.openWithCallback(self.WlanStatusClosed, WlanStatus,self.iface)
else:
# Display Wlan not available Message
self.showErrorMessage()
@@ -907,6 +902,14 @@ class AdapterSetupConfiguration(Screen, HelpableScreen):
self["menulist"].l.setList(self.mainmenu)
iNetwork.getInterfaces(self.updateStatusbar)
+ def WlanStatusClosed(self, *ret):
+ if ret is not None and len(ret):
+ from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status
+ iStatus.stopWlanConsole()
+ self.mainmenu = self.genMainMenu()
+ self["menulist"].l.setList(self.mainmenu)
+ iNetwork.getInterfaces(self.updateStatusbar)
+
def WlanScanClosed(self,*ret):
if ret[0] is not None:
self.session.openWithCallback(self.AdapterSetupClosed, AdapterSetup, self.iface,ret[0],ret[1])
@@ -930,18 +933,15 @@ class AdapterSetupConfiguration(Screen, HelpableScreen):
if data is True:
self.session.open(MessageBox, _("Finished restarting your network"), type = MessageBox.TYPE_INFO, timeout = 10, default = False)
- def getLinkState(self,iface):
- iNetwork.getLinkState(iface,self.dataAvail)
-
def dataAvail(self,data):
self.output = data.strip()
result = self.output.split('\n')
pattern = re_compile("Link detected: yes")
for item in result:
if re_search(pattern, item):
- self["statuspic"].setPixmapNum(0)
- else:
self["statuspic"].setPixmapNum(1)
+ else:
+ self["statuspic"].setPixmapNum(0)
self["statuspic"].show()
def showErrorMessage(self):
@@ -949,7 +949,27 @@ class AdapterSetupConfiguration(Screen, HelpableScreen):
def cleanup(self):
iNetwork.stopLinkStateConsole()
-
+ try:
+ from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status
+ except ImportError:
+ pass
+ else:
+ iStatus.stopWlanConsole()
+
+ def getInfoCB(self,data,status):
+ print "im getInfoCB"
+ if data is not None:
+ if data is True:
+ if status is not None:
+ print "im getInfoCB status"
+ print "acesspoint",status[self.iface]["acesspoint"]
+ if status[self.iface]["acesspoint"] == "No Connection" or status[self.iface]["acesspoint"] == "Not-Associated" or status[self.iface]["acesspoint"] == False:
+ print "setting statuspix 1"
+ self["statuspic"].setPixmapNum(1)
+ else:
+ self["statuspic"].setPixmapNum(0)
+ print "setting statuspix 0"
+ self["statuspic"].show()
class NetworkAdapterTest(Screen):
def __init__(self, session,iface):
@@ -958,6 +978,8 @@ class NetworkAdapterTest(Screen):
self.oldInterfaceState = iNetwork.getAdapterAttribute(self.iface, "up")
iNetwork.getInterfaces()
self.setLabels()
+ self.onClose.append(self.cleanup)
+ self.onHide.append(self.cleanup)
self["updown_actions"] = NumberActionMap(["WizardActions","ShortcutActions"],
{
@@ -1115,6 +1137,7 @@ class NetworkAdapterTest(Screen):
def doStep3(self):
self["Networktext"].setForegroundColorNum(1)
+ self["Network"].setText(_("Please wait..."))
self.getLinkState(self.iface)
self["NetworkInfo_Text"].setForegroundColorNum(1)
self.steptimer = True
@@ -1287,24 +1310,14 @@ class NetworkAdapterTest(Screen):
def getLinkState(self,iface):
if iface == 'wlan0' or iface == 'ath0':
try:
- from Plugins.SystemPlugins.WirelessLan.Wlan import Wlan
- w = Wlan(iface)
- stats = w.getStatus()
- if stats['BSSID'] == "00:00:00:00:00:00":
- self["Network"].setForegroundColorNum(1)
- self["Network"].setText(_("disconnected"))
- self["NetworkInfo_Check"].setPixmapNum(1)
- self["NetworkInfo_Check"].show()
- else:
- self["Network"].setForegroundColorNum(2)
- self["Network"].setText(_("connected"))
- self["NetworkInfo_Check"].setPixmapNum(0)
- self["NetworkInfo_Check"].show()
+ from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status
except:
self["Network"].setForegroundColorNum(1)
self["Network"].setText(_("disconnected"))
self["NetworkInfo_Check"].setPixmapNum(1)
self["NetworkInfo_Check"].show()
+ else:
+ iStatus.getDataForInterface(self.iface,self.getInfoCB)
else:
iNetwork.getLinkState(iface,self.LinkStatedataAvail)
@@ -1324,7 +1337,6 @@ class NetworkAdapterTest(Screen):
self["NetworkInfo_Check"].show()
def NetworkStatedataAvail(self,data):
- print "DATA",data
if data <= 2:
self["IP"].setForegroundColorNum(2)
self["IP"].setText(_("confirmed"))
@@ -1339,7 +1351,6 @@ class NetworkAdapterTest(Screen):
self.nextStepTimer.start(3000)
def DNSLookupdataAvail(self,data):
- print "DATA",data
if data <= 2:
self["DNS"].setForegroundColorNum(2)
self["DNS"].setText(_("confirmed"))
@@ -1362,5 +1373,28 @@ class NetworkAdapterTest(Screen):
self["shortcutsyellow"].setEnabled(False)
self["updown_actions"].setEnabled(True)
self.activebutton = 6
-
- \ No newline at end of file
+
+ def getInfoCB(self,data,status):
+ 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["Network"].setForegroundColorNum(1)
+ self["Network"].setText(_("disconnected"))
+ self["NetworkInfo_Check"].setPixmapNum(1)
+ self["NetworkInfo_Check"].show()
+ else:
+ self["Network"].setForegroundColorNum(2)
+ self["Network"].setText(_("connected"))
+ self["NetworkInfo_Check"].setPixmapNum(0)
+ self["NetworkInfo_Check"].show()
+
+ def cleanup(self):
+ iNetwork.stopLinkStateConsole()
+ iNetwork.stopDNSConsole()
+ try:
+ from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status
+ except ImportError:
+ pass
+ else:
+ iStatus.stopWlanConsole() \ No newline at end of file