+ 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)
+ 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)
+ 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)
+
+ def updateValues(self):
+ print "Updating values in step " + str(self.currStep)
+ # calling a step which doesn't exist can only happen if the condition in the last step is not fulfilled
+ # if a non-existing step is called, end the wizard
+ if self.currStep > len(self.wizard):
+ self.markDone()
+ self.close()
+ return
+
+ self.timeoutTimer.stop()
+
+ if self.configInstance is not None:
+ # remove callbacks
+ self.configInstance["config"].onSelectionChanged = []
+ del self.configInstance["config"]
+ self.configInstance.doClose()
+ self.configInstance = None
+
+ self.condition = True
+ exec (self.wizard[self.currStep]["condition"])
+ if not self.condition:
+ print "keys*******************:", self.wizard[self.currStep].keys()
+ if self.wizard[self.currStep].has_key("laststep"): # exit wizard, if condition of laststep doesn't hold
+ self.markDone()
+ self.close()
+ return
+ else:
+ self.currStep += 1
+ self.updateValues()