add a 'priority' for wizard screens to define the run order
authorFelix Domke <tmbinc@elitedvb.net>
Mon, 11 Feb 2008 14:12:52 +0000 (14:12 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Mon, 11 Feb 2008 14:12:52 +0000 (14:12 +0000)
lib/python/Plugins/SystemPlugins/FrontprocessorUpgrade/plugin.py
lib/python/Plugins/SystemPlugins/Videomode/plugin.py
lib/python/Screens/ImageWizard.py
lib/python/Screens/StartWizard.py
lib/python/Screens/TutorialWizard.py
lib/python/Screens/Wizard.py
mytest.py

index 407f1ad..1946edf 100644 (file)
@@ -52,6 +52,6 @@ def Plugins(**kwargs):
        version = getFPVersion()
        newversion = getUpgradeVersion() or 0
        if version is not None and version < newversion:
-               return PluginDescriptor(name="FP Upgrade", where = PluginDescriptor.WHERE_WIZARD, fnc=FPUpgrade)
+               return PluginDescriptor(name="FP Upgrade", where = PluginDescriptor.WHERE_WIZARD, fnc=(8, FPUpgrade))
        else:
                return [ ]
index 719bb0a..b5e12c2 100644 (file)
@@ -187,5 +187,5 @@ def Plugins(**kwargs):
                PluginDescriptor(name=_("Video Setup"), description=_("Advanced Video Setup"), where = PluginDescriptor.WHERE_MENU, fnc=startSetup) 
        ]
        if config.misc.firstrun.value:
-               list.append(PluginDescriptor(name=_("Video Wizard"), where = PluginDescriptor.WHERE_WIZARD, fnc=VideoWizard))
+               list.append(PluginDescriptor(name=_("Video Wizard"), where = PluginDescriptor.WHERE_WIZARD, fnc=(0, VideoWizard)))
        return list
index 148eba5..ad0640c 100644 (file)
@@ -34,7 +34,7 @@ class ImageWizard(Wizard):
        def markDone(self):
                pass
 
-wizardManager.registerWizard(ImageWizard, backupAvailable)
+wizardManager.registerWizard(ImageWizard, backupAvailable, priority = 10)
 
 def doBackup(path):
        os.system('tar cvpf ' + path + backupfile + ' /etc/enigma2')
index 0424771..a60e3d2 100644 (file)
@@ -41,7 +41,6 @@ class StartWizard(Wizard):
                config.misc.firstrun.save()
                configfile.save()
                
-wizardManager.registerWizard(LanguageSelection, config.misc.languageselected.value)
+wizardManager.registerWizard(LanguageSelection, config.misc.languageselected.value, priority = 5)
 #wizardManager.registerWizard(DefaultWizard, config.misc.defaultchosen.value)
-wizardManager.registerWizard(StartWizard, config.misc.firstrun.value)
-
+wizardManager.registerWizard(StartWizard, config.misc.firstrun.value, priority = 20)
index c90ed36..9e97b7e 100644 (file)
@@ -30,4 +30,4 @@ class TutorialWizard(Wizard):
                config.misc.firstruntutorial.value = False
                config.misc.firstruntutorial.save()
 
-#wizardManager.registerWizard(TutorialWizard, config.misc.firstruntutorial.value)
+#wizardManager.registerWizard(TutorialWizard, config.misc.firstruntutorial.value, priority = 30)
index e574f86..1b13315 100644 (file)
@@ -459,14 +459,14 @@ class WizardManager:
        def __init__(self):
                self.wizards = []
        
-       def registerWizard(self, wizard, precondition):
-               self.wizards.append((wizard, precondition))
+       def registerWizard(self, wizard, precondition, priority = 0):
+               self.wizards.append((wizard, precondition, priority))
        
        def getWizards(self):
                list = []
                for x in self.wizards:
                        if x[1] == 1: # precondition
-                               list.append(x[0])
+                               list.append((x[2], x[0]))
                return list
 
 wizardManager = WizardManager()
index 627d16f..fd72529 100644 (file)
--- a/mytest.py
+++ b/mytest.py
@@ -511,7 +511,9 @@ def runScreenTest():
        profile("wizards")
        screensToRun += wizardManager.getWizards()
 
-       screensToRun.append(Screens.InfoBar.InfoBar)
+       screensToRun.append((100, Screens.InfoBar.InfoBar))
+
+       screensToRun.sort()
 
        ePythonConfigQuery.setQueryFunc(configfile.getResolvedKey)
 
@@ -526,7 +528,7 @@ def runScreenTest():
                        quitMainloop(*result)
                        return
 
-               screen = screensToRun[0]
+               screen = screensToRun[0][1]
 
                if len(screensToRun):
                        session.openWithCallback(boundFunction(runNextScreen, session, screensToRun[1:]), screen)