def getInstalledInterfaceCount(self): self.originalInterfaceState = {} self.Adapterlist = iNetwork.getAdapterList() self.InstalledInterfaceCount = len(self.Adapterlist) if self.Adapterlist is not None: if self.InstalledInterfaceCount == 1 and self.selectedInterface is None: self.selectedInterface = self.Adapterlist[0] for interface in iNetwork.getAdapterList(): self.originalInterfaceState[interface] = {} self.originalInterfaceState[interface]["up"] = iNetwork.getAdapterAttribute(interface, 'up')
def __init__(self, session): Screen.__init__(self, session) self["key_red"] = Label(_("Select")) self["key_yellow"] = Label(_("Close")) self.list = [] self["list"] = List(self.list) self["actions"] = ActionMap( ["WizardActions", "ColorActions"], { "ok": self.selectInte, "back": self.close, "red": self.selectInte, "yellow": self.close }) self.list = [] self.adapters = [(iNetwork.getFriendlyAdapterName(x), x) for x in iNetwork.getAdapterList()] for x in self.adapters: res = (x[0], x[1]) self.list.append(res) self["list"].list = self.list
def checkInterface(self, iface): self.stopScan() if self.Adapterlist is None: self.Adapterlist = iNetwork.getAdapterList() if self.NextStep is not 'end': if len(self.Adapterlist) == 0: #Reset Network to defaults if network broken iNetwork.resetNetworkConfig('lan', self.resetNetworkConfigCB) self.resetRef = self.session.openWithCallback( self.resetNetworkConfigFinished, MessageBox, _("Please wait while we prepare your network interfaces..." ), type=MessageBox.TYPE_INFO, enable_input=False) if iface in iNetwork.getInstalledAdapters(): if iface in iNetwork.configuredNetworkAdapters and len( iNetwork.configuredNetworkAdapters) == 1: if iNetwork.getAdapterAttribute(iface, 'up') is True: self.isInterfaceUp = True else: self.isInterfaceUp = False self.currStep = self.getStepWithID(self.NextStep) self.afterAsyncCode() else: self.isInterfaceUp = iNetwork.checkforInterface(iface) self.currStep = self.getStepWithID(self.NextStep) self.afterAsyncCode() else: self.resetNetworkConfigFinished(False)
def __init__(self, session, args = None): Screen.__init__(self, session) self.index = args self.list = [] ConfigListScreen.__init__(self, self.list) if self.index == self.STATE_UPDATE: config.misc.installwizard.hasnetwork.value = False config.misc.installwizard.ipkgloaded.value = False modes = {0: " "} self.enabled = ConfigSelection(choices = modes, default = 0) self.adapters = [(iNetwork.getFriendlyAdapterName(x),x) for x in iNetwork.getAdapterList()] is_found = False for x in self.adapters: if x[1] == 'eth0': if iNetwork.getAdapterAttribute(x[1], 'up'): self.ipConfigEntry = ConfigIP(default = iNetwork.getAdapterAttribute(x[1], "ip")) iNetwork.checkNetworkState(self.checkNetworkCB) if_found = True else: iNetwork.restartNetwork(self.checkNetworkLinkCB) break if is_found is False: self.createMenu() elif self.index == self.STATE_CHOISE_CHANNELLIST: self.enabled = ConfigYesNo(default = True) modes = {"sfteam": "Astra 19e", "23e": "Astra 3", "19e-23e": "Astra 1 Astra 3", "19e-23e-28e": "Astra 1 Astra 2 Astra 3", "13e-19e-23e-28e": "Astra 1 Astra 2 Astra 3 Hotbird"} self.channellist_type = ConfigSelection(choices = modes, default = "sfteam") self.createMenu() elif self.index == self.STATE_CHOISE_PICONS: self.enabled = ConfigYesNo(default = True) modes = {"220x132.black-white": "Astra 19e - Black White 220x132", "220x132.white-black": "Astra 19e - White Black 220x132", "220x132.blue-black": "Astra 19e - Blue Black 220x132", "220x132.reflection-black": "Astra 19e - Reflection Black 220x132", "220x132.transparent-black": "Astra 19e - Transparent Black 220x132", "220x132.transparent-white": "Astra 19e - Transparent White 220x132"} self.picons_type = ConfigSelection(choices = modes, default = "220x132.black-white") self.createMenu() elif self.index == self.STATE_CHOISE_SOFTCAM: self.enabled = ConfigYesNo(default = True) modes = {"cccam230": "CCcam 2.3.0", "cccam221": "CCcam 2.2.1","cccam214": "CCcam 2.1.4","mgcamd": "MGcamd 1.30d","evocamd": "Evocamd 2.1.7","rqcamd": "RQcamd 1.3.1","scam": "Scam 3.5.3",} self.softcam_type = ConfigSelection(choices = modes, default = "cccam230") self.createMenu() elif self.index == self.STATE_CHOISE_CARDSERVER: self.enabled = ConfigYesNo(default = True) modes = {"oscam": "OScam","newcs167": "NewCS 1.6.7"} self.cardserver_type = ConfigSelection(choices = modes, default = "oscam") self.createMenu() elif self.index == self.STATE_CHOISE_MBOOT: self.enabled = ConfigYesNo(default = True) modes = {"openmultiboot": "OpenMultiBoot"} self.cache_type = ConfigSelection(choices = modes, default = "openmultiboot") self.createMenu() elif self.index == self.STATE_CHOISE_HBBTV: self.enabled = ConfigYesNo(default = True) modes = {"browser": "Install"} self.hbbtv_type = ConfigSelection(choices = modes, default = "browser") self.createMenu()
def checkWifiIface(): wiressface = [] interfaces = iNetwork.getAdapterList() for face in interfaces: if iNetwork.isWirelessInterface(face): wiressface.append(face) return wiressface
def __init__(self, session, args=None): Screen.__init__(self, session) self.index = args self.list = [] self.doNextStep = False ConfigListScreen.__init__(self, self.list) if self.index == self.STATE_UPDATE: config.misc.installwizard.hasnetwork.value = False config.misc.installwizard.opkgloaded.value = False modes = {0: " "} self.enabled = ConfigSelection(choices=modes, default=0) self.adapters = [adapter for adapter in iNetwork.getAdapterList() if adapter in ('eth0', 'eth1')] self.checkNetwork() elif self.index == self.INSTALL_PLUGINS: self.noplugins = ConfigNothing() self.doplugins = ConfigNothing() self.createMenu() elif self.index == self.SCAN: self.noscan = ConfigNothing() self.autoscan = ConfigNothing() self.manualscan = ConfigNothing() self.fastscan = ConfigNothing() self.cablescan = ConfigNothing() self.createMenu()
def __init__(self, session, args = None): Screen.__init__(self, session) self.index = args self.list = [] self.doNextStep = False ConfigListScreen.__init__(self, self.list) if self.index == self.STATE_UPDATE: config.misc.installwizard.hasnetwork.value = False config.misc.installwizard.ipkgloaded.value = False modes = {0: " "} self.enabled = ConfigSelection(choices = modes, default = 0) self.adapters = [adapter for adapter in iNetwork.getAdapterList() if adapter in ('eth0', 'eth1')] self.checkNetwork() elif self.index == self.STATE_CHOISE_CHANNELLIST: self.enabled = ConfigYesNo(default = True, graphic = False) modes = {"19e-23e-basis": "Astra1 Astra3 basis", "19e-23e": "Astra 1 Astra 3", "19e-23e-28e": "Astra 1 Astra 2 Astra 3", "13e-19e-23e-28e": "Astra 1 Astra 2 Astra 3 Hotbird", "kabelnl": "Kabel-NL"} self.channellist_type = ConfigSelection(choices = modes, default = "19e-23e-basis") self.createMenu() elif self.index == self.INSTALL_PLUGINS: self.noplugins = ConfigNothing() self.doplugins = ConfigNothing() self.createMenu() elif self.index == self.SCAN: self.noscan = ConfigNothing() self.autoscan = ConfigNothing() self.manualscan = ConfigNothing() self.fastscan = ConfigNothing() self.cablescan = ConfigNothing() self.createMenu()
def listInterfaces(self): self.rescanTimer.stop() self.checkOldInterfaceState() list = [(iNetwork.getFriendlyAdapterName(x), x) for x in iNetwork.getAdapterList()] list.append((_("Exit network wizard"), "end")) return list
def checkInterface(self, iface): self.stopScan() if self.Adapterlist is None: self.Adapterlist = iNetwork.getAdapterList() if self.NextStep is not "end": if len(self.Adapterlist) == 0: # Reset Network to defaults if network broken iNetwork.resetNetworkConfig("lan", self.resetNetworkConfigCB) self.resetRef = self.session.openWithCallback( self.resetNetworkConfigFinished, MessageBox, _("Please wait while we prepare your network interfaces..."), type=MessageBox.TYPE_INFO, enable_input=False, ) if iface in iNetwork.getInstalledAdapters(): if iface in iNetwork.configuredNetworkAdapters and len(iNetwork.configuredNetworkAdapters) == 1: if iNetwork.getAdapterAttribute(iface, "up") is True: self.isInterfaceUp = True else: self.isInterfaceUp = False self.currStep = self.getStepWithID(self.NextStep) self.afterAsyncCode() else: self.isInterfaceUp = iNetwork.checkforInterface(iface) self.currStep = self.getStepWithID(self.NextStep) self.afterAsyncCode() else: self.resetNetworkConfigFinished(False)
def command(self): ConvertIP = lambda l: "%s.%s.%s.%s" % tuple(l) if len( l) == 4 else "0.0.0.0" if iNetwork.getNumberOfAdapters > 0: iface = iNetwork.getAdapterList()[0] print "[WebComponents.About] iface: %s" % iface l = ( iNetwork.getAdapterAttribute(iface, "mac"), iNetwork.getAdapterAttribute(iface, "dhcp"), ConvertIP(iNetwork.getAdapterAttribute(iface, "ip")), ConvertIP(iNetwork.getAdapterAttribute(iface, "netmask")), ConvertIP(iNetwork.getAdapterAttribute(iface, "gateway")), ) else: print "[WebComponents.About] no network iface configured!" l = ( "N/A", "N/A", "N/A", "N/A", "N/A", ) return (l, )
def __init__(self, session, args=None): Screen.__init__(self, session) self.index = args self.list = [] ConfigListScreen.__init__(self, self.list) if self.index == self.STATE_UPDATE: config.misc.installwizard.hasnetwork.value = False config.misc.installwizard.ipkgloaded.value = False modes = {0: " "} self.enabled = ConfigSelection(choices=modes, default=0) self.adapters = [ adapter for adapter in iNetwork.getAdapterList() if adapter in ('eth0', 'eth1') ] self.checkNetwork() elif self.index == self.STATE_CHOISE_CHANNELLIST: self.enabled = ConfigYesNo(default=True) modes = { "19e": "Astra 1", "23e": "Astra 3", "19e-23e": "Astra 1 Astra 3", "19e-23e-28e": "Astra 1 Astra 2 Astra 3", "13e-19e-23e-28e": "Astra 1 Astra 2 Astra 3 Hotbird" } self.channellist_type = ConfigSelection(choices=modes, default="19e") self.createMenu() elif self.index == self.INSTALL_PLUGINS: self.enabled = ConfigYesNo(default=True) self.createMenu() elif self.index == self.INSTALL_SKINS: self.enabled = ConfigYesNo(default=True) self.createMenu()
def __init__(self, session, args = None): Screen.__init__(self, session) self.index = args self.list = [] ConfigListScreen.__init__(self, self.list) if self.index == self.STATE_UPDATE: config.misc.installwizard.hasnetwork.value = False config.misc.installwizard.ipkgloaded.value = False modes = {0: " "} self.enabled = ConfigSelection(choices = modes, default = 0) self.adapters = [(iNetwork.getFriendlyAdapterName(x),x) for x in iNetwork.getAdapterList()] is_found = False for x in self.adapters: if x[1] == 'eth0': if iNetwork.getAdapterAttribute(x[1], 'up'): self.ipConfigEntry = ConfigIP(default = iNetwork.getAdapterAttribute(x[1], "ip")) iNetwork.checkNetworkState(self.checkNetworkCB) if_found = True else: iNetwork.restartNetwork(self.checkNetworkLinkCB) break if is_found is False: self.createMenu() elif self.index == self.STATE_CHOISE_CHANNELLIST: self.enabled = ConfigYesNo(default = True) modes = {"19e": "SAT: 19e", "19e-13e": "SAT: 19e 13e", "19e-13e-5e-75e": "SAT: 19e 13e 5e 75e", "19e-16e-13e": "SAT: 19e 13e 16e", "42e-19e-13e-7e": "SAT: 42e 19e 13e 7e"} self.channellist_type = ConfigSelection(choices = modes, default = "19e") self.createMenu() elif self.index == self.STATE_CHOISE_SOFTCAM: self.enabled = ConfigYesNo(default = True) modes = {"oscam": _("default") + " (Oscam)", "cccam": "CCcam", "scam": "scam"} self.softcam_type = ConfigSelection(choices = modes, default = "oscam") self.createMenu()
def __init__(self, session, args=None): Screen.__init__(self, session) print("installwizard starts") self.index = args self.list = [] ConfigListScreen.__init__(self, self.list) if self.index == self.STATE_UPDATE: config.misc.installwizard.hasnetwork.value = False config.misc.installwizard.ipkgloaded.value = False modes = {0: " "} self.enabled = ConfigSelection(choices=modes, default=0) self.adapters = [(iNetwork.getFriendlyAdapterName(x), x) for x in iNetwork.getAdapterList()] is_found = False if os.path.isfile("/tmp/netwizardselection"): f = open('/tmp/netwizardselection', 'r') adapx1 = f.read() f.close() adapx1 = adapx1.replace('\n', '') print("adapx1:", adapx1) else: adapx1 = 'eth0' print("adapx1+1:", adapx1) for x in self.adapters: if adapx1 == 'eth0': if iNetwork.getAdapterAttribute(adapx1, 'up'): self.ipConfigEntry = ConfigIP( default=iNetwork.getAdapterAttribute(adapx1, "ip")) iNetwork.checkNetworkState(self.checkNetworkCB) if_found = True else: iNetwork.restartNetwork(self.checkNetworkLinkCB) break elif adapx1 == 'wlan0': if iNetwork.getAdapterAttribute(adapx1, 'up'): self.ipConfigEntry = ConfigIP( default=iNetwork.getAdapterAttribute(adapx1, "ip")) iNetwork.checkNetworkState(self.checkNetworkCB) if_found = True else: iNetwork.restartNetwork(self.checkNetworkLinkCB) break elif adapx1 == 'ra0': if iNetwork.getAdapterAttribute(adapx1, 'up'): self.ipConfigEntry = ConfigIP( default=iNetwork.getAdapterAttribute(adapx1, "ip")) iNetwork.checkNetworkState(self.checkNetworkCB) if_found = True else: iNetwork.restartNetwork(self.checkNetworkLinkCB) break if is_found is False: self.createMenu() elif self.index == self.STATE_CHOISE_CHANNELLIST: self.enabled = ConfigYesNo(default=True) modes = {"default": _("OpenNFR List"), "scan": _("scan new")} self.channellist_type = ConfigSelection(choices=modes, default="default") self.createMenu()
def __init__(self, session, args = None): Screen.__init__(self, session) self.index = args self.list = [] ConfigListScreen.__init__(self, self.list) if self.index is self.STATE_UPDATE: config.misc.installwizard.hasnetwork.value = False config.misc.installwizard.ipkgloaded.value = False modes = {0: " "} self.enabled = ConfigSelection(choices = modes, default = 0) self.adapters = [(iNetwork.getFriendlyAdapterName(x),x) for x in iNetwork.getAdapterList()] is_found = False for x in self.adapters: if x[1] == 'eth0': if iNetwork.getAdapterAttribute(x[1], 'up'): self.ipConfigEntry = ConfigIP(default = iNetwork.getAdapterAttribute(x[1], "ip")) iNetwork.checkNetworkState(self.checkNetworkCB) if_found = True else: iNetwork.restartNetwork(self.checkNetworkLinkCB) break if is_found is False: self.createMenu() elif self.index is self.STATE_CHOISE_CHANNELLIST: self.enabled = ConfigYesNo(default = True) modes = {"19e-23e-basis": "Astra1 Astra3 basis", "19e-23e": "Astra 1 Astra 3", "19e-23e-28e": "Astra 1 Astra 2 Astra 3", "13e-19e-23e-28e": "Astra 1 Astra 2 Astra 3 Hotbird", "kabelnl": "Kabel-NL"} self.channellist_type = ConfigSelection(choices = modes, default = "19e-23e-basis") self.createMenu() elif self.index is self.STATE_CHOISE_SOFTCAM: self.enabled = ConfigYesNo(default = True) modes = {"wicardd": _("default") + " (Wicard)", "oscam-ymod": "Oscam-Ymod", "mgcamd": "Mgcamd", "cccam": "Cccam"} self.softcam_type = ConfigSelection(choices = modes, default = "wicardd") self.createMenu()
def command(self): def ConvertIP(list): if len(list) == 4: retstr = "%s.%s.%s.%s" % (list[0], list[1], list[2], list[3]) else: retstr = "0.0.0.0" return retstr list = [] if iNetwork.getNumberOfAdapters > 0: iface = iNetwork.getAdapterList()[0] print "[WebComponents.About] iface: %s" % iface list.extend(( iNetwork.getAdapterAttribute(iface, "mac"), iNetwork.getAdapterAttribute(iface, "dhcp"), ConvertIP(iNetwork.getAdapterAttribute(iface, "ip")), ConvertIP(iNetwork.getAdapterAttribute(iface, "netmask")), ConvertIP(iNetwork.getAdapterAttribute(iface, "gateway")), )) else: print "[WebComponents.About] no network iface configured!" list.extend(( "N/A", "N/A", "N/A", "N/A", "N/A", )) return (list,)
def command(self): def ConvertIP(list): if len(list) == 4: retstr = "%s.%s.%s.%s" % (list[0], list[1], list[2], list[3]) else: retstr = "0.0.0.0" return retstr list = [] if iNetwork.getNumberOfAdapters > 0: iface = iNetwork.getAdapterList()[0] print "[WebComponents.About] iface: %s" % iface list.extend(( iNetwork.getAdapterAttribute(iface, "mac"), iNetwork.getAdapterAttribute(iface, "dhcp"), ConvertIP(iNetwork.getAdapterAttribute(iface, "ip")), ConvertIP(iNetwork.getAdapterAttribute(iface, "netmask")), ConvertIP(iNetwork.getAdapterAttribute(iface, "gateway")), )) else: print "[WebComponents.About] no network iface configured!" list.extend(( "N/A", "N/A", "N/A", "N/A", "N/A", )) return (list, )
def __init__(self, session, args = None): Screen.__init__(self, session) self.index = args self.list = [] ConfigListScreen.__init__(self, self.list) if self.index == self.STATE_UPDATE: config.misc.installwizard.hasnetwork.value = False config.misc.installwizard.ipkgloaded.value = False modes = {0: " "} self.enabled = ConfigSelection(choices = modes, default = 0) self.adapters = [(iNetwork.getFriendlyAdapterName(x),x) for x in iNetwork.getAdapterList()] is_found = False for x in self.adapters: if x[1] == 'eth0': if iNetwork.getAdapterAttribute(x[1], 'up'): self.ipConfigEntry = ConfigIP(default = iNetwork.getAdapterAttribute(x[1], "ip")) iNetwork.checkNetworkState(self.checkNetworkCB) if_found = True else: iNetwork.restartNetwork(self.checkNetworkLinkCB) break if is_found is False: self.createMenu() elif self.index == self.STATE_CHOISE_CHANNELLIST: self.enabled = ConfigYesNo(default = True) modes = {"19e": "Astra 1", "23e": "Astra 3", "19e-23e": "Astra 1 Astra 3", "19e-23e-28e": "Astra 1 Astra 2 Astra 3", "13e-19e-23e-28e": "Astra 1 Astra 2 Astra 3 Hotbird"} self.channellist_type = ConfigSelection(choices = modes, default = "19e") self.createMenu() elif self.index == self.STATE_CHOISE_PICONS: self.enabled = ConfigYesNo(default = True) modes = {"19e": "Astra 19e", "23e": "Astra 3", "19e-23e": "Astra 1 Astra 3", "19e-23e-28e": "Astra 1 Astra 2 Astra 3", "13e-19e-23e-28e": "Astra 1 Astra 2 Astra 3 Hotbird"} self.picons_type = ConfigSelection(choices = modes, default = "19e") self.createMenu() elif self.index == self.STATE_CHOISE_EPG: self.enabled = ConfigYesNo(default = True) modes = {"xmltvimport": "Xmltvimport", "crossepg": "CrossEPG"} self.epg_type = ConfigSelection(choices = modes, default = "xmltvimport") self.createMenu() elif self.index == self.STATE_CHOISE_TDT: self.enabled = ConfigYesNo(default = True) modes = {"siano": "Siano", "Volar Black": "Hauppauge"} self.tdt_type = ConfigSelection(choices = modes, default = "siano") self.createMenu() elif self.index == self.STATE_CHOISE_SOFTCAM: self.enabled = ConfigYesNo(default = True) modes = {"cccam": "CCcam", "oscam": "Oscam"} self.softcam_type = ConfigSelection(choices = modes, default = "cccam") self.createMenu() elif self.index == self.STATE_CHOISE_CACHE: self.enabled = ConfigYesNo(default = True) modes = {"multics": "MultiCS"} self.cache_type = ConfigSelection(choices = modes, default = "multics") self.createMenu()
def __init__(self, session, args=None): Screen.__init__(self, session) self.index = args self.list = [] self.doNextStep = False ConfigListScreen.__init__(self, self.list) if self.index == self.STATE_UPDATE: config.misc.installwizard.hasnetwork.value = False config.misc.installwizard.opkgloaded.value = False modes = {0: " "} self.enabled = ConfigSelection(choices=modes, default=0) self.adapters = [adapter for adapter in iNetwork.getAdapterList() if adapter in ('eth0', 'eth1')] self.checkNetwork() elif self.index == self.STATE_CHOISE_CHANNELLIST: self.enabled = ConfigYesNo(default=True, graphic=False) modes = {"19e-23e-basis": "Astra1 Astra3 basis", "19e-23e": "Astra 1 Astra 3", "19e-23e-28e": "Astra 1 Astra 2 Astra 3", "13e-19e-23e-28e": "Astra 1 Astra 2 Astra 3 Hotbird", "9e-13e-19e-23e-28e-rotating": "Rotating", "kabelnl": "Kabel-NL"} self.channellist_type = ConfigSelection(choices=modes, default="19e-23e-basis") self.createMenu() elif self.index == self.INSTALL_PLUGINS: self.noplugins = ConfigNothing() self.doplugins = ConfigNothing() self.createMenu() elif self.index == self.SCAN: self.noscan = ConfigNothing() self.autoscan = ConfigNothing() self.manualscan = ConfigNothing() self.fastscan = ConfigNothing() self.cablescan = ConfigNothing() self.createMenu()
def __init__(self, session, args = None): Screen.__init__(self, session) self.index = args self.list = [] ConfigListScreen.__init__(self, self.list) if self.index == self.STATE_UPDATE: config.misc.installwizard.hasnetwork.value = False config.misc.installwizard.ipkgloaded.value = False modes = {0: " "} self.enabled = ConfigSelection(choices = modes, default = 0) self.adapters = [adapter for adapter in iNetwork.getAdapterList() if adapter in ('eth0', 'eth1')] self.checkNetwork() elif self.index == self.STATE_CHOICE_CHANNELLIST: self.enabled = ConfigYesNo(default = True, graphic = False) modes = { "19e": "Astra 19.2e", "19e-13e": "Astra 19.2e Hotbird 13.0e", "kabel-bw": "Kabel BW", "kabeldeutschland": " Kabel Deutschland", "unity-media": "Kabel Unitymedia" } self.channellist_type = ConfigSelection(choices = modes, default = "19e-13e") self.createMenu() # elif self.index == self.STATE_CHOICE_SOFTCAM: # self.enabled = ConfigYesNo(default = False) # self.createMenu() elif self.index == self.INSTALL_PLUGINS: self.enabled = ConfigYesNo(default = True) self.createMenu()
def __init__(self, session, args = None): Screen.__init__(self, session) self.index = args self.list = [] ConfigListScreen.__init__(self, self.list) if self.index == self.STATE_UPDATE: config.misc.installwizard.hasnetwork.value = False config.misc.installwizard.ipkgloaded.value = False modes = {0: " "} self.enabled = ConfigSelection(choices = modes, default = 0) self.adapters = [(iNetwork.getFriendlyAdapterName(x),x) for x in iNetwork.getAdapterList()] is_found = False for x in self.adapters: if x[1] == 'eth0' or x[1] == 'eth1': if iNetwork.getAdapterAttribute(x[1], 'up'): self.ipConfigEntry = ConfigIP(default = iNetwork.getAdapterAttribute(x[1], "ip")) iNetwork.checkNetworkState(self.checkNetworkCB) if_found = True else: iNetwork.restartNetwork(self.checkNetworkLinkCB) break if is_found is False: self.createMenu() elif self.index == self.STATE_CHOISE_CHANNELLIST: self.enabled = ConfigYesNo(default = True) modes = {"ESI": "ESI default(13e-19e)", "19e": "Astra 1", "23e": "Astra 3", "19e-23e": "Astra 1 Astra 3", "19e-23e-28e": "Astra 1 Astra 2 Astra 3", "13e-19e-23e-28e": "Astra 1 Astra 2 Astra 3 Hotbird"} self.channellist_type = ConfigSelection(choices = modes, default = "ESI") self.createMenu()
def __init__(self, session, args=None): Screen.__init__(self, session) self.index = args self.list = [] ConfigListScreen.__init__(self, self.list) if self.index == self.STATE_UPDATE: config.misc.installwizard.hasnetwork.value = False config.misc.installwizard.opkgloaded.value = False modes = {0: " "} self.enabled = ConfigSelection(choices=modes, default=0) self.adapters = [ adapter for adapter in iNetwork.getAdapterList() if adapter in ('eth0', 'eth1') ] self.checkNetwork() elif self.index == self.STATE_CHOICE_CHANNELLIST: self.enabled = ConfigYesNo(default=True, graphic=False) modes = { "19e": "Astra 19.2e", "19e-13e": "Astra 19.2e Hotbird 13.0e", "kabel-bw": "Kabel BW", "kabeldeutschland": " Kabel Deutschland", "unity-media": "Kabel Unitymedia" } self.channellist_type = ConfigSelection(choices=modes, default="19e-13e") self.createMenu() # elif self.index == self.STATE_CHOICE_SOFTCAM: # self.enabled = ConfigYesNo(default = False) # self.createMenu() elif self.index == self.INSTALL_PLUGINS: self.enabled = ConfigYesNo(default=True) self.createMenu()
def getBoolean(self): ret = False service = self.source.service info = service and service.info() if not info: return False if self.type == self.INETCONECTION: if not hayinet(): ret = False else: try: f = open('/tmp/testinet.txt', 'r') texto = f.read().replace('\n', '') f.close() if '1 packets transmitted, 1 packets received' in texto: ret = True except: pass try: system('ping -q -c 1 -s 6 -w 2 www.google.com >/tmp/testinet.txt &') except: pass elif self.type == self.NETCONECTION: try: adapters = [ (iNetwork.getFriendlyAdapterName(x), x) for x in iNetwork.getAdapterList() ] except: adapters = False if not adapters: ret = False else: puerta = '0.0.0.0' for x in adapters: if iNetwork.getAdapterAttribute(x[1], 'up') is True: puerta = str(iNetwork.getAdapterAttribute(x[1], 'gateway')).replace(',', '.').replace('[', '').replace(' ', '').replace(']', '') break if puerta == '0.0.0.0': ret = False else: try: f = open('/tmp/testnet.txt', 'r') texto = f.read().replace('\n', '') f.close() if '1 packets transmitted, 1 packets received' in texto: ret = True except: pass try: system('ping -q -c 1 -s 6 -w 2 ' + puerta + ' >/tmp/testnet.txt &') except: pass return ret
def getBoolean(self): ret=False service = self.source.service info = service and service.info() if not info: return False if self.type == self.INETCONECTION: if not hayinet(): ret=False else: try: f = open("/tmp/testinet.txt", "r") texto =f.read().replace("\n","") f.close() if "1 packets transmitted, 1 packets received" in texto: ret=True except: pass try: system("ping -q -c 1 -s 6 -w 2 www.google.es >/tmp/testinet.txt &") except: pass elif self.type == self.NETCONECTION: try: adapters = [(iNetwork.getFriendlyAdapterName(x),x) for x in iNetwork.getAdapterList()] except: adapters = False if not adapters: ret=False else: puerta="0.0.0.0" for x in adapters: if iNetwork.getAdapterAttribute(x[1], 'up') is True: puerta=str(iNetwork.getAdapterAttribute(x[1], "gateway")).replace(",",".").replace("[","").replace(" ","").replace("]","") break; if puerta=="0.0.0.0": ret=False else: try: f = open("/tmp/testnet.txt", "r") texto =f.read().replace("\n","") f.close() if "1 packets transmitted, 1 packets received" in texto: ret=True except: pass try: system("ping -q -c 1 -s 6 -w 2 "+puerta+" >/tmp/testnet.txt &") except: pass # system("echo '"+puerta+"' >/tmp/gat.txt") return ret
def networkstart(reason, **kwargs): interfaces = [] for i in iNetwork.getAdapterList(): interfaces.append((i,i)) print "[AirPlayer] found network dev",i config.plugins.airplayer.interface = ConfigSelection(choices = interfaces) if reason == 1 and config.plugins.airplayer.startuptype.value: startWebserver(global_session) elif reason == 0: stopWebserver(global_session)
def getInstalledInterfaceCount(self): self.rescanTimer.stop() self.Adapterlist = iNetwork.getAdapterList() self.InstalledInterfaceCount = len(self.Adapterlist) if self.Adapterlist is not None: if self.InstalledInterfaceCount == 1 and self.selectedInterface is None: self.selectedInterface = self.Adapterlist[0] self.originalAth0State = iNetwork.getAdapterAttribute('ath0', 'up') self.originalEth0State = iNetwork.getAdapterAttribute('eth0', 'up') self.originalWlan0State = iNetwork.getAdapterAttribute('wlan0', 'up')
def networkstart(reason, **kwargs): interfaces = [] for i in iNetwork.getAdapterList(): interfaces.append((i, i)) print '[AirPlayer] found network dev', i config.plugins.airplayer.interface = ConfigSelection(choices=interfaces, default='eth0') if reason == 1 and config.plugins.airplayer.startuptype.value: startWebserver(global_session) elif reason == 0: stopWebserver(global_session)
def __init__(self, session, args = None): Screen.__init__(self, session) self.index = args self.list = [] ConfigListScreen.__init__(self, self.list) self.ipConfigEntry = ConfigIP(default=[0, 0, 0, 0]) self.interface = 'eth0' if self.index == self.STATE_UPDATE: config.misc.installwizard.hasnetwork.value = False config.misc.installwizard.ipkgloaded.value = False modes = {0: ' '} self.enabled = ConfigSelection(choices=modes, default=0) self.adapters = [ (iNetwork.getFriendlyAdapterName(x), x) for x in iNetwork.getAdapterList() ] is_found = False for x in self.adapters: if x[1] == 'eth0': if iNetwork.getAdapterAttribute(x[1], 'up'): self.ipConfigEntry = ConfigIP(default=iNetwork.getAdapterAttribute(x[1], 'ip')) iNetwork.checkNetworkState(self.checkNetworkCB) if_found = True self.interface = x[1] else: iNetwork.restartNetwork(self.checkNetworkLinkCB) break if is_found is False: self.createMenu() elif self.index == self.STATE_CHOISE_CHANNELLIST: self.enabled = ConfigYesNo(default=True) modes = {'henksat-19e': 'Astra 1', 'henksat-23e': 'Astra 3', 'henksat-19e-23e': 'Astra 1 Astra 3', 'henksat-19e-23e-28e': 'Astra 1 Astra 2 Astra 3', 'henksat-13e-19e-23e-28e': 'Astra 1 Astra 2 Astra 3 Hotbird'} self.channellist_type = ConfigSelection(choices=modes, default='henksat-13e-19e-23e-28e') self.createMenu() elif self.index == self.STATE_CHOISE_SOFTCAM: self.enabled = ConfigYesNo(default=True) modes = {'oscam': _('default') + ' OSCam', 'cccam': 'CCcam', 'gbox': 'GBox', 'wicardd': 'Wicardd', 'mgcamd': 'MGCamd'} if getBoxType() in 'vusolo4k': modes = {'oscam': _('default') + ' OSCam', 'wicardd': 'Wicardd'} if getBoxType() in 'wetekplay': modes = {'oscam': _('default') + ' OSCam'} self.softcam_type = ConfigSelection(choices=modes, default='oscam') self.createMenu()
def GetNetworkInterfaces(self): adapters = [(iNetwork.getFriendlyAdapterName(x),x) for x in iNetwork.getAdapterList()] if not adapters: adapters = [(iNetwork.getFriendlyAdapterName(x),x) for x in iNetwork.getConfiguredAdapters()] if len(adapters) == 0: adapters = [(iNetwork.getFriendlyAdapterName(x),x) for x in iNetwork.getInstalledAdapters()] for x in adapters: if iNetwork.getAdapterAttribute(x[1], 'up') is True: return x[1] return 'eth0'
def GetNetworkInterfaces(self): self.adapters = [ (iNetwork.getFriendlyAdapterName(x), x) for x in iNetwork.getAdapterList() ] if not self.adapters: self.adapters = [ (iNetwork.getFriendlyAdapterName(x), x) for x in iNetwork.getConfiguredAdapters() ] if len(self.adapters) == 0: self.adapters = [ (iNetwork.getFriendlyAdapterName(x), x) for x in iNetwork.getInstalledAdapters() ] self.activeInterface = None for x in self.adapters: if iNetwork.getAdapterAttribute(x[1], 'up') is True: self.activeInterface = x[1] return return
def GetNetworkInterfaces(self): self.adapters = [(iNetwork.getFriendlyAdapterName(x),x) for x in iNetwork.getAdapterList()] if not self.adapters: self.adapters = [(iNetwork.getFriendlyAdapterName(x),x) for x in iNetwork.getConfiguredAdapters()] if len(self.adapters) == 0: self.adapters = [(iNetwork.getFriendlyAdapterName(x),x) for x in iNetwork.getInstalledAdapters()] for x in self.adapters: if iNetwork.getAdapterAttribute(x[1], 'up') is True: return x[1] return None
def __init__(self, session, args=None): Screen.__init__(self, session) self.index = args self.list = [] self.doNextStep = False ConfigListScreen.__init__(self, self.list) if self.index == self.STATE_UPDATE: config.misc.installwizard.hasnetwork.value = False config.misc.installwizard.ipkgloaded.value = False modes = {0: " "} self.enabled = ConfigSelection(choices=modes, default=0) self.adapters = [(iNetwork.getFriendlyAdapterName(x), x) for x in iNetwork.getAdapterList()] is_found = False for x in self.adapters: if x[1] == 'eth0' or x[1] == 'eth1': if iNetwork.getAdapterAttribute(x[1], 'up'): self.ipConfigEntry = ConfigIP( default=iNetwork.getAdapterAttribute(x[1], "ip")) iNetwork.checkNetworkState(self.checkNetworkCB) if_found = True else: iNetwork.restartNetwork(self.checkNetworkLinkCB) break if is_found is False: self.createMenu() elif self.index == self.STATE_CHOISE_CHANNELLIST: self.enabled = ConfigYesNo(default=True) modes = { "19e-23e-basis": "Astra1 Astra3 basis", "19e-23e": "Astra 1 Astra 3", "19e-23e-28e": "Astra 1 Astra 2 Astra 3", "13e-19e-23e-28e": "Astra 1 Astra 2 Astra 3 Hotbird", "kabelnl": "Kabel-NL" } self.channellist_type = ConfigSelection(choices=modes, default="19e-23e-basis") self.createMenu() elif self.index == self.INSTALL_PLUGINS: self.noplugins = ConfigNothing() self.doplugins = ConfigNothing() self.createMenu() elif self.index == self.SCAN: self.noscan = ConfigNothing() self.autoscan = ConfigNothing() self.manualscan = ConfigNothing() self.fastscan = ConfigNothing() self.cablescan = ConfigNothing() self.createMenu()
def __init__(self, session, args = None): Screen.__init__(self, session) self.index = args self.list = [] ConfigListScreen.__init__(self, self.list) if self.index == self.STATE_UPDATE: config.misc.installwizard.hasnetwork.value = False config.misc.installwizard.ipkgloaded.value = False modes = {0: " "} self.enabled = ConfigSelection(choices = modes, default = 0) self.adapters = [(iNetwork.getFriendlyAdapterName(x),x) for x in iNetwork.getAdapterList()] is_found = False for x in self.adapters: if x[1] == 'eth0': if iNetwork.getAdapterAttribute(x[1], 'up'): self.ipConfigEntry = ConfigIP(default = iNetwork.getAdapterAttribute(x[1], "ip")) iNetwork.checkNetworkState(self.checkNetworkCB) if_found = True else: iNetwork.restartNetwork(self.checkNetworkLinkCB) break elif x[1] == 'wlan0': if iNetwork.getAdapterAttribute(x[1], 'up'): self.ipConfigEntry = ConfigIP(default = iNetwork.getAdapterAttribute(x[1], "ip")) iNetwork.checkNetworkState(self.checkNetworkCB) if_found = True else: iNetwork.restartNetwork(self.checkNetworkLinkCB) break elif x[1] == 'ra0': if iNetwork.getAdapterAttribute(x[1], 'up'): self.ipConfigEntry = ConfigIP(default = iNetwork.getAdapterAttribute(x[1], "ip")) iNetwork.checkNetworkState(self.checkNetworkCB) if_found = True else: iNetwork.restartNetwork(self.checkNetworkLinkCB) break if is_found is False: self.createMenu() elif self.index == self.STATE_CHOISE_CHANNELLIST: self.enabled = ConfigYesNo(default = True) modes = {"default-ventonsupport": "Default Germany", "henksat-19e": "Astra 1", "henksat-23e": "Astra 3", "henksat-19e-23e": "Astra 1 Astra 3", "henksat-19e-23e-28e": "Astra 1 Astra 2 Astra 3", "henksat-13e-19e-23e-28e": "Astra 1 Astra 2 Astra 3 Hotbird"} self.channellist_type = ConfigSelection(choices = modes, default = "default-ventonsupport") self.createMenu() elif self.index == self.STATE_CHOISE_SOFTCAM: self.enabled = ConfigYesNo(default = True) modes = {"cccam": _("default") + " (CCcam)", "gbox": "GBox", "wicardd": "Wicardd"} self.softcam_type = ConfigSelection(choices = modes, default = "cccam") self.createMenu()
def __init__(self, session): Screen.__init__(self, session) HelpableScreen.__init__(self) self.setTitle(_("Select a network adapter")) self.wlan_errortext = _("No working wireless network adapter found.\nPlease verify that you have attached a compatible WLAN device and your network is configured correctly.") self.lan_errortext = _("No working local network adapter found.\nPlease verify that you have attached a network cable and your network is configured correctly.") self.oktext = _("Press OK on your remote control to continue.") self.edittext = _("Press OK to edit the settings.") self.defaulttext = _("Press yellow to set this interface as default interface.") self.restartLanRef = None self["key_red"] = StaticText(_("Close")) self["key_green"] = StaticText(_("Select")) self["key_yellow"] = StaticText("") self["key_blue"] = StaticText("") self["introduction"] = StaticText(self.edittext) self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions", { "cancel": (self.close, _("Exit network interface list")), "ok": (self.okbuttonClick, _("Select interface")), }) self["ColorActions"] = HelpableActionMap(self, "ColorActions", { "red": (self.close, _("Exit network interface list")), "green": (self.okbuttonClick, _("Select interface")), "blue": (self.openNetworkWizard, _("Use the network wizard to configure selected network adapter")), }) self["DefaultInterfaceAction"] = HelpableActionMap(self, "ColorActions", { "yellow": (self.setDefaultInterface, [_("Set interface as default Interface"),_("* Only available if more than one interface is active.")] ), }) self.adapters = [(iNetwork.getFriendlyAdapterName(x),x) for x in iNetwork.getAdapterList()] if not self.adapters: self.adapters = [(iNetwork.getFriendlyAdapterName(x),x) for x in iNetwork.getConfiguredAdapters()] if len(self.adapters) == 0: self.adapters = [(iNetwork.getFriendlyAdapterName(x),x) for x in iNetwork.getInstalledAdapters()] self.list = [] self["list"] = List(self.list) self.updateList() if len(self.adapters) == 1: self.onFirstExecBegin.append(self.okbuttonClick) self.onClose.append(self.cleanup)
def __init__(self, session, args = None): Screen.__init__(self, session) self.index = args self.list = [] ConfigListScreen.__init__(self, self.list) if self.index == self.STATE_UPDATE: config.misc.installwizard.hasnetwork.value = False config.misc.installwizard.ipkgloaded.value = False modes = {0: " "} self.enabled = ConfigSelection(choices = modes, default = 0) self.adapters = [(iNetwork.getFriendlyAdapterName(x),x) for x in iNetwork.getAdapterList()] is_found = False if os.path.isfile("/tmp/netwizardselection"): f = open('/tmp/netwizardselection', 'r') adapx1 = f.read() f.close() adapx1 = adapx1.replace('\n','') print "adapx1:", adapx1 else: adapx1 = 'eth0' print "adapx1+1:", adapx1 for x in self.adapters: if adapx1 == 'eth0': if iNetwork.getAdapterAttribute(adapx1, 'up'): self.ipConfigEntry = ConfigIP(default = iNetwork.getAdapterAttribute(adapx1, "ip")) iNetwork.checkNetworkState(self.checkNetworkCB) if_found = True else: iNetwork.restartNetwork(self.checkNetworkLinkCB) break elif adapx1 == 'wlan0': if iNetwork.getAdapterAttribute(adapx1, 'up'): self.ipConfigEntry = ConfigIP(default = iNetwork.getAdapterAttribute(adapx1, "ip")) iNetwork.checkNetworkState(self.checkNetworkCB) if_found = True else: iNetwork.restartNetwork(self.checkNetworkLinkCB) break elif adapx1 == 'ra0': if iNetwork.getAdapterAttribute(adapx1, 'up'): self.ipConfigEntry = ConfigIP(default = iNetwork.getAdapterAttribute(adapx1, "ip")) iNetwork.checkNetworkState(self.checkNetworkCB) if_found = True else: iNetwork.restartNetwork(self.checkNetworkLinkCB) break if is_found is False: self.createMenu()
def networkRestart_stop(self, nextFunc=None): printDebugMsg("networkRestart_stop") self.msgPlugins(False) self.commands = [] # stop current network self.networkRestartConsole = Console() self.commands.append("/etc/init.d/avahi-daemon stop") for iface in iNetwork.getAdapterList(): if iface != 'eth0' or not iNetwork.onRemoteRootFS(): self.commands.append("ifdown " + iface) self.commands.append("ip addr flush dev " + iface) self.commands.append("/etc/init.d/hostapd stop") self.commands.append("/etc/init.d/networking stop") self.commands.append("killall -9 udhcpc") self.commands.append("rm /var/run/udhcpc*") self.networkRestartConsole.eBatch(self.commands, nextFunc, debug=True)
def networkRestart_stop(self, nextFunc = None ): printDebugMsg("networkRestart_stop") self.msgPlugins(False) self.commands = [] # stop current network self.networkRestartConsole = Console() self.commands.append("/etc/init.d/avahi-daemon stop") for iface in iNetwork.getAdapterList(): if iface != 'eth0' or not iNetwork.onRemoteRootFS(): self.commands.append("ifdown " + iface) self.commands.append("ip addr flush dev " + iface) self.commands.append("/etc/init.d/hostapd stop") self.commands.append("/etc/init.d/networking stop") self.commands.append("killall -9 udhcpc") self.commands.append("rm /var/run/udhcpc*") self.networkRestartConsole.eBatch(self.commands, nextFunc, debug = True)
def getMac(self): mac = None while True: #Wait until iNetwork is not loaded ifaces = iNetwork.getAdapterList() for iface in ifaces: if iNetwork.getAdapterName(iface) == "eth0": mac = str(iNetwork.getAdapterAttribute(iface, "mac")) break if mac is not None: break else: time.sleep(1) mac = mac.replace(":", "").lower() return mac
def __init__(self, session): Screen.__init__(self, session) self['key_red'] = Label(_('Select')) self['key_yellow'] = Label(_('Close')) self.list = [] self['list'] = List(self.list) self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'ok': self.selectInte, 'back': self.close, 'red': self.selectInte, 'yellow': self.close}) self.list = [] self.adapters = [ (iNetwork.getFriendlyAdapterName(x), x) for x in iNetwork.getAdapterList() ] for x in self.adapters: res = (x[0], x[1]) self.list.append(res) self['list'].list = self.list
def __init__(self, session, args = None): Screen.__init__(self, session) self.index = args self.list = [] ConfigListScreen.__init__(self, self.list) if self.index == self.STATE_UPDATE: config.misc.installwizard.hasnetwork.value = False config.misc.installwizard.ipkgloaded.value = False modes = {0: ' '} self.enabled = ConfigSelection(choices=modes, default=0) self.adapters = [ (iNetwork.getFriendlyAdapterName(x), x) for x in iNetwork.getAdapterList() ] is_found = False for x in self.adapters: if x[1] == 'eth0' or x[1] == 'eth1': if iNetwork.getAdapterAttribute(x[1], 'up'): self.ipConfigEntry = ConfigIP(default=iNetwork.getAdapterAttribute(x[1], 'ip')) iNetwork.checkNetworkState(self.checkNetworkCB) if_found = True else: iNetwork.restartNetwork(self.checkNetworkLinkCB) break if is_found is False: self.createMenu() elif self.index == self.STATE_CHOISE_CHANNELLIST: self.enabled = ConfigYesNo(default=True) modes = {'19e': 'Astra 1', '23e': 'Astra 3', '19e-23e': 'Astra 1 Astra 3', '19e-23e-28e': 'Astra 1 Astra 2 Astra 3', '13e-19e-23e-28e': 'Astra 1 Astra 2 Astra 3 Hotbird'} self.channellist_type = ConfigSelection(choices=modes, default='19e') self.createMenu() elif self.index == self.STATE_CHOISE_SETTINGPLUGIN: self.enabled = ConfigYesNo(default=True) modes = {'isettinge2': 'iSettingE2', 'cyrussettings': 'Cyrus Setting'} self.pluginsetting_type = ConfigSelection(choices=modes, default='isettinge2') self.createMenu() elif self.index == self.STATE_CHOISE_MULTIBOOTPLUGIN: self.enabled = ConfigYesNo(default=True) modes = {'multiboot': 'ItalySat Multiboot', 'openmultiboot': 'OpenMultiboot'} self.pluginmultiboot_type = ConfigSelection(choices=modes, default='multiboot') self.createMenu()
def __init__(self, session, args=None): Screen.__init__(self, session) self.index = args self.list = [] ConfigListScreen.__init__(self, self.list) if self.index == self.STATE_UPDATE: config.misc.installwizard.hasnetwork.value = False config.misc.installwizard.ipkgloaded.value = False modes = {0: " "} self.enabled = ConfigSelection(choices=modes, default=0) self.adapters = [(iNetwork.getFriendlyAdapterName(x), x) for x in iNetwork.getAdapterList()] is_found = False for x in self.adapters: if x[1] == 'eth0' or x[1] == 'eth1': if iNetwork.getAdapterAttribute(x[1], 'up'): self.ipConfigEntry = ConfigIP( default=iNetwork.getAdapterAttribute(x[1], "ip")) iNetwork.checkNetworkState(self.checkNetworkCB) if_found = True else: iNetwork.restartNetwork(self.checkNetworkLinkCB) break if is_found is False: self.createMenu() elif self.index == self.STATE_CHOICE_CHANNELLIST: self.enabled = ConfigYesNo(default=True, graphic=False) modes = { "19e": "Astra 19.2e", "19e-13e": "Astra 19.2e Hotbird 13.0e", "kabel-bw": "Kabel BW", "kabeldeutschland": " Kabel Deutschland", "unity-media": "Kabel Unitymedia" } self.channellist_type = ConfigSelection(choices=modes, default="19e-13e") self.createMenu() # elif self.index == self.STATE_CHOICE_SOFTCAM: # self.enabled = ConfigYesNo(default = False) # self.createMenu() elif self.index == self.INSTALL_PLUGINS: self.enabled = ConfigYesNo(default=True) self.createMenu()
def getInfoNet(): ret = '' from Components.Network import iNetwork adapters = [(iNetwork.getFriendlyAdapterName(x), x) for x in iNetwork.getAdapterList()] if not adapters: return '' else: default_gw = None num_configured_if = len(iNetwork.getConfiguredAdapters()) if num_configured_if < 2 and path.exists('/etc/default_gw'): unlink('/etc/default_gw') if path.exists('/etc/default_gw'): fp = file('/etc/default_gw', 'r') result = fp.read() fp.close() default_gw = result if len(adapters) == 0: ret = '' else: for x in adapters: if x[1] == default_gw: default_int = True else: default_int = False if iNetwork.getAdapterAttribute(x[1], 'up') is True: active_int = True else: active_int = False if active_int: iNetwork.loadNameserverConfig() ret = 'IP: ' + str(iNetwork.getAdapterAttribute( x[1], 'ip')) + '' if iNetwork.getAdapterAttribute(x[1], 'dhcp'): ret = ret + ' (DHCP)' ippub = '' if len(ippub) > 8: ippub = ' - ' + _('Public IP') + ': ' + ippub + '' ret = ret + ippub break return ret.replace('[', '').replace(']', '').replace(',', '.').replace('. ', '.')
def __init__(self, session, args = None): Screen.__init__(self, session) self.index = args self.list = [] self.doNextStep = False ConfigListScreen.__init__(self, self.list) if self.index == self.STATE_UPDATE: config.misc.installwizard.hasnetwork.value = False config.misc.installwizard.ipkgloaded.value = False modes = {0: " "} self.enabled = ConfigSelection(choices = modes, default = 0) self.adapters = [(iNetwork.getFriendlyAdapterName(x),x) for x in iNetwork.getAdapterList()] is_found = False for x in self.adapters: if x[1] == 'eth0' or x[1] == 'eth1': if iNetwork.getAdapterAttribute(x[1], 'up'): self.ipConfigEntry = ConfigIP(default = iNetwork.getAdapterAttribute(x[1], "ip")) iNetwork.checkNetworkState(self.checkNetworkCB) if_found = True else: iNetwork.restartNetwork(self.checkNetworkLinkCB) break if is_found is False: self.createMenu() elif self.index == self.STATE_CHOISE_CHANNELLIST: self.enabled = ConfigYesNo(default = True, graphic = False) modes = {"19e-23e-basis": "Astra1 Astra3 basis", "19e-23e": "Astra 1 Astra 3", "19e-23e-28e": "Astra 1 Astra 2 Astra 3", "13e-19e-23e-28e": "Astra 1 Astra 2 Astra 3 Hotbird", "kabelnl": "Kabel-NL"} self.channellist_type = ConfigSelection(choices = modes, default = "19e-23e-basis") self.createMenu() elif self.index == self.INSTALL_PLUGINS: self.noplugins = ConfigNothing() self.doplugins = ConfigNothing() self.createMenu() elif self.index == self.SCAN: self.noscan = ConfigNothing() self.autoscan = ConfigNothing() self.manualscan = ConfigNothing() self.fastscan = ConfigNothing() self.cablescan = ConfigNothing() self.createMenu()
def __init__(self, session, args = None): Screen.__init__(self, session) self.index = args self.list = [] ConfigListScreen.__init__(self, self.list) if self.index == self.STATE_UPDATE: config.misc.installwizard.hasnetwork.value = False config.misc.installwizard.ipkgloaded.value = False modes = {0: " "} self.enabled = ConfigSelection(choices = modes, default = 0) self.adapters = [(iNetwork.getFriendlyAdapterName(x),x) for x in iNetwork.getAdapterList()] is_found = False for x in self.adapters: if x[1] == 'eth0' or x[1] == 'eth1': if iNetwork.getAdapterAttribute(x[1], 'up'): self.ipConfigEntry = ConfigIP(default = iNetwork.getAdapterAttribute(x[1], "ip")) iNetwork.checkNetworkState(self.checkNetworkCB) if_found = True else: iNetwork.restartNetwork(self.checkNetworkLinkCB) break if is_found is False: self.createMenu() elif self.index == self.STATE_CHOICE_CHANNELLIST: self.enabled = ConfigYesNo(default = True) modes = { "19e": "Astra 19.2e", "19e-13e": "Astra 19.2e Hotbird 13.0e", "kabel-bw": "Kabel BW", "kabeldeutschland": " Kabel Deutschland", "unity-media": "Kabel Unitymedia" } self.channellist_type = ConfigSelection(choices = modes, default = "19e-13e") self.createMenu() # elif self.index == self.STATE_CHOICE_SOFTCAM: # self.enabled = ConfigYesNo(default = False) # self.createMenu() elif self.index == self.INSTALL_PLUGINS: self.enabled = ConfigYesNo(default = True) self.createMenu()
def __init__(self, session, args = None): Screen.__init__(self, session) self.index = args self.list = [] ConfigListScreen.__init__(self, self.list) if self.index == self.STATE_UPDATE: config.misc.installwizard.hasnetwork.value = False config.misc.installwizard.ipkgloaded.value = False modes = {0: " "} self.enabled = ConfigSelection(choices = modes, default = 0) self.adapters = [(iNetwork.getFriendlyAdapterName(x),x) for x in iNetwork.getAdapterList()] is_found = False for x in self.adapters: if x[1] == 'eth0' or x[1] == 'eth1': if iNetwork.getAdapterAttribute(x[1], 'up'): self.ipConfigEntry = ConfigIP(default = iNetwork.getAdapterAttribute(x[1], "ip")) iNetwork.checkNetworkState(self.checkNetworkCB) if_found = True else: iNetwork.restartNetwork(self.checkNetworkLinkCB) break if is_found is False: self.createMenu() elif self.index == self.STATE_CHOISE_CHANNELLIST: self.enabled = ConfigYesNo(default = True) modes = {"unibox": "Astra/Eutelsat", "henksat-19e": "Astra 1", "henksat-23e": "Astra 3", "henksat-19e-23e": "Astra 1 Astra 3", "henksat-19e-23e-28e": "Astra 1 Astra 2 Astra 3", "henksat-13e-19e-23e-28e": "Astra 1 Astra 2 Astra 3 Hotbird"} self.channellist_type = ConfigSelection(choices = modes, default = "unibox") self.createMenu() # elif self.index == self.STATE_CHOISE_SOFTCAM: # self.enabled = ConfigYesNo(default = True) # modes = {"cccam": _("default") + " (CCcam)", "scam": "scam"} # self.softcam_type = ConfigSelection(choices = modes, default = "cccam") # self.createMenu() elif self.index == self.STATE_CHOISE_IMAGE_UPGRADE: modes = {"yes": _(" "), "no": _(" ")} modes2 = {"yes": _(" "), "no": _(" ")} self.enabled = ConfigSelection(choices = modes, default = "yes") self.enabled2 = ConfigSelection(choices = modes2, default = "no") self.createMenu()
def __init__(self, session, args = None): Screen.__init__(self, session) self.index = args self.list = [] ConfigListScreen.__init__(self, self.list) self.ipConfigEntry = ConfigIP(default=[0, 0, 0, 0]) self.interface = 'eth0' if self.index == self.STATE_UPDATE: config.misc.installwizard.hasnetwork.value = False config.misc.installwizard.ipkgloaded.value = False modes = {0: ' '} self.enabled = ConfigSelection(choices=modes, default=0) self.adapters = [ (iNetwork.getFriendlyAdapterName(x), x) for x in iNetwork.getAdapterList() ] is_found = False for x in self.adapters: if x[1] == 'eth0' or x[1] == 'eth1' or x[1] == 'wlan0' or x[1] == 'ra0': if iNetwork.getAdapterAttribute(x[1], 'up'): self.ipConfigEntry = ConfigIP(default=iNetwork.getAdapterAttribute(x[1], 'ip')) iNetwork.checkNetworkState(self.checkNetworkCB) if_found = True self.interface = x[1] else: iNetwork.restartNetwork(self.checkNetworkLinkCB) break if is_found is False: self.createMenu() elif self.index == self.STATE_CHOISE_CHANNELLIST: self.enabled = ConfigYesNo(default=True) modes = {'default-ventonsupport': 'Default Germany', 'henksat-19e': 'Astra 1', 'henksat-23e': 'Astra 3', 'henksat-19e-23e': 'Astra 1 Astra 3', 'henksat-19e-23e-28e': 'Astra 1 Astra 2 Astra 3', 'henksat-13e-19e-23e-28e': 'Astra 1 Astra 2 Astra 3 Hotbird'} self.channellist_type = ConfigSelection(choices=modes, default='henksat-13e-19e-23e-28e') self.createMenu()
def getInfoNet(): ret = '' from Components.Network import iNetwork adapters = [ (iNetwork.getFriendlyAdapterName(x), x) for x in iNetwork.getAdapterList() ] if not adapters: return '' else: default_gw = None num_configured_if = len(iNetwork.getConfiguredAdapters()) if num_configured_if < 2 and path.exists('/etc/default_gw'): unlink('/etc/default_gw') if path.exists('/etc/default_gw'): fp = file('/etc/default_gw', 'r') result = fp.read() fp.close() default_gw = result if len(adapters) == 0: ret = '' else: for x in adapters: if x[1] == default_gw: default_int = True else: default_int = False if iNetwork.getAdapterAttribute(x[1], 'up') is True: active_int = True else: active_int = False if active_int: iNetwork.loadNameserverConfig() ret = 'IP: ' + str(iNetwork.getAdapterAttribute(x[1], 'ip')) + '' if iNetwork.getAdapterAttribute(x[1], 'dhcp'): ret = ret + ' (DHCP)' ippub = '' if len(ippub) > 8: ippub = ' - ' + _('Public IP') + ': ' + ippub + '' ret = ret + ippub break return ret.replace('[', '').replace(']', '').replace(',', '.').replace('. ', '.')
def command(self): ConvertIP = lambda l: "%s.%s.%s.%s" % tuple(l) if len(l) == 4 else "0.0.0.0" if iNetwork.getNumberOfAdapters > 0: iface = iNetwork.getAdapterList()[0] print "[WebComponents.About] iface: %s" % iface l = ( iNetwork.getAdapterAttribute(iface, "mac"), iNetwork.getAdapterAttribute(iface, "dhcp"), ConvertIP(iNetwork.getAdapterAttribute(iface, "ip")), ConvertIP(iNetwork.getAdapterAttribute(iface, "netmask")), ConvertIP(iNetwork.getAdapterAttribute(iface, "gateway")), ) else: print "[WebComponents.About] no network iface configured!" l = ( "N/A", "N/A", "N/A", "N/A", "N/A", ) return (l,)
def __init__(self, session, menu_path=""): Screen.__init__(self, session) self["key_red"] = Label(_("Close")) self["key_green"] = Label(_("Select")) self.list = [] self["list"] = List(self.list) self["actions"] = ActionMap(["WizardActions", "ColorActions"], { "ok": self.selectInte, "back": self.close, "red": self.close, "green": self.selectInte }) self.list = [ ] self.adapters = [(iNetwork.getFriendlyAdapterName(x),x) for x in iNetwork.getAdapterList()] for x in self.adapters: res = (x[0], x[1]) self.list.append(res) self["list"].list = self.list
def __init__(self, session, args=None): Screen.__init__(self, session) self.index = args self.list = [] ConfigListScreen.__init__(self, self.list) if self.index == self.STATE_UPDATE: config.misc.installwizard.hasnetwork.value = False config.misc.installwizard.ipkgloaded.value = False modes = {0: " "} self.enabled = ConfigSelection(choices=modes, default=0) self.adapters = [(iNetwork.getFriendlyAdapterName(x), x) for x in iNetwork.getAdapterList()] is_found = False for x in self.adapters: if x[1] == 'eth0': if iNetwork.getAdapterAttribute(x[1], 'up'): self.ipConfigEntry = ConfigIP( default=iNetwork.getAdapterAttribute(x[1], "ip")) iNetwork.checkNetworkState(self.checkNetworkCB) if_found = True else: iNetwork.restartNetwork(self.checkNetworkLinkCB) break if is_found is False: self.createMenu() elif self.index == self.STATE_CHOISE_CHANNELLIST: self.enabled = ConfigYesNo(default=True) modes = { "19e": "Astra 1", "23e": "Astra 3", "19e-23e": "Astra 1 Astra 3", "19e-23e-28e": "Astra 1 Astra 2 Astra 3", "13e-19e-23e-28e": "Astra 1 Astra 2 Astra 3 Hotbird" } self.channellist_type = ConfigSelection(choices=modes, default="19e") self.createMenu() elif self.index == self.STATE_CHOISE_PICONS: self.enabled = ConfigYesNo(default=True) modes = { "19e": "Astra 19e", "23e": "Astra 3", "19e-23e": "Astra 1 Astra 3", "19e-23e-28e": "Astra 1 Astra 2 Astra 3", "13e-19e-23e-28e": "Astra 1 Astra 2 Astra 3 Hotbird" } self.picons_type = ConfigSelection(choices=modes, default="19e") self.createMenu() elif self.index == self.STATE_CHOISE_EPG: self.enabled = ConfigYesNo(default=True) modes = {"xmltvimport": "Xmltvimport", "crossepg": "CrossEPG"} self.epg_type = ConfigSelection(choices=modes, default="xmltvimport") self.createMenu() elif self.index == self.STATE_CHOISE_TDT: self.enabled = ConfigYesNo(default=True) modes = {"siano": "Siano", "Volar Black": "Hauppauge"} self.tdt_type = ConfigSelection(choices=modes, default="siano") self.createMenu() elif self.index == self.STATE_CHOISE_SOFTCAM: self.enabled = ConfigYesNo(default=True) modes = {"cccam": "CCcam", "oscam": "Oscam"} self.softcam_type = ConfigSelection(choices=modes, default="cccam") self.createMenu() elif self.index == self.STATE_CHOISE_CACHE: self.enabled = ConfigYesNo(default=True) modes = {"multics": "MultiCS"} self.cache_type = ConfigSelection(choices=modes, default="multics") self.createMenu()
def __init__(self, session, args=None): Screen.__init__(self, session) self.index = args self.list = [] ConfigListScreen.__init__(self, self.list) if self.index == self.STATE_UPDATE: config.misc.installwizard.hasnetwork.value = False config.misc.installwizard.ipkgloaded.value = False modes = {0: " "} self.enabled = ConfigSelection(choices=modes, default=0) self.adapters = [(iNetwork.getFriendlyAdapterName(x), x) for x in iNetwork.getAdapterList()] is_found = False for x in self.adapters: if x[1] == 'eth0': if iNetwork.getAdapterAttribute(x[1], 'up'): self.ipConfigEntry = ConfigIP( default=iNetwork.getAdapterAttribute(x[1], "ip")) iNetwork.checkNetworkState(self.checkNetworkCB) if_found = True else: iNetwork.restartNetwork(self.checkNetworkLinkCB) break if is_found is False: self.createMenu() elif self.index == self.STATE_CHOISE_CHANNELLIST: self.enabled = ConfigYesNo(default=True) modes = { "sfteam": "Astra 19e", "23e": "Astra 3", "19e-23e": "Astra 1 Astra 3", "19e-23e-28e": "Astra 1 Astra 2 Astra 3", "13e-19e-23e-28e": "Astra 1 Astra 2 Astra 3 Hotbird" } self.channellist_type = ConfigSelection(choices=modes, default="sfteam") self.createMenu() elif self.index == self.STATE_CHOISE_PICONS: self.enabled = ConfigYesNo(default=True) modes = { "220x132.black-white": "Astra 19e - Black White 220x132", "220x132.white-black": "Astra 19e - White Black 220x132", "220x132.blue-black": "Astra 19e - Blue Black 220x132", "220x132.reflection-black": "Astra 19e - Reflection Black 220x132", "220x132.transparent-black": "Astra 19e - Transparent Black 220x132", "220x132.transparent-white": "Astra 19e - Transparent White 220x132" } self.picons_type = ConfigSelection(choices=modes, default="220x132.black-white") self.createMenu() elif self.index == self.STATE_CHOISE_SOFTCAM: self.enabled = ConfigYesNo(default=True) modes = { "cccam230": "CCcam 2.3.0", "cccam221": "CCcam 2.2.1", "cccam214": "CCcam 2.1.4", "mgcamd": "MGcamd 1.30d", "evocamd": "Evocamd 2.1.7", "rqcamd": "RQcamd 1.3.1", "scam": "Scam 3.5.3", } self.softcam_type = ConfigSelection(choices=modes, default="cccam230") self.createMenu() elif self.index == self.STATE_CHOISE_CARDSERVER: self.enabled = ConfigYesNo(default=True) modes = {"oscam": "OScam", "newcs167": "NewCS 1.6.7"} self.cardserver_type = ConfigSelection(choices=modes, default="oscam") self.createMenu() elif self.index == self.STATE_CHOISE_MBOOT: self.enabled = ConfigYesNo(default=True) modes = {"openmultiboot": "OpenMultiBoot"} self.cache_type = ConfigSelection(choices=modes, default="openmultiboot") self.createMenu() elif self.index == self.STATE_CHOISE_HBBTV: self.enabled = ConfigYesNo(default=True) modes = {"browser": "Install"} self.hbbtv_type = ConfigSelection(choices=modes, default="browser") self.createMenu()