From 0edf7aa1e78f93acedf783850e2ebd1204ca7681 Mon Sep 17 00:00:00 2001 From: Philip Henning Date: Sun, 2 Sep 2018 13:09:03 +0200 Subject: [PATCH] Stratum 0 flavored homescreen --- home_stratum0/logo.png | Bin 0 -> 3472 bytes home_stratum0/main.py | 88 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 home_stratum0/logo.png create mode 100644 home_stratum0/main.py diff --git a/home_stratum0/logo.png b/home_stratum0/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..5c10a9f637d48fead2c800bc1b594a51f067f048 GIT binary patch literal 3472 zcmWkx1z1yU6duwgDM+WZ6A8r;(#?h_GD4&oF>=5Zq*Gc1Bqqp2;3o$NNIIl(0s@XM zrDcG0$$x$B7tcNSp6@y5yYKg&_a>M^^%&{6=|CV5qk+D*88AbD?oLAmj9ZGD^T0&q zV5FxFy8L$)wv}W67Fr*DOMk$F_^*>`O5~vdBQ?svM2C8bmW%~_T|C$Xuz5= zH^=W$eP!+y&ZDLGx9|CeBgpm$#x{L&Q^0$k+v~1ytfH*5%F?*%+zuCT>->1h9%}hS z&oobVoky`MGR4cYn(yjga~K*8{T0;Ve=)P&Ac%f-M!np!IyZko3L<@4JttwP!xxJ6 zMOj-a(hxfPM6V7k{)|G+RfJTKNn5#%6(o}+7 zLQ)c+z$V@lz+z-zVp81Msp*bD6fQ2>H(L~qu9p@SMf&;q=?kYbdtA<5Nlr|}Mn+yS zlVDenlhdp-p`xNHZEek0`+MxDR=B>tj#?hLCYMK0u+YYinA+P5Ra!TGlOL|Akom8? zT%=_d>Thl=#`dH=B!`ui^}`jy*RSuVrl#&O`qaK5xJZG){FkvB2L}hJ4nr?5Fqt3= zNXEK>;i$aAwv8Jk$eP$qbMw@5LD{H50#6mCw%}Mj&1Jt3G}#iQTU; z7!zG=df9y3RX$-Bma~;^2i#|b!koX6y8`#_-?MG4YN9-kZhBhEUWmY`Bu8S*6j^vdGj;5HCZ_&kcIu;=B z@WjN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ly(xUyMqDnzg@S_O zc;95g^UnVM{%4@7d*1m1G$%PcFwV~l&~t*jA}Q$?wzrvZ@TB2kQwnNo|F+w(KTCH31{ z`Yy8p)^peU0GJwswyS)WSLXrmvhzTG?^X1<`Yf6BEljfIEQXJ00HQLoKoeZ%C!(!IE-gDZv zw*0^RKG~_xsEa2)lIs3ff&dMs@~2OPhLJG_F2g?^*F1#;whWM63=9l~9UTHxQDnde nFflPX-tM?e%g$cSAUhKnTc9ZCn48e~_orl_1J$n5w2S;7q;0Q; literal 0 HcmV?d00001 diff --git a/home_stratum0/main.py b/home_stratum0/main.py new file mode 100644 index 0000000..33358f1 --- /dev/null +++ b/home_stratum0/main.py @@ -0,0 +1,88 @@ +"""Stratum 0 homescreen + +This is the Stratum 0 flavored homescreen for the Tilda Mk4. +""" + +___name___ = "Homescreen (Stratum 0)" +___license___ = "MIT" +___categories___ = ["Homescreens"] +___dependencies___ = ["homescreen"] + +import ugfx +from homescreen import * +import time +from tilda import Buttons + +# Init Homescreen +init() + +# Padding for name +intro_height = 30 +intro_text = "Moin! I'm" +name_height = 60 +status_height = 20 +info_height = 30 +logo_path = "home_stratum0/logo.png" +logo_height = 106 +logo_width = 58 + +# Maximum length of name before downscaling +max_name = 8 + +# Background stuff +ugfx.clear(ugfx.html_color(0x000000)) + +# Colour stuff +style = ugfx.Style() +style.set_enabled([ugfx.WHITE, ugfx.html_color(0x000000), ugfx.html_color(0x000000), ugfx.html_color(0x000000)]) +style.set_background(ugfx.html_color(0x000000)) +ugfx.set_default_style(style) + +# Logo stuff +ugfx.orientation(90) +ugfx.display_image( + int((ugfx.width() - logo_width) / 2), + int((ugfx.height() - logo_height) / 2), + logo_path +) + +# Draw for people to see +ugfx.orientation(90) +# Draw introduction +ugfx.set_default_font(ugfx.FONT_TITLE) +ugfx.Label(0, ugfx.height() - name_height - intro_height, ugfx.width(), intro_height, intro_text, justification=ugfx.Label.CENTER) +# Process name +name_setting = name("Set your name in the settings app") +if len(name_setting) <= max_name: + ugfx.set_default_font(ugfx.FONT_NAME) +else: + ugfx.set_default_font(ugfx.FONT_MEDIUM_BOLD) +# Draw name +ugfx.Label(0, ugfx.height() - name_height, ugfx.width(), name_height, name_setting, justification=ugfx.Label.CENTER) + + + +# Draw for wearer to see +ugfx.orientation(270) +# Title +ugfx.set_default_font(ugfx.FONT_TITLE) +ugfx.Label(0, ugfx.height() - info_height * 2, ugfx.width(), info_height, "TiLDA Mk4", justification=ugfx.Label.CENTER) +# info +ugfx.Label(0, ugfx.height() - info_height, ugfx.width(), info_height, "Long Press MENU", justification=ugfx.Label.CENTER) + +ugfx.set_default_font(ugfx.FONT_SMALL) +status = ugfx.Label(0, ugfx.height() - info_height * 2 - status_height, ugfx.width(), status_height, "", justification=ugfx.Label.CENTER) + +# WiFi/Battery update loop +while True: + text = ""; + value_wifi_strength = wifi_strength() + value_battery = battery() + if value_wifi_strength: + text += "Wi-Fi: %s%%, " % int(value_wifi_strength) + if value_battery: + text += "Battery: %s%%" % int(value_battery) + status.text(text) + sleep_or_exit(5.0) + +app.restart_to_default()