Ejemplo n.º 1
0
def readMenu(xmldoc, menu_node):
	speak("This is the " + menu_node.getAttribute("name") + " menu.")
	speak(menu_node.getAttribute("value"))

	time.sleep(1)

	# the following loop print all the child nodes(which are the current menu)
	for child in menu_node.childNodes:
		if isinstance(child,minidom.Element):
			speak(child.getAttribute("name"))
			count=clap.listenAndCount(2)
			if count==1:
				return child
			if count==2:
				return parentNode(xmldoc, menu_node)

	speak("Menu Over.")
	speak("Clap to repeat")
	if menu_node!=xmldoc.firstChild:
		speak("Or clap twice to go back")
	
	claps=clap.waitForClaps()
	if claps>=2:
		return parentNode(xmldoc, menu_node)
	return menu_node
Ejemplo n.º 2
0
def readMethod(xmldoc, method_node):
	speak("The method steps will be read one by one.")
	speak("Clap once to move to the next")
	speak("Clap twice to return to the dish menu")
	time.sleep(1)

	steps=method_node.getElementsByTagName('step');
	for step in steps:
		speak(step.firstChild.nodeValue)
		claps=clap.waitForClaps()
		print "####################### claps: " + str(claps)
		if claps>1:
			return parentNode(xmldoc, method_node)

	time.sleep(1)

	speak("Clap twice to return to the dish menu")
	return parentNode(xmldoc, method_node)