class FetchingInfo(WidgetWrap): 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])), ]))) def close(self, sender=None): if self.closed: return self.closed = True self.spinner.stop() self.parent.remove_overlay()
def __init__(self, loop): spinner = Spinner(loop, style='dots') spinner.start() text = _("Applying config") # | text | # 12 34 self.width = len(text) + 4 super().__init__( LineBox(Pile([ ('pack', Text(' ' + text)), ('pack', spinner), ])))
def __init__(self, parent): self.parent = parent spinner = Spinner(parent.controller.loop, style='dots') spinner.start() text = _("Fetching SSH keys...") button = cancel_btn(label=_("Cancel"), on_press=self.cancel) # | text | # 12 34 self.width = len(text) + 4 super().__init__( LineBox( Pile([ ('pack', Text(' ' + text)), ('pack', spinner), ('pack', button_pile([button])), ])))
def load(self, sender=None): spinner = None called = False def callback(snap_list): nonlocal called called = True if spinner is not None: spinner.stop() if len(snap_list) == 0: self.offer_retry() else: self.make_main_screen(snap_list) self.show_main_screen() self.controller.get_snap_list(callback) if called: return spinner = Spinner(self.controller.loop, style='dots') spinner.start() self._w = screen( [spinner], [ok_btn(label=_("Continue"), on_press=self.done)], excerpt=_("Loading server snaps from store, please wait..."))