def buttonTest(self, text): """This is an example of a speech rule which triggers when the user says "Create a button" or "Make a button". This example demonstrates how to display buttons to the user which allow the user to perform a web search for specific text. * text -- The text spoken by the user """ # Create the two web search buttons to display to the user button1 = ObjectFactory.button(Buttons.WebSearch, "Search for Siri", "siri") button2 = ObjectFactory.button(Buttons.WebSearch, "Search for Python", "python") # Create an utterance to go along with the buttons utterance = ObjectFactory.utterance("Look! I made buttons", "Aren't they cool?") # Create a view to display the utterance and the buttons self.makeView([utterance, button1, button2]) self.completeRequest()
def createCustomButtons(): '''Create a list of buttons that perform custom commands.''' buttons = [] # Create buttons to execute custom commands for each of the # buttons in the list of buttons for buttonText, command in self.__buttonList: button = ObjectFactory.button(Buttons.Custom, buttonText, command) buttons.append(button) return buttons
def __createCustomButtons(self): """Create a list of buttons that perform custom commands.""" buttons = [] # Create buttons to execute custom commands for each of the # buttons in the list of buttons for buttonText, command in self.__buttonList: button = ObjectFactory.button(Buttons.Custom, buttonText, command) buttons.append(button) return buttons
def buttonTest(self, text): '''This is an example of a speech rule which triggers when the user says "Create a button" or "Make a button". This example demonstrates how to display buttons to the user which allow the user to perform a web search for specific text. * text -- The text spoken by the user ''' # Create the two web search buttons to display to the user button1 = ObjectFactory.button(Buttons.WebSearch, "Search for Siri", "siri") button2 = ObjectFactory.button(Buttons.WebSearch, "Search for Python", "python") # Create an utterance to go along with the buttons utterance = ObjectFactory.utterance("Look! I made buttons", "Aren't they cool?") # Create a view to display the utterance and the buttons self.makeView([utterance, button1, button2]) self.completeRequest()