def nextSlide(self): clearQueue() seq.onQuestion += 1 if seq.onQuestion > len(seq.sequence) - 1: return forms.scriptInputFormWithErrorMessage(__version__,"") else: return speakAndReturnForm()
def respondToAnswer(n, q): clearQueue() response = "" seq.onQuestion = int(q) if n<len(seq.sequence[seq.onQuestion].answers): # mark answer as visited seq.sequence[seq.onQuestion].answers[n].visited = True # say what there is to say response = seq.sequence[seq.onQuestion].answers[n].responseText if response != "": speakList([response]) # follow any response side link responseSideLink = seq.sequence[seq.onQuestion].answers[n].responseSideLink if len(responseSideLink)>0: seq.sequence = scriptParser.parseScript(responseSideLink) if seq.sequence: seq.onQuestion = 0 return speakAndReturnForm() #TODO error recovery # move to whichever question comes next if seq.sequence[seq.onQuestion].answers[n].action != 0: nextQ = seq.onQuestion + seq.sequence[seq.onQuestion].answers[n].action if 0 <= nextQ <= len(seq.sequence): seq.onQuestion = nextQ if seq.onQuestion<len(seq.sequence): return speakAndReturnForm() else: # past end of sequence speakList(["You have reached the end. Please select another script."]) return forms.scriptInputFormWithErrorMessage(__version__,"")
def nextSlide(self): clearQueue() seq.onQuestion += 1 if seq.onQuestion > len(seq.sequence) - 1: return forms.scriptInputFormWithErrorMessage(__version__, "") else: return speakAndReturnForm()
def respondToAnswer(n, q): clearQueue() response = "" seq.onQuestion = int(q) if n < len(seq.sequence[seq.onQuestion].answers): # mark answer as visited seq.sequence[seq.onQuestion].answers[n].visited = True # say what there is to say response = seq.sequence[seq.onQuestion].answers[n].responseText if response != "": speakList([response]) # follow any response side link responseSideLink = seq.sequence[ seq.onQuestion].answers[n].responseSideLink if len(responseSideLink) > 0: seq.sequence = scriptParser.parseScript(responseSideLink) if seq.sequence: seq.onQuestion = 0 return speakAndReturnForm() #TODO error recovery # move to whichever question comes next if seq.sequence[seq.onQuestion].answers[n].action != 0: nextQ = seq.onQuestion + seq.sequence[ seq.onQuestion].answers[n].action if 0 <= nextQ <= len(seq.sequence): seq.onQuestion = nextQ if seq.onQuestion < len(seq.sequence): return speakAndReturnForm() else: # past end of sequence speakList(["You have reached the end. Please select another script."]) return forms.scriptInputFormWithErrorMessage(__version__, "")
def getScriptName(self, name = None): #name = "http://dl.dropbox.com/u/12838403/20110428a.txt" if name: if name=="exit": sys.exit() seq.sequence = scriptParser.parseScript(name) if seq.sequence: seq.onQuestion = 0 return speakAndReturnForm() else: return forms.scriptInputFormWithErrorMessage( \ __version__, "<i>Could not open "+name+"</i>") else: # No name was specified return forms.scriptInputFormWithErrorMessage( \ __version__, "<i>Please enter a file name or link on the web.</i>")
def getScriptName(self, name=None): #name = "http://dl.dropbox.com/u/12838403/20110428a.txt" if name: if name == "exit": sys.exit() seq.sequence = scriptParser.parseScript(name) if seq.sequence: seq.onQuestion = 0 return speakAndReturnForm() else: return forms.scriptInputFormWithErrorMessage( \ __version__, "<i>Could not open "+name+"</i>") else: # No name was specified return forms.scriptInputFormWithErrorMessage( \ __version__, "<i>Please enter a file name or link on the web.</i>")
def index(self): # Ask for the script name. return forms.scriptInputFormWithErrorMessage(__version__,"")
def index(self): # Ask for the script name. return forms.scriptInputFormWithErrorMessage(__version__, "")