+ print "after updateValues stepHistory:", self.stepHistory
+
+ def exitWizardQuestion(self, ret = False):
+ if (ret):
+ self.markDone()
+ self.close()
+
+ def markDone(self):
+ pass
+
+ def getStepWithID(self, id):
+ print "getStepWithID:", id
+ count = 0
+ for x in self.wizard.keys():
+ if self.wizard[x]["id"] == id:
+ print "result:", count
+ return count
+ count += 1
+ print "result: nothing"
+ return 0
+
+ def finished(self, gotoStep = None, *args, **kwargs):
+ print "finished"
+ currStep = self.currStep
+
+ 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"]