fix crash when eof in background: windows cannot be opened from other than the curren...
[enigma2.git] / lib / python / Screens / Wizard.py
index e574f861b2f4ffba36c6a39dd6312bacfaaaf27c..f018c3ce137a6888b183eaa2788a24efc574239c 100644 (file)
@@ -162,7 +162,7 @@ class Wizard(Screen, HelpableScreen):
                self.currStep = 1
                
                self.timeoutTimer = eTimer()
-               self.timeoutTimer.timeout.get().append(self.timeoutCounterFired)
+               self.timeoutTimer.callback.append(self.timeoutCounterFired)
 
                self["text"] = Label()
 
@@ -211,12 +211,17 @@ class Wizard(Screen, HelpableScreen):
                self.lcdCallbacks.append(callback)
 
        def back(self):
+               print "getting back..."
+               print "stepHistory:", self.stepHistory
                if len(self.stepHistory) > 1:
                        self.currStep = self.stepHistory[-2]
                        self.stepHistory = self.stepHistory[:-2]
                if self.currStep < 1:
                        self.currStep = 1
+               print "currStep:", self.currStep
+               print "new stepHistory:", self.stepHistory
                self.updateValues()
+               print "after updateValues stepHistory:", self.stepHistory
                
        def markDone(self):
                pass
@@ -366,7 +371,8 @@ class Wizard(Screen, HelpableScreen):
                self.condition = True
                exec (self.wizard[self.currStep]["condition"])
                if self.condition:
-                       self.stepHistory.append(self.currStep)
+                       if len(self.stepHistory) == 0 or self.stepHistory[-1] != self.currStep:
+                               self.stepHistory.append(self.currStep)
                        print "wizard step:", self.wizard[self.currStep]
                        
                        if self.showSteps:
@@ -459,14 +465,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()