Пример #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_quit_option(self):
        # quit option
        p = Prompt()
        p.add_quit_option()
        self._check_default_option(p, Prompt.QUIT, Prompt.QUIT_DESCRIPTION)

        # test add with description
        p = Prompt()
        p.add_quit_option("Other quit")
        self._check_default_option(p, Prompt.QUIT, "Other quit")

        # change existing description
        p.add_quit_option("New quit")
        self._check_default_option(p, Prompt.QUIT, "New quit")