示例#1
0
 def __init__(self, parent, snap, loop):
     self.parent = parent
     self.spinner = Spinner(loop, style='dots')
     self.spinner.start()
     self.closed = False
     text = _("Fetching info for {}").format(snap.name)
     # | text |
     # 12    34
     self.width = len(text) + 4
     cancel = cancel_btn(label=_("Cancel"), on_press=self.close)
     super().__init__(
         LineBox(
             Pile([
                 ('pack', Text(' ' + text)),
                 ('pack', self.spinner),
                 ('pack', button_pile([cancel])),
             ])))
示例#2
0
 def __init__(self, parent, aio_loop, msg, task_to_cancel):
     self.parent = parent
     self.spinner = Spinner(aio_loop, style='dots')
     self.spinner.start()
     self.closed = False
     # | text |
     # 12    34
     self.width = len(msg) + 4
     widgets = [
         ('pack', Text(' ' + msg)),
         ('pack', self.spinner),
     ]
     if task_to_cancel is not None:
         self.task_to_cancel = task_to_cancel
         cancel = cancel_btn(label=_("Cancel"), on_press=self.close)
         widgets.append(('pack', button_pile([cancel])))
     super().__init__(LineBox(Pile(widgets)))
示例#3
0
    def _build_buttons(self):
        log.debug('FileSystemView: building buttons')
        buttons = []

        # don't enable done botton if we can't install
        if self.model.installable():
            buttons.append(
                Color.button(done_btn(on_press=self.done),
                             focus_map='button focus'))

        buttons.append(
            Color.button(reset_btn(on_press=self.reset),
                         focus_map='button focus'))
        buttons.append(
            Color.button(cancel_btn(on_press=self.cancel),
                         focus_map='button focus'))

        return Pile(buttons)
示例#4
0
 def make_main_screen(self, snap_list):
     self.snap_boxes = {}
     body = []
     preinstalled = self.get_preinstalled_snaps()
     for snap in snap_list:
         if snap.name in preinstalled:
             log.debug("not offering preseeded snap %r", snap.name)
             continue
         box = self.snap_boxes[snap.name] = SnapCheckBox(
             self, snap, snap.name in self.to_install)
         publisher = snap.publisher
         if snap.verified:
             publisher = [publisher, ('verified', '\N{check mark}')]
         row = [
             box,
             Text(publisher),
             Text(snap.summary, wrap='clip'),
             Text("\N{BLACK RIGHT-POINTING SMALL TRIANGLE}")
         ]
         body.append(
             AttrMap(
                 TableRow(row),
                 'menu_button',
                 {
                     None: 'menu_button focus',
                     'verified': 'verified focus'
                 },
             ))
     table = NoTabCyclingTableListBox(body,
                                      colspecs={
                                          1: ColSpec(omittable=True),
                                          2: ColSpec(pack=False,
                                                     min_width=40),
                                      })
     ok = ok_btn(label=_("Done"), on_press=self.done)
     cancel = cancel_btn(label=_("Back"), on_press=self.cancel)
     self._main_screen = screen(
         table, [ok, cancel],
         focus_buttons=False,
         excerpt=_(
             "These are popular snaps in server environments. Select or "
             "deselect with SPACE, press ENTER to see more details of the "
             "package, publisher and versions available."))
示例#5
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)
示例#6
0
 def __init__(self, model, controller, method):
     self.model = model
     self.controller = controller
     self.method = method
     cancel = cancel_btn(_("Cancel"), on_press=self.cancel)
     rows = []
     for disk in self.model.all_disks():
         if disk.size >= dehumanize_size("6G"):
             disk_btn = ClickableIcon(disk.label)
             connect_signal(disk_btn, 'click', self.choose_disk, disk.path)
             attr = Color.done_button
         else:
             disk_btn = Text("  " + disk.label)
             attr = Color.info_minor
         rows.append(
             attr(
                 TableRow([
                     Text('['),
                     disk_btn,
                     Text(humanize_size(disk.size), align='right'),
                     Text('\N{BLACK RIGHT-POINTING SMALL TRIANGLE}'),
                     Text(']'),
                 ])))
     super().__init__(
         screen(TableListBox(rows,
                             spacing=1,
                             colspecs={
                                 1:
                                 ColSpec(can_shrink=True,
                                         min_width=20,
                                         rpad=2),
                                 2:
                                 ColSpec(min_width=9),
                             },
                             align='center'),
                button_pile([cancel]),
                focus_buttons=False,
                excerpt=(excerpts[method] + "\n\n" +
                         _("Choose the disk to install to:"))))
示例#7
0
 def __init__(self, model, controller, method):
     self.model = model
     self.controller = controller
     self.method = method
     cancel = cancel_btn(_("Cancel"), on_press=self.cancel)
     rows = []
     for disk in self.model.all_disks():
         for obj, cells in summarize_device(disk):
             wrap = Color.info_minor
             if obj is disk:
                 start, end = '[', ']'
                 arrow = '\N{BLACK RIGHT-POINTING SMALL TRIANGLE}'
                 if disk.size >= dehumanize_size("6G"):
                     arrow = ClickableIcon(arrow)
                     connect_signal(arrow, 'click', self.choose_disk, disk)
                     wrap = _wrap_button_row
             else:
                 start, arrow, end = '', '', ''
             if isinstance(arrow, str):
                 arrow = Text(arrow)
             rows.append(
                 wrap(TableRow([Text(start)] + cells +
                               [arrow, Text(end)])))
         rows.append(TableRow([Text("")]))
     super().__init__(
         screen(TableListBox(rows[:-1],
                             spacing=2,
                             colspecs={
                                 0: ColSpec(rpad=1),
                                 2: ColSpec(can_shrink=True),
                                 4: ColSpec(min_width=9),
                                 5: ColSpec(rpad=1),
                             },
                             align='center'),
                button_pile([cancel]),
                focus_buttons=False,
                excerpt=(excerpts[method] + "\n\n" +
                         _("Choose the disk to install to:"))))
示例#8
0
 def _build_buttons(self):
     buttons = [
         done_btn(on_press=self.done),
         cancel_btn(on_press=self.cancel),
     ]
     return Pile(buttons)
示例#9
0
 def _build_buttons(self):
     buttons = [
         done_btn("Done", on_press=self.done),
         cancel_btn("Cancel", on_press=self.cancel),
     ]
     return buttons
示例#10
0
文件: error.py 项目: tbille/subiquity
 def _build_buttons(self):
     buttons = [
         cancel_btn(label="Back to Start", on_press=self.cancel),
     ]
     return Pile(buttons)
示例#11
0
 def _build_buttons(self):
     cancel = cancel_btn(_("Cancel"), on_press=self.cancel)
     done = done_btn(_("Done"), on_press=self.done)
     return button_pile([done, cancel])
示例#12
0
 def _build_buttons(self):
     self.buttons = [
         Color.button(cancel_btn(on_press=self.cancel),
                      focus_map='button focus'),
     ]
     return Pile(self.buttons)
示例#13
0
    def _build_buttons(self):
        cancel = cancel_btn(on_press=self.cancel)
        done = done_btn(on_press=self.done)

        buttons = [Color.button(done), Color.button(cancel)]
        return Pile(buttons)