예제 #1
0
 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)
예제 #2
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)
예제 #3
0
    def main_page(self, tile_num):
        self.aclock_tile = self.mainbar.get_tile_obj(tile_num)
        self.aclock_style = lv.style_t()
        self.aclock_style.copy(self.mainbar.get_style())

        self.CANVAS_HEIGHT = lv.scr_act().get_disp().driver.ver_res
        self.CANVAS_WIDTH = self.CANVAS_HEIGHT
        cbuf = bytearray(self.CANVAS_HEIGHT * self.CANVAS_HEIGHT * 4)

        self.canvas = lv.canvas(self.aclock_tile, None)
        self.canvas.set_buffer(cbuf, self.CANVAS_HEIGHT, self.CANVAS_HEIGHT,
                               lv.img.CF.TRUE_COLOR)
        self.canvas.align(self.aclock_tile, lv.ALIGN.CENTER, 0, 0)

        circle_dsc = lv.draw_line_dsc_t()
        circle_dsc.init()
        circle_dsc.color = lv_colors.GREEN
        self.radius = 90
        xo = self.CANVAS_WIDTH // 2
        yo = self.CANVAS_HEIGHT // 2 - 20
        self.canvas.draw_arc(xo, yo, self.radius, 0, 360, circle_dsc)
        vor = xo + 1j * yo
        vtstart = 0.9 * self.radius + 0j  # start of tick
        vtick = 0.1 * self.radius + 0j  # tick
        vrot = cmath.exp(2j * cmath.pi / 12)  # unit rotation
        for _ in range(12):
            polar(self.canvas, vor + conj(vtstart), vtick, 1, lv_colors.GREEN)
            vtick *= vrot
            vtstart *= vrot

        vtick = 0.05 * self.radius + 0j  # tick
        vrot = cmath.exp(2j * cmath.pi / 60)  # unit rotation
        for _ in range(60):
            polar(self.canvas, vor + conj(vtstart), vtick, 1, lv_colors.GREEN)
            vtick *= vrot
            vtstart *= vrot
            self.hrs_radius = self.radius - 32
            self.min_radius = self.radius - 12
            self.sec_radius = self.radius - 12

        self.task = lv.task_create_basic()
        self.task.set_cb(lambda task: self.updateClock(self.task))
        self.task.set_period(100)
        self.task.set_prio(lv.TASK_PRIO.LOWEST)

        exit_btn = lv.imgbtn(self.aclock_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.aclock_style)
        exit_btn.align(self.aclock_tile, lv.ALIGN.IN_BOTTOM_LEFT, 10, -10)
        self.log.debug("setting up exit callback")
        exit_btn.set_event_cb(self.exit_aclock_app_event_cb)

        self.aclock_style.set_text_opa(lv.obj.PART.MAIN, lv.OPA.COVER)
예제 #4
0
    def setup_register(self, setup_name, icon_filename, event_cb):
        self.setup_tile = self.mainbar.gui.app_tile
        self.log.debug("register " + setup_name + " with icon filename " +
                       icon_filename)
        setup = self.setup_tile.get_free_app_icon()
        if setup == None:
            return
        else:
            self.log.debug("Icon successfully registered")

        setup.active = True  # reserve the icon
        # setup label
        setup.label.set_text(setup_name)

        setup.label.align(setup.cont, lv.ALIGN.OUT_BOTTOM_MID, 0, 0)
        setup.label.set_align(lv.label.ALIGN.CENTER)
        setup.cont.set_hidden(False)
        setup.label.set_hidden(False)
        #
        # setup icon and set event callback
        # create the img buttons allowing to start the apps
        #
        setup_style = lv.style_t()
        setup_style.copy(self.mainbar.get_style())
        #
        # create the imgbtn
        #
        setup.icon_img = lv.imgbtn(app.cont, None)

        (setup.icon_img_data,
         setup.icon_img_dsc) = self.get_setup_image(icon_filename)
        setup.icon_img.set_src(lv.btn.STATE.RELEASED, setup.icon_img_dsc)
        setup.icon_img.set_src(lv.btn.STATE.PRESSED, setup.icon_img_dsc)
        setup.icon_img.set_src(lv.btn.STATE.CHECKED_RELEASED,
                               setup.icon_img_dsc)
        setup.icon_img.set_src(lv.btn.STATE.CHECKED_PRESSED,
                               setup.icon_img_dsc)
        setup.icon_img.reset_style_list(lv.obj.PART.MAIN)
        setup.icon_img.align(setup.cont, lv.ALIGN.IN_TOP_LEFT, 0, 0)
        setup.icon_img.set_event_cb(event_cb)
        self.log.debug("imgbtn position: %d,%d" % (setup.x, setup.y))
        self.mainbar.add_slide_element(setup.icon_img)

        # setup the indicator
        setup.indicator = lv.img(setup.cont, None)
        setup.indicator.align(setup.cont, lv.ALIGN.IN_TOP_LEFT, 0, 0)
        setup.indicator.set_hidden(True)

        lv.obj.invalidate(lv.scr_act())
        return setup
예제 #5
0
    def setup_page(self,tile_num):
        example_setup_tile = self.mainbar.get_tile_obj(tile_num)
        setup_style = lv.style_t()
        setup_style.copy(self.mainbar.get_style())
        setup_style.set_bg_color(lv.obj.PART.MAIN, lv_colors.GRAY)
        setup_style.set_bg_opa(lv.obj.PART.MAIN, lv.OPA.COVER)
        setup_style.set_border_width(lv.obj.PART.MAIN, 0)
        example_setup_tile.add_style(lv.obj.PART.MAIN, setup_style)

        exit_cont = lv.obj(example_setup_tile,None)
        exit_cont.set_size(lv.scr_act().get_disp().driver.hor_res,40)
        exit_cont.add_style(lv.obj.PART.MAIN, setup_style)

        exit_btn = lv.imgbtn(example_setup_tile,None)
        exit_btn.set_src(lv.btn.STATE.RELEASED,self.mainbar.get_exit_btn_dsc())
        exit_btn.set_src(lv.btn.STATE.PRESSED,self.mainbar.get_exit_btn_dsc())
        exit_btn.set_src(lv.btn.STATE.CHECKED_RELEASED,self.mainbar.get_exit_btn_dsc())
        exit_btn.set_src(lv.btn.STATE.CHECKED_PRESSED,self.mainbar.get_exit_btn_dsc())
        exit_btn.align(exit_cont,lv.ALIGN.IN_TOP_LEFT, 10, 0)
        exit_btn.set_event_cb(self.exit_example_app_setup_event_cb)

        exit_label = lv.label(exit_cont,None)
        exit_label.add_style(lv.obj.PART.MAIN, setup_style)
        exit_label.set_text("my app setup")
        exit_label.align(exit_btn, lv.ALIGN.OUT_RIGHT_MID, 5, 0 )

        foobar_switch_cont = lv.obj(example_setup_tile,None)
        foobar_switch_cont.set_size(lv.scr_act().get_disp().driver.hor_res,40)
        foobar_switch_cont.add_style(lv.obj.PART.MAIN, setup_style)
        foobar_switch_cont.align(exit_cont,lv.ALIGN.OUT_BOTTOM_LEFT, 0, 0 )

        foobar_switch = lv.switch(foobar_switch_cont,None)
        foobar_switch.add_protect(lv.PROTECT.CLICK_FOCUS)
        foobar_switch.add_style(lv.switch.PART.INDIC, setup_style)
        foobar_switch.off(lv.ANIM.ON)
        foobar_switch.align(foobar_switch_cont,lv.ALIGN.IN_RIGHT_MID, -5, 0 )
        self.log.debug("setting up the foobar switch callback")
        foobar_switch.set_event_cb(self.example_app_foobar_switch_event_cb)
        
        foobar_switch_label = lv.label(foobar_switch_cont,None)
        foobar_switch_label.add_style(lv.obj.PART.MAIN, setup_style)
        foobar_switch_label.set_text("foo bar")
        foobar_switch_label.align(foobar_switch_cont,lv.ALIGN.IN_LEFT_MID, 5, 0 )
예제 #6
0
    def main_page(self, tile_num):
        self.calendar_tile = self.mainbar.get_tile_obj(tile_num)
        self.calendar_style = lv.style_t()
        self.calendar_style.copy(self.mainbar.get_style())

        # create a calendar
        calendar = lv.calendar(self.calendar_tile, None)
        calendar.set_size(200, 200)
        calendar.align(self.calendar_tile, lv.ALIGN.CENTER, 0, -15)
        calendar.set_event_cb(self.event_handler)

        # Make the date number smaller to be sure they fit into their area
        calendar.set_style_local_text_font(lv.calendar.PART.DATE,
                                           lv.STATE.DEFAULT,
                                           lv.theme_get_font_small())

        exit_btn = lv.imgbtn(self.calendar_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.calendar_style)
        exit_btn.align(self.calendar_tile, lv.ALIGN.IN_BOTTOM_LEFT, 10, 0)
        self.log.debug("setting up exit callback")
        exit_btn.set_event_cb(self.exit_calendar_app_event_cb)

        self.calendar_style.set_text_opa(lv.obj.PART.MAIN, lv.OPA.COVER)
        # get current date and time
        today = lv.calendar_date_t()
        if self.mainbar.pcf8563:
            # read time from pcf8563
            localTime = self.mainbar.pcf8563.datetime()
            today.year = localTime[0] + 2000
        else:
            now = time.time()
            localTime = time.localtime(now)
            today.year = localTime[0]

        today.month = localTime[1]
        today.day = localTime[2]

        calendar.set_today_date(today)
        calendar.set_showed_date(today)
예제 #7
0
    def main_page(self,tile_num):
        self.calendar_tile = self.mainbar.get_tile_obj(tile_num);
        self.calendar_style = lv.style_t()
        self.calendar_style.copy(self.mainbar.get_style())
        
        # create a calendar
        calendar = lv.calendar(self.calendar_tile,None)
        calendar.set_size(200,200)
        calendar.align(self.calendar_tile,lv.ALIGN.CENTER,0,-15)
        calendar.set_event_cb(self.event_handler)
        
        # Make the date number smaller to be sure they fit into their area
        calendar.set_style_local_text_font(lv.calendar.PART.DATE,
                                           lv.STATE.DEFAULT,lv.theme_get_font_small())

        exit_btn = lv.imgbtn(self.calendar_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.calendar_style)
        exit_btn.align(self.calendar_tile,lv.ALIGN.IN_BOTTOM_LEFT, 10, 0 )
        self.log.debug("setting up exit callback")
        exit_btn.set_event_cb(self.exit_calendar_app_event_cb)
        
        self.calendar_style.set_text_opa(lv.obj.PART.MAIN, lv.OPA.COVER)
예제 #8
0
    def main_page(self, tile_num):
        # create the GUI
        self.weather_app_tile = self.mainbar.get_tile_obj(tile_num)
        weather_style = lv.style_t()
        weather_style.copy(self.mainbar.get_style())

        weather_cont = lv.obj(self.weather_app_tile, None)
        weather_cont.set_size(lv.scr_act().get_disp().driver.hor_res, 30)
        weather_cont.add_style(lv.cont.PART.MAIN, weather_style)

        # create date label and left right buttons
        btn_style = lv.style_t()
        btn_style.copy(weather_style)
        btn_style.set_radius(lv.btn.STATE.RELEASED, 2)
        self.left_button = lv.btn(weather_cont, None)
        self.left_button.set_size(25, 25)
        self.left_button.add_style(lv.btn.PART.MAIN, btn_style)
        left_label = lv.label(self.left_button, None)
        left_label.set_text(lv.SYMBOL.LEFT)
        self.left_button.align(weather_cont, lv.ALIGN.IN_LEFT_MID, 5, 0)
        self.left_button.set_hidden(True)
        self.left_button.set_event_cb(self.decrement_day)

        self.date_label = lv.label(weather_cont, None)
        self.date_label.set_text(self.date[self.day_index])
        self.date_label.align(weather_cont, lv.ALIGN.CENTER, 0, 0)

        self.right_button = lv.btn(weather_cont, None)
        self.right_button.set_size(25, 25)
        self.right_button.add_style(lv.btn.PART.MAIN, btn_style)
        right_label = lv.label(self.right_button, None)
        right_label.set_text(lv.SYMBOL.RIGHT)
        self.right_button.align(weather_cont, lv.ALIGN.IN_RIGHT_MID, -5, 0)
        self.right_button.set_event_cb(self.increment_day)

        icon_cont_style = lv.style_t()
        icon_cont_style.copy(weather_style)
        icon_cont_style.set_bg_opa(lv.obj.PART.MAIN, lv.OPA.TRANSP)

        icon_cont = lv.cont(self.weather_app_tile, None)
        icon_cont.set_layout(lv.LAYOUT.COLUMN_LEFT)
        icon_cont.add_style(lv.cont.PART.MAIN, icon_cont_style)
        icon_cont.set_fit(lv.FIT.TIGHT)

        self.icon = lv.img(icon_cont, None)
        key_list = list(self.icon_filename.keys())
        self.log.debug(key_list)
        index = key_list.index(self.weather_state_abbr[self.day_index])
        self.log.debug("index of %s: %d" %
                       (self.weather_state_abbr[self.day_index], index))
        self.icon.set_src(self.icon_dsc[index])
        icon_cont.align(weather_cont, lv.ALIGN.OUT_BOTTOM_LEFT, 0, 0)
        self.state_label = lv.label(icon_cont, None)
        self.state_label.set_width(100)
        self.state_label.set_text(self.weather_state_name[self.day_index])

        info_cont_style = lv.style_t()
        info_cont_style.copy(weather_style)
        info_cont_style.set_pad_top(lv.STATE.DEFAULT, 6)
        info_cont_style.set_pad_inner(lv.STATE.DEFAULT, 4)

        info_cont = lv.cont(self.weather_app_tile, None)
        info_cont.set_size(lv.scr_act().get_disp().driver.hor_res, 90)
        info_cont.set_layout(lv.LAYOUT.COLUMN_LEFT)
        info_cont.add_style(lv.cont.PART.MAIN, icon_cont_style)
        info_cont.set_fit(lv.FIT.NONE)
        info_cont.align(icon_cont, lv.ALIGN.OUT_BOTTOM_LEFT, 0, 0)
        info_cont.add_style(lv.cont.PART.MAIN, info_cont_style)

        self.confidence_label = lv.label(info_cont, None)
        self.confidence_label.set_text("Confidence level: {}%".format(
            self.predic[self.day_index]))
        self.temp_label = lv.label(info_cont, None)
        self.temp_label.set_text(
            "Temp: min: %3.1f°C, max: %3.1f°C" %
            (self.min_temp[self.day_index], self.max_temp[self.day_index]))
        self.humidity_label = lv.label(info_cont, None)
        self.humidity_label.set_text("Humidity: {}%".format(
            self.humid[self.day_index]))
        self.pressure_label = lv.label(info_cont, None)
        self.pressure_label.set_text("Air pressure: %d hPa" %
                                     self.air_pressure[self.day_index])

        info_cont2 = lv.cont(self.weather_app_tile, None)
        # info_cont2.set_size(140,120)
        info_cont2.set_layout(lv.LAYOUT.COLUMN_LEFT)
        info_cont2.add_style(lv.cont.PART.MAIN, icon_cont_style)
        info_cont2.set_fit(lv.FIT.TIGHT)
        info_cont2.align(icon_cont, lv.ALIGN.OUT_RIGHT_TOP, -5, 0)
        info_cont2.add_style(lv.cont.PART.MAIN, info_cont_style)

        self.location_label = lv.label(info_cont2, None)
        self.location_label.set_text("Location: " + self.location)
        self.wind_label = lv.label(info_cont2, None)
        self.wind_label.set_text("Wind:\nspeed: %5.1f kph\ndir: %s" %
                                 (self.wind_speed[self.day_index],
                                  self.wind_direction[self.day_index]))

        exit_btn = lv.imgbtn(self.weather_app_tile, None)
        exit_btn.set_src(lv.btn.STATE.RELEASED,
                         self.mainbar.get_exit_btn_dsc())
        exit_btn.set_src(lv.btn.STATE.PRESSED, self.mainbar.get_exit_btn_dsc())
        exit_btn.set_src(lv.btn.STATE.CHECKED_RELEASED,
                         self.mainbar.get_exit_btn_dsc())
        exit_btn.set_src(lv.btn.STATE.CHECKED_PRESSED,
                         self.mainbar.get_exit_btn_dsc())
        exit_btn.align(self.weather_app_tile, lv.ALIGN.IN_BOTTOM_RIGHT, -10,
                       -10)
        exit_btn.set_event_cb(self.exit_weather_app_event_cb)
예제 #9
0
    def __init__(self,parent):
        tiles = []
        log = logging.getLogger("App")
        log.setLevel(logging.DEBUG)
        self.SDL=0
        self.TWATCH=1
        y=0
        for tile_no in range(self.MAX_APPS_TILES):
            id = "setup tile %s"%(tile_no+1)
            tiles.append(parent.add_tile(tile_no+1,y,id))
            
        self.app_icon_data = [None]*self.MAX_APPS_ICON
        self.app_icon_dsc = [None]*self.MAX_APPS_ICON
        self.app_buttons=[None]*self.MAX_APPS_ICON
        self.app_labels=[None]*self.MAX_APPS_ICON
        
        for i in range(len(self.app_icon_files)):
            if i > self.MAX_APPS_ICON:
                log.error("Too many apps")
                break
            
            filename = self.app_icon_files[i]
            try:
                sdl_filename = 'images/' + filename + "_argb8888.bin"
                log.debug('sdl filename: ' + sdl_filename)
                with open(sdl_filename,'rb') as f:
                    self.app_icon_data[i] = f.read()
                    self.driver = self.SDL
                    log.debug(sdl_filename + " successfully read")
            except:
                twatch_filename = 'images/' + filename + "_argb565.bin"
                log.debug('t-watch filename: ' + twatch_filename)
                try:
                    with open(twatch_filename,'rb') as f:
                        self.app_icon_data[i]= f.read()
                        self.driver = self.TWATCH
                        log.debug(twatch_filename + " successfully read")
                        
                except:
                    log.error("Could not find image file: " + filename) 
                    
            self.app_icon_dsc[i] = lv.img_dsc_t(
                {
                    "header": {"always_zero": 0, "w": 64, "h": 64, "cf": lv.img.CF.TRUE_COLOR_ALPHA},
                    "data": self.app_icon_data[i],
                    "data_size": len(self.app_icon_data[i]),
                }
            )
            #
            # create the img buttons allowing to start the apps
            #
            x_pos = i%3 * 76 +12
            y_pos = (i-6*(i//6))//3 * 100 + 40
            print("x_pos: %d, y_pos: %d"%(x_pos,y_pos))

            self.app_buttons[i] = lv.imgbtn(tiles[i//6],None)
            self.app_buttons[i].set_src(lv.btn.STATE.RELEASED,self.app_icon_dsc[i])
            self.app_buttons[i].align(tiles[i//6],lv.ALIGN.IN_TOP_LEFT, x_pos, y_pos)
            self.app_buttons[i].set_event_cb(self.exec_cb)
            
            self.app_labels[i] = lv.label(tiles[i//6],None)
            self.app_labels[i].set_text(self.app_names[i])
            self.app_labels[i].align(self.app_buttons[i],lv.ALIGN.OUT_BOTTOM_MID,0,0)
예제 #10
0
    def __init__(self, parent, tile_num):

        self.log = logging.getLogger("BatteryViewTile")
        self.log.setLevel(logging.DEBUG)

        self.tile_num = tile_num
        self.tile = parent.get_tile_obj(tile_num)

        self.style = lv.style_t()
        self.style.copy(parent.mainbar_style)
        self.style.set_bg_color(lv.obj.PART.MAIN, lv_colors.GRAY)
        self.style.set_bg_opa(lv.obj.PART.MAIN, lv.OPA.COVER)
        self.style.border_width(lv.obj.PART.MAIN, 0)
        self.tile.add_style(lv.obj.PART.MAIN, self.style)

        # create exit button

        self.exit_icon = parent.get_exit_btn_dsc()
        self.exit_btn = lv.imgbtn(self.tile, None)
        self.exit_btn.set_src(lv.btn.STATE.RELEASED, self.exit_icon)
        self.exit_btn.add_style(lv.imgbtn.PART.MAIN, self.style)
        self.exit_btn.align(self.tile, lv.ALIGN.IN_TOP_LEFT, 10,
                            Constants.STATUSBAR_HEIGHT + 10)

        # create settings button

        self.settings_icon = parent.get_setup_btn_dsc()
        self.settings_btn = lv.imgbtn(self.tile, None)
        self.settings_btn.set_src(lv.btn.STATE.RELEASED, self.exit_icon)
        self.settings_btn.add_style(lv.imgbtn.PART.MAIN, self.style)
        self.settings_btn.align(self.tile, lv.ALIGN.IN_TOP_RIGHT, -10,
                                Constants.STATUSBAR_HEIGHT + 10)

        self.exit_label = lv.label(self.tile, None)
        self.exit_label.set_text("battery / energy")
        self.exit_label.align(self.exit_btn.lv.ALIGN.OUT_RIGHT_MID, 5, 0)

        self.design_cont = lv.obj(self.tile, None)
        self.design_cont.set_size(lv.scr_act().get_disp().driver.hor_res, 25)
        self.design_cont.add_style(lv.obj.PART.MAIN, self.style)
        self.design_cont.align(self.tile, lv.ALIGN.IN_TOP_RIGHT, 0, 75)
        self.design_cap_label = lv.label(self.design_cont, None)
        self.design_cap_label.add_style(lv.obj.PART.MAIN, self.style)
        self.design_cap_label.set_text("designed cap")
        self.design_cap_label.align(self.design_cont, lv.ALIGN.IN_LEFT_MID, 5,
                                    0)

        self.design_cap = lv.label(self.design_cont, None)
        self.design_cap.add_style(lv.obj.PART.MAIN, self.style)
        self.design_cap.set_text("300mAh")
        self.design_cap.align(self.design_cont, lv.ALIGN_IN.RIGHT_MID, -5, 0)

        self.current_cont = lv.obj(self.tile, None)
        self.current_cont.set_size(lv.scr_act().get_disp().driver.hor_res, 22)
        self.current_cont.add_style(lv.obj.PART.MAIN, self.style)
        self.current_cont.align(self.design_cont, lv.ALIGN.OUT_BOTTOM_MID, 0,
                                0)
        self.current_cap_label = lv.label(self.current_cont, None)
        self.current_cap_label.add_style(lv.obj.PART.MAIN, self.style)
        self.current_cap_label.set_text("charged capacity")
        self.current_cap_label.align(self.current_cont, lv.ALIGN.IN_LEFT_MID,
                                     5, 0)

        self.current_cap = lv.label(self.current_cont, None)
        self.current_cap.add_style(lv.obj.PART.MAIN, self.style)
        self.current_cap.set_text("300mAh")
        self.current_cap.align(self.current_cont, lv.ALIGN_IN.RIGHT_MID, -5, 0)

        self.voltage_cont = lv.obj(self.tile, None)
        self.voltage_cont.set_size(lv.scr_act().get_disp().driver.hor_res, 22)
        self.voltage_cont.add_style(lv.obj.PART.MAIN, self.style)
        self.voltage_cont.align(self.current_cont, lv.ALIGN.OUT_BOTTOM_MID, 0,
                                0)
        self.voltage_label = lv.label(self.voltage_cont, None)
        self.voltage_label.add_style(lv.obj.PART.MAIN, self.style)
        self.voltage_label.set_text("battery voltage")
        self.voltage_label.align(self.current_cont, lv.ALIGN.IN_LEFT_MID, 5, 0)

        self.voltage = lv.label(self.current_cont, None)
        self.voltage.add_style(lv.obj.PART.MAIN, self.style)
        self.voltage.set_text("2.4mV")
        self.voltage.align(self.current_cont, lv.ALIGN_IN.RIGHT_MID, -5, 0)

        self.charge_cont = lv.obj(self.tile, None)
        self.charge_cont.set_size(lv.scr_act().get_disp().driver.hor_res, 22)
        self.charge_cont.add_style(lv.obj.PART.MAIN, self.style)
        self.charge_cont.align(self.voltage_cont, lv.ALIGN.OUT_BOTTOM_MID, 0,
                               0)
        self.charge_label = lv.label(self.charge_cont, None)
        self.charge_label.add_style(lv.obj.PART.MAIN, self.style)
        self.charge_label.set_text("charge current")
        self.charge_label.align(self.current_cont, lv.ALIGN.IN_LEFT_MID, 5, 0)

        self.charge = lv.label(self.current_cont, None)
        self.charge.add_style(lv.obj.PART.MAIN, self.style)
        self.charge.set_text("100mAh")
        self.charge.align(self.current_cont, lv.ALIGN_IN.RIGHT_MID, -5, 0)

        self.discharge_cont = lv.obj(self.tile, None)
        self.discharge_cont.set_size(lv.scr_act().get_disp().driver.hor_res,
                                     22)
        self.discharge_cont.add_style(lv.obj.PART.MAIN, self.style)
        self.discharge_cont.align(self.charge_cont, lv.ALIGN.OUT_BOTTOM_MID, 0,
                                  0)
        self.discharge_label = lv.label(self.discharge_cont, None)
        self.discharge_label.add_style(lv.obj.PART.MAIN, self.style)
        self.discharge_label.set_text("discharge current")
        self.discharge_label.align(self.current_cont, lv.ALIGN.IN_LEFT_MID, 5,
                                   0)

        self.discharge = lv.label(self.current_cont, None)
        self.discharge.add_style(lv.obj.PART.MAIN, self.style)
        self.discharge.set_text("100mAh")
        self.discharge.align(self.current_cont, lv.ALIGN_IN.RIGHT_MID, -5, 0)

        self.vbus_voltage_cont = lv.obj(self.tile, None)
        self.vbus_voltage_cont.set_size(lv.scr_act().get_disp().driver.hor_res,
                                        22)
        self.vbus_voltage_cont.add_style(lv.obj.PART.MAIN, self.style)
        self.vbus_voltage_cont.align(self.discharge_cont,
                                     lv.ALIGN.OUT_BOTTOM_MID, 0, 0)
        self.vbus_voltage_label = lv.label(self.vbus_voltage_cont, None)
        self.vbus_voltage_label.add_style(lv.obj.PART.MAIN, self.style)
        self.vbus_voltage_label.set_text("vbus_voltage current")
        self.vbus_voltage_label.align(self.current_cont, lv.ALIGN.IN_LEFT_MID,
                                      5, 0)

        self.vbus_voltage = lv.label(self.current_cont, None)
        self.vbus_voltage.add_style(lv.obj.PART.MAIN, self.style)
        self.vbus_voltage.set_text("100mAh")
        self.vbus_voltage.align(self.current_cont, lv.ALIGN_IN.RIGHT_MID, -5,
                                0)
예제 #11
0
    def __init__(self, parent, w=50, h=16):
        """Initialize paddle.

        Args:
            display (SSD1351): OLED display.
            width (Optional int): Paddle width (default 25).
            height (Optional int): Paddle height (default 8).
        """
        super().__init__(parent)
        self.x = 120 - 35
        self.y = 300
        self.width = w
        self.height = h
        # Create a parent (gray rectangle)
        rect_style = lv.style_t()
        rect_style.set_bg_color(lv.STATE.DEFAULT, lv_colors.BLACK)
        rect_style.set_radius(lv.STATE.DEFAULT, 0)
        rect_style.set_border_width(lv.STATE.DEFAULT, 0)
        self.set_size(SCREEN_WIDTH - 18, h)
        self.add_style(lv.obj.PART.MAIN, rect_style)
        self.align(None, lv.ALIGN.CENTER, 0, 0)
        self.set_x(10)
        self.set_y(300)

        try:
            with open('arkanoid_images/Paddle50x16_released_argb8888.bin',
                      'rb') as f:
                paddle_released_data = f.read()
            print(
                'arkanoid_images/Paddle50x16_released_argb8888.bin successfully read'
            )
            driver = SDL
        except:
            try:
                with open('images/Paddle50x16_released_rgb565.bin', 'rb') as f:
                    paddle_released_data = f.read()
                print(
                    'images/Paddle50x16_released_rgb565.bin successfully read')
                driver = ILI9341
            except:
                print('Could not open Paddle_50x16_released image file')
                sys.exit()

        if driver == SDL:
            paddle_released_dsc = lv.img_dsc_t({
                "header": {
                    "always_zero": 0,
                    "w": w,
                    "h": h,
                    "cf": lv.img.CF.TRUE_COLOR_ALPHA
                },
                "data_size":
                len(paddle_released_data),
                "data":
                paddle_released_data,
            })
        else:
            paddle_released_dsc = lv.img_dsc_t({
                "header": {
                    "always_zero": 0,
                    "w": w,
                    "h": h,
                    "cf": lv.img.CF.TRUE_COLOR
                },
                "data_size":
                len(paddle_released_data),
                "data":
                paddle_released_data,
            })
        try:
            with open('arkanoid_images/Paddle50x16_pressed_argb8888.bin',
                      'rb') as f:
                paddle_pressed_data = f.read()
            print(
                'arkanoid_images/Paddle50x16_pressed_argb8888.bin successfully read'
            )
            driver = SDL
        except:
            try:
                with open('images/Paddle50x16_pressed_rgb565.bin', 'rb') as f:
                    paddle_pressed_data = f.read()
                print(
                    'images/Paddle50x16_pressed_rgb565.bin successfully read')
                driver = ILI9341
            except:
                print('Could not open Paddle_50x16_pressed image file')
                sys.exit()

        if driver == SDL:
            paddle_pressed_dsc = lv.img_dsc_t({
                "header": {
                    "always_zero": 0,
                    "w": w,
                    "h": h,
                    "cf": lv.img.CF.TRUE_COLOR_ALPHA
                },
                "data_size":
                len(paddle_pressed_data),
                "data":
                paddle_pressed_data,
            })
        else:
            paddle_pressed_dsc = lv.img_dsc_t({
                "header": {
                    "always_zero": 0,
                    "w": w,
                    "h": h,
                    "cf": lv.img.CF.TRUE_COLOR
                },
                "data_size":
                len(paddle_pressed_data),
                "data":
                paddle_pressed_data,
            })

        self.paddle_btn = lv.imgbtn(self, None)
        self.paddle_btn.set_src(lv.btn.STATE.RELEASED, paddle_released_dsc)
        self.paddle_btn.set_src(lv.btn.STATE.PRESSED, paddle_pressed_dsc)
        self.paddle_btn.set_x(self.x - self.width // 2)
        self.paddle_btn.set_y(self.y)

        self.paddle_btn.set_drag(True)  # Enable dragging
        self.paddle_btn.set_size(self.width, self.height)  # Set the size
        self.paddle_btn.align(self, lv.ALIGN.CENTER, 0,
                              0)  # Align to the center of the parent
        self.paddle_btn.add_protect(
            lv.PROTECT.PRESS_LOST)  # To prevent press lost on fast drags
        self.old_btn_signal_cb = self.paddle_btn.get_signal_cb(
        )  # Save to old signal function
        self.paddle_btn.set_signal_cb(
            self.new_btn_signal_cb)  # Set a new signal function
예제 #12
0
imgbtn_blue_dsc = lv.img_dsc_t({
    "header": {
        "always_zero": 0,
        "w": 125,
        "h": 40,
        "cf": lv.img.CF.TRUE_COLOR_ALPHA
    },
    "data": blue_img_data,
    "data_size": len(blue_img_data),
})
# Darken the button when pressed
style = lv.style_t()
style.init()
style.set_image_recolor_opa(lv.STATE.PRESSED, lv.OPA._30)
style.set_image_recolor(lv.STATE.PRESSED, lv_colors.BLACK)
style.set_text_color(lv.STATE.DEFAULT, lv_colors.WHITE)

# Create an Image button
imgbtn1 = lv.imgbtn(lv.scr_act(), None)
imgbtn1.set_src(lv.btn.STATE.RELEASED, imgbtn_green_dsc)
imgbtn1.set_src(lv.btn.STATE.PRESSED, imgbtn_green_dsc)
imgbtn1.set_src(lv.btn.STATE.CHECKED_RELEASED, imgbtn_blue_dsc)
imgbtn1.set_src(lv.btn.STATE.CHECKED_PRESSED, imgbtn_blue_dsc)
imgbtn1.set_checkable(True)
imgbtn1.add_style(lv.imgbtn.PART.MAIN, style)
imgbtn1.align(None, lv.ALIGN.CENTER, 0, -40)

# Create a label on the Image button
label = lv.label(imgbtn1, None)
label.set_text("Button")
예제 #13
0
    def main_page(self, tile_num):
        alarm_clock_main_tile = self.mainbar.get_tile_obj(tile_num)
        alarm_clock_main_style = lv.style_t()
        alarm_clock_main_style.copy(self.mainbar.get_style())

        self.activated_cont = lv.obj(alarm_clock_main_tile, None)
        self.activated_cont.set_width(lv.scr_act().get_disp().driver.hor_res)
        self.activated_cont.set_height(30)
        self.activated_cont.add_style(lv.label.PART.MAIN,
                                      alarm_clock_main_style)

        self.activated_label = lv.label(self.activated_cont, None)

        self.activated_label.align(self.activated_cont, lv.ALIGN.IN_LEFT_MID,
                                   10, 0)  # align left
        self.activated_label.set_text("Activated")
        self.activated_label.add_style(lv.label.PART.MAIN,
                                       alarm_clock_main_style)

        # create the activate switch
        self.activated_switch = lv.switch(self.activated_cont, None)
        self.activated_switch.align(self.activated_cont, lv.ALIGN.IN_RIGHT_MID,
                                    -10, 0)

        self.day_cont_style = lv.style_t()
        self.day_cont_style.copy(self.mainbar.get_style())
        self.day_cont_style.set_pad_inner(lv.STATE.DEFAULT, 1)
        self.day_cont_style.set_pad_left(lv.STATE.DEFAULT, 10)
        self.day_cont_style.set_pad_top(lv.STATE.DEFAULT, 4)

        self.day_cont = lv.cont(alarm_clock_main_tile, None)
        self.day_cont.set_width(lv.scr_act().get_disp().driver.hor_res)
        self.day_cont.set_layout(lv.LAYOUT.PRETTY_BOTTOM)
        self.day_cont.set_fit(lv.FIT.NONE)
        self.day_cont.align(self.activated_cont, lv.ALIGN.OUT_BOTTOM_MID, 0, 0)
        self.day_cont.add_style(lv.cont.PART.MAIN, self.day_cont_style)

        # create the day buttons
        day_style = lv.style_t()
        day_style.set_radius(lv.STATE.DEFAULT, 3)

        for i in range(7):
            # create the button
            self.day_button[i] = lv.btn(self.day_cont, None)
            self.day_button[i].set_checkable(True)
            self.day_button[i].add_style(lv.btn.PART.MAIN, day_style)
            self.day_button[i].set_size(30, 30)
            self.day_label[i] = lv.label(self.day_button[i])
            # print("Setting label %d text to: %s"%(i,self.weekDayTable_2[i]))
            self.day_label[i].set_text(self.alarm_clock_week_day_2[i])

        # create a roller for the hours
        for i in range(23):
            self.hours += (str(i) + "\n")
        self.hours += str(23)
        #print(self.hours)
        self.hourRoller = lv.roller(alarm_clock_main_tile, None)
        self.hourRoller.set_auto_fit(False)
        self.hourRoller.set_width(60)
        self.hourRoller.set_visible_row_count(4)
        self.hourRoller.set_options(self.hours, lv.roller.MODE.INFINITE)
        self.hourRoller.align(self.day_cont, lv.ALIGN.OUT_BOTTOM_LEFT, 50, 0)

        for i in range(59):
            # self.minutes += (str(i)+"\n")
            self.minutes += "%02d\n" % i
        self.minutes += str(59)
        self.minuteRoller = lv.roller(alarm_clock_main_tile, None)
        self.minuteRoller.set_auto_fit(False)
        self.minuteRoller.set_width(60)
        self.minuteRoller.set_visible_row_count(4)
        self.minuteRoller.set_options(self.minutes, lv.roller.MODE.INFINITE)
        self.minuteRoller.align(self.day_cont, lv.ALIGN.OUT_BOTTOM_RIGHT, -50,
                                0)

        self.colon = lv.label(alarm_clock_main_tile, None)
        self.colon.set_text(":")
        self.colon.add_style(lv.label.PART.MAIN, self.day_cont_style)
        self.colon.align(self.hourRoller, lv.ALIGN.OUT_RIGHT_MID, 0, 0)

        exit_btn = lv.imgbtn(self.alarm_clock_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, alarm_clock_main_style)
        exit_btn.align(self.alarm_clock_main_tile, lv.ALIGN.IN_BOTTOM_LEFT, 10,
                       -10)
        self.log.debug("setting up exit callback")
        exit_btn.set_event_cb(self.exit_alarm_clock_main_event_cb)

        setup_btn = lv.imgbtn(self.alarm_clock_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, alarm_clock_main_style)
        setup_btn.align(self.alarm_clock_main_tile, lv.ALIGN.IN_BOTTOM_RIGHT,
                        -10, -10)
        self.log.debug("setting up setup callback")
예제 #14
0
# Create a transition animation on width transformation and recolor.
tr_prop = [lv.STYLE.TRANSFORM_WIDTH, lv.STYLE.IMG_RECOLOR_OPA, 0]
tr = lv.style_transition_dsc_t()
tr.init(tr_prop, lv.anim_t.path_linear, 200, 0, None)

style_def = lv.style_t()
style_def.init()
style_def.set_text_color(lv.color_white())
style_def.set_transition(tr)

# Darken the button when pressed and make it wider
style_pr = lv.style_t()
style_pr.init()
style_pr.set_img_recolor_opa(lv.OPA._30)
style_pr.set_img_recolor(lv.color_black())
style_pr.set_transform_width(20)

# Create an image button
imgbtn1 = lv.imgbtn(lv.scr_act())
imgbtn1.set_src(lv.imgbtn.STATE.RELEASED, imgbtn_left_dsc, imgbtn_mid_dsc,
                imgbtn_right_dsc)
imgbtn1.add_style(style_def, 0)
imgbtn1.add_style(style_pr, lv.STATE.PRESSED)

imgbtn1.align(lv.ALIGN.CENTER, 0, 0)

# Create a label on the image button
label = lv.label(imgbtn1)
label.set_text("Button")
label.align(lv.ALIGN.CENTER, 0, -4)
예제 #15
0
    def __init__(self, mainbar):

        self.log = logging.getLogger("main_tile")
        self.log.setLevel(logging.DEBUG)

        self.log.debug("Creating main tile")
        self.mainbar = mainbar
        main_tile_no = mainbar.add_tile(0, 0, "main tile")
        main_tile = mainbar.get_tile_obj(main_tile_no)
        style = mainbar.get_style()

        self.clock_cont = lv.obj(main_tile, None)
        self.clock_cont.set_size(lv.scr_act().get_disp().driver.hor_res,
                                 lv.scr_act().get_disp().driver.ver_res // 2)

        self.clock_cont.add_style(lv.obj.PART.MAIN, style)
        self.clock_cont.align(main_tile, lv.ALIGN.IN_TOP_MID, 0, 0)

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

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

        self.datelabel = lv.label(self.clock_cont, None)
        self.datelabel.align(self.clocklabel, lv.ALIGN.OUT_BOTTOM_LEFT, 40, 20)
        self.datelabel.set_recolor(True)
        self.datelabel.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.MID)

        mainbar.main_tile = self

        #
        # init widgets
        #
        for i in range(MAX_WIDGET_NUM):
            self.widget_table[i] = Icon()
            self.widget_table[i].active = False
            self.widget_table[i].cont = mainbar.obj_create(main_tile)
            self.widget_table[i].cont.add_style(lv.obj.PART.MAIN, style)
            self.widget_table[i].cont.set_size(Constants.WIDGET_X_SIZE,
                                               Constants.WIDGET_Y_SIZE + 20)
            # create app label
            self.widget_table[i].label = lv.label(self.widget_table[i].cont,
                                                  None)
            mainbar.add_slide_element(self.widget_table[i].label)
            self.widget_table[i].label.add_style(lv.obj.PART.MAIN, style)
            self.widget_table[i].label.set_size(Constants.WIDGET_X_SIZE,
                                                Constants.WIDGET_LABEL_Y_SIZE)
            self.widget_table[i].label.set_align(lv.label.ALIGN.CENTER)
            self.widget_table[i].label.align(self.widget_table[i].cont,
                                             lv.ALIGN.IN_BOTTOM_LEFT, 0, -20)
            # create app label
            self.widget_table[i].ext_label = lv.label(
                self.widget_table[i].cont, None)
            mainbar.add_slide_element(self.widget_table[i].ext_label)
            self.widget_table[i].ext_label.add_style(lv.obj.PART.MAIN, style)
            self.widget_table[i].ext_label.set_size(
                Constants.WIDGET_X_SIZE, Constants.WIDGET_LABEL_Y_SIZE)
            self.widget_table[i].ext_label.set_align(lv.label.ALIGN.CENTER)
            self.widget_table[i].ext_label.align(self.widget_table[i].label,
                                                 lv.ALIGN.OUT_BOTTOM_LEFT, 0,
                                                 0)
            # create img and indicator
            self.widget_table[i].button_img = lv.imgbtn(
                self.widget_table[i].cont, None)
            # self.widget_table[i].indicator = lv.img(self.widget_table[i].cont, None)

            # hide all
            self.widget_table[i].cont.set_hidden(True)
            self.widget_table[i].button_img.set_hidden(True)
            # self.widget_table[i].indicator.set_hidden(True)

            self.widget_table[i].label.set_hidden(True)
            self.widget_table[i].ext_label.set_hidden(True)
예제 #16
0
    def __init__(self,mainbar):
        try:
            import ulogging as logging
        except:
            import logging
             
        self.log = logging.getLogger("Stopwatch")
        self.log.setLevel(logging.DEBUG)
        
        self.mainbar=mainbar
        self.statusbar=mainbar.gui.statusbar
        self.app = mainbar.app
        
        self.tile_num = mainbar.add_app_tile( 1, 1, "Stopwatch App" )
        self.log.debug("tile number for main tile: %d",self.tile_num)
        self.stopwatch_tile = mainbar.get_tile_obj(self.tile_num)

        self.stopwatch_style = lv.style_t()
        self.stopwatch_style.copy(self.mainbar.get_style())
        self.stopwatch_style.set_text_font(lv.STATE.DEFAULT,lv.font_montserrat_48)
        
        # create the container
        self.stopwatch_cont = lv.obj(self.stopwatch_tile,None)
        self.stopwatch_cont.set_size(lv.scr_act().get_disp().driver.hor_res,
                                lv.scr_act().get_disp().driver.ver_res//2)
        
        self.stopwatch_cont.add_style(lv.obj.PART.MAIN,self.stopwatch_style)
        self.stopwatch_cont.align(self.stopwatch_tile,lv.ALIGN.CENTER, 0, 0)
        
        self.label = lv.label(self.stopwatch_cont,None)
        self.label.set_text("00:00.0")
        self.label.align(self.stopwatch_cont,lv.ALIGN.CENTER, 0, 0)
        self.label.add_style(lv.obj.PART.MAIN,self.stopwatch_style)
        # create exit button
        self.exit_btn = lv.imgbtn(self.stopwatch_tile,None)        
        self.exit_btn.set_src(lv.btn.STATE.RELEASED,self.mainbar.get_exit_btn_dsc())
        self.exit_btn.add_style(lv.imgbtn.PART.MAIN,self.stopwatch_style)
        self.exit_btn.align(self.stopwatch_tile,lv.ALIGN.IN_BOTTOM_LEFT, 10, -10 )
        self.log.debug("setting up exit callback")
        self.exit_btn.set_event_cb(self.exit_stopwatch_app_event_cb)
        # create start button
        self.start_button = lv.btn(self.stopwatch_tile,None)
        self.start_button.set_size(50, 50)
        self.symbol_style = lv.style_t()
        self.symbol_style.copy(self.stopwatch_style)
        self.symbol_style.set_text_font(lv.STATE.DEFAULT,lv.font_montserrat_32)
        self.start_button.add_style(lv.imgbtn.PART.MAIN, self.symbol_style )
        self.start_button.align(self.stopwatch_tile, lv.ALIGN.IN_BOTTOM_MID, 0, 0 )
        self.start_button.set_event_cb(self.start_stopwatch_event_cb)
        self.start_button_label = lv.label(self.start_button,None)
        self.start_button_label.set_text(lv.SYMBOL.PLAY)

        # create stop button
        self.stop_button = lv.btn(self.stopwatch_tile,None)
        self.stop_button.set_size(50, 50)
        self.stop_button.add_style(lv.imgbtn.PART.MAIN, self.symbol_style )
        self.stop_button.align(self.stopwatch_tile, lv.ALIGN.IN_BOTTOM_MID, 0, 0 )
        self.stop_button.set_event_cb(self.stop_stopwatch_event_cb)
        self.stop_button_label = lv.label(self.stop_button,None)
        self.stop_button_label.set_text(lv.SYMBOL.STOP)
        self.stop_button.set_hidden(True)
        
        # create reset button
        self.reset_button = lv.btn(self.stopwatch_tile,None)
        self.reset_button.set_size(50, 50)
        self.reset_button.add_style(lv.imgbtn.PART.MAIN, self.symbol_style )
        self.reset_button.align(self.stopwatch_tile, lv.ALIGN.IN_BOTTOM_RIGHT, -20, 0 )
        self.reset_button.set_event_cb(self.reset_stopwatch_event_cb)
        self.reset_button_label = lv.label(self.reset_button,None)
        self.reset_button_label.set_text(lv.SYMBOL.EJECT)
        self.is_running=False
        self.log.debug("registering stopwatch app")
        app=self.app.register("stop\nwatch","stopwatch_64px",self.enter_stopwatch_app_event_cb)