Clean up
11
.gitignore
vendored
@ -1,10 +1,11 @@
|
|||||||
/__pycache__/
|
/__pycache__/
|
||||||
|
|
||||||
# Effie's python environment
|
# Effie's python environment
|
||||||
/bin
|
/bin/
|
||||||
/include
|
/include/
|
||||||
/lib
|
/lib/
|
||||||
/lib64
|
/lib64/
|
||||||
pyvenv.cfg
|
/pyvenv.cfg
|
||||||
|
|
||||||
/test*.png
|
/test*.png
|
||||||
/cache.sqlite
|
/cache.sqlite
|
||||||
|
|||||||
13
__main__.py
@ -1,10 +1,6 @@
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from PIL import Image, ImageDraw, ImageFont
|
from PIL import Image, ImageDraw, ImageFont
|
||||||
|
|
||||||
def scale_to_height(icon):
|
|
||||||
scale = 100 / icon.height
|
|
||||||
return icon.resize((int(icon.width * scale), int(icon.height * scale)))
|
|
||||||
|
|
||||||
BLACK = 0x000000 # 00 BGR
|
BLACK = 0x000000 # 00 BGR
|
||||||
WHITE = 0xffffff # 01
|
WHITE = 0xffffff # 01
|
||||||
YELLOW = 0x00ffff # 10
|
YELLOW = 0x00ffff # 10
|
||||||
@ -18,9 +14,8 @@ fonttime = ImageFont.truetype('NETWORKSANS-2019-REGULAR.TTF', 92)
|
|||||||
image = Image.new('RGB', (800, 480), WHITE)
|
image = Image.new('RGB', (800, 480), WHITE)
|
||||||
draw = ImageDraw.Draw(image)
|
draw = ImageDraw.Draw(image)
|
||||||
|
|
||||||
|
|
||||||
# Backing image
|
# Backing image
|
||||||
with Image.open('ui test 2.png').convert('RGBA') as bg:
|
with Image.open('assets/ui test 2.png').convert('RGBA') as bg:
|
||||||
image.paste(bg, (0, 0))
|
image.paste(bg, (0, 0))
|
||||||
|
|
||||||
# Time
|
# Time
|
||||||
@ -43,9 +38,9 @@ draw.text((123, 237), f'{temphigh}', font=font42, anchor="ms", fill=WHITE)
|
|||||||
rainfall = 3
|
rainfall = 3
|
||||||
rainthreshold = 5
|
rainthreshold = 5
|
||||||
if rainfall > rainthreshold:
|
if rainfall > rainthreshold:
|
||||||
rainimgpath = 'rain.png'
|
rainimgpath = 'assets/rain.png'
|
||||||
else:
|
else:
|
||||||
rainimgpath = 'sun.png'
|
rainimgpath = 'assets/sun.png'
|
||||||
draw.text((40, 0), f'{rainfall}', font=font64, anchor="mt")
|
draw.text((40, 0), f'{rainfall}', font=font64, anchor="mt")
|
||||||
with Image.open(rainimgpath) as rainimg:
|
with Image.open(rainimgpath) as rainimg:
|
||||||
image.paste(rainimg, mask=rainimg)
|
image.paste(rainimg, mask=rainimg)
|
||||||
@ -60,7 +55,7 @@ pal_image.putpalette((0x00,0x00,0x00, 0xff,0xff,0xff, 0xff,0xff,0x00, 0xff,0x00,
|
|||||||
image_4color = image.quantize(palette=pal_image, dither=Image.NONE)
|
image_4color = image.quantize(palette=pal_image, dither=Image.NONE)
|
||||||
image_4color.save('test_after_palette.png')
|
image_4color.save('test_after_palette.png')
|
||||||
|
|
||||||
show_on_screen = False
|
show_on_screen = True
|
||||||
if show_on_screen:
|
if show_on_screen:
|
||||||
import epd7in3g as epd
|
import epd7in3g as epd
|
||||||
try:
|
try:
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
BIN
icon_bus.png
|
Before Width: | Height: | Size: 31 KiB |
BIN
icon_train.png
|
Before Width: | Height: | Size: 27 KiB |
BIN
icon_tram.png
|
Before Width: | Height: | Size: 32 KiB |
@ -1,4 +1,5 @@
|
|||||||
colorzero==2.0
|
colorzero==2.0
|
||||||
gpiozero==2.0.1
|
gpiozero==2.0.1
|
||||||
|
lgpio==0.2.2.0
|
||||||
pillow==11.2.1
|
pillow==11.2.1
|
||||||
spidev==3.6
|
spidev==3.6
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |