only show network adapter list when more than one adapters are available
[enigma2.git] / lib / python / Components / Network.py
index 3ee76298312549c87cd6552019867686f94d0ab0..d10163fbee3718374353cf7d63e4c59e4e7e321b 100644 (file)
@@ -1,5 +1,3 @@
-from Components.config import config, ConfigYesNo, ConfigIP, NoSave, ConfigSubsection, ConfigMAC
-
 import os
 import re
 from socket import *
@@ -190,7 +188,7 @@ class Network:
 
        def deactivateNetworkConfig(self):
                for iface in self.ifaces.keys():
-                       os.system("ip addr flush" + iface)
+                       os.system("ip addr flush " + iface)
                os.system("/etc/init.d/networking stop")
                os.system("killall -9 udhcpc")
                os.system("rm /var/run/udhcpc*")
@@ -200,7 +198,15 @@ class Network:
                
        def getNumberOfAdapters(self):
                return len(self.ifaces)
-       
+
+       def getFriendlyAdapterName(self, x):
+               # maybe this needs to be replaced by an external list.
+               friendlyNames = {
+                       "eth0": _("Integrated Ethernet"),
+                       "wlan0": _("Wireless")
+               }
+               return friendlyNames.get(x, x) # when we have no friendly name, use adapter name
+
        def getAdapterName(self, iface):
                return iface