Formatting

This commit is contained in:
2025-02-16 20:37:42 +00:00
parent 018643dde9
commit 61eed0d0f9
3 changed files with 25 additions and 11 deletions

BIN
Nunito-Bold.ttf Normal file

Binary file not shown.

View File

@@ -12,3 +12,7 @@ python3 -m venv .venv
source .venv/bin/activate source .venv/bin/activate
pip install -r requirements.txt pip install -r requirements.txt
``` ```
## Todo
- [ ] Accurate temp

View File

@@ -14,7 +14,7 @@ white = "#ffffff"
fontSymbols = ImageFont.truetype("SymbolsNerdFont-Regular.ttf", 18) fontSymbols = ImageFont.truetype("SymbolsNerdFont-Regular.ttf", 18)
fontTitle = ImageFont.truetype("Nunito-SemiBold.ttf", 24) fontTitle = ImageFont.truetype("Nunito-Bold.ttf", 24)
fontLarge = ImageFont.truetype("Nunito-ExtraLight.ttf", 18) fontLarge = ImageFont.truetype("Nunito-ExtraLight.ttf", 18)
fontLargeBold = ImageFont.truetype("Nunito-SemiBold.ttf", 18) fontLargeBold = ImageFont.truetype("Nunito-SemiBold.ttf", 18)
fontSmall = ImageFont.truetype("Nunito-ExtraLight.ttf", 16) fontSmall = ImageFont.truetype("Nunito-ExtraLight.ttf", 16)
@@ -56,31 +56,40 @@ def draw_image():
draw = ImageDraw.Draw(image) draw = ImageDraw.Draw(image)
# Draw the top bar # Draw the top bar
topbar = 26
draw.rectangle((0, 0, 400, 300), fill=white) draw.rectangle((0, 0, 400, 300), fill=white)
draw.rectangle((0, 0, 400, 30), fill=black) draw.rectangle((0, 0, 400, topbar), fill=black)
# Add the clock # Add the clock
timeStr = strftime("%H:%M", time.localtime()) timeStr = strftime("%H:%M", time.localtime())
draw.text((10, 5), timeStr, white, fontSmall) draw.text((10, 3), timeStr, white, fontSmall)
# Add indoor tempriture # Add indoor temperature
draw.text((350, 5), "19c", white, fontSmall) draw.text((350, 3), "19c", white, fontSmall)
# Add sections # Add sections
ep = 3 ep = 3
margin = 5
draw.rounded_rectangle( draw.rounded_rectangle(
(ep, 30 + ep, (400 / 2) - ep, 300 - ep), 10, outline=black, width=2 (margin, topbar + margin, (400 / 2) - margin, 300 - margin),
10,
outline=black,
width=2,
) )
draw.rounded_rectangle( draw.rounded_rectangle(
((400 / 2) + ep, 30 + ep, 400 - ep, 300 - ep), 10, outline=black, width=2 ((400 / 2) + margin, topbar + margin, 400 - margin, 300 - margin),
10,
outline=black,
width=2,
) )
# Add tasks # Add tasks
draw.text((15, 40), "Tasks", black, fontTitle) draw.text((20, topbar + 7), "Tasks", black, fontTitle)
draw.line((margin, 62, 200 - margin, 62), fill=black, width=1)
tasks = get_todo_items() tasks = get_todo_items()
taskStart = 80 taskStart = 70
for task in tasks: for task in tasks:
if task["status"] == "completed": if task["status"] == "completed":
continue continue
@@ -96,7 +105,8 @@ def draw_image():
taskStart += titleSizeH + (2 * ep) taskStart += titleSizeH + (2 * ep)
# Add cal # Add cal
draw.text((215, 40), "Calendar", black, fontTitle) draw.text((220, topbar + 7), "Calendar", black, fontTitle)
draw.line(((400 / 2) + margin, 62, 400 - margin, 62), fill=black, width=1)
events = get_calendar_events() events = get_calendar_events()
def get_start_date(x): def get_start_date(x):
@@ -114,7 +124,7 @@ def draw_image():
else: else:
return startDate return startDate
itemStart = 80 itemStart = 70
try: try:
for key, group in groupby(events, get_start_date): for key, group in groupby(events, get_start_date):
if key == datetime.today().date(): if key == datetime.today().date():