From bdbf663b67d46f79ba2163f6b7df377a63218092 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Mon, 7 Jul 2008 20:22:30 +0000 Subject: [PATCH] - allow multiple xml control files for one wizard (to combine wizards, that should also be able to run standalone) - separate question for default sat lists in start wizard --- data/defaultsatlists.xml | 23 +++++++++---------- data/startwizard.xml | 36 +++++++++++++++++++---------- lib/python/Screens/ScanSetup.py | 4 ++-- lib/python/Screens/StartWizard.py | 9 +++++--- lib/python/Screens/Wizard.py | 38 +++++++++++++++++-------------- 5 files changed, 64 insertions(+), 46 deletions(-) diff --git a/data/defaultsatlists.xml b/data/defaultsatlists.xml index f6489676..132b427c 100644 --- a/data/defaultsatlists.xml +++ b/data/defaultsatlists.xml @@ -1,5 +1,5 @@ - + packagelist = self.fillPackagesList() self.runWizard = (len(packagelist) > 0) @@ -12,11 +12,11 @@ self.condition = self.runWizard self.disableKeys = True - + - + if self.runWizard: self.condition = True @@ -32,12 +32,9 @@ else: self.disableKeys = False - -self.markDone() - - + self.condition = False if self.runWizard: @@ -49,12 +46,14 @@ if self.runWizard: self.disableKeys = True self.installPackages(self.indexList) - - -#print "len of packageslist", len(self.packageslist) -#if (len(self.packageslist) == 1): - #self.installPackage(0) + + + +self.markDone() +self.condition = False + + diff --git a/data/startwizard.xml b/data/startwizard.xml index 3dedafc9..8e054fb6 100644 --- a/data/startwizard.xml +++ b/data/startwizard.xml @@ -1,5 +1,5 @@ - + self["arrowdown"].moveTo(557, 232, 1) @@ -99,6 +99,25 @@ self["arrowdown"].moveTo(740, 355, 1) self["arrowdown"].startMoving() + + + +self.condition = config.misc.startwizard.doservicescan.value + + +self["rc"].moveTo(800, 50, 1) +self["rc"].startMoving() +self["arrowup"].moveTo(800, 310, 1) +self["arrowup"].startMoving() +self["arrowup2"].moveTo(800, 310, 1) +self["arrowup2"].startMoving() + + + + + + + @@ -115,17 +134,10 @@ self["arrowup2"].startMoving() - - + - -if self["list"].index == 2: - #from Screens.ScanSetup import ScanSetup - from Screens.ScanSetup import DefaultSatLists - self.session.open(DefaultSatLists) - - + self.condition = config.misc.startwizard.doservicescan.value @@ -146,10 +158,10 @@ self.condition = config.misc.startwizard.doservicescan.value - + - + diff --git a/lib/python/Screens/ScanSetup.py b/lib/python/Screens/ScanSetup.py index 5d049545..18995d10 100644 --- a/lib/python/Screens/ScanSetup.py +++ b/lib/python/Screens/ScanSetup.py @@ -281,6 +281,7 @@ class CableTransponderSearchSupport: class DefaultSatLists(DefaultWizard): def __init__(self, session, silent = True, showSteps = False): + self.xmlfile = "defaultsatlists.xml" DefaultWizard.__init__(self, session, silent, showSteps, neededTag = "services") print "configuredSats:", nimmanager.getConfiguredSats() @@ -290,8 +291,7 @@ class DefaultSatLists(DefaultWizard): import os os.system("mount %s %s" % (resolveFilename(SCOPE_DEFAULTPARTITION), resolveFilename(SCOPE_DEFAULTPARTITIONMOUNTDIR))) self.directory.append(resolveFilename(SCOPE_DEFAULTPARTITIONMOUNTDIR)) - self.xmlfile = "defaultsatlists.xml" - + def statusCallback(self, status, progress): print "statusCallback:", status, progress from Components.DreamInfoHandler import DreamInfoHandler diff --git a/lib/python/Screens/StartWizard.py b/lib/python/Screens/StartWizard.py index d0ece295..1c4cfb24 100644 --- a/lib/python/Screens/StartWizard.py +++ b/lib/python/Screens/StartWizard.py @@ -1,5 +1,7 @@ from Wizard import wizardManager from Screens.WizardLanguage import WizardLanguage +from Screens.ScanSetup import DefaultSatLists +from Screens.DefaultWizard import DefaultWizard from Components.Pixmap import Pixmap, MovingPixmap from Components.config import config, ConfigBoolean, configfile, ConfigSubsection @@ -12,10 +14,11 @@ config.misc.startwizard.shownimconfig = ConfigBoolean(default = True) config.misc.startwizard.doservicescan = ConfigBoolean(default = True) config.misc.languageselected = ConfigBoolean(default = True) -class StartWizard(WizardLanguage): - def __init__(self, session): - self.xmlfile = "startwizard.xml" +class StartWizard(DefaultSatLists): + def __init__(self, session, silent = True, showSteps = False, neededTag = None): + self.xmlfile = ["startwizard.xml", "defaultsatlists.xml"] WizardLanguage.__init__(self, session, showSteps = False) + DefaultWizard.__init__(self, session, silent, showSteps, neededTag = "services") self["wizard"] = Pixmap() self["rc"] = MovingPixmap() self["arrowdown"] = MovingPixmap() diff --git a/lib/python/Screens/Wizard.py b/lib/python/Screens/Wizard.py index a399c96a..9c9cbd30 100644 --- a/lib/python/Screens/Wizard.py +++ b/lib/python/Screens/Wizard.py @@ -55,12 +55,10 @@ class Wizard(Screen, HelpableScreen): self.isPointsElement, self.isReboundsElement = 0, 0 self.wizard = wizard self.currContent = "" - self.lastStep = 0 - - - + self.lastStep = 0 + def startElement(self, name, attrs): - print "startElement", name + #print "startElement", name self.currContent = name if (name == "step"): self.lastStep += 1 @@ -68,7 +66,7 @@ class Wizard(Screen, HelpableScreen): id = str(attrs.get('id')) else: id = "" - print "id:", id + #print "id:", id if attrs.has_key('nextstep'): nextstep = str(attrs.get('nextstep')) else: @@ -97,7 +95,7 @@ class Wizard(Screen, HelpableScreen): self.wizard[self.lastStep]["dynamiclist"] = attrs.get("source") #self.wizard[self.lastStep]["list"].append(("Hallo", "test")) if (attrs.has_key("evaluation")): - print "evaluation" + #print "evaluation" self.wizard[self.lastStep]["listevaluation"] = attrs.get("evaluation") if (attrs.has_key("onselect")): self.wizard[self.lastStep]["onselect"] = attrs.get("onselect") @@ -111,7 +109,7 @@ class Wizard(Screen, HelpableScreen): self.wizard[self.lastStep]["config"]["screen"] = eval(str(attrs.get('screen'))) if (attrs.has_key('args')): - print "has args" + #print "has args" self.wizard[self.lastStep]["config"]["args"] = str(attrs.get('args')) elif type == "dynamic": self.wizard[self.lastStep]["config"]["source"] = str(attrs.get('source')) @@ -124,6 +122,7 @@ class Wizard(Screen, HelpableScreen): self.codeafter = False elif (name == "condition"): pass + def endElement(self, name): self.currContent = "" if name == 'code': @@ -134,7 +133,8 @@ class Wizard(Screen, HelpableScreen): elif name == 'condition': self.wizard[self.lastStep]["condition"] = self.wizard[self.lastStep]["condition"].strip() elif name == 'step': - print "Step number", self.lastStep, ":", self.wizard[self.lastStep] + #print "Step number", self.lastStep, ":", self.wizard[self.lastStep] + pass def characters(self, ch): if self.currContent == "code": @@ -153,13 +153,16 @@ class Wizard(Screen, HelpableScreen): self.wizard = {} parser = make_parser() - print "Reading " + self.xmlfile + if not isinstance(self.xmlfile, list): + self.xmlfile = [self.xmlfile] + print "Reading ", self.xmlfile wizardHandler = self.parseWizard(self.wizard) parser.setContentHandler(wizardHandler) - if self.xmlfile[0] != '/': - parser.parse('/usr/share/enigma2/' + self.xmlfile) - else: - parser.parse(self.xmlfile) + for xmlfile in self.xmlfile: + if xmlfile[0] != '/': + parser.parse('/usr/share/enigma2/' + xmlfile) + else: + parser.parse(xmlfile) self.showSteps = showSteps self.showStepSlider = showStepSlider @@ -167,7 +170,7 @@ class Wizard(Screen, HelpableScreen): self.showConfig = showConfig self.numSteps = len(self.wizard) - self.currStep = 1 + self.currStep = self.getStepWithID("start") + 1 self.timeoutTimer = eTimer() self.timeoutTimer.callback.append(self.timeoutCounterFired) @@ -261,7 +264,7 @@ class Wizard(Screen, HelpableScreen): def getStepWithID(self, id): print "getStepWithID:", id count = 0 - for x in self.wizard: + for x in self.wizard.keys(): if self.wizard[x]["id"] == id: print "result:", count return count @@ -289,7 +292,8 @@ class Wizard(Screen, HelpableScreen): else: self.currStep = self.getStepWithID(nextStep) - if (currStep == self.numSteps): # wizard finished + if ((currStep == self.numSteps and self.wizard[currStep]["nextstep"] is None) or self.wizard[currStep]["id"] == "end"): # wizard finished + print "wizard finished" self.markDone() self.close() else: -- 2.30.2