- allow multiple xml control files for one wizard (to combine wizards, that should...
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Mon, 7 Jul 2008 20:22:30 +0000 (20:22 +0000)
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Mon, 7 Jul 2008 20:22:30 +0000 (20:22 +0000)
- separate question for default sat lists in start wizard

data/defaultsatlists.xml
data/startwizard.xml
lib/python/Screens/ScanSetup.py
lib/python/Screens/StartWizard.py
lib/python/Screens/Wizard.py

index f6489676fd03d8b12d731a6a4084d2f9095d78d3..132b427c12e1947ea68391af91fda43691cce523 100644 (file)
@@ -1,5 +1,5 @@
 <wizard>
 <wizard>
-       <step id="welcome" nextstep="nothingtoinstall">
+       <step id="startdefaultlists" nextstep="nothingtoinstall">
                <condition>
 packagelist = self.fillPackagesList()
 self.runWizard = (len(packagelist) > 0)
                <condition>
 packagelist = self.fillPackagesList()
 self.runWizard = (len(packagelist) > 0)
@@ -12,11 +12,11 @@ self.condition = self.runWizard
 self.disableKeys = True
                </code>
        </step>
 self.disableKeys = True
                </code>
        </step>
-       <step id="nopackages" nextstep="install">
+       <step id="nopackages" nextstep="finisheddefaultsatlists">
                <text value="There are no default services lists in your image." />
        </step>
        
                <text value="There are no default services lists in your image." />
        </step>
        
-       <step id="nothingtoinstall" nextstep="install">
+       <step id="nothingtoinstall" nextstep="finisheddefaultsatlists">
                <condition>
 if self.runWizard:
        self.condition = True
                <condition>
 if self.runWizard:
        self.condition = True
@@ -32,12 +32,9 @@ else:
                <code>
 self.disableKeys = False
                </code>
                <code>
 self.disableKeys = False
                </code>
-               <code pos="after">
-self.markDone()
-               </code>
        </step>
        
        </step>
        
-       <step id="install">
+       <step id="install" nextstep="finisheddefaultsatlists">
                <condition>
 self.condition = False
 if self.runWizard:
                <condition>
 self.condition = False
 if self.runWizard:
@@ -49,12 +46,14 @@ if self.runWizard:
                <code>
 self.disableKeys = True                        
 self.installPackages(self.indexList)
                <code>
 self.disableKeys = True                        
 self.installPackages(self.indexList)
-               </code>
-               <code>
-#print "len of packageslist", len(self.packageslist)
-#if (len(self.packageslist) == 1):
-       #self.installPackage(0)
                </code>
                <text value="Installing default sat lists... Please wait..." />
        </step>
                </code>
                <text value="Installing default sat lists... Please wait..." />
        </step>
+       
+       <step id="finisheddefaultsatlists">
+               <condition>
+self.markDone()
+self.condition = False
+               </condition>
+       </step>
 </wizard>
 </wizard>
index 3dedafc9d5c4e24f6287cf804456fc01d259638c..8e054fb64f7d4e6bd022f27af8047e50e3743188 100644 (file)
@@ -1,5 +1,5 @@
 <wizard>
 <wizard>
-               <step id="welcome" nextstep="introduction">
+               <step id="start" nextstep="introduction">
                        <text value="Welcome.\n\nThis start wizard will guide you through the basic setup of your Dreambox.\nPress the OK button on your remote control to move to the next step." />
                        <code>
 self["arrowdown"].moveTo(557, 232, 1)
                        <text value="Welcome.\n\nThis start wizard will guide you through the basic setup of your Dreambox.\nPress the OK button on your remote control to move to the next step." />
                        <code>
 self["arrowdown"].moveTo(557, 232, 1)
@@ -99,6 +99,25 @@ self["arrowdown"].moveTo(740, 355, 1)
 self["arrowdown"].startMoving()
                        </code>
                </step>
 self["arrowdown"].startMoving()
                        </code>
                </step>
+               <step id="satlistsquestion">
+                       <text value="Do you want to install default sat lists?" />
+                       <condition>
+self.condition = config.misc.startwizard.doservicescan.value
+                       </condition>
+                       <code>
+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()
+                       </code>
+                       <list>
+                               <listentry caption="Yes" step="startdefaultlists" />
+                               <listentry caption="No" step="scanquestion" />
+                       </list>
+               </step>
+
                <step id="scanquestion">
                        <text value="Do you want to do a service scan?" />
                        <condition>
                <step id="scanquestion">
                        <text value="Do you want to do a service scan?" />
                        <condition>
@@ -115,17 +134,10 @@ self["arrowup2"].startMoving()
                        <list>
                                <listentry caption="Yes, do an automatic scan now" step="scan" />
                                <listentry caption="Yes, do a manual scan now" step="manualscan" />
                        <list>
                                <listentry caption="Yes, do an automatic scan now" step="scan" />
                                <listentry caption="Yes, do a manual scan now" step="manualscan" />
-                               <listentry caption="No, let me choose default lists" step="parentalcontrol" />
-                               <listentry caption="No, scan later manually" step="parentalcontrol" />
+                               <listentry caption="No, scan later manually" step="finisheddefaultsatlists" />
                        </list>
                        </list>
-                       <code pos="after">
-if self["list"].index == 2:
-       #from Screens.ScanSetup import ScanSetup
-       from Screens.ScanSetup import DefaultSatLists
-       self.session.open(DefaultSatLists)
-                       </code>
                </step>
                </step>
-               <step id="scan" nextstep="parentalcontrol">
+               <step id="scan" nextstep="finisheddefaultsatlists">
                        <condition>
 self.condition = config.misc.startwizard.doservicescan.value
                        </condition>                    
                        <condition>
 self.condition = config.misc.startwizard.doservicescan.value
                        </condition>                    
@@ -146,10 +158,10 @@ self.condition = config.misc.startwizard.doservicescan.value
                        <text value="Do you want to do another manual service scan?" />
                        <list>
                                <listentry caption="Yes, do another manual scan now" step="manualscan" />
                        <text value="Do you want to do another manual service scan?" />
                        <list>
                                <listentry caption="Yes, do another manual scan now" step="manualscan" />
-                               <listentry caption="No, scan later manually" step="parentalcontrol" />
+                               <listentry caption="No, scan later manually" step="finisheddefaultsatlists" />
                        </list>
                </step>
                        </list>
                </step>
-               <step id="parentalcontrol">
+               <step id="finisheddefaultsatlists">
                        <text value="Do you want to enable the parental control feature on your dreambox?" />
                        <list>
                                <listentry caption="Yes" step="parentalsetup" />
                        <text value="Do you want to enable the parental control feature on your dreambox?" />
                        <list>
                                <listentry caption="Yes" step="parentalsetup" />
index 5d0495450314a140153e252629798474f1b91b4c..18995d10108b2f2867c2751d8cab67ed14477fac 100644 (file)
@@ -281,6 +281,7 @@ class CableTransponderSearchSupport:
 
 class DefaultSatLists(DefaultWizard):
        def __init__(self, session, silent = True, showSteps = False):
 
 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()
 
                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))
                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
        def statusCallback(self, status, progress):
                print "statusCallback:", status, progress
                from Components.DreamInfoHandler import DreamInfoHandler
index d0ece2950ad47576ec0dcc00e6018978bfbd1914..1c4cfb2485929cfb3ee97287de20b3ed92b1d047 100644 (file)
@@ -1,5 +1,7 @@
 from Wizard import wizardManager
 from Screens.WizardLanguage import WizardLanguage
 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
 
 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)
 
 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)
                WizardLanguage.__init__(self, session, showSteps = False)
+               DefaultWizard.__init__(self, session, silent, showSteps, neededTag = "services")
                self["wizard"] = Pixmap()
                self["rc"] = MovingPixmap()
                self["arrowdown"] = MovingPixmap()
                self["wizard"] = Pixmap()
                self["rc"] = MovingPixmap()
                self["arrowdown"] = MovingPixmap()
index a399c96a4b12e497a0aee9e8e0472f7584ff47da..9c9cbd30e97b8986b80a4878c07447e29ab04593 100644 (file)
@@ -55,12 +55,10 @@ class Wizard(Screen, HelpableScreen):
                        self.isPointsElement, self.isReboundsElement = 0, 0
                        self.wizard = wizard
                        self.currContent = ""
                        self.isPointsElement, self.isReboundsElement = 0, 0
                        self.wizard = wizard
                        self.currContent = ""
-                       self.lastStep = 0
-                       
-               
-               
+                       self.lastStep = 0       
+
                def startElement(self, name, attrs):
                def startElement(self, name, attrs):
-                       print "startElement", name
+                       #print "startElement", name
                        self.currContent = name
                        if (name == "step"):
                                self.lastStep += 1
                        self.currContent = name
                        if (name == "step"):
                                self.lastStep += 1
@@ -68,7 +66,7 @@ class Wizard(Screen, HelpableScreen):
                                        id = str(attrs.get('id'))
                                else:
                                        id = ""
                                        id = str(attrs.get('id'))
                                else:
                                        id = ""
-                               print "id:", id
+                               #print "id:", id
                                if attrs.has_key('nextstep'):
                                        nextstep = str(attrs.get('nextstep'))
                                else:
                                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")):
                                                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")                  
                                        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')):
                                
                                        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'))
                                                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
                                        self.codeafter = False
                        elif (name == "condition"):
                                pass
+                       
                def endElement(self, name):
                        self.currContent = ""
                        if name == 'code':
                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':
                        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":
                                                                
                def characters(self, ch):
                        if self.currContent == "code":
@@ -153,13 +153,16 @@ class Wizard(Screen, HelpableScreen):
 
                self.wizard = {}
                parser = make_parser()
 
                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)
                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
 
                self.showSteps = showSteps
                self.showStepSlider = showStepSlider
@@ -167,7 +170,7 @@ class Wizard(Screen, HelpableScreen):
                self.showConfig = showConfig
 
                self.numSteps = len(self.wizard)
                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)
                
                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
        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
                        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)
 
                                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:
                        self.markDone()
                        self.close()
                else: