X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/4b53fef5099e42240db57ce118dd9aa570b7815d..dea2fe0418b7e3761ff8f7a1f59e4066b3ed2cc8:/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py index 45c69447..e69de29b 100644 --- a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py +++ b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py @@ -1,191 +0,0 @@ -from Screens.Screen import Screen -from Screens.MessageBox import MessageBox - -from Components.ActionMap import ActionMap, NumberActionMap -from Components.Pixmap import Pixmap -from Components.Label import Label -from Components.GUIComponent import * -from Components.MenuList import MenuList -from Components.MultiContent import MultiContentEntryText - - -from Components.config import config, getConfigListEntry -from Components.ConfigList import ConfigList, ConfigListScreen -from Components.Network import Network - -from Plugins.Plugin import PluginDescriptor - -from Wlan import Wlan, WlanList, wpaSupplicant - -plugin_path = "/usr/lib/enigma2/python/Plugins/SystemPlugins/WirelessLAN" - -class WlanSelection(Screen): - skin = """ - - - - - - - - - - - - - - """ - def __init__(self, session, args = None): - - self.skin = WlanSelection.skin - self.session = session - Screen.__init__(self, session) - - self.list = [] - - self["list"] = WlanList(self.session) - self.skin_path = plugin_path - - self["cancel"] = Pixmap() - self["select"] = Pixmap() - self["rescan"] = Pixmap() - self["skip"] = Pixmap() - - - self["canceltext"] = Label(_("Cancel")) - self["selecttext"] = Label(_("Select")) - self["rescantext"] = Label(_("Rescan")) - self["skiptext"] = Label(_("Skip")) - - self["actions"] = NumberActionMap(["WizardActions", "InputActions", "EPGSelectActions"], - { - "ok": self.select, - "back": self.exit, -# "up": self.up, -# "down": self.down, - }, -1) - - self["shortcuts"] = ActionMap(["ShortcutActions"], - { - "red": self.exit, - "green": self.select, - "yellow": self.rescan, - "blue": self.skip, - }) - - def select(self): - cur = self["list"].getCurrent() - if cur: - ret = (self.session, cur) - else: - ret = (self.session, None) - self.close(ret) - - def rescan(self): - self["list"].reload() - - def skip(self): - self.close( (self.session, None) ) - - def exit(self): - self.close( (None ,) ) - -class WlanConfiguration(ConfigListScreen, Screen): - skin = """ - - - - - - """ - - def __init__(self, session, essid = None, encrypted = False, iface = "wlan0"): - - Screen.__init__(self, session) - self.skin = WlanConfiguration.skin - - self.iface = iface - self.list = [] - self.ws = wpaSupplicant() - - self["introduction"] = Label(_("Press OK to activate the settings.")) - self["interface"] = Label(_("Interface: ")+self.iface) - - if essid is None: - self.ws.loadConfig() - - else: - config.plugins.wlan.essid.value = essid - config.plugins.wlan.encryption.enabled.value = True - - self["actions"] = ActionMap(["SetupActions"], - { - "ok": self.ok, - "cancel": self.cancel, - }, -2) - - ConfigListScreen.__init__(self, self.list) - self.createSetup() - - def createSetup(self): - - self.list = [ ] - - self.list.append(getConfigListEntry(_("Network SSID"), config.plugins.wlan.essid)) - self.list.append(getConfigListEntry(_("Encryption"), config.plugins.wlan.encryption.enabled)) - - if config.plugins.wlan.encryption.enabled.value: - self.list.append(getConfigListEntry(_("Encryption Type"), config.plugins.wlan.encryption.type)) - self.list.append(getConfigListEntry(_("Encryption Key"), config.plugins.wlan.encryption.psk)) - - self["config"].list = self.list - self["config"].l.setList(self.list) - - def keyLeft(self): - ConfigListScreen.keyLeft(self) - self.createSetup() - - def keyRight(self): - ConfigListScreen.keyRight(self) - self.createSetup() - - def ok(self): - self.ws.writeConfig() - self.ws.restart(self.iface) - self.close() - - def cancel(self): - self.close() - -def EntryChosen(parms): - if parms[0]: - session = parms[0] - if parms[1] is not None: - val = parms[1] - essid = val[0] - encrypted = val[2] - iface = val[3] - session.open(WlanConfiguration, essid, encrypted, iface) - else: - session.open(WlanConfiguration) - -def WlanSelectionMain(session, iface): - session.openWithCallback(EntryChosen, WlanSelection) - -def WlanConfigurationMain(session, **kwargs): - session.open(WlanConfiguration) - -def callFunction(iface): - w = Wlan() - - if iface in w.getWirelessInterfaces(): - return WlanSelectionMain - else: - return None - -def configStrings(iface): - return "#Custom Configstring for "+iface - -def Plugins(**kwargs): - return PluginDescriptor(name=_("Wireless LAN"), description=_("Connect to a Wireless Network"), where = PluginDescriptor.WHERE_NETWORKSETUP, fnc={"ifaceSupported": callFunction, "configStrings": configStrings, "menuEntryName": lambda x: _("Wlan Configuartion Utility")}) - \ No newline at end of file