Example #1
0
    def _build_buttons(self):
        self.done = Toggleable(done_btn(_("Done"), on_press=self.done))

        return [
            self.done,
            reset_btn(_("Reset"), on_press=self.reset),
            back_btn(_("Back"), on_press=self.cancel),
        ]
Example #2
0
    def _build_buttons(self):
        back = back_btn(_("Back"), on_press=self.cancel)
        done = done_btn(_("Done"), on_press=self.done)

        buttons = button_pile([done, back])

        buttons.base_widget.focus_position = 0

        return buttons
    def _build_buttons(self):
        log.debug('FileSystemView: building buttons')
        self.done = Toggleable(done_btn(_("Done"), on_press=self.done))

        return [
            self.done,
            reset_btn(_("Reset"), on_press=self.reset),
            back_btn(_("Back"), on_press=self.cancel),
            ]
Example #4
0
    def __init__(self, controller, netdev_infos):
        self.controller = controller
        self.dev_name_to_table = {}
        self.cur_netdev_names = []
        self.error = Text("", align='center')

        self.device_colspecs = {
            0: ColSpec(rpad=1),
            3: ColSpec(min_width=15),
            4: ColSpec(can_shrink=True, rpad=1),
        }

        self.heading_table = TablePile([
            TableRow([
                Color.info_minor(Text(header)) for header in [
                    "",
                    "NAME",
                    "TYPE",
                    "NOTES",
                    "",
                ]
            ])
        ],
                                       spacing=2,
                                       colspecs=self.device_colspecs)

        self.device_pile = Pile([self.heading_table])

        for dev_info in netdev_infos:
            self.new_link(dev_info)

        self._create_bond_btn = menu_btn(_("Create bond"),
                                         on_press=self._create_bond)
        bp = button_pile([self._create_bond_btn])
        bp.align = 'left'

        rows = [
            self.device_pile,
            bp,
        ]

        self.buttons = button_pile([
            done_btn("TBD", on_press=self.done),  # See _route_watcher
            back_btn(_("Back"), on_press=self.cancel),
        ])
        self.bottom = Pile([
            ('pack', self.buttons),
        ])

        self.error_showing = False

        super().__init__(
            screen(rows=rows,
                   buttons=self.bottom,
                   focus_buttons=True,
                   excerpt=_(self.excerpt)))
Example #5
0
 def __init__(self, model, controller):
     self.title = self.title.format(
         lsb_release.get_distro_information()['RELEASE'])
     self.model = model
     self.controller = controller
     self.items = []
     back = back_btn(_("Back"), on_press=self.cancel)
     super().__init__(
         screen(self._build_choices(), [back],
                focus_buttons=False,
                excerpt=_(self.excerpt)))
Example #6
0
 def __init__(self, model, controller):
     self.title = self.title.format(lsb_release().get(
         'release', 'Unknown Release'))
     self.model = model
     self.controller = controller
     self.items = []
     back = back_btn(_("Back"), on_press=self.cancel)
     super().__init__(
         screen(self._build_choices(), [back],
                focus_buttons=False,
                excerpt=_(self.excerpt)))
Example #7
0
 def __init__(self, controller):
     self.controller = controller
     guided = ok_btn(_("Use An Entire Disk"), on_press=self.guided)
     manual = ok_btn(_("Manual"), on_press=self.manual)
     back = back_btn(_("Back"), on_press=self.cancel)
     lb = ListBox([
         Padding.center_70(Text("")),
         Padding.center_70(Text(text)),
         Padding.center_70(Text("")),
         button_pile([guided, manual, back]),
     ])
     super().__init__(lb)
Example #8
0
    def __init__(self, controller, systems):
        self.controller = controller

        heading_table = TablePile([
            TableRow([
                Color.info_minor(Text(header))
                for header in ["LABEL", "MODEL", "PUBLISHER", ""]
            ])
        ],
                                  spacing=2)

        trows = []
        systems = sorted(
            systems,
            key=lambda s:
            (s.brand.display_name, s.model.display_name, s.current, s.label))
        for s in systems:
            actions = []
            log.debug('actions: %s', s.actions)
            for act in sorted(s.actions, key=by_preferred_action_type):
                actions.append(
                    Action(label=act.title.capitalize(),
                           value=act,
                           enabled=True))
            menu = ActionMenu(actions)
            connect_signal(menu, 'action', self._system_action, s)
            srow = make_action_menu_row([
                Text(s.label),
                Text(s.model.display_name),
                Text(s.brand.display_name),
                Text("(installed)" if s.current else ""),
                menu,
            ], menu)
            trows.append(srow)

        systems_table = TablePile(trows, spacing=2)
        systems_table.bind(heading_table)
        rows = [
            Pile([heading_table, systems_table]),
        ]

        buttons = []
        if controller.model.current is not None:
            # back to options of current system
            buttons.append(back_btn("BACK", on_press=self.back))

        super().__init__(
            controller.model.current,
            screen(rows=rows,
                   buttons=button_pile(buttons),
                   focus_buttons=False,
                   excerpt=self.excerpt))
Example #9
0
    def _build_buttons(self):
        log.debug('FileSystemView: building buttons')
        buttons = []

        # don't enable done botton if we can't install
        # XXX should enable/disable button rather than having it appear/disappear I think
        if self.model.can_install():
            buttons.append(done_btn(_("Done"), on_press=self.done))

        buttons.append(reset_btn(_("Reset"), on_press=self.reset))
        buttons.append(back_btn(_("Back"), on_press=self.cancel))

        return button_pile(buttons)
Example #10
0
 def __init__(self, model, controller):
     self.model = model
     self.controller = controller
     self.items = []
     back = back_btn(_("Back"), on_press=self.cancel)
     self.body = [
         ('pack', Text("")),
         Padding.center_79(self._build_choices()),
         ('pack', Text("")),
         ('pack', button_pile([back])),
         ('pack', Text("")),
     ]
     super().__init__(Pile(self.body))
Example #11
0
 def __init__(self, controller):
     self.controller = controller
     direct = ok_btn(
         _("Use An Entire Disk"), on_press=self.guided, user_arg="direct")
     lvm = ok_btn(
         _("Use An Entire Disk And Set Up LVM"), on_press=self.guided,
         user_arg="lvm")
     manual = ok_btn(_("Manual"), on_press=self.manual)
     back = back_btn(_("Back"), on_press=self.cancel)
     super().__init__(screen(
         rows=[button_pile([direct, lvm, manual, back]), Text("")],
         buttons=None,
         focus_buttons=False,
         excerpt=text))
Example #12
0
 def __init__(self, controller):
     self.controller = controller
     direct = ok_btn(
         _("Use An Entire Disk"), on_press=self.guided, user_arg="direct")
     lvm = ok_btn(
         _("Use An Entire Disk And Set Up LVM"), on_press=self.guided,
         user_arg="lvm")
     manual = ok_btn(_("Manual"), on_press=self.manual)
     back = back_btn(_("Back"), on_press=self.cancel)
     lb = ListBox([
         Padding.center_70(Text("")),
         Padding.center_70(Text(_(text))),
         Padding.center_70(Text("")),
         button_pile([direct, lvm, manual, back]),
         ])
     super().__init__(lb)
Example #13
0
    def __init__(self, model, controller):
        self.model = model
        self.controller = controller
        self.dev_to_table = {}
        self.cur_netdevs = []
        self.error = Text("", align='center')

        self.device_colspecs = {
            0: ColSpec(rpad=1),
            3: ColSpec(min_width=15),
            4: ColSpec(can_shrink=True, rpad=1),
        }

        self.device_pile = Pile(self._build_model_inputs())

        self._create_bond_btn = menu_btn(_("Create bond"),
                                         on_press=self._create_bond)
        bp = button_pile([self._create_bond_btn])
        bp.align = 'left'

        rows = [
            self.device_pile,
            bp,
        ]

        self.buttons = button_pile([
            done_btn("TBD", on_press=self.done),  # See _route_watcher
            back_btn(_("Back"), on_press=self.cancel),
        ])
        self.bottom = Pile([
            ('pack', self.buttons),
        ])

        self.controller.network_event_receiver.add_default_route_watcher(
            self._route_watcher)

        self.error_showing = False

        super().__init__(
            screen(rows=rows,
                   buttons=self.bottom,
                   focus_buttons=True,
                   excerpt=_(self.excerpt)))
Example #14
0
    def __init__(self, controller, selection):
        self.controller = controller

        buttons = [
            danger_btn("CONFIRM", on_press=self.confirm),
            back_btn("BACK", on_press=self.back),
        ]
        fmt = self.canned_summary.get(selection.action.mode,
                                      self.default_summary)
        summary = fmt.format(action=selection.action.title,
                             action_lower=selection.action.title.lower(),
                             model=selection.system.model.display_name,
                             publisher=selection.system.brand.display_name,
                             version=selection.system.label)
        rows = [
            Text(summary),
        ]
        super().__init__(
            controller.model.current,
            screen(rows=rows,
                   buttons=button_pile(buttons),
                   focus_buttons=False))
Example #15
0
    def __init__(self, model, controller):
        self.model = model
        self.controller = controller
        self.dev_to_row = {}
        self.cur_netdevs = []
        self.error = Text("", align='center')
        self.device_table = TablePile(
            self._build_model_inputs(),
            spacing=2, colspecs={
                0: ColSpec(rpad=1),
                4: ColSpec(can_shrink=True, rpad=1),
                })

        self._create_bond_btn = menu_btn(
            _("Create bond"), on_press=self._create_bond)
        bp = button_pile([self._create_bond_btn])
        bp.align = 'left'

        rows = [
            self.device_table,
            bp,
        ]

        buttons = button_pile([
                    done_btn(_("Done"), on_press=self.done),
                    back_btn(_("Back"), on_press=self.cancel),
                    ])
        self.bottom = Pile([
            ('pack', buttons),
        ])

        self.error_showing = False

        super().__init__(screen(
            rows=rows,
            buttons=self.bottom,
            focus_buttons=True,
            excerpt=self.excerpt))
Example #16
0
 def _build_buttons(self):
     return [
         done_btn(_("Continue"), on_press=self.done),
         back_btn(_("Back"), on_press=self.cancel),
         ]
Example #17
0
 def _build_buttons(self):
     back = back_btn(_("Back"), on_press=self.cancel)
     done = done_btn(_("Done"), on_press=self.done)
     return button_pile([done, back])
Example #18
0
 def _build_buttons(self):
     self.buttons = [
         back_btn(on_press=self.cancel),
     ]
     return button_pile(self.buttons)