Example #1
0
    def make_language_choices(self):
        btns = []
        current_index = None
        langs = self.model.get_languages(self.is_linux_tty)
        cur = self.model.selected_language
        log.debug("_build_model_inputs selected_language=%s", cur)
        if cur in ["C", None]:
            cur = "en_US"
        for i, (code, native) in enumerate(langs):
            log.debug("%s", (code, self.model.selected_language))
            if code == cur:
                current_index = i
            btns.append(
                forward_btn(label=native,
                            on_press=self.choose_language,
                            user_arg=code))

        lb = ListBox(btns)
        if current_index is not None:
            lb.base_widget.focus_position = current_index
        return screen(
            lb,
            buttons=None,
            narrow_rows=True,
            excerpt=_("Use UP, DOWN and ENTER keys to select your language."))
Example #2
0
 def _build_choices(self):
     choices = []
     for label, path in self.model.paths:
         log.debug("Building inputs: {}".format(path))
         choices.append(
             forward_btn(label=label, on_press=self.confirm, user_arg=path))
     return ListBox(choices)
Example #3
0
 def make_serial_choices(self):
     ssh_password = get_installer_password(self.controller.opts.dry_run)
     ips = get_global_addresses(self.controller.app)
     btns = [
         other_btn(label="Switch to rich mode", on_press=self.enable_rich),
         forward_btn(label="Continue in basic mode",
                     on_press=self.choose_language,
                     user_arg='C'),
     ]
     widgets = [
         Text(""),
         Text(rewrap(SERIAL_TEXT)),
         Text(""),
     ]
     if ssh_password and ips:
         widgets.append(Text(rewrap(SSH_TEXT)))
         widgets.append(Text(""))
         btns.insert(
             1,
             other_btn(label="View SSH instructions",
                       on_press=self.ssh_help,
                       user_arg=ssh_password))
     widgets.extend([
         button_pile(btns),
     ])
     lb = ListBox(widgets)
     return screen(lb, buttons=None)
Example #4
0
 def __init__(self, model, controller):
     self.model = model
     self.controller = controller
     cancel = cancel_btn(_("Cancel"), on_press=self.cancel)
     disks = []
     for disk in self.model.all_disks():
         label = "%-42s %s" % (disk.label, humanize_size(
             disk.size).rjust(9))
         if disk.size >= model.lower_size_limit:
             disk_btn = forward_btn(label,
                                    on_press=self.choose_disk,
                                    user_arg=disk)
         else:
             disk_btn = Color.info_minor(Text("  " + label))
         disks.append(disk_btn)
     body = Pile([
         ('pack', Text("")),
         ('pack',
          Padding.center_70(Text(_("Choose the disk to install to:")))),
         ('pack', Text("")),
         Padding.center_70(ListBox(disks)),
         ('pack', Text("")),
         ('pack', button_pile([cancel])),
         ('pack', Text("")),
     ])
     super().__init__(body)
Example #5
0
    def make_language_choices(self):
        btns = []
        current_index = None
        langs = get_languages()
        cur = self.cur_lang
        if cur in ["C.UTF-8", None]:
            cur = "en_US.UTF-8"
        for i, (code, native) in enumerate(langs):
            log.debug("%s", (code, cur))
            if code == cur:
                current_index = i
            btns.append(
                forward_btn(
                    label=native,
                    on_press=self.choose_language,
                    user_arg=code))

        lb = ListBox(btns)
        back = None
        if self.serial:
            back = other_btn(_("Back"), on_press=self.controller.cancel)
        if current_index is not None:
            lb.base_widget.focus_position = current_index
        return screen(
            lb, focus_buttons=False, narrow_rows=True,
            buttons=[back] if back else None,
            excerpt=_("Use UP, DOWN and ENTER keys to select your language."))
Example #6
0
    def _build_model_inputs(self):
        sl = []
        for code, native in self.model.get_languages():
            sl.append(
                forward_btn(label=native, on_press=self.confirm,
                            user_arg=code))

        return SimpleList(sl)
Example #7
0
 def make_serial(self):
     self.rich_btn = forward_btn(label="Continue in rich mode",
                                 on_press=self.rich_mode)
     self.basic_btn = forward_btn(label="Continue in basic mode",
                                  on_press=self.basic_mode)
     btns = [self.rich_btn, self.basic_btn]
     widgets = [
         Text(""),
         Text(rewrap(SERIAL_TEXT)),
         Text(""),
     ]
     if self.ssh_info:
         widgets.append(Text(rewrap(SSH_TEXT)))
         widgets.append(Text(""))
         btns.append(
             other_btn(label="View SSH instructions",
                       on_press=self.ssh_help))
     return screen(widgets, btns)
Example #8
0
 def _build_choices(self):
     choices = []
     focus_position = 0
     for i, (label, path) in enumerate(self.model.paths):
         log.debug("Building inputs: {}".format(path))
         choices.append(
             forward_btn(label=label, on_press=self.confirm, user_arg=path))
         if path == self.model.path:
             focus_position = i
     bp = button_pile(choices)
     bp.base_widget.focus_position = focus_position
     return bp
Example #9
0
    def _build_model_inputs(self):
        btns = []
        current_index = None
        for i, (code, native) in enumerate(self.model.get_languages()):
            if code == self.model.selected_language:
                current_index = i
            btns.append(forward_btn(label=native, on_press=self.confirm,
                                    user_arg=code))

        lb = ListBox(btns)
        if current_index is not None:
            lb.base_widget.focus_position = current_index
        return lb
Example #10
0
    def _build_model_inputs(self):
        sl = []
        current_index = None
        for i, (code, native) in enumerate(self.model.get_languages()):
            if code == self.model.selected_language:
                current_index = i
            sl.append(
                forward_btn(label=native, on_press=self.confirm,
                            user_arg=code))

        lb = SimpleList(sl)
        if current_index is not None:
            lb._w.focus_position = current_index
        return lb
Example #11
0
    def __init__(self, controller, current, has_more=False):
        self.controller = controller
        log.debug('more systems available: %s', has_more)
        log.debug('current system: %s', current)

        actions = []
        for action in sorted(current.actions, key=by_preferred_action_type):
            actions.append(
                forward_btn(label=action.title.capitalize(),
                            on_press=self._current_system_action,
                            user_arg=(current, action)))

        if has_more:
            # add a button to show the other systems
            actions.append(Text(""))
            actions.append(
                forward_btn(label="Show all available systems",
                            on_press=self._more_options))

        lb = ListBox(actions)

        super().__init__(current,
                         screen(lb, narrow_rows=True, excerpt=self.excerpt))
Example #12
0
 def __init__(self, model, controller):
     self.model = model
     self.controller = controller
     cancel = cancel_btn("Cancel", on_press=self.cancel)
     disks = []
     for disk in self.model.all_disks():
         disk_btn = forward_btn(
             "%-40s %s" % (disk.serial, humanize_size(disk.size).rjust(9)),
             on_press=self.choose_disk,
             user_arg=disk)
         disks.append(disk_btn)
     lb = ListBox([
         Padding.center_70(Text("")),
         Padding.center_70(Text(_("Choose the disk to install to:"))),
         Padding.center_70(Text("")),
         Padding.center_70(Pile(disks)),
         Padding.center_70(Text("")),
         button_pile([cancel]),
     ])
     super().__init__(lb)
Example #13
0
    def make_language_choices(self):
        btns = []
        current_index = None
        excerpt_context = _(
            "Use UP, DOWN and ENTER keys to select your language.")
        extented_excerpt_context = _(
            "You are using old Windows Console Host, Entering fallback mode. "
            "Use Windows Terminal to get more language options."
        ) + "\n\n" + excerpt_context
        if not self.fallback_mode_checked:
            if "WT_PROFILE_ID" in os.environ:
                self.__class__.title = self.__class__.extented_title
            else:
                excerpt_context = extented_excerpt_context
            self.fallback_mode_checked = True
        langs = self.model.get_languages("WT_PROFILE_ID" not in os.environ)
        cur = self.model.selected_language
        log.debug("_build_model_inputs selected_language=%s", cur)
        if cur in ["C", None]:
            cur = "en_US"
        for i, (code, native) in enumerate(langs):
            log.debug("%s", (code, self.model.selected_language))
            if code == cur:
                current_index = i
            btns.append(
                forward_btn(label=native,
                            on_press=self.choose_language,
                            user_arg=code))

        lb = ListBox(btns)
        if current_index is not None:
            lb.base_widget.focus_position = current_index
        return screen(lb,
                      buttons=None,
                      narrow_rows=True,
                      excerpt=excerpt_context)