def __init__(self, wallet, network, idx=None, branch_index=0):
        self.wallet = wallet
        self.network = network
        self.idx = wallet.unused_recv
        addr, gap = wallet.get_address(self.idx,
                                       network=network,
                                       branch_index=branch_index)
        super().__init__(
            "    " + wallet.name + "  #708092 " + lv.SYMBOL.EDIT,
            format_addr(addr, words=4),
            "bitcoin:" + addr,
            qr_width=350,
        )
        self.title.set_recolor(True)
        self.title.set_click(True)
        self.title.set_event_cb(on_release(self.rename))
        self.policy = add_label(wallet.policy, y=55, style="hint", scr=self)

        style = lv.style_t()
        lv.style_copy(style, self.message.get_style(0))
        style.text.font = lv.font_roboto_mono_22
        self.message.set_style(0, style)

        # index
        self.branch_index = branch_index
        self.note = add_label("%s address #%d" % (self.prefix, self.idx),
                              y=80,
                              style="hint",
                              scr=self)
        self.qr.align(self.note, lv.ALIGN.OUT_BOTTOM_MID, 0, 15)
        self.message.align(self.qr, lv.ALIGN.OUT_BOTTOM_MID, 0, 15)

        # warning label for address gap limit
        self.warning = add_label("", scr=self)
        self.warning.align(self.message, lv.ALIGN.OUT_BOTTOM_MID, 0, 15)
        style = lv.style_t()
        lv.style_copy(style, self.note.get_style(0))
        style.text.color = lv.color_hex(0xFF9A00)
        self.warning.set_style(0, style)

        # delbtn = add_button("Delete wallet", on_release(cb_del), y=610)
        self.prv = add_button(lv.SYMBOL.LEFT, on_release(self.prev), scr=self)
        self.nxt = add_button(lv.SYMBOL.RIGHT, on_release(self.next), scr=self)
        if self.idx <= 0:
            self.prv.set_state(lv.btn.STATE.INA)
        self.prv.set_width(70)
        self.prv.align(self.qr, lv.ALIGN.OUT_LEFT_MID, -20, 0)
        self.prv.set_x(0)
        self.nxt.set_width(70)
        self.nxt.align(self.qr, lv.ALIGN.OUT_RIGHT_MID, 20, 0)
        self.nxt.set_x(HOR_RES - 70)

        self.menubtn = add_button(lv.SYMBOL.SETTINGS + " Settings",
                                  on_release(self.show_menu),
                                  scr=self)
        self.menubtn.align(self.close_button, lv.ALIGN.OUT_TOP_MID, 0, -20)

        if idx is not None:
            self.idx = idx
            self.update_address()
Exemple #2
0
def add_mnemonic_table(mnemonic, y=PADDING, scr=None):
    if scr is None:
        scr = lv.scr_act()

    cell_style = lv.style_t()
    lv.style_copy(cell_style, styles["theme"].style.label.prim)
    cell_style.body.opa = 0
    cell_style.text.font = lv.font_roboto_22

    num_style = lv.style_t()
    lv.style_copy(num_style, cell_style)
    num_style.text.opa = lv.OPA._40

    table = lv.table(scr)
    table.set_col_cnt(4)
    table.set_row_cnt(12)
    table.set_col_width(0, 50)
    table.set_col_width(2, 50)
    table.set_col_width(1, 150)
    table.set_col_width(3, 150)

    table.set_style(lv.page.STYLE.BG, cell_style)
    table.set_style(lv.table.STYLE.CELL1, cell_style)
    table.set_style(lv.table.STYLE.CELL2, num_style)

    for i in range(12):
        table.set_cell_value(i, 0, "%d" % (i + 1))
        table.set_cell_value(i, 2, "%d" % (i + 13))
        table.set_cell_type(i, 0, lv.table.STYLE.CELL2)
        table.set_cell_type(i, 2, lv.table.STYLE.CELL2)
    table.align(scr, lv.ALIGN.IN_TOP_MID, 0, y)

    table_set_mnemonic(table, mnemonic)

    return table
Exemple #3
0
    def __init__(self, parent):
        scr_style = lv.style_t()
        scr_style.set_bg_color(lv.STATE.DEFAULT, lv_colors.BLACK)
        parent.add_style(lv.obj.PART.MAIN, scr_style)

        label1_style = lv.style_t()
        label1_style.set_text_font(lv.STATE.DEFAULT, lv.font_montserrat_48)

        self.label1 = lv.label(parent, None)
        self.label1.set_long_mode(lv.label.LONG.BREAK)  # Break the long lines
        self.label1.set_recolor(
            True)  # Enable re-coloring by commands in the text
        self.label1.set_align(lv.label.ALIGN.LEFT)  # Center aligned lines
        self.label1.set_text("#00ff00 11:35:00#")
        self.label1.set_width(240)
        self.label1.align(None, lv.ALIGN.CENTER, 30, -30)
        self.label1.add_style(lv.label.PART.MAIN, label1_style)

        self.label2 = lv.label(parent, None)
        self.label2.align(self.label1, lv.ALIGN.OUT_BOTTOM_LEFT, 40, 20)
        self.label2.set_recolor(True)
        self.label2.set_text("#ffffff Mon 30.11.2020#")

        self.task = lv.task_create_basic()
        self.task.set_cb(lambda task: self.updateClock(task))
        self.task.set_period(1000)
        self.task.set_prio(lv.TASK_PRIO.LOWEST)
Exemple #4
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.words = [""]
        # styles
        cell_style = lv.style_t()
        lv.style_copy(cell_style, styles["theme"].style.label.prim)
        cell_style.body.opa = 0
        cell_style.text.font = lv.font_roboto_22

        num_style = lv.style_t()
        lv.style_copy(num_style, cell_style)
        num_style.text.opa = lv.OPA._40

        self.set_col_cnt(4)
        self.set_row_cnt(12)
        self.set_col_width(0, 50)
        self.set_col_width(2, 50)
        self.set_col_width(1, 150)
        self.set_col_width(3, 150)

        self.set_style(lv.page.STYLE.BG, cell_style)
        self.set_style(lv.table.STYLE.CELL1, cell_style)
        self.set_style(lv.table.STYLE.CELL2, num_style)

        for i in range(12):
            self.set_cell_value(i, 0, "%d" % (i+1))
            self.set_cell_value(i, 2, "%d" % (i+13))
            self.set_cell_type(i, 0, lv.table.STYLE.CELL2)
            self.set_cell_type(i, 2, lv.table.STYLE.CELL2)
Exemple #5
0
    def __init__(self, title, meta):
        send_amount = sum(
            [out["value"] for out in meta["outputs"] if not out["change"]])
        super().__init__(title, "verify transaction and confirm")

        style = lv.style_t()
        lv.style_copy(style, self.message.get_style(0))
        style.text.font = lv.font_roboto_mono_28

        style_secondary = lv.style_t()
        lv.style_copy(style_secondary, self.message.get_style(0))
        style_secondary.text.color = lv.color_hex(0x999999)
        style_secondary.text.font = lv.font_roboto_mono_22

        style_warning = lv.style_t()
        lv.style_copy(style_warning, self.message.get_style(0))
        style_warning.text.color = lv.color_hex(0xFF9A00)

        self.style = style
        self.style_secondary = style_secondary
        self.style_warning = style_warning

        obj = self.message
        num_change_outputs = 0
        for out in meta["outputs"]:
            # first only show destination addresses
            if out["change"]:
                num_change_outputs += 1
                continue
            obj = self.show_output(out, obj)

        if send_amount > 0:
            fee_percent = meta["fee"] * 100 / send_amount
            fee = add_label("Fee: %d satoshi (%.2f%%)" %
                            (meta["fee"], fee_percent),
                            scr=self.page)
        # back to wallet
        else:
            fee = add_label("Fee: %d satoshi" % (meta["fee"]), scr=self.page)
        fee.align(obj, lv.ALIGN.OUT_BOTTOM_MID, 0, 30)

        obj = fee

        if num_change_outputs > 0:
            obj = add_label("Change outputs:", scr=self.page, style="title")
            obj.align(fee, lv.ALIGN.OUT_BOTTOM_MID, 0, 30)
            for out in meta["outputs"]:
                # now show change
                if not out["change"]:
                    continue
                obj = self.show_output(out, obj)

        # warning label for address gap limit
        if "warnings" in meta and len(meta["warnings"]) > 0:
            text = "WARNING!\n" + "\n".join(meta["warnings"])
            self.warning = add_label(text, scr=self.page)
            self.warning.set_style(0, style_warning)
            self.warning.align(obj, lv.ALIGN.OUT_BOTTOM_MID, 0, 30)
Exemple #6
0
    def __init__(self):

        self.value = 0
        canvas_style = lv.style_t()
        canvas_style.init()
        canvas_style.set_bg_color(lv.STATE.DEFAULT, lv_colors.WHITE)

        cbuf = bytearray(SCREEN_WIDTH * 30 * 4)
        canvas = lv.canvas(lv.scr_act(), None)
        canvas.set_buffer(cbuf, SCREEN_WIDTH, 30, lv.img.CF.TRUE_COLOR)
        # canvas.add_style(lv.canvas.PART.MAIN,canvas_style)
        canvas.align(None, lv.ALIGN.IN_TOP_LEFT, 0, 0)

        p1 = lv.point_t()
        p2 = lv.point_t()
        point_array = [p1, p2]
        p1.x = 0
        p1.y = 0
        p2.x = 15
        p2.y = p1.y

        # style for horizontal lines
        line_dsc = lv.draw_line_dsc_t()
        line_dsc.init()
        line_dsc.color = lv_colors.BLUE
        line_dsc.opa = lv.OPA.COVER
        line_dsc.width = 5

        # draw the horizontal lines

        canvas.draw_line(point_array, 2, line_dsc)
        p1.x = 130
        p2.x = SCREEN_WIDTH
        canvas.draw_line(point_array, 2, line_dsc)

        # draw the vertical lines

        p1.x = 0
        p2.x = p1.x
        p2.y = 30
        canvas.draw_line(point_array, 2, line_dsc)

        p1.x = SCREEN_WIDTH - 3
        p2.x = p1.x
        canvas.draw_line(point_array, 2, line_dsc)

        text_style = lv.style_t()
        text_style.init()
        text_style.set_text_font(lv.STATE.DEFAULT, lv.font_montserrat_18)
        text_style.set_bg_color(lv.STATE.DEFAULT, lv_colors.BLACK)
        text_style.set_bg_opa(lv.STATE.DEFAULT, lv.OPA.COVER)

        self.label = lv.label(canvas, None)
        self.label.add_style(lv.label.PART.MAIN, text_style)
        self.label.set_recolor(True)

        self.reset()
        self.label.align(None, lv.ALIGN.OUT_TOP_MID, -60, 25)
Exemple #7
0
    def __init__(self, title="Enter your PIN code", note=None, get_word=None, subtitle=None):
        super().__init__()
        self.title = add_label(title, scr=self, y=PADDING, style="title")
        if subtitle is not None:
            lbl = add_label(subtitle, scr=self, style="hint")
            lbl.set_recolor(True)
            lbl.align(self.title, lv.ALIGN.OUT_BOTTOM_MID, 0, 10)
        if note is not None:
            lbl = add_label(note, scr=self, style="hint")
            lbl.align(self.title, lv.ALIGN.OUT_BOTTOM_MID, 0, 180)
        self.get_word = get_word
        if get_word is not None:
            self.words = add_label(get_word(b""), scr=self)
            self.words.align(self.title, lv.ALIGN.OUT_BOTTOM_MID, 0, 210)
        btnm = lv.btnm(self)
        # shuffle numbers to make sure
        # no constant fingerprints left on screen
        buttons = ["%d" % i for i in range(0, 10)]
        btnmap = []
        for j in range(3):
            for i in range(3):
                v = rng.get_random_bytes(1)[0] % len(buttons)
                btnmap.append(buttons.pop(v))
            btnmap.append("\n")
        btnmap = btnmap + [lv.SYMBOL.CLOSE, buttons.pop(), lv.SYMBOL.OK, ""]
        btnm.set_map(btnmap)
        btnm.set_width(HOR_RES)
        btnm.set_height(HOR_RES)
        btnm.align(self, lv.ALIGN.IN_BOTTOM_MID, 0, 0)
        # increase font size
        style = lv.style_t()
        lv.style_copy(style, btnm.get_style(lv.btnm.STYLE.BTN_REL))
        style.text.font = lv.font_roboto_28
        # remove feedback on press to avoid sidechannels
        btnm.set_style(lv.btnm.STYLE.BTN_REL, style)
        btnm.set_style(lv.btnm.STYLE.BTN_PR, style)

        self.pin = lv.ta(self)
        self.pin.set_text("")
        self.pin.set_pwd_mode(True)
        style = lv.style_t()
        lv.style_copy(style, styles["theme"].style.ta.oneline)
        style.text.font = lv.font_roboto_28
        style.text.color = styles["theme"].style.scr.text.color
        style.text.letter_space = 15
        self.pin.set_style(lv.label.STYLE.MAIN, style)
        self.pin.set_width(HOR_RES - 2 * PADDING)
        self.pin.set_x(PADDING)
        self.pin.set_y(PADDING + 50)
        self.pin.set_cursor_type(lv.CURSOR.HIDDEN)
        self.pin.set_one_line(True)
        self.pin.set_text_align(lv.label.ALIGN.CENTER)
        self.pin.set_pwd_show_time(0)
        self.pin.align(btnm, lv.ALIGN.OUT_TOP_MID, 0, -150)

        btnm.set_event_cb(feed_rng(self.cb))
Exemple #8
0
    def __init__(self, page):
        self.page = page

        # display ftDuino32 "title"
        label = lv.label(page)
        label.set_recolor(True);
        label.set_text("#ff0000 f##0000ff t##00664c Duino#32")
        style = lv.style_t()
        style.set_text_font(lv.STATE.DEFAULT, lv.font_montserrat_16)
        label.add_style(lv.label.PART.MAIN, style)
        label.align(page, lv.ALIGN.CENTER, 0, -100)

        # display user definabled device name
        self.dname = lv.label(page)
        self.set_device_name("ftDuino32")

        # display release
        rlabel = lv.label(page)
        rlabel.set_text("Release: ")
        if hasattr(os, "uname"):
            rlabel.ins_text(lv.LABEL_POS.LAST, os.uname().release)
        else:
            rlabel.ins_text(lv.LABEL_POS.LAST, "<unknown>")            
        rlabel.align(page, lv.ALIGN.CENTER, 0, -40)

        # display version
        vlabel = lv.label(page)
        vlabel.set_long_mode(lv.label.LONG.BREAK);
        vlabel.set_width(210);
        vlabel.set_align(lv.label.ALIGN.CENTER)
        if hasattr(os, "uname"):
            vlabel.set_text(os.uname().version)
        else:
            vlabel.set_text("<unknown version>")
            
        vlabel.align(page, lv.ALIGN.CENTER, 0, -10)

        scroll = lv.label(page)
        scroll.set_long_mode(lv.label.LONG.SROLL_CIRC);
        scroll.set_width(150);
        scroll.set_recolor(True);
        scroll.set_text("Thank you for using the #ff0000 f##0000ff t##00664c Duino#32 controller.")
        scroll.align(page, lv.ALIGN.CENTER, 0, 40)
        
        # add two status bar labels for wifi and sd card
        self.status = { }
        labelstyle = lv.style_t()
        labelstyle.set_text_color(lv.STATE.DEFAULT, lv.color_hex3(0xccc))
        labelstyle.set_text_font(lv.STATE.DEFAULT, lv.font_montserrat_16)
        for i in self.ICONS:
            self.status[i] = lv.label(page)
            self.status[i].set_text(self.ICON_CHAR[i])
            self.status[i].add_style(lv.label.PART.MAIN, labelstyle)
            self.status[i].align(page, lv.ALIGN.CENTER, 16-32*self.ICONS.index(i), 100)
 async def show_voltage_monitor_screen(self): 
     # 
     # Measurement screen using a table
     #
     #
     # lv.table.STYLE.CELL1 = normal cell
     # lv.table.STYLE.CELL2 = header cell
     # lv.table.STYLE.CELL3 = ?
     # lv.table.STYLE.CELL4 = ?
     voltage_screen = lv.obj()
     
     # set background color, with no gradient
     screenstyle = lv.style_t(lv.style_plain)
     #screenstyle.body.main_color = lv.color_make(0xFF, 0xA5, 0x00)
     # 0xFF, 0x00, 0x00  Red
     # 0xC0, 0xC0, 0xC0  Silver
     # 0xFF, 0xA5, 0x00  Orange
     #screenstyle.body.grad_color = lv.color_make(0xFF, 0xA5, 0x00)
     #screenstyle.body.border.color = lv.color_hex(0xe32a19)
     #screenstyle.body.border.width = 5
     voltage_screen.set_style(screenstyle)
     
     tablestyle = lv.style_t(lv.style_plain)
     tablestyle.body.border.width = 0
     tablestyle.body.opa = 0
     
     cellstyle = lv.style_t(lv.style_plain)
     cellstyle.text.color = lv.color_hex(0xa028d4)
     cellstyle.text.font = lv.font_roboto_28
     cellstyle.body.padding.top = 1
     cellstyle.body.padding.bottom = 1
     cellstyle.body.border.width = 0
     cellstyle.body.opa = 0
     
     mtable = lv.table(voltage_screen)
     mtable.set_row_cnt(2)
     mtable.set_col_cnt(3)
     mtable.set_col_width(0, 110)
     mtable.set_col_width(1, 100)
     mtable.set_col_width(2, 100)
     mtable.set_style(lv.table.STYLE.BG, tablestyle)
     mtable.set_style(lv.table.STYLE.CELL1, cellstyle)
     
     mtable.set_cell_value(0,0, "Vbat")
     mtable.set_cell_value(1,0, "Vusb")
     
     mtable.set_cell_value(0,2, "V")
     mtable.set_cell_value(1,2, "V")
     
     mtable.set_cell_value(0,1, '{:.2f}'.format(repo.get('vbat').current))
     mtable.set_cell_value(1,1, '{:.2f}'.format(repo.get('vusb').current))
     
     lv.scr_load(voltage_screen)
     self.backlight_ctrl.value(1)
    def __init__(self):

	scr = lv.obj()

	# Create style for the Arcs - Hour
	styleHour = lv.style_t()
	lv.style_copy(styleHour, lv.style_plain)
	styleHour.line.color = lv.color_make(119,158,203) # Arc color
	styleHour.line.width = 8                      # Arc width

	# Create an Arc - Hour
	arcHour = lv.arc(scr)
	arcHour.set_style(lv.arc.STYLE.MAIN, styleHour)   # Use the new style
	arcHour.set_angles(45, 0)
	arcHour.set_size(300, 300)
	arcHour.align(None, lv.ALIGN.CENTER, 0, 0)

	# Create style for the Arcs - Minute
	styleMin = lv.style_t()
	lv.style_copy(styleMin, lv.style_plain)
	styleMin.line.color = lv.color_make(124,252,0) # Arc color
	styleMin.line.width = 8                      # Arc width

	# Create an Arc - Minute
	arcMin = lv.arc(scr)
	arcMin.set_style(lv.arc.STYLE.MAIN, styleMin)   # Use the new style
	arcMin.set_angles(45, 0)
	arcMin.set_size(380, 380)
	arcMin.align(None, lv.ALIGN.CENTER, 0, 0)

	# Create style for the Arcs - Second
	styleSecond = lv.style_t()
	lv.style_copy(styleSecond, lv.style_plain)
	styleSecond.line.color = lv.color_make(250,128,114) # Arc color
	styleSecond.line.width = 8                      # Arc width

	# Create an Arc - Minute
	arcSecond = lv.arc(scr)
	arcSecond.set_style(lv.arc.STYLE.MAIN, styleSecond)   # Use the new style
	arcSecond.set_angles(45, 0)
	arcSecond.set_size(220, 220)
	arcSecond.align(None, lv.ALIGN.CENTER, 0, 0)

	def event_handler(obj, event):
		lv.obj_del(scr)
		from secondScreen import secondScreen

	btn1 = lv.btn(scr)
	btn1.set_event_cb(event_handler)
	btn1.align(None, lv.ALIGN.CENTER, 0, 0)
	label = lv.label(btn1)
	label.set_text("Button")

	lv.scr_load(scr)
Exemple #11
0
    def __init__(self, lv_cont=None, size_x=0, size_y=0, digit_margin=10):
        self.cont_main = lv_cont
        self.size_x = size_x
        self.pos_x = 0
        self.size_y = size_y
        self.pos_y = 0
        self.digit_margin = digit_margin
        self.digit_width = int((size_x - (digit_margin * 9)) / 8)
        self.digit_height = int(size_y - (digit_margin * 2))

        self.time = time.time()
        (self.year, self.month, self.mday, self.hour, self.minute, self.second,
         self.weekday, self.yearday) = time.localtime()

        # Line Style
        self.line_style = lv.style_t()
        self.line_style.init()
        self.line_style.set_line_width(lv.STATE.DEFAULT, 2)
        self.line_style.set_line_color(lv.STATE.DEFAULT,
                                       lv.color_hex(0x0000ff))
        self.line_style.set_line_rounded(lv.STATE.DEFAULT, True)
        self.line_style.set_pad_all(lv.STATE.DEFAULT, 0)
        self.line_style.set_margin_all(lv.STATE.DEFAULT, 0)

        # Container Style
        self.cont_style = lv.style_t()
        self.cont_style.init()
        self.cont_style.set_pad_all(lv.STATE.DEFAULT, 1)
        self.cont_style.set_margin_all(lv.STATE.DEFAULT, 1)
        # self.cont_style.set_border_opa(lv.STATE.DEFAULT, lv.OPA.TRANSP)
        # self.cont_style.set_bg_opa(lv.STATE.DEFAULT, lv.OPA.TRANSP)
        # dont nedd -> cont_style.set_bg_color(lv.STATE.DEFAULT, styles.LV_COLOR_WATCH)

        # Digit Container Style
        self.cont_dstyle = lv.style_t()
        self.cont_dstyle.init()
        self.cont_dstyle.set_pad_all(lv.STATE.DEFAULT, 5)
        self.cont_dstyle.set_margin_all(lv.STATE.DEFAULT, 5)
        # self.cont_style.set_border_opa(lv.STATE.DEFAULT, lv.OPA.TRANSP)
        # self.cont_style.set_bg_opa(lv.STATE.DEFAULT, lv.OPA.TRANSP)
        # dont nedd -> cont_style.set_bg_color(lv.STATE.DEFAULT, styles.LV_COLOR_WATCH)

        # Setup Main Parent container
        if self.cont_main is not None:
            #self.cont_main = lv.cont(lv_scr)
            # self.cont_main.set_auto_realign(True)
            self.cont_main.set_size(size_x, size_y)
            self.cont_main.set_fit(lv.FIT.NONE)
            #self.cont_main.set_layout(lv.LAYOUT.PRETTY_MID)
            self.cont_main.set_layout(lv.LAYOUT.ROW_MID)
            self.cont_main.add_style(self.cont_main.PART.MAIN, self.cont_style)

        # 12:34:56
        self.digit_pts = []
    def popup_calibration(self):
        modal_style = lv.style_t()
        lv.style_copy(modal_style, lv.style_plain_color)
        modal_style.body.main_color = modal_style.body.grad_color = lv.color_make(
            0, 0, 0)
        modal_style.body.opa = lv.OPA._50
        bg = lv.obj(self.main_scr)
        bg.set_style(modal_style)
        bg.set_pos(0, 0)
        bg.set_size(self.main_scr.get_width(), self.main_scr.get_height())
        bg.set_opa_scale_enable(True)

        popup_cali = lv.mbox(bg)
        popup_cali.set_text('What would you like to calibrate?')
        btns = ['Temp Sensor', '\n', 'Touch Screen', '\n', 'Cancel', '']
        popup_cali.add_btns(btns)

        lv.cont.set_fit(popup_cali, lv.FIT.NONE)
        mbox_style = popup_cali.get_style(popup_cali.STYLE.BTN_REL)
        popup_cali_style = lv.style_t()
        lv.style_copy(popup_cali_style, mbox_style)
        popup_cali_style.body.padding.bottom = 96
        popup_cali.set_style(popup_cali.STYLE.BTN_REL, popup_cali_style)

        popup_cali.set_height(186)

        this = self

        def event_handler(obj, event):
            if event == lv.EVENT.VALUE_CHANGED:
                active_btn_text = popup_cali.get_active_btn_text()
                tim = machine.Timer(-1)
                if active_btn_text == 'Temp Sensor':
                    this.config['has_calibrated'] = False
                    with open('config.json', 'w') as f:
                        ujson.dump(this.config, f)
                    tim.init(period=500,
                             mode=machine.Timer.ONE_SHOT,
                             callback=lambda t: machine.reset())
                elif active_btn_text == 'Touch Screen':
                    uos.remove(this.config.get('touch_cali_file'))
                    tim.init(period=500,
                             mode=machine.Timer.ONE_SHOT,
                             callback=lambda t: machine.reset())
                else:
                    tim.deinit()

                bg.del_async()
                popup_cali.start_auto_close(5)

        popup_cali.set_event_cb(event_handler)
        popup_cali.align(None, lv.ALIGN.CENTER, 0, 0)
        self.popup_cali = popup_cali
        return self.popup_cali
 async def show_environmental_screen(self):
     # 
     # Environmental screen using a table
     #
     #
     # lv.table.STYLE.CELL1 = normal cell
     # lv.table.STYLE.CELL2 = header cell
     # lv.table.STYLE.CELL3 = ?
     # lv.table.STYLE.CELL4 = ?
     environmental_screen = lv.obj()
     
     # set background color, with no gradient
     screenstyle = lv.style_t(lv.style_plain)
     #screenstyle.body.main_color = lv.color_make(0xFF, 0xA5, 0x00)
     # 0xFF, 0x00, 0x00  Red
     # 0xC0, 0xC0, 0xC0  Silver
     # 0xFF, 0xA5, 0x00  Orange
     #screenstyle.body.grad_color = lv.color_make(0xFF, 0xA5, 0x00)
     #screenstyle.body.border.color = lv.color_hex(0xe32a19)
     #screenstyle.body.border.width = 5
     environmental_screen.set_style(screenstyle)
     
     tablestyle = lv.style_t(lv.style_plain)
     tablestyle.body.border.width = 0
     tablestyle.body.opa = 0
     
     cellstyle = lv.style_t(lv.style_plain)
     cellstyle.text.color = lv.color_hex(0xa028d4)
     cellstyle.text.font = lv.font_roboto_28
     cellstyle.body.padding.top = 1
     cellstyle.body.padding.bottom = 1
     cellstyle.body.border.width = 0
     cellstyle.body.opa = 0
     
     mtable = lv.table(environmental_screen)
     mtable.set_row_cnt(2)
     mtable.set_col_cnt(3)
     mtable.set_col_width(0, 130)
     mtable.set_col_width(1, 90)
     mtable.set_col_width(2, 90)
     mtable.set_style(lv.table.STYLE.BG, tablestyle)
     mtable.set_style(lv.table.STYLE.CELL1, cellstyle)
     
     mtable.set_cell_value(0,0, "Temp")
     mtable.set_cell_value(1,0, "Humidity")
     
     mtable.set_cell_value(0,1, '{:.1f}'.format(repo.get('tdegc').current))
     mtable.set_cell_value(1,1, '{:.1f}'.format(repo.get('rh').current))
     
     mtable.set_cell_value(0,2, "degC")
     mtable.set_cell_value(1,2, "%")
     
     lv.scr_load(environmental_screen)
     self.backlight_ctrl.value(1)
    def popup_settings(self):
        modal_style = lv.style_t()
        lv.style_copy(modal_style, lv.style_plain_color)
        modal_style.body.main_color = modal_style.body.grad_color = lv.color_make(
            0, 0, 0)
        modal_style.body.opa = lv.OPA._50
        bg = lv.obj(self.main_scr)
        bg.set_style(modal_style)
        bg.set_pos(0, 0)
        bg.set_size(self.main_scr.get_width(), self.main_scr.get_height())
        bg.set_opa_scale_enable(True)

        popup_settings = lv.mbox(bg)
        popup_settings.set_text('Settings')
        btns = ['Set PID Params', '\n', 'Calibrate Touch', '\n', 'Close', '']
        popup_settings.add_btns(btns)

        lv.cont.set_fit(popup_settings, lv.FIT.NONE)
        mbox_style = popup_settings.get_style(popup_settings.STYLE.BTN_REL)
        popup_cali_style = lv.style_t()
        lv.style_copy(popup_cali_style, mbox_style)
        popup_cali_style.body.padding.bottom = 115
        popup_settings.set_style(popup_settings.STYLE.BTN_REL,
                                 popup_cali_style)
        popup_settings.set_height(186)

        def event_handler(obj, event):
            if event == lv.EVENT.VALUE_CHANGED:
                active_btn_text = popup_settings.get_active_btn_text()
                tim = machine.Timer(-1)
                # Note: With PID, temp calibration no longer needed
                # if active_btn_text == 'Temp Sensor':
                #     this.config['has_calibrated'] = False
                #     with open('config.json', 'w') as f:
                #         ujson.dump(this.config, f)
                #     tim.init(period=500, mode=machine.Timer.ONE_SHOT, callback=lambda t:machine.reset())
                # elif active_btn_text == 'Touch Screen':
                if active_btn_text == 'Calibrate Touch':
                    uos.remove(self.config.get('touch_cali_file'))
                    tim.init(period=500,
                             mode=machine.Timer.ONE_SHOT,
                             callback=lambda t: machine.reset())
                elif active_btn_text == 'Set PID Params':
                    tim.init(period=50,
                             mode=machine.Timer.ONE_SHOT,
                             callback=lambda t: self.popup_pid_params())
                else:
                    tim.deinit()
                bg.del_async()
                popup_settings.start_auto_close(5)

        popup_settings.set_event_cb(event_handler)
        popup_settings.align(None, lv.ALIGN.CENTER, 0, 0)
Exemple #15
0
def lv_line(screen):
    line_points = [[5,5], [70,70]]
    valid_pos = [lv.point_t(), lv.point_t(), lv.point_t(), lv.point_t(), lv.point_t(), lv.point_t(), lv.point_t()]
    valid_pos[0].x = 0
    valid_pos[0].y = 0
    valid_pos[1].x = 10
    valid_pos[1].y = 0
    valid_pos[2].x = 10
    valid_pos[2].y = 10
    valid_pos[3].x = 0
    valid_pos[3].y = 10
    valid_pos[4].x = 10
    valid_pos[4].y = 10
    valid_pos[5].x = 10
    valid_pos[5].y = 20
    valid_pos[6].x = 0
    valid_pos[6].y = 20

    line_style2 = lv.style_t()
    line_style2.init()
    line_style2.set_line_width(lv.STATE.DEFAULT, 8)
    line_style2.set_line_color(lv.STATE.DEFAULT, styles.LV_COLOR_BLUE)
    line_style2.set_line_rounded(lv.STATE.DEFAULT, True)

    cont_style = lv.style_t()
    cont_style.init()
    cont_style.set_border_opa(lv.STATE.DEFAULT, lv.OPA.TRANSP)
    cont_style.set_bg_opa(lv.STATE.DEFAULT, lv.OPA.TRANSP)
    # cont_style.set_bg_color(lv.STATE.DEFAULT, styles.LV_COLOR_WATCH)

    cont = lv.cont(screen)
    #cont.add_style(cont.PART.MAIN, cont_style)
    cont.set_auto_realign(True)
    cont.set_size(200,65)
    cont.set_pos(20,85)
    #cont.align_origo(None, lv.ALIGN.CENTER, 0, 0)
    cont.set_fit(lv.FIT.NONE)
    # cont.set_layout(lv.LAYOUT.PRETTY_MID)
    cont.set_layout(lv.LAYOUT.ROW_MID)

    line = lv.line(cont)
    points = styles.get_line_pts_from_num(1, size=40)
    line.set_points(points, len(points))
    line.add_style(line.PART.MAIN, line_style2)
    line.align(None, lv.ALIGN.CENTER, 0, 0)

    line2 = lv.line(cont)
    points = styles.get_line_pts_from_num(2, size=40)
    line2.set_points(points, len(points))
    line2.add_style(line2.PART.MAIN, line_style2)
    line2.align(None, lv.ALIGN.CENTER, 0, 0)
 async def show_decibel_screen(self):  
     # 
     # Decibel screen
     #
     decibel_screen = lv.obj()
     dba = repo.get('dba').current
     
     screenstyle = lv.style_t(lv.style_plain)
     # 0xFF, 0x00, 0x00  Red
     # 0xC0, 0xC0, 0xC0  Silver
     # 0xFF, 0xA5, 0x00  Orange
     # set background color, with no gradient
     
     # set background and text color based on dBA reading
     if dba < 70:
         bg_color = lv.color_hex(0x00FF00) # green
         text_color = lv.color_hex(0x000000) # black
     elif dba < 85:
         bg_color = lv.color_hex(0xFFFF00) # yellow
         text_color = lv.color_hex(0x000000) # black
     else:
         bg_color = lv.color_hex(0xFF0000)  # red
         text_color = lv.color_hex(0xFFFFFF) # white
         
     screenstyle.body.grad_color = bg_color
     screenstyle.body.main_color = bg_color
     #screenstyle.body.border.color = lv.color_hex(0xe32a19)
     #screenstyle.body.border.width = 5
     screenstyle.text.color = text_color
     screenstyle.text.font = lv.font_roboto_120
     decibel_screen.set_style(screenstyle)
     
     reading = lv.label(decibel_screen)
     reading.set_x(40)
     reading.set_y(70)
     reading.set_text('{:.1f}'.format(dba))
     
     unit = lv.label(decibel_screen)
     unitstyle = lv.style_t(lv.style_plain)
     unitstyle.text.color = text_color
     unitstyle.text.font = lv.font_roboto_28
     unit.set_style(lv.label.STYLE.MAIN, unitstyle)
     unit.set_x(215)
     unit.set_y(170)
     unit.set_text("dBA")
     
     lv.scr_load(decibel_screen)        
     self.backlight_ctrl.value(1)
Exemple #17
0
    def __init__(self, text, *args, **kwds):
        super().__init__(*args, **kwds)

        # styly of the background overlay
        self.style = lv.style_t()
        self.style.init()
        self.style.set_bg_opa(lv.STATE.DEFAULT, lv.OPA._60)
        self.style.set_bg_color(lv.STATE.DEFAULT, lv.color_hex3(0x000))

        # create a base object for the modal background
        self.reset_style_list(lv.obj.PART.MAIN)
        self.add_style(lv.obj.PART.MAIN, self.style)
        self.set_pos(0, 0)
        self.set_size(240, 320)

        self.mbox = lv.msgbox(self)
        self.mbox.set_text(text)
        self.mbox.add_btns(["OK", ""])
        self.mbox.set_width(200)
        self.mbox.align(lv.scr_act(), lv.ALIGN.CENTER, 0, 0)
        self.mbox.set_event_cb(self.mbox_event_cb)

        self.g = lv.group_t()
        self.g.add_obj(self.mbox)
        lv.group_focus_obj(self.mbox)
        self.g.focus_freeze(True)
Exemple #18
0
 def _set_custom_style(self):
     style = lv.style_t()
     lv.style_copy(style, self.lv_obj.get_style(lv.cont.STYLE.MAIN))
     style.body.main_color = lv.color_make(0xC0, 0xC0, 0xC0)
     style.body.grad_color = lv.color_make(0x4F, 0x52, 0x57)
     style.body.radius = 0
     self.lv_obj.set_style(lv.cont.STYLE.MAIN, style)
Exemple #19
0
    def main_page(self,tile_num):
        self.calculator_tile = self.mainbar.get_tile_obj(tile_num);
        self.calculator_style = lv.style_t()
        self.calculator_style.copy(self.mainbar.get_style())
        
         # create the number textarea
        self.ta = lv.textarea(self.calculator_tile,None)
        self.ta.set_size(200,40)
        self.ta.align(None,lv.ALIGN.IN_TOP_MID,0,10)
        self.ta.set_text("0")

        # create a button matrix
        self.btnm = lv.btnmatrix(self.calculator_tile,None)
        self.btnm.set_map(self.btnm_map)
        self.btnm.set_ctrl_map(self.btnm_ctlr_map)
        self.btnm.set_width(226)
        self.btnm.align(self.ta,lv.ALIGN.OUT_BOTTOM_MID,0,10)
        # attach the callback
        self.btnm.set_event_cb(self.event_handler)
        # create the exit button
        
        exit_btn = lv.imgbtn(self.calculator_tile,None)        
        exit_btn.set_src(lv.btn.STATE.RELEASED,self.mainbar.get_exit_btn_dsc())
        exit_btn.add_style(lv.imgbtn.PART.MAIN,self.calculator_style)
        exit_btn.align(self.calculator_tile,lv.ALIGN.IN_BOTTOM_LEFT, 10, -10 )
        self.log.debug("setting up exit callback")
        exit_btn.set_event_cb(self.exit_calculator_app_event_cb)
        
        self.calculator_style.set_text_opa(lv.obj.PART.MAIN, lv.OPA.COVER)
Exemple #20
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        style = lv.style_t()
        lv.style_copy(style, qr_style)
        style.text.font = lv.font_roboto_16
        style.text.color = lv.color_hex(0x192432)

        self._autoplay = True

        self.qr = lvqr.QRCode(self)
        self._text = "Text"
        self.version = self.QR_VERSION

        self._original_size = None
        self._press_start = None

        self.create_density_controls(style)
        self.create_playback_controls(style)

        self.note = lv.label(self)
        self.note.set_style(0, style)
        self.note.set_text("")
        self.note.set_align(lv.label.ALIGN.CENTER)

        self.set_text(self._text)
        self.task = asyncio.create_task(self.animate())
        self.set_event_cb(self.cb)
    def start_btn_init(self):
        """
        Initialize the Start/Stop button on the screen
        """
        this = self

        def start_btn_hander(obj, event):
            if event == lv.EVENT.CLICKED:
                if this.has_started:  # Clicked to stop the process
                    # popup to let user confirm the stop action
                    this.popup_confirm_stop()
                else:  # Clicked to start the process
                    this.set_reflow_process_on(True)

        start_btn = lv.btn(self.main_scr)
        start_btn.set_size(140, 60)
        start_btn.set_event_cb(start_btn_hander)
        start_btn.align(self.timer_label, lv.ALIGN.IN_TOP_RIGHT, 190, 0)
        style_start = lv.style_t()
        lv.style_copy(style_start, lv.style_btn_rel)
        style_start.text.font = lv.font_roboto_28
        start_label = lv.label(start_btn)
        start_label.set_text(lv.SYMBOL.PLAY + ' Start')
        start_label.set_style(lv.label.STYLE.MAIN, style_start)
        return start_btn, start_label
    def popup_confirm_stop(self):
        modal_style = lv.style_t()
        lv.style_copy(modal_style, lv.style_plain_color)
        modal_style.body.main_color = modal_style.body.grad_color = lv.color_make(
            0, 0, 0)
        modal_style.body.opa = lv.OPA._50
        bg = lv.obj(self.main_scr)
        bg.set_style(modal_style)
        bg.set_pos(0, 0)
        bg.set_size(self.main_scr.get_width(), self.main_scr.get_height())
        bg.set_opa_scale_enable(True)

        popup_stop = lv.mbox(bg)
        popup_stop.set_text(
            'Do you really want to stop the soldering process?')
        btns = ['OK', 'Cancel', '']
        popup_stop.add_btns(btns)
        this = self

        def event_handler(obj, event):
            if event == lv.EVENT.VALUE_CHANGED:
                if popup_stop.get_active_btn() == 0:
                    this.set_reflow_process_on(False)
                else:
                    pass

                bg.del_async()
                popup_stop.start_auto_close(5)

        popup_stop.set_event_cb(event_handler)
        popup_stop.align(None, lv.ALIGN.CENTER, 0, 0)
Exemple #23
0
 def create_style(self, colour=(0x00, 0x3b, 0x75), width=3, rounded=1):
     style_line = lv.style_t()
     lv.style_copy(style_line, lv.style_plain)
     style_line.line.color = lv.color_make(colour[0], colour[1], colour[2])
     style_line.line.width = width
     style_line.line.rounded = rounded
     return style_line
 def set_text(self, text="Text"):
     if self._text != text:
         print("QR on screen:", text)
     self._text = text
     qr = qrcode.encode_to_string(text)
     size = int(math.sqrt(len(qr))) # + 4 clear space on every side
     width = self.get_width()
     scale = width//size
     sizes = range(1,10)
     fontsize = [s for s in sizes if s < scale or s == 1][-1]
     font = getattr(lv, "square%d" % fontsize)
     style = lv.style_t()
     lv.style_copy(style, qr_style)
     style.text.font = font
     pad = 4*fontsize
     style.body.radius = fontsize
     style.body.padding.top = pad
     style.body.padding.left = pad
     style.body.padding.right = pad
     style.body.padding.bottom = pad-fontsize # there is \n at the end
     self.set_style(lv.label.STYLE.MAIN, style)
     self.set_body_draw(True)
     super().set_text(qr)
     del qr
     gc.collect()
Exemple #25
0
def prompt_tx(title, data, ok=None, cancel=None):
    message = ""
    scr = prompt(title, message, ok=ok, cancel=cancel)
    obj = scr.message
    obj.set_y(0)
    style = lv.style_t()
    lv.style_copy(style, scr.message.get_style(0))
    style.text.font = lv.font_roboto_mono_28

    for out in data["send_outputs"]:
        addr = format_addr(
                    format_addr(
                        out["address"], letters=6, separator=" "
                    ), 
                    letters=21, separator="\n"
                )
        lbl = add_label("%u sat ( %g BTC ) to" % (out["value"], out["value"]/1e8), scr=scr)
        lbl.align(obj, lv.ALIGN.OUT_BOTTOM_MID, 0, 20)
        addrlbl = add_label(addr, scr=scr)
        addrlbl.set_style(0, style)
        addrlbl.align(lbl, lv.ALIGN.OUT_BOTTOM_MID, 0, 20)
        obj = addrlbl

    lbl = lv.label(scr)
    lbl.set_text("Fee: %u satoshi - %.1f" % (data["fee"], 100*data["fee"]/data["spending"]) + "%")
    lbl.align(obj, lv.ALIGN.OUT_BOTTOM_MID, 0, 50)
    return scr
 def main_page(self,tile_num):
     example_app_main_tile = self.mainbar.get_tile_obj(tile_num);
     example_main_style = lv.style_t()
     example_main_style.copy(self.mainbar.get_style())
     
     exit_btn = lv.imgbtn(self.example_app_main_tile,None)        
     exit_btn.set_src(lv.btn.STATE.RELEASED,self.mainbar.get_exit_btn_dsc())
     exit_btn.add_style(lv.imgbtn.PART.MAIN,example_main_style)
     exit_btn.align(self.example_app_main_tile,lv.ALIGN.IN_BOTTOM_LEFT, 10, -10 )
     self.log.debug("setting up exit callback")
     exit_btn.set_event_cb(self.exit_example_app_main_event_cb)
     
     setup_btn = lv.imgbtn(self.example_app_main_tile,None)
     setup_btn.set_src(lv.btn.STATE.RELEASED,self.mainbar.get_setup_btn_dsc())
     setup_btn.add_style(lv.imgbtn.PART.MAIN,example_main_style)
     setup_btn.align(self.example_app_main_tile,lv.ALIGN.IN_BOTTOM_RIGHT, -10, -10 )
     self.log.debug("setting up setup callback")
     setup_btn.set_event_cb(self.enter_example_app_setup_event_cb)
     
     example_main_style.set_text_opa(lv.obj.PART.MAIN, lv.OPA._70)
     example_main_style.set_text_font(lv.STATE.DEFAULT,lv.font_montserrat_48)
     example_app_label = lv.label(self.example_app_main_tile,None)
     example_app_label.set_text("myapp")
     example_app_label.add_style(lv.obj.PART.MAIN,example_main_style)
     example_app_label.align(self.example_app_main_tile,lv.ALIGN.CENTER,0,0)
    def __init__(self):
        self.mask_top_id = -1
        self.mask_bottom_id = -1

        #
        # Add an fade mask to roller.
        #
        style = lv.style_t()
        style.init()
        style.set_bg_color(lv.color_black())
        style.set_text_color(lv.color_white())

        lv.scr_act().add_style(style, 0)

        roller1 = lv.roller(lv.scr_act())
        roller1.add_style(style, 0)
        roller1.set_style_border_width(0, 0)
        roller1.set_style_pad_all(0, 0)
        roller1.set_style_bg_opa(lv.OPA.TRANSP, lv.PART.SELECTED)

        #if LV_FONT_MONTSERRAT_22
        #    lv_obj_set_style_text_font(roller1, &lv_font_montserrat_22, LV_PART_SELECTED);
        #endif
        roller1.set_options(
            "\n".join([
                "January", "February", "March", "April", "May", "June", "July",
                "August", "September", "October", "November", "December"
            ]), lv.roller.MODE.NORMAL)

        roller1.center()
        roller1.set_visible_row_count(3)
        roller1.add_event_cb(self.mask_event_cb, lv.EVENT.ALL, None)
Exemple #28
0
    def __init__(self, parent):

        self.main_tile = None
        self.note_tile = None

        self.gui = None
        self.pcf8563 = None
        self.log = logging.getLogger("mainbar")
        self.log.setLevel(logging.DEBUG)

        self.mainbar_style = lv.style_t()
        self.mainbar_style.init()
        self.mainbar_style.set_radius(lv.obj.PART.MAIN, 0)
        self.mainbar_style.set_bg_color(lv.obj.PART.MAIN, lv_colors.GRAY)
        self.mainbar_style.set_bg_opa(lv.obj.PART.MAIN, lv.OPA._0)

        self.mainbar_style.set_border_width(lv.obj.PART.MAIN, 0)
        self.mainbar_style.set_text_color(lv.obj.PART.MAIN, lv_colors.WHITE)
        self.mainbar_style.set_image_recolor(lv.obj.PART.MAIN, lv_colors.WHITE)

        self.mainbar_switch_style = lv.style_t()
        self.mainbar_switch_style.init()
        self.mainbar_switch_style.set_bg_color(lv.STATE.CHECKED,
                                               lv_colors.GREEN)

        self.mainbar_slider_style = lv.style_t()
        self.mainbar_slider_style.init()
        self.mainbar_slider_style.set_bg_color(lv.STATE.DEFAULT,
                                               lv_colors.GREEN)

        self.mainbar_button_style = lv.style_t()
        self.mainbar_button_style.init()
        self.mainbar_button_style.set_radius(lv.STATE.DEFAULT, 3)
        self.mainbar_button_style.set_border_color(lv.STATE.DEFAULT,
                                                   lv_colors.WHITE)
        self.mainbar_button_style.set_border_opa(lv.STATE.DEFAULT, lv.OPA._70)
        self.mainbar_button_style.set_border_width(lv.STATE.DEFAULT, 2)

        self.mainbar = lv.tileview(parent, None)
        self.mainbar.set_edge_flash(False)
        self.mainbar.add_style(lv.obj.PART.MAIN, self.mainbar_style)
        lv.page.set_scrollbar_mode(lv.page.__cast__(self.mainbar),
                                   lv.SCROLLBAR_MODE.OFF)

        self.exit_icon_dsc = self.get_image_dsc('exit_32px')
        self.setup_icon_dsc = self.get_image_dsc('setup_32px')
        self.app = App(self)
    def __init__(self):
        # create a logger
        self.log = logging.getLogger("Splashscreen")
        self.log.setLevel(logging.DEBUG)

        scr_style = lv.style_t()
        scr_style.set_bg_color(lv.STATE.DEFAULT, lv_colors.BLACK)
        lv.scr_act().add_style(lv.obj.PART.MAIN, scr_style)

        try:
            with open('images/hedgehog143x81_argb8888.bin', 'rb') as f:
                hedgehog_data = f.read()
                self.log.debug("hedgehog143x81_argb8888.bin successfully read")
        except:
            try:
                with open('images/hedgehog143x81_argb565.bin', 'rb') as f:
                    hedgehog_data = f.read()
                    self.log.debug(
                        "hedgehog143x81_argb565.bin successfully read")
            except:
                self.log.error("Could not open hedgehog image file")
                sys.exit()

        self.image = lv.img(lv.scr_act(), None)

        img_dsc = lv.img_dsc_t({
            "header": {
                "always_zero": 0,
                "w": 143,
                "h": 81,
                "cf": lv.img.CF.TRUE_COLOR_ALPHA
            },
            "data_size": len(hedgehog_data),
            "data": hedgehog_data,
        })

        self.image.set_src(img_dsc)
        self.image.align(None, lv.ALIGN.CENTER, 0, -20)

        self.text_style = lv.style_t()
        self.text_style.init()
        self.text_style.set_text_color(lv.STATE.DEFAULT, lv_colors.WHITE)
        self.label = lv.label(lv.scr_act(), None)
        self.label.add_style(lv.label.PART.MAIN, self.text_style)
        self.label.set_text("Starting up...")
        self.label.align(self.image, lv.ALIGN.IN_BOTTOM_MID, 0, 50)
Exemple #30
0
    def set_status(self, which, what):
        labelstyle = lv.style_t()
        if what:
            labelstyle.set_text_color(lv.STATE.DEFAULT, lv.color_hex3(0x080))
        else:
            labelstyle.set_text_color(lv.STATE.DEFAULT, lv.color_hex3(0xccc))

        self.status[which].add_style(lv.label.PART.MAIN, labelstyle)