示例#1
0
 def render_content(self, s: ButtonStyleStateType, ax: int, ay: int,
                    aw: int, ah: int) -> None:
     tx = ax + aw // 2
     ty = ay + ah // 2 + 8
     t = self.text
     if t:
         display.text_center(tx, ty, t, s.text_style, s.fg_color,
                             s.bg_color)
         return
     i = self.icon
     if i:
         display.icon(tx - _ICON // 2, ty - _ICON, i, s.fg_color,
                      s.bg_color)
         return
示例#2
0
文件: pin.py 项目: qjawe/trezor-core
    def render(self):

        header = '*' * len(self.pin) if self.pin else self.label

        # clear canvas under input line
        display.bar(0, 0, 205, 48, ui.BG)

        # input line with a header
        display.text_center(120, 30, header, ui.NORMAL,
                            ui.blend(ui.BG, ui.FG, 0.5), ui.BG)

        # pin matrix buttons
        for btn in self.pin_buttons:
            btn.render()
示例#3
0
 def render(self):
     # passphrase or prompt
     if self.input.content:
         self.input.render()
     else:
         display.bar(0, 0, 240, 48, ui.BG)
         display.text_center(ui.SCREEN // 2, 32, self.prompt, ui.BOLD,
                             ui.GREY, ui.BG)
     render_scrollbar(self.page)
     # buttons
     self.back.render()
     self.done.render()
     for btn in self.keys:
         btn.render()
示例#4
0
文件: pin.py 项目: hofesh/trezor-core
    def render(self):

        header = '*' * len(self.pin) if self.pin else self.label

        # clear canvas under input line
        display.bar(0, 0, 205, 48, ui.BLACK)

        # input line with a header
        display.text_center(120, 30, header, ui.BOLD, ui.GREY, ui.BLACK)

        # render clear button
        if self.pin:
            self.clear_button.render()
        else:
            display.bar(240 - 48, 0, 48, 42, ui.BLACK)

        # pin matrix buttons
        for btn in self.pin_buttons:
            btn.render()
示例#5
0
    def render(self):
        # clear canvas under input line
        display.bar(0, 0, ui.WIDTH, 45, ui.BG)

        if self.pin:
            # input line with pin
            l = len(self.pin)
            y = const(20)
            size = const(10)
            padding = const(14)
            box_w = const(240)
            x = (box_w - l * padding) // 2
            for i in range(0, l):
                ui.display.bar_radius(x + i * padding, y, size, size, ui.GREY, ui.BG, 4)
        else:
            # input line with header label
            display.text_center(ui.WIDTH // 2, 36, self.label, ui.BOLD, ui.GREY, ui.BG)

        # pin matrix buttons
        for btn in self.pin_buttons:
            btn.render()
示例#6
0
文件: pin.py 项目: stopstopstop/emu
    def render(self):
        # pin matrix buttons
        for btn in self.pin_buttons:
            btn.render()

        if not self.tainted:
            return

        # clear canvas under input line
        display.bar(0, 0, ui.WIDTH, 52, ui.BG)

        if self.pin:
            # input line with pin
            l = len(self.pin)
            y = const(20)
            size = const(10)
            padding = const(14)
            box_w = const(240)
            x = (box_w - l * padding) // 2
            for i in range(0, l):
                ui.display.bar_radius(x + i * padding, y, size, size, ui.GREY,
                                      ui.BG, 4)
        elif self.sublabel:
            # input line with header label and sublabel
            display.text_center(ui.WIDTH // 2, 20, self.label, ui.BOLD,
                                ui.GREY, ui.BG)
            display.text_center(ui.WIDTH // 2, 46, self.sublabel, ui.NORMAL,
                                ui.GREY, ui.BG)
        else:
            # input line with header label
            display.text_center(ui.WIDTH // 2, 36, self.label, ui.BOLD,
                                ui.GREY, ui.BG)

        self.tainted = False
示例#7
0
 def render_prompt(self):
     display.bar(0, 0, ui.WIDTH, 50, ui.BG)
     if self.subprompt:
         display.text_center(ui.WIDTH // 2, 20, self.prompt, ui.BOLD, ui.GREY, ui.BG)
         display.text_center(
             ui.WIDTH // 2, 46, self.subprompt, ui.NORMAL, ui.GREY, ui.BG
         )
     else:
         display.text_center(ui.WIDTH // 2, 36, self.prompt, ui.BOLD, ui.GREY, ui.BG)
示例#8
0
 def on_render(self) -> None:
     if self.repaint:
         display.bar(0, 0, ui.WIDTH, 48, ui.BG)
         display.text_center(ui.WIDTH // 2, 32, self.text, ui.BOLD, ui.GREY,
                             ui.BG)
         self.repaint = False
 def test_text_center(self):
     display.text_center(120, 120, 'Test', 0, 0xFFFF, 0x0000)
示例#10
0
 def render(self):
     if self.dirty:
         display.bar(0, 0, ui.WIDTH, 48, ui.BG)
         display.text_center(ui.WIDTH // 2, 32, self.text, ui.BOLD, ui.GREY,
                             ui.BG)
         self.dirty = False
示例#11
0
    def render(self):
        for btn in self.buttons:
            btn.render()

        # header label
        display.text_center(ui.WIDTH // 2, 36, self.label, ui.BOLD, ui.GREY, ui.BG)