def __init__(self, title=None, excerpt=None): widgets = [Text("")] if title is not None: widgets.append( Padding.center_79(Color.body(Text(title)))) widgets.append(Text("")) if excerpt is not None: widgets.append( Padding.center_79(Color.body(Text(excerpt)))) widgets.append(Text("")) super().__init__(Pile(widgets))
def __init__(self, parent, cur_index): self.parent = parent group = [] for i, option in enumerate(self.parent._options): if option.enabled: btn = ClickableThing(option.label) connect_signal(btn, 'click', self.click, i) if i == cur_index: rhs = '\N{BLACK LEFT-POINTING SMALL TRIANGLE} ' else: rhs = '' else: btn = option.label rhs = '' row = Columns([ (1, Text("")), btn, (2, Text(rhs)), ]) if option.enabled: row = AttrWrap(row, 'menu_button', 'menu_button focus') else: row = AttrWrap(row, 'info_minor') btn = UrwidPadding(row, width=self.parent._padding.width) group.append(btn) list_box = ListBox(group) list_box.base_widget.focus_position = cur_index super().__init__(Color.body(LineBox(list_box)))
def __init__(self): self.header = Header("") self.body = Body() self.footer = Footer("", 0, 1) self.frame = Frame(self.body, header=self.header, footer=self.footer) self.progress_current = 0 self.progress_completion = 0 super().__init__(Color.body(self.frame))
def __init__(self): self.header = Header("", self.right_icon) self.pile = Pile([ ('pack', self.header), ListBox([Text("")]), ]) self.pile.focus_position = 1 super().__init__(Color.body(self.pile))
def __init__(self): choices = [ (_("No"), True, None), (_("from Github"), True, "gh"), (_("from Launchpad"), True, "lp"), (_("from Ubuntu One account"), True, "sso"), ] self.selector = Selector(choices) connect_signal(self.selector, 'select', self._select) self.username = UsernameEditor() self.email = EmailEditor() connect_signal(self.username, 'change', self._change) self.cols = Columns([ self.selector, (1, Text("")), (2, Color.body(Text(""))), Color.body(Text("")) ]) super().__init__(self.cols)
def __init__(self): self.header = Header("") self.footer = Footer("", 0, 1) self.frame = Frame(ListBox([Text("")]), header=self.header, footer=self.footer) self.progress_current = 0 self.progress_completion = 0 # After the install starts, we want to stop setting the footer # from the body view. self.auto_footer = True super().__init__(Color.body(self.frame))
def __init__(self, message="", completion=0): message_widget = Padding.center_79(Color.body(Text(message))) progress_bar = Padding.center_60( ProgressBar(normal='progress_incomplete', complete='progress_complete', current=completion, done=100)) status = deque([ Padding.line_break(""), message_widget ]) if completion > 0: status.appendleft(progress_bar) super().__init__(Pile(status))
def _select(self, sender, val): label = sender.option_by_value(val).label self.cols.contents[0] = (self.cols.contents[0][0], self.cols.options('given', len(label) + 4)) if val is not None: if val == 'sso': editor = self.email else: editor = self.username self.cols.contents[3] = (editor, self.cols.options()) self.cols[1].set_text(":") self.cols.focus_position = 3 else: self.username.set_edit_text("") self.cols[1].set_text("") self.cols.contents[3] = (Color.body(Text("")), self.cols.options()) self.bff.help = self._helps[val]
def __init__(self, parent): self.parent = parent close_text = "(close)" close = ActionBackButton(close_text) connect_signal(close, "click", self.close) group = [Color.menu_button(close)] width = len(close_text) for i, action in enumerate(self.parent._actions): if action.enabled: if isinstance(action.label, Widget): btn = action.label elif action.opens_dialog: btn = Color.menu_button(ActionMenuOpenButton(action.label)) else: btn = Color.menu_button(ActionMenuButton(action.label)) width = max(width, len(btn.base_widget.label)) connect_signal( btn.base_widget, 'click', self.click, action.value) else: label = action.label if isinstance(label, Widget): label = label.base_widget.label width = max(width, len(label)) if action.opens_dialog: rhs = "\N{BLACK RIGHT-POINTING SMALL TRIANGLE}" else: rhs = "" btn = Columns([ ('fixed', 1, Text("")), Text(label), ('fixed', 1, Text(rhs)), ], dividechars=1) btn = AttrWrap(btn, 'info_minor') group.append(btn) self.width = width super().__init__(Color.body(LineBox(ListBox(group))))