EMF_Camp_Badge/home_default/main.py

46 lines
1.2 KiB
Python
Raw Normal View History

2018-07-15 06:53:48 -04:00
"""Default homescreen
This is the default homescreen for the Tilda Mk4.
It gets automatically installed when a badge is
newly activated or reset.
"""
___name___ = "Homescreen (Default)"
2018-08-27 05:02:16 -04:00
___license___ = "MIT"
2018-07-15 06:53:48 -04:00
___categories___ = ["homescreen"]
2018-08-05 17:14:31 -04:00
___dependencies___ = ["homescreen"]
2018-07-15 06:53:48 -04:00
___launchable___ = False
___bootstrapped___ = True
2018-08-05 17:14:31 -04:00
import ugfx
from homescreen import *
import time
init()
2018-08-24 18:00:09 -04:00
ugfx.clear()
2018-08-05 17:14:31 -04:00
# title
2018-08-24 18:00:09 -04:00
#ugfx.set_default_font(ugfx.FONT_MEDIUM_BOLD)
ugfx.Label(0, 20, ugfx.width(), 40, "TiLDA Mk4") # , justification=ugfx.Label.CENTERTOP
2018-08-05 17:14:31 -04:00
# name
if name():
2018-08-24 18:00:09 -04:00
#ugfx.set_default_font(ugfx.FONT_NAME)
ugfx.Label(0, 60, ugfx.width(), 40, name()) # , justification=ugfx.Label.CENTERTOP
2018-08-05 17:14:31 -04:00
else:
2018-08-24 18:00:09 -04:00
#ugfx.set_default_font(ugfx.FONT_MEDIUM)
ugfx.Label(0, 60, ugfx.width(), 40, "Set your name in the settings app") # , justification=ugfx.Label.CENTERTOP
2018-08-05 17:14:31 -04:00
# info
2018-08-24 18:00:09 -04:00
ugfx.Label(0, 200, ugfx.width(), 40, "Press MENU") # , justification=ugfx.Label.CENTERTOP
2018-08-05 17:14:31 -04:00
2018-08-24 18:00:09 -04:00
#ugfx.set_default_font(ugfx.FONT_MEDIUM)
status = ugfx.Label(0, 130, ugfx.width(), 40, "") # , justification=ugfx.Label.CENTERTOP
2018-08-05 17:14:31 -04:00
# update loop
2018-08-06 16:45:35 -04:00
while True:
2018-08-05 17:14:31 -04:00
status.text("wifi: %s%%\nbattery: %s%%" % (int(wifi_strength() * 100), int(battery() * 100)))
2018-08-24 18:00:09 -04:00
sleep_or_exit(0.5)
2018-07-15 06:53:48 -04:00