Skip to content

Commit f4c12ef

Browse files
committed
feat: display version on startup
1 parent 84c1696 commit f4c12ef

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

middag.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from luma.core.legacy import text, show_message
1717
from luma.core.legacy.font import proportional, CP437_FONT, TINY_FONT, SINCLAIR_FONT, LCD_FONT
1818
from backports.datetime_fromisoformat import MonkeyPatch
19+
from pathlib import Path
1920

2021
MonkeyPatch.patch_fromisoformat()
2122
# If modifying these scopes, delete the file token.pickle.
@@ -62,6 +63,11 @@ def main(argv):
6263
"""Shows basic usage of the Google Calendar API.
6364
Prints the start and name of the next 10 events on the user's calendar.
6465
"""
66+
67+
# Get version
68+
version = Path('version.txt').read_text().replace('\n','')
69+
print("Version: ", version)
70+
6571
creds = None
6672
# The file token.pickle stores the user's access and refresh tokens, and is
6773
# created automatically when the authorization flow completes for the first
@@ -87,7 +93,11 @@ def main(argv):
8793
serial = spi(port=0, device=0, gpio=noop())
8894
device = max7219(serial, cascaded=8, block_orientation=90, rotate=0)
8995
print("Created device")
90-
96+
97+
# Show version
98+
show_message(device, "Ver. " + version, fill="white", font=proportional(CP437_FONT))
99+
time.sleep(4)
100+
91101
start = time.perf_counter()
92102
while (start + 550) > time.perf_counter() or loop:
93103
# Call the Calendar API

0 commit comments

Comments
 (0)