Esempio n. 1
0
def generate_buttons(start, end, page, pad):
    start = start + (_ITEMS_PER_PAGE + 1) * page - page
    end = min(end, (_ITEMS_PER_PAGE + 1) * (page + 1) - page)
    digits = list(range(start, end))

    buttons = [NumButton(i, d, pad) for i, d in enumerate(digits)]

    area = ui.grid(_PLUS_BUTTON_POSITION + 3)
    plus = Button(area, str(end) + "+", ButtonMonoDark)
    plus.on_click = pad.on_plus

    area = ui.grid(_BACK_BUTTON_POSITION + 3)
    back = Button(area, res.load(ui.ICON_BACK), ButtonMonoDark)
    back.on_click = pad.on_back

    if len(digits) == _ITEMS_PER_PAGE:
        # move the tenth button to its proper place and make place for the back button
        buttons[-1].area = ui.grid(_PLUS_BUTTON_POSITION - 1 + 3)
        buttons.append(plus)

    if page == 0:
        back.disable()
    buttons.append(back)

    return buttons
Esempio n. 2
0
 def __init__(self, words, share_index, word_index):
     self.words = words
     self.share_index = share_index
     self.word_index = word_index
     self.buttons = []
     for i, word in enumerate(words):
         area = ui.grid(i + 2, n_x=1)
         btn = Button(area, word)
         btn.on_click = self.select(word)
         self.buttons.append(btn)
     if share_index is None:
         self.text = Text("Check seed")
     else:
         self.text = Text("Check share #%s" % (share_index + 1))
     self.text.normal("Select the %s word:" % utils.format_ordinal(word_index + 1))
Esempio n. 3
0
 def __init__(self, words, share_index, word_index, count, group_index=None):
     self.words = words
     self.share_index = share_index
     self.word_index = word_index
     self.buttons = []
     for i, word in enumerate(words):
         area = ui.grid(i + 2, n_x=1)
         btn = Button(area, word)
         btn.on_click = self.select(word)
         self.buttons.append(btn)
     if share_index is None:
         self.text = Text("Check seed")
     elif group_index is None:
         self.text = Text("Check share #%s" % (share_index + 1))
     else:
         self.text = Text(
             "Check G%s - Share %s" % ((group_index + 1), (share_index + 1))
         )
     self.text.normal("Select word %d of %d:" % (word_index + 1, count))