+ if self.updateValues not in self.onShown:
+ self.onShown.append(self.updateValues)
+
+ if self.showConfig:
+ if self.wizard[currStep]["config"]["type"] == "dynamic":
+ eval("self." + self.wizard[currStep]["config"]["evaluation"])()
+
+ if self.showList:
+ if (len(self.wizard[currStep]["evaluatedlist"]) > 0):
+ print "current:", self["list"].current
+ nextStep = self["list"].current[1]
+ if (self.wizard[currStep].has_key("listevaluation")):
+ exec("self." + self.wizard[self.currStep]["listevaluation"] + "('" + nextStep + "')")
+ else:
+ self.currStep = self.getStepWithID(nextStep)
+
+ print_now = True
+ 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.codeafter = True
+ self.runCode(self.wizard[currStep]["codeafter"])
+ self.prevStep = currStep
+ self.gotoStep = gotoStep
+ if not self.runCode(self.wizard[currStep]["codeafter_async"]):
+ self.afterAsyncCode()
+ else:
+ if self.updateValues in self.onShown:
+ self.onShown.remove(self.updateValues)
+
+ if print_now:
+ print "Now: " + str(self.currStep)
+
+ def ok(self):
+ print "OK"
+ if self.disableKeys:
+ return
+ currStep = self.currStep
+
+ if self.showConfig:
+ if (self.wizard[currStep]["config"]["screen"] != None):
+ # TODO: don't die, if no run() is available
+ # there was a try/except here, but i can't see a reason
+ # for this. If there is one, please do a more specific check
+ # and/or a comment in which situation there is no run()
+ if callable(getattr(self.configInstance, "runAsync", None)):
+ if self.updateValues in self.onShown:
+ self.onShown.remove(self.updateValues)
+ self.configInstance.runAsync(self.finished)
+ return
+ else:
+ self.configInstance.run()
+ self.finished()
+
+ def keyNumberGlobal(self, number):
+ if (self.wizard[self.currStep]["config"]["screen"] != None):
+ self.configInstance.keyNumberGlobal(number)
+
+ def keyGotAscii(self):
+ if (self.wizard[self.currStep]["config"]["screen"] != None):
+ self["config"].handleKey(KEY_ASCII)
+
+ def left(self):
+ self.resetCounter()
+ if (self.wizard[self.currStep]["config"]["screen"] != None):
+ self.configInstance.keyLeft()
+ elif (self.wizard[self.currStep]["config"]["type"] == "dynamic"):
+ self["config"].handleKey(KEY_LEFT)
+ print "left"
+
+ def right(self):
+ self.resetCounter()
+ if (self.wizard[self.currStep]["config"]["screen"] != None):
+ self.configInstance.keyRight()
+ elif (self.wizard[self.currStep]["config"]["type"] == "dynamic"):
+ self["config"].handleKey(KEY_RIGHT)
+ print "right"
+
+ def up(self):
+ 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"):
+ print "current:", self["list"].current
+ self.selection = self["list"].current[-1]
+ #self.selection = self.wizard[self.currStep]["evaluatedlist"][self["list"].l.getCurrentSelectionIndex()][1]
+ exec("self." + self.wizard[self.currStep]["onselect"] + "()")
+ print "up"
+
+ def down(self):
+ 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()
+ if self.wizard[self.currStep].has_key("onselect"):
+ print "current:", self["list"].current
+ #self.selection = self.wizard[self.currStep]["evaluatedlist"][self["list"].l.getCurrentSelectionIndex()][1]
+ #exec("self." + self.wizard[self.currStep]["onselect"] + "()")
+ self.selection = self["list"].current[-1]
+ #self.selection = self.wizard[self.currStep]["evaluatedlist"][self["list"].l.getCurrentSelectionIndex()][1]
+ exec("self." + self.wizard[self.currStep]["onselect"] + "()")
+ print "down"
+
+ def selChanged(self):
+ self.resetCounter()
+
+ if (self.showConfig and self.wizard[self.currStep]["config"]["screen"] != None):
+ self["config"].instance.moveSelection(self["config"].instance.moveUp)
+ elif (self.showList and len(self.wizard[self.currStep]["evaluatedlist"]) > 0):
+ if self.wizard[self.currStep].has_key("onselect"):
+ self.selection = self["list"].current[-1]
+ print "self.selection:", self.selection
+ exec("self." + self.wizard[self.currStep]["onselect"] + "()")
+
+ def resetCounter(self):
+ self.timeoutCounter = self.wizard[self.currStep]["timeout"]
+
+ def runCode(self, code):
+ if code != "":
+ print "code", code
+ exec(code)
+ return True
+ return False
+
+ def getTranslation(self, text):
+ return _(text)
+
+ def updateText(self, firstset = False):
+ text = self.getTranslation(self.wizard[self.currStep]["text"])
+ if text.find("[timeout]") != -1:
+ text = text.replace("[timeout]", str(self.timeoutCounter))
+ self["text"].setText(text)
+ else:
+ if firstset:
+ self["text"].setText(text)
+