示例#1
0
    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()
示例#2
0
        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
示例#3
0
    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
示例#4
0
    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()