def applyConfig(self, ret = False):
		if ret:
			self.applyConfigRef = None
			iNetwork.setAdapterAttribute(self.iface, "up", self.activateInterfaceEntry.value)
			iNetwork.setAdapterAttribute(self.iface, "dhcp", self.dhcpConfigEntry.value)
			iNetwork.setAdapterAttribute(self.iface, "ip", self.ipConfigEntry.value)
			iNetwork.setAdapterAttribute(self.iface, "netmask", self.netmaskConfigEntry.value)
			if self.hasGatewayConfigEntry.value:
				iNetwork.setAdapterAttribute(self.iface, "gateway", self.gatewayConfigEntry.value)
			else:
				iNetwork.removeAdapterAttribute(self.iface, "gateway")

			if self.extended is not None and self.configStrings is not None:
				iNetwork.setAdapterAttribute(self.iface, "configStrings", self.configStrings(self.iface))
				self.ws.writeConfig(self.iface)

			if self.activateInterfaceEntry.value is False:
				iNetwork.deactivateInterface(self.iface,self.deactivateInterfaceCB)
				iNetwork.writeNetworkConfig()
				self.applyConfigRef = self.session.openWithCallback(self.applyConfigfinishedCB, MessageBox, _("Please wait for activation of your network configuration..."), type = MessageBox.TYPE_INFO, enable_input = False)
			else:
				if self.oldInterfaceState is False:
					iNetwork.activateInterface(self.iface,self.deactivateInterfaceCB)
				else:
					iNetwork.deactivateInterface(self.iface,self.activateInterfaceCB)
				iNetwork.writeNetworkConfig()
				self.applyConfigRef = self.session.openWithCallback(self.applyConfigfinishedCB, MessageBox, _("Please wait for activation of your network configuration..."), type = MessageBox.TYPE_INFO, enable_input = False)
		else:
			self.keyCancel()
Beispiel #2
0
			def msgClosed(ret):
				if ret:
					from os import system, _exit
					system("rm -rf /etc/enigma2")
					system("rm -rf /etc/network/interfaces")
					system("rm -rf /etc/wpa_supplicant.ath0.conf")
					system("rm -rf /etc/wpa_supplicant.wlan0.conf")
					system("rm -rf /etc/wpa_supplicant.conf")
					system("cp -a /usr/share/enigma2/defaults /etc/enigma2")
					system("/usr/bin/showiframe /usr/share/backdrop.mvi")
					iNetwork.setAdapterAttribute("eth0", "up", True)
					iNetwork.setAdapterAttribute("eth0", "dhcp", True)
					iNetwork.activateInterface("eth0", deactivateInterfaceCB)
					iNetwork.writeNetworkConfig()
					_exit(2)  # We want a full reboot to ensure new hostname is picked up
Beispiel #3
0
 def msgClosed(ret):
     if ret:
         from os import system, _exit
         system("rm -rf /etc/enigma2")
         system("rm -rf /etc/network/interfaces")
         system("rm -rf /etc/wpa_supplicant.ath0.conf")
         system("rm -rf /etc/wpa_supplicant.wlan0.conf")
         system("rm -rf /etc/wpa_supplicant.conf")
         system("cp -a /usr/share/enigma2/defaults /etc/enigma2")
         system("/usr/bin/showiframe /usr/share/backdrop.mvi")
         iNetwork.setAdapterAttribute("eth0", "up", True)
         iNetwork.setAdapterAttribute("eth0", "dhcp", True)
         iNetwork.activateInterface("eth0", deactivateInterfaceCB)
         iNetwork.writeNetworkConfig()
         _exit(
             2
         )  # We want a full reboot to ensure new hostname is picked up
Beispiel #4
0
    def setValue(self, oid, value):
        #the first time we are called, we have to fill the bisect oid store, values are just values, no objects (we cannot call value.get)
        try:
            value.get()
        except:
            return bisectoidstore.BisectOIDStore.setValue(self, oid, value)

        oidstring = bisectoidstore.sortableToOID(oid)
        if oidstring == self.MANAGERIP_OID:
            if config.plugins.SnmpAgent.managerip.value <> value.get():
                config.plugins.SnmpAgent.managerip.value = value.get()
                config.plugins.SnmpAgent.managerip.save()
        elif oidstring == self.ENABLE_BITRATE_OID:
            if config.plugins.SnmpAgent.measurebitrate.value and not value.get(
            ):
                config.plugins.SnmpAgent.measurebitrate.value = False
                config.plugins.SnmpAgent.measurebitrate.save()
                if self.bitrate:
                    self.bitrate.stop()
                    self.bitrate = None
            elif not config.plugins.SnmpAgent.measurebitrate.value and value.get(
            ):
                config.plugins.SnmpAgent.measurebitrate.value = True
                config.plugins.SnmpAgent.measurebitrate.save()
                self.bitrate = Bitrate(self.session)
                self.bitrate.start()
        elif oidstring == self.SYSTEMNAME_OID:
            if config.plugins.SnmpAgent.systemname.value <> value.get():
                config.plugins.SnmpAgent.systemname.value = value.get()
                config.plugins.SnmpAgent.systemname.save()
        elif oidstring == self.SUPPORTADDRESS_OID:
            if config.plugins.SnmpAgent.supportaddress.value <> value.get():
                config.plugins.SnmpAgent.supportaddress.value = value.get()
                config.plugins.SnmpAgent.supportaddress.save()
        elif oidstring == self.SYSTEMDESCRIPTION_OID:
            if config.plugins.SnmpAgent.systemdescription.value <> value.get():
                config.plugins.SnmpAgent.systemdescription.value = value.get()
                config.plugins.SnmpAgent.systemdescription.save()
        elif oidstring == self.LOCATION_OID:
            if config.plugins.SnmpAgent.location.value <> value.get():
                config.plugins.SnmpAgent.location.value = value.get()
                config.plugins.SnmpAgent.location.save()
        elif oidstring == self.CHANNELNAME_OID:
            if self.getChannelName() <> value.get():
                root = config.tv.lastroot.value.split(';')
                fav = eServiceReference(root[-2])
                services = ServiceList(fav,
                                       command_func=self.zapTo,
                                       validate_commands=False)
                sub = services.getServicesAsList()

                if len(sub) > 0:
                    for (ref, name) in sub:
                        if name == value.get():
                            self.zapTo(eServiceReference(ref))
                            break
        elif oidstring == self.SERVICESTRING_OID:
            if self.getServiceString() <> value.get():
                self.zapTo(eServiceReference(value.get()))
        elif oidstring == self.FASTSCANSTRING_OID:
            refstring = ''
            fields = value.get().split(',')
            if len(fields) >= 15:
                onid, tsid, freq, id1, id2, sid, orbital_pos, f1, f2, f3, symbolrate, f4, name, provider, servicetype = fields[
                    0:15]
                refstring = '%d:%d:%d:%x:%x:%x:%x:%x:%x:%x:' % (
                    1, 0, int(servicetype), int(sid), int(tsid), int(onid),
                    int(orbital_pos) * 65536, 0, 0, 0)
            if refstring is not '':
                self.zapTo(eServiceReference(refstring))
        elif oidstring == self.SERVICEPARAMS_OID:
            refstring = ''
            fields = value.get().split(',')
            if len(fields) >= 5:
                orbital_pos, tsid, onid, sid, servicetype = fields[0:5]
                refstring = '%d:%d:%d:%x:%x:%x:%x:%x:%x:%x:' % (
                    1, 0, int(servicetype), int(sid), int(tsid), int(onid),
                    int(orbital_pos) * 65536, 0, 0, 0)
            if refstring is not '':
                self.zapTo(eServiceReference(refstring))
        elif oidstring == self.IP_OID:
            ipstring = value.get().split('.')
            ipval = []
            for x in ipstring:
                ipval.append(int(x))
            if iNetwork.getAdapterAttribute(self.iface, "ip") <> ipval:
                iNetwork.setAdapterAttribute(self.iface, "dhcp", 0)
                iNetwork.setAdapterAttribute(self.iface, "ip", ipval)
                iNetwork.deactivateNetworkConfig()
                iNetwork.writeNetworkConfig()
                iNetwork.activateNetworkConfig()
        elif oidstring == self.IP_OID:
            ipstring = value.get().split('.')
            ipval = []
            for x in ipstring:
                ipval.append(int(x))
            if iNetwork.getAdapterAttribute(self.iface, "netmask") <> ipval:
                iNetwork.setAdapterAttribute(self.iface, "dhcp", 0)
                iNetwork.setAdapterAttribute(self.iface, "netmask", ipval)
                iNetwork.deactivateNetworkConfig()
                iNetwork.writeNetworkConfig()
                iNetwork.activateNetworkConfig()
        elif oidstring == self.GATEWAY_OID:
            ipstring = value.get().split('.')
            ipval = []
            for x in ipstring:
                ipval.append(int(x))
            if iNetwork.getAdapterAttribute(self.iface, "gateway") <> ipval:
                iNetwork.setAdapterAttribute(self.iface, "dhcp", 0)
                iNetwork.setAdapterAttribute(self.iface, "gateway", ipval)
                iNetwork.deactivateNetworkConfig()
                iNetwork.writeNetworkConfig()
                iNetwork.activateNetworkConfig()
        elif oidstring == self.ENABLE_EMM_OID:
            if config.plugins.SnmpAgent.checkemm.value and not value.get():
                config.plugins.SnmpAgent.checkemm.value = False
                config.plugins.SnmpAgent.checkemm.save()
                if self.emm:
                    self.emm.stop()
                    self.emm = None
            elif not config.plugins.SnmpAgent.checkemm.value and value.get():
                config.plugins.SnmpAgent.checkemm.value = True
                config.plugins.SnmpAgent.checkemm.save()
                self.emm = Emm(self.session)
                self.emm.start()
        else:
            print "oid not found!?"

        return None
	def setValue(self, oid, value):
		#the first time we are called, we have to fill the bisect oid store, values are just values, no objects (we cannot call value.get)
		try:
			value.get()
		except:
			return bisectoidstore.BisectOIDStore.setValue(self, oid, value)

		oidstring = bisectoidstore.sortableToOID(oid)
		if oidstring == self.MANAGERIP_OID:
			if config.plugins.SnmpAgent.managerip.value <> value.get():
				config.plugins.SnmpAgent.managerip.value = value.get()
				config.plugins.SnmpAgent.managerip.save()
		elif oidstring == self.ENABLE_BITRATE_OID:
			if config.plugins.SnmpAgent.measurebitrate.value and not value.get():
				config.plugins.SnmpAgent.measurebitrate.value = False
				config.plugins.SnmpAgent.measurebitrate.save()
				if self.bitrate:
					self.bitrate.stop()
					self.bitrate = None
			elif not config.plugins.SnmpAgent.measurebitrate.value and value.get():
				config.plugins.SnmpAgent.measurebitrate.value = True
				config.plugins.SnmpAgent.measurebitrate.save()
				self.bitrate = Bitrate(self.session)
				self.bitrate.start()
		elif oidstring == self.SYSTEMNAME_OID:
			if config.plugins.SnmpAgent.systemname.value <> value.get():
				config.plugins.SnmpAgent.systemname.value = value.get()
				config.plugins.SnmpAgent.systemname.save()
		elif oidstring == self.SUPPORTADDRESS_OID:
			if config.plugins.SnmpAgent.supportaddress.value <> value.get():
				config.plugins.SnmpAgent.supportaddress.value = value.get()
				config.plugins.SnmpAgent.supportaddress.save()
		elif oidstring == self.SYSTEMDESCRIPTION_OID:
			if config.plugins.SnmpAgent.systemdescription.value <> value.get():
				config.plugins.SnmpAgent.systemdescription.value = value.get()
				config.plugins.SnmpAgent.systemdescription.save()
		elif oidstring == self.LOCATION_OID:
			if config.plugins.SnmpAgent.location.value <> value.get():
				config.plugins.SnmpAgent.location.value = value.get()
				config.plugins.SnmpAgent.location.save()
		elif oidstring == self.CHANNELNAME_OID:
			if self.getChannelName() <> value.get():
				root = config.tv.lastroot.value.split(';')
				fav = eServiceReference(root[-2])
				services = ServiceList(fav, command_func=self.zapTo, validate_commands=False)
				sub = services.getServicesAsList()

				if len(sub) > 0:
					for (ref, name) in sub:
						if name == value.get():
							self.zapTo(eServiceReference(ref))
							break
		elif oidstring == self.SERVICESTRING_OID:
			if self.getServiceString() <> value.get():
				self.zapTo(eServiceReference(value.get()))
		elif oidstring == self.FASTSCANSTRING_OID:
			refstring = ''
			fields = value.get().split(',')
			if len(fields) >= 15:
				onid, tsid, freq, id1, id2, sid, orbital_pos, f1, f2, f3, symbolrate, f4, name, provider, servicetype = fields[0:15]
				refstring = '%d:%d:%d:%x:%x:%x:%x:%x:%x:%x:' % (1, 0, int(servicetype), int(sid), int(tsid), int(onid), int(orbital_pos) * 65536, 0, 0, 0)
			if refstring is not '':
				self.zapTo(eServiceReference(refstring))
		elif oidstring == self.SERVICEPARAMS_OID:
			refstring = ''
			fields = value.get().split(',')
			if len(fields) >= 5:
				orbital_pos, tsid, onid, sid, servicetype = fields[0:5]
				refstring = '%d:%d:%d:%x:%x:%x:%x:%x:%x:%x:' % (1, 0, int(servicetype), int(sid), int(tsid), int(onid), int(orbital_pos) * 65536, 0, 0, 0)
			if refstring is not '':
				self.zapTo(eServiceReference(refstring))
		elif oidstring == self.IP_OID:
			ipstring = value.get().split('.')
			ipval = []
			for x in ipstring:
				ipval.append(int(x))
			if iNetwork.getAdapterAttribute(self.iface, "ip") <> ipval:
				iNetwork.setAdapterAttribute(self.iface, "dhcp", 0)
				iNetwork.setAdapterAttribute(self.iface, "ip", ipval)
				iNetwork.deactivateNetworkConfig()
				iNetwork.writeNetworkConfig()
				iNetwork.activateNetworkConfig()
		elif oidstring == self.IP_OID:
			ipstring = value.get().split('.')
			ipval = []
			for x in ipstring:
				ipval.append(int(x))
			if iNetwork.getAdapterAttribute(self.iface, "netmask") <> ipval:
				iNetwork.setAdapterAttribute(self.iface, "dhcp", 0)
				iNetwork.setAdapterAttribute(self.iface, "netmask", ipval)
				iNetwork.deactivateNetworkConfig()
				iNetwork.writeNetworkConfig()
				iNetwork.activateNetworkConfig()
		elif oidstring == self.GATEWAY_OID:
			ipstring = value.get().split('.')
			ipval = []
			for x in ipstring:
				ipval.append(int(x))
			if iNetwork.getAdapterAttribute(self.iface, "gateway") <> ipval:
				iNetwork.setAdapterAttribute(self.iface, "dhcp", 0)
				iNetwork.setAdapterAttribute(self.iface, "gateway", ipval)
				iNetwork.deactivateNetworkConfig()
				iNetwork.writeNetworkConfig()
				iNetwork.activateNetworkConfig()
		elif oidstring == self.ENABLE_EMM_OID:
			if config.plugins.SnmpAgent.checkemm.value and not value.get():
				config.plugins.SnmpAgent.checkemm.value = False
				config.plugins.SnmpAgent.checkemm.save()
				if self.emm:
					self.emm.stop()
					self.emm = None
			elif not config.plugins.SnmpAgent.checkemm.value and value.get():
				config.plugins.SnmpAgent.checkemm.value = True
				config.plugins.SnmpAgent.checkemm.save()
				self.emm = Emm(self.session)
				self.emm.start()
		else:
			print "oid not found!?"

		return None