From: Acid Burn Date: Tue, 10 Nov 2009 12:18:26 +0000 (+0100) Subject: Enigma2-{Wizard.py,Networksetup.py,ConfigList.py,skin_default.xml,NetworkWizard.py... X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=commitdiff_plain;h=dd6c331e2a83af4e911fecc70c47b74256ea3419 Enigma2-{Wizard.py,Networksetup.py,ConfigList.py,skin_default.xml,NetworkWizard.py}: -add possibility to use the VirtualKeyboard globally with every ConfigText and ConfigPassword ConfigEntry inside ConfigListScreens and WizardScreens. -add possibility to globally move the NumericalHelpInputWindow shown from a ConfigListScreen or a Wizard Screen to a inside the Skin defined Position This currently still needs following Skin entries defined in your Screens Skin: " " used for Showing/hiding the TEXT Icon if the VirtualKeyboard is available. and: "" used to position the NumericalTextInputHelpWIndow inside your Screen as defined by your Screens Skin. also you need currently: from Components.Sources.Boolean import Boolean self["VKeyIcon"] = Boolean(False) self["HelpWindow"] = Pixmap() self["HelpWindow"].hide() inside your Screens sourcecode so we know that these items should be handled globally from Enigma2. - remove own Helpwindow/Vkey handling from NetworkSetup.py - include new VirtualKeyboardhandling inside NetworkWizard This fixes #157 --- diff --git a/data/skin_default.xml b/data/skin_default.xml index 72dc357..dfab4d8 100755 --- a/data/skin_default.xml +++ b/data/skin_default.xml @@ -43,7 +43,9 @@ - + + + diff --git a/lib/python/Components/ConfigList.py b/lib/python/Components/ConfigList.py old mode 100644 new mode 100755 index 00949e2..6078580 --- a/lib/python/Components/ConfigList.py +++ b/lib/python/Components/ConfigList.py @@ -1,7 +1,7 @@ from HTMLComponent import HTMLComponent from GUIComponent import GUIComponent -from config import KEY_LEFT, KEY_RIGHT, KEY_HOME, KEY_END, KEY_0, KEY_DELETE, KEY_BACKSPACE, KEY_OK, KEY_TOGGLEOW, KEY_ASCII, KEY_TIMEOUT, KEY_NUMBERS, ConfigElement -from Components.ActionMap import NumberActionMap +from config import KEY_LEFT, KEY_RIGHT, KEY_HOME, KEY_END, KEY_0, KEY_DELETE, KEY_BACKSPACE, KEY_OK, KEY_TOGGLEOW, KEY_ASCII, KEY_TIMEOUT, KEY_NUMBERS, ConfigElement, ConfigText, ConfigPassword +from Components.ActionMap import NumberActionMap, ActionMap from enigma import eListbox, eListboxPythonConfigContent, eRCInput, eTimer from Screens.MessageBox import MessageBox @@ -66,6 +66,7 @@ class ConfigList(HTMLComponent, GUIComponent, object): self.current = self.getCurrent() if self.current: self.current[1].onSelect(self.session) + for x in self.onSelectionChanged: x() @@ -127,13 +128,47 @@ class ConfigListScreen: "9": self.keyNumberGlobal, "0": self.keyNumberGlobal }, -1) # to prevent left/right overriding the listbox + + self["VirtualKB"] = ActionMap(["VirtualKeyboardActions"], + { + "showVirtualKeyboard": self.KeyText, + }, -2) + self["VirtualKB"].setEnabled(False) self["config"] = ConfigList(list, session = session) + if on_change is not None: self.__changed = on_change else: self.__changed = lambda: None - + + if not self.handleInputHelpers in self["config"].onSelectionChanged: + self["config"].onSelectionChanged.append(self.handleInputHelpers) + + def handleInputHelpers(self): + if isinstance(self["config"].getCurrent()[1], ConfigText) or isinstance(self["config"].getCurrent()[1], ConfigPassword): + if self.has_key("VKeyIcon"): + self["VirtualKB"].setEnabled(True) + self["VKeyIcon"].boolean = True + if self.has_key("HelpWindow"): + if self["config"].getCurrent()[1].help_window.instance is not None: + helpwindowpos = self["HelpWindow"].getPosition() + from enigma import ePoint + self["config"].getCurrent()[1].help_window.instance.move(ePoint(helpwindowpos[0],helpwindowpos[1])) + else: + if self.has_key("VKeyIcon"): + self["VirtualKB"].setEnabled(False) + self["VKeyIcon"].boolean = False + + def KeyText(self): + from Screens.VirtualKeyBoard import VirtualKeyBoard + self.session.openWithCallback(self.VirtualKeyBoardCallback, VirtualKeyBoard, title = self["config"].getCurrent()[0], text = self["config"].getCurrent()[1].getValue()) + + def VirtualKeyBoardCallback(self, callback = None): + if callback is not None and len(callback): + self["config"].getCurrent()[1].setValue(callback) + self["config"].invalidate(self["config"].getCurrent()) + def keyOK(self): self["config"].handleKey(KEY_OK) diff --git a/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py b/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py index 4d36115..b158cde 100755 --- a/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py +++ b/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py @@ -4,15 +4,11 @@ from Screens.Rc import Rc from Screens.MessageBox import MessageBox from Components.Pixmap import Pixmap, MovingPixmap, MultiPixmap +from Components.Sources.Boolean import Boolean from Components.config import config, ConfigBoolean, configfile, ConfigYesNo, NoSave, ConfigSubsection, ConfigText, getConfigListEntry, ConfigSelection, ConfigPassword from Components.Network import iNetwork -#from Components.Label import Label -#from Components.MenuList import MenuList -#from Components.PluginComponent import plugins -#from Plugins.Plugin import PluginDescriptor from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE -#import time, os, re config.misc.firstrun = ConfigBoolean(default = True) @@ -39,7 +35,7 @@ config.plugins.wlan.encryption.psk = NoSave(ConfigPassword(default = "mysecurewl class NetworkWizard(WizardLanguage, Rc): skin = """ - + @@ -52,6 +48,10 @@ class NetworkWizard(WizardLanguage, Rc): + + + + """ def __init__(self, session): self.xmlfile = resolveFilename(SCOPE_PLUGINS, "SystemPlugins/NetworkWizard/networkwizard.xml") @@ -59,7 +59,10 @@ class NetworkWizard(WizardLanguage, Rc): Rc.__init__(self) self.session = session self["wizard"] = Pixmap() - + self["HelpWindow"] = Pixmap() + self["HelpWindow"].hide() + self["VKeyIcon"] = Boolean(False) + self.InterfaceState = None self.isInterfaceUp = None self.WlanPluginInstalled = None diff --git a/lib/python/Screens/NetworkSetup.py b/lib/python/Screens/NetworkSetup.py index ec2bafe..401e0cf 100755 --- a/lib/python/Screens/NetworkSetup.py +++ b/lib/python/Screens/NetworkSetup.py @@ -6,6 +6,7 @@ from Screens.VirtualKeyBoard import VirtualKeyBoard from Screens.HelpMenu import HelpableScreen from Components.Network import iNetwork from Components.Sources.StaticText import StaticText +from Components.Sources.Boolean import Boolean from Components.Label import Label,MultiColorLabel from Components.Pixmap import Pixmap,MultiPixmap from Components.MenuList import MenuList @@ -319,11 +320,6 @@ class AdapterSetup(Screen, ConfigListScreen, HelpableScreen): "blue": (self.KeyBlue, _("open nameserver configuration")), }) - self["VirtualKB"] = HelpableActionMap(self, "VirtualKeyboardActions", - { - "showVirtualKeyboard": (self.KeyText, [_("open virtual keyboard input help"),_("* Only available when entering hidden SSID or network key")] ), - }) - self["actions"] = NumberActionMap(["SetupActions"], { "ok": self.ok, @@ -355,9 +351,10 @@ class AdapterSetup(Screen, ConfigListScreen, HelpableScreen): self["key_red"] = StaticText(_("Cancel")) self["key_blue"] = StaticText(_("Edit DNS")) - self["VKeyIcon"] = Pixmap() + self["VKeyIcon"] = Boolean(False) self["HelpWindow"] = Pixmap() - + self["HelpWindow"].hide() + def layoutFinished(self): self["DNS1"].setText(self.primaryDNS.getText()) self["DNS2"].setText(self.secondaryDNS.getText()) @@ -386,9 +383,6 @@ class AdapterSetup(Screen, ConfigListScreen, HelpableScreen): self["Gateway"].setText("") self["Gatewaytext"].setText("") self["Adapter"].setText(iNetwork.getFriendlyAdapterName(self.iface)) - self["VKeyIcon"].hide() - self["VirtualKB"].setEnabled(False) - self["HelpWindow"].hide() def createConfig(self): self.InterfaceEntry = None @@ -518,30 +512,10 @@ class AdapterSetup(Screen, ConfigListScreen, HelpableScreen): self["config"].list = self.list self["config"].l.setList(self.list) - if not self.selectionChanged in self["config"].onSelectionChanged: - self["config"].onSelectionChanged.append(self.selectionChanged) def KeyBlue(self): self.session.openWithCallback(self.NameserverSetupClosed, NameserverSetup) - def KeyText(self): - if self.iface == "wlan0" or self.iface == "ath0" : - if self["config"].getCurrent() == self.hiddenSSID: - if config.plugins.wlan.essid.value == 'hidden...': - self.session.openWithCallback(self.VirtualKeyBoardSSIDCallback, VirtualKeyBoard, title = (_("Enter WLAN network name/SSID:")), text = config.plugins.wlan.essid.value) - if self["config"].getCurrent() == self.encryptionKey: - self.session.openWithCallback(self.VirtualKeyBoardKeyCallback, VirtualKeyBoard, title = (_("Enter WLAN passphrase/key:")), text = config.plugins.wlan.encryption.psk.value) - - def VirtualKeyBoardSSIDCallback(self, callback = None): - if callback is not None and len(callback): - config.plugins.wlan.hiddenessid.setValue(callback) - self["config"].invalidate(self.hiddenSSID) - - def VirtualKeyBoardKeyCallback(self, callback = None): - if callback is not None and len(callback): - config.plugins.wlan.encryption.psk.setValue(callback) - self["config"].invalidate(self.encryptionKey) - def newConfig(self): if self["config"].getCurrent() == self.InterfaceEntry: self.createSetup() @@ -565,24 +539,6 @@ class AdapterSetup(Screen, ConfigListScreen, HelpableScreen): ConfigListScreen.keyRight(self) self.newConfig() - def selectionChanged(self): - current = self["config"].getCurrent() - if current == self.hiddenSSID and config.plugins.wlan.essid.value == 'hidden...': - helpwindowpos = self["HelpWindow"].getPosition() - if current[1].help_window.instance is not None: - current[1].help_window.instance.move(ePoint(helpwindowpos[0],helpwindowpos[1])) - self["VKeyIcon"].show() - self["VirtualKB"].setEnabled(True) - elif current == self.encryptionKey and config.plugins.wlan.encryption.enabled.value: - helpwindowpos = self["HelpWindow"].getPosition() - if current[1].help_window.instance is not None: - current[1].help_window.instance.move(ePoint(helpwindowpos[0],helpwindowpos[1])) - self["VKeyIcon"].show() - self["VirtualKB"].setEnabled(True) - else: - self["VKeyIcon"].hide() - self["VirtualKB"].setEnabled(False) - def ok(self): current = self["config"].getCurrent() if current == self.hiddenSSID and config.plugins.wlan.essid.value == 'hidden...': diff --git a/lib/python/Screens/Wizard.py b/lib/python/Screens/Wizard.py index 74219eb..1bff028 100755 --- a/lib/python/Screens/Wizard.py +++ b/lib/python/Screens/Wizard.py @@ -1,16 +1,15 @@ from Screen import Screen - from Screens.HelpMenu import HelpableScreen from Screens.MessageBox import MessageBox -from Components.config import config, KEY_LEFT, KEY_RIGHT, KEY_HOME, KEY_END, KEY_0, KEY_DELETE, KEY_BACKSPACE, KEY_OK, KEY_TOGGLEOW, KEY_ASCII, KEY_TIMEOUT, KEY_NUMBERS +from Components.config import config, ConfigText, ConfigPassword, KEY_LEFT, KEY_RIGHT, KEY_HOME, KEY_END, KEY_0, KEY_DELETE, KEY_BACKSPACE, KEY_OK, KEY_TOGGLEOW, KEY_ASCII, KEY_TIMEOUT, KEY_NUMBERS from Components.Label import Label +from Components.Sources.StaticText import StaticText from Components.Slider import Slider from Components.ActionMap import NumberActionMap from Components.MenuList import MenuList from Components.ConfigList import ConfigList from Components.Sources.List import List - from enigma import eTimer from xml.sax import make_parser @@ -19,8 +18,8 @@ from xml.sax.handler import ContentHandler class WizardSummary(Screen): skin = """ - - + + """ @@ -36,7 +35,7 @@ class WizardSummary(Screen): #self.skinName.append("Wizard") #print "*************+++++++++++++++++****************++++++++++******************* WizardSummary", self.skinName # - self["text"] = Label("") + self["text"] = StaticText("") self.onShow.append(self.setCallback) def setCallback(self): @@ -214,12 +213,13 @@ class Wizard(Screen): self.onShown.append(self.updateValues) self.configInstance = None + self.currentConfigIndex = None self.lcdCallbacks = [] self.disableKeys = False - self["actions"] = NumberActionMap(["WizardActions", "NumberActions", "ColorActions", "SetupActions", "InputAsciiActions"], + self["actions"] = NumberActionMap(["WizardActions", "NumberActions", "ColorActions", "SetupActions", "InputAsciiActions", "KeyboardInputActions"], { "gotAsciiCode": self.keyGotAscii, "ok": self.ok, @@ -245,6 +245,13 @@ class Wizard(Screen): "9": self.keyNumberGlobal, "0": self.keyNumberGlobal }, -1) + + self["VirtualKB"] = NumberActionMap(["VirtualKeyboardActions"], + { + "showVirtualKeyboard": self.KeyText, + }, -2) + + self["VirtualKB"].setEnabled(False) def red(self): print "red" @@ -405,6 +412,7 @@ class Wizard(Screen): self.resetCounter() if (self.showConfig and self.wizard[self.currStep]["config"]["screen"] != None or self.wizard[self.currStep]["config"]["type"] == "dynamic"): self["config"].instance.moveSelection(self["config"].instance.moveUp) + self.handleInputHelpers() elif (self.showList and len(self.wizard[self.currStep]["evaluatedlist"]) > 0): self["list"].selectPrevious() if self.wizard[self.currStep].has_key("onselect"): @@ -418,6 +426,7 @@ class Wizard(Screen): self.resetCounter() if (self.showConfig and self.wizard[self.currStep]["config"]["screen"] != None or self.wizard[self.currStep]["config"]["type"] == "dynamic"): self["config"].instance.moveSelection(self["config"].instance.moveDown) + self.handleInputHelpers() elif (self.showList and len(self.wizard[self.currStep]["evaluatedlist"]) > 0): #self["list"].instance.moveSelection(self["list"].instance.moveDown) self["list"].selectNext() @@ -598,6 +607,9 @@ class Wizard(Screen): print "clearConfigList", self.configInstance["config"], self["config"] else: self["config"].l.setList([]) + self.handleInputHelpers() + + else: if self.has_key("config"): self["config"].hide() @@ -614,6 +626,45 @@ class Wizard(Screen): self.finished(gotoStep = self.wizard[self.currStep]["timeoutstep"]) self.updateText() + def handleInputHelpers(self): + if self["config"].getCurrent() is not None: + if isinstance(self["config"].getCurrent()[1], ConfigText) or isinstance(self["config"].getCurrent()[1], ConfigPassword): + if self.has_key("VKeyIcon"): + self["VirtualKB"].setEnabled(True) + self["VKeyIcon"].boolean = True + if self.has_key("HelpWindow"): + if self["config"].getCurrent()[1].help_window.instance is not None: + helpwindowpos = self["HelpWindow"].getPosition() + from enigma import ePoint + self["config"].getCurrent()[1].help_window.instance.move(ePoint(helpwindowpos[0],helpwindowpos[1])) + else: + if self.has_key("VKeyIcon"): + self["VirtualKB"].setEnabled(False) + self["VKeyIcon"].boolean = False + else: + if self.has_key("VKeyIcon"): + self["VirtualKB"].setEnabled(False) + self["VKeyIcon"].boolean = False + + def KeyText(self): + from Screens.VirtualKeyBoard import VirtualKeyBoard + self.currentConfigIndex = self["config"].getCurrentIndex() + self.session.openWithCallback(self.VirtualKeyBoardCallback, VirtualKeyBoard, title = self["config"].getCurrent()[0], text = self["config"].getCurrent()[1].getValue()) + + def VirtualKeyBoardCallback(self, callback = None): + if callback is not None and len(callback): + if isinstance(self["config"].getCurrent()[1], ConfigText) or isinstance(self["config"].getCurrent()[1], ConfigPassword): + if self.has_key("HelpWindow"): + if self["config"].getCurrent()[1].help_window.instance is not None: + helpwindowpos = self["HelpWindow"].getPosition() + from enigma import ePoint + self["config"].getCurrent()[1].help_window.instance.move(ePoint(helpwindowpos[0],helpwindowpos[1])) + self["config"].instance.moveSelectionTo(self.currentConfigIndex) + self["config"].setCurrentIndex(self.currentConfigIndex) + self["config"].getCurrent()[1].setValue(callback) + self["config"].invalidate(self["config"].getCurrent()) + + class WizardManager: def __init__(self): self.wizards = []