def checkWifiIface():
    wiressface = []
    interfaces = iNetwork.getAdapterList()
    for face in interfaces:
        if iNetwork.isWirelessInterface(face):
            wiressface.append(face)
    return wiressface
Exemple #2
0
	def __init__(self, session, menu_path = ""):
		Screen.__init__(self, session)
		screentitle = _("Network")
		if config.usage.show_menupath.value == 'large':
			menu_path += screentitle
			title = menu_path
			self["menu_path_compressed"] = StaticText("")
		elif config.usage.show_menupath.value == 'small':
			title = screentitle
			self["menu_path_compressed"] = StaticText(menu_path + " >" if not menu_path.endswith(' / ') else menu_path[:-3] + " >" or "")
		else:
			title = screentitle
			self["menu_path_compressed"] = StaticText("")
		Screen.setTitle(self, title)
		self.skinName = ["SystemNetworkInfo", "WlanStatus"]
		self["LabelBSSID"] = StaticText()
		self["LabelESSID"] = StaticText()
		self["LabelQuality"] = StaticText()
		self["LabelSignal"] = StaticText()
		self["LabelBitrate"] = StaticText()
		self["LabelEnc"] = StaticText()
		self["BSSID"] = StaticText()
		self["ESSID"] = StaticText()
		self["quality"] = StaticText()
		self["signal"] = StaticText()
		self["bitrate"] = StaticText()
		self["enc"] = StaticText()

		self["IFtext"] = StaticText()
		self["IF"] = StaticText()
		self["Statustext"] = StaticText()
		self["statuspic"] = MultiPixmap()
		self["statuspic"].setPixmapNum(1)
		self["statuspic"].show()
		self["devicepic"] = MultiPixmap()

		self.iface = None
		self.createscreen()
		self.iStatus = None

		if iNetwork.isWirelessInterface(self.iface):
			try:
				from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus

				self.iStatus = iStatus
			except:
				pass
			self.resetList()
			self.onClose.append(self.cleanup)

		self["key_red"] = StaticText(_("Close"))

		self["actions"] = ActionMap(["SetupActions", "ColorActions", "DirectionActions"],
									{
										"cancel": self.close,
										"ok": self.close,
										"up": self["AboutScrollLabel"].pageUp,
										"down": self["AboutScrollLabel"].pageDown
									})
		self.onLayoutFinish.append(self.updateStatusbar)
Exemple #3
0
    def __init__(self, session):
        Screen.__init__(self, session)
        Screen.setTitle(self, _("Network Information"))
        self.skinName = ["SystemNetworkInfo", "About"]

        OpenNFRVersion = _("OpenNFR %s") % about.getImageVersionString()
        self["OpenNFRVersion"] = Label(OpenNFRVersion)

        self["LabelBSSID"] = StaticText()
        self["LabelESSID"] = StaticText()
        self["LabelQuality"] = StaticText()
        self["LabelSignal"] = StaticText()
        self["LabelBitrate"] = StaticText()
        self["LabelEnc"] = StaticText()
        self["LabelChannel"] = StaticText(_('Channel:'))
        self["LabelEncType"] = StaticText(_('Encryption Type:'))
        self["LabelFrequency"] = StaticText(_('Frequency:'))
        self["LabelFrequencyNorm"] = StaticText(_('Frequency Norm:'))
        self["BSSID"] = StaticText()
        self["ESSID"] = StaticText()
        self["quality"] = StaticText()
        self["signal"] = StaticText()
        self["bitrate"] = StaticText()
        self["enc"] = StaticText()
        self["channel"] = StaticText()
        self["encryption_type"] = StaticText()
        self["frequency"] = StaticText()
        self["frequency_norm"] = StaticText()

        self["IFtext"] = StaticText()
        self["IF"] = StaticText()
        self["Statustext"] = StaticText()
        self["statuspic"] = MultiPixmap()
        self["statuspic"].setPixmapNum(1)
        self["statuspic"].hide()

        self.iface = None
        self.createscreen()
        self.iStatus = None

        if iNetwork.isWirelessInterface(self.iface):
            try:
                from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus

                self.iStatus = iStatus
            except:
                pass
            self.resetList()
            self.onClose.append(self.cleanup)
        self.updateStatusbar()

        self["key_red"] = StaticText(_("Close"))

        self["actions"] = ActionMap(
            ["SetupActions", "ColorActions", "DirectionActions"], {
                "cancel": self.close,
                "ok": self.close,
                "up": self["AboutScrollLabel"].pageUp,
                "down": self["AboutScrollLabel"].pageDown
            })
def checkWifiIface():
    wiressface = []
    interfaces = iNetwork.getAdapterList()
    for face in interfaces:
        if iNetwork.isWirelessInterface(face):
            wiressface.append(face)
    return wiressface
Exemple #5
0
def callFunction(iface):
	iWlan.setInterface(iface)
	i = iWlan.getWirelessInterfaces()
	if i:
		if iface in i or iNetwork.isWirelessInterface(iface):
			return WlanStatusScreenMain
		return None
	return None
Exemple #6
0
def callFunction(iface):
	iWlan.setInterface(iface)
	i = iWlan.getWirelessInterfaces()
	if i:
		if iface in i or iNetwork.isWirelessInterface(iface):
			return WlanStatusScreenMain
		return None
	return None
Exemple #7
0
	def loadWanIfStatusModule(self, ifaceName):
		if 'iStatus' not in globals() and iNetwork.isWirelessInterface(ifaceName):
			try:
				from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus

				self.iStatus = iStatus
			except:
				pass
			self.onClose.append(self.cleanup)
Exemple #8
0
 def updateStatusbar(self):
     self["IFtext"].setText(_("Network:"))
     self["IF"].setText(iNetwork.getFriendlyAdapterName(self.iface))
     if iNetwork.isWirelessInterface(self.iface):
         try:
             self.iStatus.getDataForInterface(self.iface, self.getInfoCB)
         except:
             pass
     else:
         iNetwork.getLinkState(self.iface, self.dataAvail)
Exemple #9
0
 def selectInterface(self):
     self.InterfaceState = None
     if self.selectedInterface is None:
         if self.InstalledInterfaceCount <= 1:
             if not iNetwork.isWirelessInterface(self.selectedInterface):
                 self.NextStep = 'nwconfig'
             else:
                 self.NextStep = 'asknetworktype'
             self.checkInterface(self.selectedInterface)
         else:
             self.NextStep = 'selectinterface'
             self.currStep = self.getStepWithID(self.NextStep)
             self.afterAsyncCode()
     else:
         if not iNetwork.isWirelessInterface(self.selectedInterface):
             self.NextStep = 'nwconfig'
         else:
             self.NextStep = 'asknetworktype'
         self.checkInterface(self.selectedInterface)
Exemple #10
0
	def selectInterface(self):
		self.InterfaceState = None
		if self.selectedInterface is None:
			if self.InstalledInterfaceCount <= 1:
				if not iNetwork.isWirelessInterface(self.selectedInterface):
					self.NextStep = 'nwconfig'
				else:
					self.NextStep = 'asknetworktype'
				self.checkInterface(self.selectedInterface)
			else:
				self.NextStep = 'selectinterface'
				self.currStep = self.getStepWithID(self.NextStep)
				self.afterAsyncCode()
		else:
			if not iNetwork.isWirelessInterface(self.selectedInterface):
				self.NextStep = 'nwconfig'
			else:
				self.NextStep = 'asknetworktype'
			self.checkInterface(self.selectedInterface)
Exemple #11
0
	def updateStatusbar(self):
		self["IFtext"].setText(_("Network:"))
		self["IF"].setText(iNetwork.getFriendlyAdapterName(self.iface))
		if iNetwork.isWirelessInterface(self.iface):
			try:
				self.iStatus.getDataForInterface(self.iface, self.getInfoCB)
			except:
				pass
		else:
			iNetwork.getLinkState(self.iface, self.dataAvail)
Exemple #12
0
def Plugins(**kwargs):
    fnc = {}
    fnc["ifaceSupported"] = lambda iface: iNetwork.isWirelessInterface(
        iface) or None
    fnc["configStrings"] = getConfigStrings
    fnc["WlanPluginEntry"] = None

    return PluginDescriptor(name=_("Wireless LAN Setup"),
                            description="Wireless LAN Setup",
                            where=[PluginDescriptor.WHERE_NETWORKSETUP],
                            fnc=fnc)
Exemple #13
0
	def checkNetworkCB(self,data):
		if data is True:
			if iNetwork.isWirelessInterface(self.selectedInterface):
				if self.WlanPluginInstalled:
					from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus
					iStatus.getDataForInterface(self.selectedInterface,self.checkWlanStateCB)
				else:
					self.currStep = self.getStepWithID("checklanstatusend")
					self.afterAsyncCode()
			else:
				self.currStep = self.getStepWithID("checklanstatusend")
				self.afterAsyncCode()
Exemple #14
0
	def __init__(self, session):
		Screen.__init__(self, session)
		screentitle = _("Network")
		title = screentitle
		Screen.setTitle(self, title)
		self.skinName = ["SystemNetworkInfo", "WlanStatus"]
		self["LabelBSSID"] = StaticText()
		self["LabelESSID"] = StaticText()
		self["LabelQuality"] = StaticText()
		self["LabelSignal"] = StaticText()
		self["LabelBitrate"] = StaticText()
		self["LabelEnc"] = StaticText()
		self["BSSID"] = StaticText()
		self["ESSID"] = StaticText()
		self["quality"] = StaticText()
		self["signal"] = StaticText()
		self["bitrate"] = StaticText()
		self["enc"] = StaticText()

		self["IFtext"] = StaticText()
		self["IF"] = StaticText()
		self["Statustext"] = StaticText()
		self["statuspic"] = MultiPixmap()
		self["statuspic"].setPixmapNum(1)
		self["statuspic"].show()
		self["devicepic"] = MultiPixmap()

		self["AboutScrollLabel"] = ScrollLabel()

		self.iface = None
		self.createscreen()
		self.iStatus = None

		if iNetwork.isWirelessInterface(self.iface):
			try:
				from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus

				self.iStatus = iStatus
			except:
				pass
			self.resetList()
			self.onClose.append(self.cleanup)

		self["key_red"] = StaticText(_("Close"))

		self["actions"] = ActionMap(["SetupActions", "ColorActions", "DirectionActions"],
									{
										"cancel": self.close,
										"ok": self.close,
										"up": self["AboutScrollLabel"].pageUp,
										"down": self["AboutScrollLabel"].pageDown
									})
		self.onLayoutFinish.append(self.updateStatusbar)
	def __init__(self, session):
		Screen.__init__(self, session)
		Screen.setTitle(self, _("Network Information"))
		self.skinName = ["SystemNetworkInfo", "About"]
		
		OpenNFRVersion = _("OpenNFR %s") % about.getImageVersionString()
		self["OpenNFRVersion"] = Label(OpenNFRVersion)
		
		self["LabelBSSID"] = StaticText()
		self["LabelESSID"] = StaticText()
		self["LabelQuality"] = StaticText()
		self["LabelSignal"] = StaticText()
		self["LabelBitrate"] = StaticText()
		self["LabelEnc"] = StaticText()
		self["BSSID"] = StaticText()
		self["ESSID"] = StaticText()
		self["quality"] = StaticText()
		self["signal"] = StaticText()
		self["bitrate"] = StaticText()
		self["enc"] = StaticText()

		self["IFtext"] = StaticText()
		self["IF"] = StaticText()
		self["Statustext"] = StaticText()
		self["statuspic"] = MultiPixmap()
		self["statuspic"].setPixmapNum(1)
		self["statuspic"].hide()

		self.iface = None
		self.createscreen()
		self.iStatus = None

		if iNetwork.isWirelessInterface(self.iface):
			try:
				from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus

				self.iStatus = iStatus
			except:
				pass
			self.resetList()
			self.onClose.append(self.cleanup)
		self.updateStatusbar()

		self["key_red"] = StaticText(_("Close"))

		self["actions"] = ActionMap(["SetupActions", "ColorActions", "DirectionActions"],
									{
										"cancel": self.close,
										"ok": self.close,
										"up": self["AboutScrollLabel"].pageUp,
										"down": self["AboutScrollLabel"].pageDown
									})
Exemple #16
0
    def updateStatusbar(self):
        self['IFtext'].setText(_('Network:'))
        self['IF'].setText(iNetwork.getFriendlyAdapterName(self.iface))
        self['Statustext'].setText(_('Link:'))
        if iNetwork.isWirelessInterface(self.iface):
            try:
                self.iStatus.getDataForInterface(self.iface, self.getInfoCB)
            except:
                self['statuspic'].setPixmapNum(1)
                self['statuspic'].show()

        else:
            iNetwork.getLinkState(self.iface, self.dataAvail)
Exemple #17
0
    def updateStatusbar(self):
        self['IFtext'].setText(_('Network:'))
        self['IF'].setText(iNetwork.getFriendlyAdapterName(self.iface))
        self['Statustext'].setText(_('Link:'))
        if iNetwork.isWirelessInterface(self.iface):
            try:
                self.iStatus.getDataForInterface(self.iface, self.getInfoCB)
            except:
                self['statuspic'].setPixmapNum(1)
                self['statuspic'].show()

        else:
            iNetwork.getLinkState(self.iface, self.dataAvail)
Exemple #18
0
    def addIfList(self, ifaceName):
        prevLinkState = ifaceName in self.linkState and self.linkState[
            ifaceName]
        self.linkState[ifaceName] = False

        iface = about.getIfConfig(ifaceName)
        if 'addr' in iface:
            self.linkState[ifaceName] = self.getLinkState(ifaceName, iface)
            self.list.add(
                self.makeNetworkHeadEntry(
                    _("Network:"), iNetwork.getFriendlyAdapterName(ifaceName),
                    _("Link:"), self.linkIcons[self.linkState[ifaceName]]))

            self.list.add(self.makeInfoEntry(_("IP:"), str(iface['addr'])))
            if 'netmask' in iface:
                self.list.add(
                    self.makeInfoEntry(_("Netmask:"), str(iface['netmask'])))
            if 'brdaddr' in iface:
                self.list.add(
                    self.makeInfoEntry(_("Broadcast:"), iface['brdaddr']))
            if 'hwaddr' in iface:
                self.list.add(self.makeInfoEntry(_("MAC:"), iface['hwaddr']))
            gateways = self.allGateways.get(ifaceName)
            if gateways:
                if len(gateways) == 1:
                    gatewayLabel = _("Gateway:")
                elif len(gateways) > 1:
                    gatewayLabel = _("Gateways")
                    self.list.add(
                        self.makeGwInfoEntry('', _("Gateway"),
                                             _("Destination")))
                for gw in gateways:
                    if gw["destination"] == "0.0.0.0":
                        gw["destination"] = "default"
                    self.list.add(
                        self.makeGwInfoEntry(gatewayLabel, gw["gateway"],
                                             gw["destination"]))
                gatewayLabel = None
            transferredData = self.allTransferredData.get(ifaceName)
            if transferredData:
                self.list.add(
                    self.makeInfoEntry(
                        _("Bytes in / out:"),
                        ' / '.join([str(s) for s in transferredData])))

            self.loadWanIfStatusModule(ifaceName)

            if iNetwork.isWirelessInterface(ifaceName):
                self.addWirelessInfo(ifaceName)
Exemple #19
0
 def updateStatusbar(self):
     self["IFtext"].setText(_("Network:"))
     self["IF"].setText(iNetwork.getFriendlyAdapterName(self.iface))
     self["Statustext"].setText(_("Link:"))
     if iNetwork.isWirelessInterface(self.iface):
         self["devicepic"].setPixmapNum(1)
         try:
             self.iStatus.getDataForInterface(self.iface, self.getInfoCB)
         except:
             self["statuspic"].setPixmapNum(1)
             self["statuspic"].show()
     else:
         iNetwork.getLinkState(self.iface, self.dataAvail)
         self["devicepic"].setPixmapNum(0)
     self["devicepic"].show()
Exemple #20
0
	def updateStatusbar(self):
		self["IFtext"].setText(_("Network:"))
		self["IF"].setText(iNetwork.getFriendlyAdapterName(self.iface))
		self["Statustext"].setText(_("Link:"))
		if iNetwork.isWirelessInterface(self.iface):
			self["devicepic"].setPixmapNum(1)
			try:
				self.iStatus.getDataForInterface(self.iface, self.getInfoCB)
			except:
				self["statuspic"].setPixmapNum(1)
				self["statuspic"].show()
		else:
			iNetwork.getLinkState(self.iface, self.dataAvail)
			self["devicepic"].setPixmapNum(0)
		self["devicepic"].show()
Exemple #21
0
    def __init__(self, session):
        Screen.__init__(self, session)
        Screen.setTitle(self, _('Network Information'))
        self.skinName = ['SystemNetworkInfo', 'WlanStatus']
        EGAMIVersion = _('EGAMI %s') % about.getImageVersionString()
        self['lab1'] = Label(EGAMIVersion)
        self['LabelBSSID'] = StaticText()
        self['LabelESSID'] = StaticText()
        self['LabelQuality'] = StaticText()
        self['LabelSignal'] = StaticText()
        self['LabelBitrate'] = StaticText()
        self['LabelEnc'] = StaticText()
        self['BSSID'] = StaticText()
        self['ESSID'] = StaticText()
        self['quality'] = StaticText()
        self['signal'] = StaticText()
        self['bitrate'] = StaticText()
        self['enc'] = StaticText()
        self['IFtext'] = StaticText()
        self['IF'] = StaticText()
        self['Statustext'] = StaticText()
        self['statuspic'] = MultiPixmap()
        self['statuspic'].setPixmapNum(1)
        self['statuspic'].show()
        self.iface = None
        self.createscreen()
        self.iStatus = None
        if iNetwork.isWirelessInterface(self.iface):
            try:
                from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus
                self.iStatus = iStatus
            except:
                pass

            self.resetList()
            self.onClose.append(self.cleanup)
        self.updateStatusbar()
        self['key_red'] = StaticText(_('Close'))
        self['actions'] = ActionMap(
            ['SetupActions', 'ColorActions', 'DirectionActions'], {
                'cancel': self.close,
                'ok': self.close,
                'up': self['AboutScrollLabel'].pageUp,
                'down': self['AboutScrollLabel'].pageDown
            })
        return
Exemple #22
0
    def __init__(self, session):
        Screen.__init__(self, session)
        Screen.setTitle(self, _('Network Information'))
        self.skinName = ['SystemNetworkInfo', 'WlanStatus']
        EGAMIVersion = _('EGAMI %s') % about.getImageVersionString()
        self['lab1'] = Label(EGAMIVersion)
        self['LabelBSSID'] = StaticText()
        self['LabelESSID'] = StaticText()
        self['LabelQuality'] = StaticText()
        self['LabelSignal'] = StaticText()
        self['LabelBitrate'] = StaticText()
        self['LabelEnc'] = StaticText()
        self['BSSID'] = StaticText()
        self['ESSID'] = StaticText()
        self['quality'] = StaticText()
        self['signal'] = StaticText()
        self['bitrate'] = StaticText()
        self['enc'] = StaticText()
        self['IFtext'] = StaticText()
        self['IF'] = StaticText()
        self['Statustext'] = StaticText()
        self['statuspic'] = MultiPixmap()
        self['statuspic'].setPixmapNum(1)
        self['statuspic'].show()
        self.iface = None
        self.createscreen()
        self.iStatus = None
        if iNetwork.isWirelessInterface(self.iface):
            try:
                from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus
                self.iStatus = iStatus
            except:
                pass

            self.resetList()
            self.onClose.append(self.cleanup)
        self.updateStatusbar()
        self['key_red'] = StaticText(_('Close'))
        self['actions'] = ActionMap(['SetupActions', 'ColorActions', 'DirectionActions'], {'cancel': self.close,
         'ok': self.close,
         'up': self['AboutScrollLabel'].pageUp,
         'down': self['AboutScrollLabel'].pageDown})
        return
 def checkNetworkCB(self, data):
     if data <= 2:  # OK
         self["connectTestInfo"].setText(_("Network connection ok "))
         self["connectTestInfo"].setForegroundColorNum(2)
         self["connectTest_OK"].setPixmapNum(0)
         self["connectTest_OK"].show()
         self.testitem.setTestResult(FactoryTestItem.TESTRESULT_OK)
         self["opreateInfo"].setText(_("Press 'OK' restart     Press 'Exit' exit"))
         self._runing = False
     else:
         self["connectTestInfo"].setText(_("ping server fail! check network and check hardware!"))
         self["connectTestInfo"].setForegroundColorNum(1)
         self["connectTest_OK"].setPixmapNum(1)
         self["connectTest_OK"].show()
         self["opreateInfo"].setText(_("Press 'OK' restart     Press 'Exit' exit"))
         self._runing = False
     if iNetwork.isWirelessInterface(self.testiface):
         os.system("mv " + self.interfacebackupname + " " + self.interfacename)
         os.system("rm " + self.wlanconfigname)
    def doNetworkconfig(self):
        if iNetwork.isWirelessInterface(self.testiface):
            # back up /etc/network/interfaces
            ret = os.system("cp " + self.interfacename + " " + self.interfacebackupname)
            if ret != 0:
                print "backup interfaces file fail ret:\n", ret
                self["ConfigTestInfo"].setText("backup file(interfaces) fail,Wifi test stop!!")
                self["ConfigTestInfo"].setForegroundColorNum(1)
                self["ConfigTest_OK"].setPixmapNum(1)
                self["ConfigTest_OK"].show()
                return "backup interfaces file fail"

                # config interfaces
            self.writeTestInterfaces()

            interfaces = ["eth0"]
            self.writeWifiConfig(self.testiface)
            iNetwork.deactivateInterface(interfaces, self.activeNetworkCB)
        else:
            interfaces = ["wlan0"]
            iNetwork.deactivateInterface(interfaces, self.activeNetworkCB)
Exemple #25
0
	def updateStatusbar(self):
		self["IFtext"].setText(_("Network:"))
		self["IF"].setText(iNetwork.getFriendlyAdapterName(self.iface))
		self["Statustext"].setText(_("Link:"))
		if self.iface == 'wlan0':
			wait_txt = _("Please wait...")
			self["BSSID"].setText(wait_txt)
			self["ESSID"].setText(wait_txt)
			self["quality"].setText(wait_txt)
			self["signal"].setText(wait_txt)
			self["bitrate"].setText(wait_txt)
			self["enc"].setText(wait_txt)

		if iNetwork.isWirelessInterface(self.iface):
			try:
				self.iStatus.getDataForInterface(self.iface,self.getInfoCB)
			except:
				self["statuspic"].setPixmapNum(1)
				self["statuspic"].show()
		else:
			iNetwork.getLinkState(self.iface,self.dataAvail)
    def creatLables(self):
        if iNetwork.isWirelessInterface(self.testiface):
            self["ConfigWifiText"] = MultiColorLabel(_("WLAN connection config"))  #
        else:
            self["ConfigWifiText"] = MultiColorLabel(_("LAN connection config"))  #

        self["ConfigTestInfo"] = MultiColorLabel()  # Teststatus
        # 		self["ConfigTestInfo"] = StaticText("")
        self["ConfigTest_OK"] = MultiPixmap()  # testicon
        self["ConfigTest_OK"].hide()

        self["DhcpText"] = MultiColorLabel(_("DHCP"))  #
        self["DhcpTestInfo"] = MultiColorLabel()  # Teststatus
        self["DhcpTest_OK"] = MultiPixmap()  # testicon
        self["DhcpTest_OK"].hide()

        self["connectText"] = MultiColorLabel(_("Network Connection Test"))  #
        self["connectTestInfo"] = MultiColorLabel()  # Teststatus
        self["connectTest_OK"] = MultiPixmap()  # testicon
        self["connectTest_OK"].hide()

        self["opreateInfo"] = Label(_("Press 'OK' start"))
Exemple #27
0
	def updateStatusbar(self):
		self["IFtext"].setText(_("Network:"))
		self["IF"].setText(iNetwork.getFriendlyAdapterName(self.iface))
		self["Statustext"].setText(_("Link:"))
		if self.iface == 'wlan0':
			wait_txt = _("Please wait...")
			self["BSSID"].setText(wait_txt)
			self["ESSID"].setText(wait_txt)
			self["quality"].setText(wait_txt)
			self["signal"].setText(wait_txt)
			self["bitrate"].setText(wait_txt)
			self["enc"].setText(wait_txt)

		if iNetwork.isWirelessInterface(self.iface):
			try:
				from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus
			except:
				self["statuspic"].setPixmapNum(1)
				self["statuspic"].show()
			else:
				iStatus.getDataForInterface(self.iface,self.getInfoCB)
		else:
			iNetwork.getLinkState(self.iface,self.dataAvail)
 def checkNetworkCB(self, data):
     if data <= 2:  #OK
         self["connectTestInfo"].setText(_("Network connection ok "))
         self["connectTestInfo"].setForegroundColorNum(2)
         self["connectTest_OK"].setPixmapNum(0)
         self["connectTest_OK"].show()
         self.testitem.setTestResult(FactoryTestItem.TESTRESULT_OK)
         self["opreateInfo"].setText(
             _("Press 'OK' restart     Press 'Exit' exit"))
         self._runing = False
     else:
         self["connectTestInfo"].setText(
             _("ping server fail! check network and check hardware!"))
         self["connectTestInfo"].setForegroundColorNum(1)
         self["connectTest_OK"].setPixmapNum(1)
         self["connectTest_OK"].show()
         self["opreateInfo"].setText(
             _("Press 'OK' restart     Press 'Exit' exit"))
         self._runing = False
     if iNetwork.isWirelessInterface(self.testiface):
         os.system("mv " + self.interfacebackupname + " " +
                   self.interfacename)
         os.system("rm " + self.wlanconfigname)
    def doNetworkconfig(self):
        if iNetwork.isWirelessInterface(self.testiface):
            #back up /etc/network/interfaces
            ret = os.system("cp " + self.interfacename + " " +
                            self.interfacebackupname)
            if ret != 0:
                print "backup interfaces file fail ret:\n", ret
                self["ConfigTestInfo"].setText(
                    "backup file(interfaces) fail,Wifi test stop!!")
                self["ConfigTestInfo"].setForegroundColorNum(1)
                self["ConfigTest_OK"].setPixmapNum(1)
                self["ConfigTest_OK"].show()
                return "backup interfaces file fail"

            #config interfaces
            self.writeTestInterfaces()

            interfaces = ["eth0"]
            self.writeWifiConfig(self.testiface)
            iNetwork.deactivateInterface(interfaces, self.activeNetworkCB)
        else:
            interfaces = ["wlan0"]
            iNetwork.deactivateInterface(interfaces, self.activeNetworkCB)
    def creatLables(self):
        if iNetwork.isWirelessInterface(self.testiface):
            self["ConfigWifiText"] = MultiColorLabel(
                _("WLAN connection config"))  #
        else:
            self["ConfigWifiText"] = MultiColorLabel(
                _("LAN connection config"))  #

        self["ConfigTestInfo"] = MultiColorLabel()  #Teststatus
        #		self["ConfigTestInfo"] = StaticText("")
        self["ConfigTest_OK"] = MultiPixmap()  #testicon
        self["ConfigTest_OK"].hide()

        self["DhcpText"] = MultiColorLabel(_("DHCP"))  #
        self["DhcpTestInfo"] = MultiColorLabel()  #Teststatus
        self["DhcpTest_OK"] = MultiPixmap()  #testicon
        self["DhcpTest_OK"].hide()

        self["connectText"] = MultiColorLabel(_("Network Connection Test"))  #
        self["connectTestInfo"] = MultiColorLabel()  #Teststatus
        self["connectTest_OK"] = MultiPixmap()  #testicon
        self["connectTest_OK"].hide()

        self["opreateInfo"] = Label(_("Press 'OK' start"))
Exemple #31
0
	def addIfList(self, ifaceName):
		prevLinkState = ifaceName in self.linkState and self.linkState[ifaceName]
		self.linkState[ifaceName] = False

		iface = about.getIfConfig(ifaceName)
		if 'addr' in iface:
			self.linkState[ifaceName] = self.getLinkState(ifaceName, iface)
			self.list.add(self.makeNetworkHeadEntry(_("Network:"), iNetwork.getFriendlyAdapterName(ifaceName), _("Link:"), self.linkIcons[self.linkState[ifaceName]]))

			self.list.add(self.makeInfoEntry(_("IP:"), str(iface['addr'])))
			if 'netmask' in iface:
				self.list.add(self.makeInfoEntry(_("Netmask:"), str(iface['netmask'])))
			if 'brdaddr' in iface:
				self.list.add(self.makeInfoEntry(_("Broadcast:"), iface['brdaddr']))
			if 'hwaddr' in iface:
				self.list.add(self.makeInfoEntry(_("MAC:"), iface['hwaddr']))
			gateways = self.allGateways.get(ifaceName)
			if gateways:
				if len(gateways) == 1:
					gatewayLabel = _("Gateway:")
				elif len(gateways) > 1:
					gatewayLabel = _("Gateways")
					self.list.add(self.makeGwInfoEntry('', _("Gateway"), _("Destination")))
				for gw in gateways:
					if gw["destination"] == "0.0.0.0":
						gw["destination"] = "default"
					self.list.add(self.makeGwInfoEntry(gatewayLabel, gw["gateway"], gw["destination"]))
				gatewayLabel = None
			transferredData = self.allTransferredData.get(ifaceName)
			if transferredData:
				self.list.add(self.makeInfoEntry(_("Bytes in / out:"), ' / '.join([str(s) for s in transferredData])))

			self.loadWanIfStatusModule(ifaceName)

			if iNetwork.isWirelessInterface(ifaceName):
				self.addWirelessInfo(ifaceName)
Exemple #32
0
    def __init__(self, session, menu_path=""):
        Screen.__init__(self, session)
        screentitle = _("Network")
        if config.usage.show_menupath.value == 'large':
            menu_path += screentitle
            title = menu_path
            self["menu_path_compressed"] = StaticText("")
        elif config.usage.show_menupath.value == 'small':
            title = screentitle
            self["menu_path_compressed"] = StaticText(
                menu_path +
                " >" if not menu_path.endswith(' / ') else menu_path[:-3] +
                " >" or "")
        else:
            title = screentitle
            self["menu_path_compressed"] = StaticText("")
        Screen.setTitle(self, title)
        self.skinName = ["SystemNetworkInfo", "WlanStatus"]
        self["LabelBSSID"] = StaticText()
        self["LabelESSID"] = StaticText()
        self["LabelQuality"] = StaticText()
        self["LabelSignal"] = StaticText()
        self["LabelBitrate"] = StaticText()
        self["LabelEnc"] = StaticText()
        self["BSSID"] = StaticText()
        self["ESSID"] = StaticText()
        self["quality"] = StaticText()
        self["signal"] = StaticText()
        self["bitrate"] = StaticText()
        self["enc"] = StaticText()

        self["IFtext"] = StaticText()
        self["IF"] = StaticText()
        self["Statustext"] = StaticText()
        self["statuspic"] = MultiPixmap()
        self["statuspic"].setPixmapNum(1)
        self["statuspic"].show()
        self["devicepic"] = MultiPixmap()

        self["AboutScrollLabel"] = ScrollLabel()

        self.iface = None
        self.createscreen()
        self.iStatus = None

        if iNetwork.isWirelessInterface(self.iface):
            try:
                from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus

                self.iStatus = iStatus
            except:
                pass
            self.resetList()
            self.onClose.append(self.cleanup)

        self["key_red"] = StaticText(_("Close"))

        self["actions"] = ActionMap(
            ["SetupActions", "ColorActions", "DirectionActions"], {
                "cancel": self.close,
                "ok": self.close,
                "up": self["AboutScrollLabel"].pageUp,
                "down": self["AboutScrollLabel"].pageDown
            })
        self.onLayoutFinish.append(self.updateStatusbar)