Exemplo n.º 1
0
    def _print_long_widget(self, widget):
        """Prints a long widget (possibly longer than the screen height) with user interaction (when needed).

        :param widget: possibly long widget to print
        :type widget: Widget instance
        """

        pos = 0
        lines = widget.get_lines()
        num_lines = len(lines)

        if num_lines < self._screen_height - 2:
            # widget plus prompt are shorter than screen height, just print the widget
            print(u"\n".join(lines))
            return

        # long widget, print it in steps and prompt user to continue
        last_line = num_lines - 1
        while pos <= last_line:
            if pos + self._screen_height - 2 > last_line:
                # enough space to print the rest of the widget plus regular
                # prompt (2 lines)
                for line in lines[pos:]:
                    print(line)
                pos += self._screen_height - 1
            else:
                # print part with a prompt to continue
                for line in lines[pos:(pos + self._screen_height - 2)]:
                    print(line)
                self._app.raw_input(
                    Prompt(_("\nPress %s to continue") % Prompt.ENTER))
                pos += self._screen_height - 1
Exemplo n.º 2
0
 def prompt(self, args=None):
     """ Override the default TUI prompt."""
     if self._rescue.automated:
         if self._rescue.mount:
             self._mount_root()
         self._show_result_and_prompt_for_shell()
         return None
     return Prompt()
Exemplo n.º 3
0
 def prompt(self, args=None):
     """ Override the default TUI prompt."""
     return Prompt(
         _("Please make your selection from the above list.\n"
           "Press '%(continue)s' to continue after you have made your selection"
           ) % {
               # TRANSLATORS:'c' to continue
               'continue': C_('TUI|Root Selection', 'c'),
           })
Exemplo n.º 4
0
    def prompt(self, args=None):
        # the title is enough, no custom prompt is needed
        if self.value is None:  # first run or nothing entered
            return Prompt(_("Enter an NTP server address and press %s") % Prompt.ENTER)

        # an NTP server address has been entered
        self._new_ntp_server = self.value

        self.apply()
        self.close()
Exemplo n.º 5
0
 def prompt(self, args=None):
     """ Override the default TUI prompt."""
     if self._rescue.automated:
         if self._rescue.reboot and self._rescue.status == RescueModeStatus.ROOT_NOT_FOUND:
             delay = 5
         else:
             delay = 0
             self._rescue.run_shell()
         self._rescue.finish(delay=delay)
         return None
     return Prompt(_("Please press %s to get a shell") % Prompt.ENTER)
Exemplo n.º 6
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
Exemplo n.º 7
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
Exemplo n.º 8
0
 def prompt(self, args=None):
     """ Override the default TUI prompt."""
     return Prompt(_("Please press %s to get a shell") % Prompt.ENTER)
Exemplo n.º 9
0
 def prompt(self, args=None):
     """ Override the default TUI prompt."""
     return Prompt()