示例#1
0
    def prompt(self, args=None):
        """Return the text to be shown as prompt or handle the prompt and return None.

        :param args: optional argument passed from switch_screen calls
        :type args: anything
        :return: returns an instance of Prompt with text to be shown next to the prompt
                 for input or None to skip further input processing
        :rtype: Prompt instance|None
        """
        prompt = Prompt()
        prompt.add_refresh_option()
        prompt.add_continue_option()
        prompt.add_quit_option()
        return prompt
示例#2
0
    def test_refresh_option(self):
        # refresh option
        p = Prompt()
        p.add_refresh_option()
        self._check_default_option(p, Prompt.REFRESH, Prompt.REFRESH_DESCRIPTION)

        # test add with description
        p = Prompt()
        p.add_refresh_option("Other refresh")
        self._check_default_option(p, Prompt.REFRESH, "Other refresh")

        # change existing description
        p.add_refresh_option("New refresh")
        self._check_default_option(p, Prompt.REFRESH, "New refresh")