def radio(self, text): 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 buttons = createCustomButtons() utterance = ObjectFactory.utterance("Welche Station willst du hören?") self.makeView([utterance] + buttons) self.completeRequest()
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 testButtons(self, text): """This is an example of a speech rule which triggers when the user says "Test custom buttons". This example demonstrates how to display buttons to the user which execute custom commands when the button is pressed. This plugin is able to respond to the custom commands. * text -- The text spoken by the user """ # Create the custom command buttons buttons = self.__createCustomButtons() # Create an utterance to go along with the buttons utterance = ObjectFactory.utterance("Please press a button") # Now create a view which displays the utterance and the buttons self.makeView([utterance] + buttons) self.completeRequest()
def testButtons(self, text): '''This is an example of a speech rule which triggers when the user says "Test custom buttons". This example demonstrates how to display buttons to the user which execute custom commands when the button is pressed. This plugin is able to respond to the custom commands. * text -- The text spoken by the user ''' # Create the custom command buttons buttons = self.__createCustomButtons() # Create an utterance to go along with the buttons utterance = ObjectFactory.utterance("Please press a button") # Now create a view which displays the utterance and the buttons self.makeView([utterance] + buttons) self.completeRequest()
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()