changes
This commit is contained in:
20
display.py
20
display.py
@@ -213,10 +213,10 @@ def draw_weather(surface: pygame.Surface, fonts: dict, x: int, y: int) -> None:
|
|||||||
surface.blit(fonts['tiny'].render(row2_fn(item), True, WHITE), (cx, start_y + row))
|
surface.blit(fonts['tiny'].render(row2_fn(item), True, WHITE), (cx, start_y + row))
|
||||||
surface.blit(fonts['tiny'].render(row3_fn(item), True, DIM_GRAY), (cx, start_y + 2*row))
|
surface.blit(fonts['tiny'].render(row3_fn(item), True, DIM_GRAY), (cx, start_y + 2*row))
|
||||||
|
|
||||||
# Town name header (small font — bigger than the grid text)
|
# Town name header
|
||||||
town_h = fonts['small'].get_height()
|
town_h = fonts['medium'].get_height()
|
||||||
if town:
|
if town:
|
||||||
surface.blit(fonts['small'].render(town, True, GRAY), (x, y))
|
surface.blit(fonts['medium'].render(town, True, GRAY), (x, y))
|
||||||
|
|
||||||
if not week:
|
if not week:
|
||||||
surface.blit(fonts['tiny'].render('Loading…', True, DIM_GRAY), (x, y + town_h + 4))
|
surface.blit(fonts['tiny'].render('Loading…', True, DIM_GRAY), (x, y + town_h + 4))
|
||||||
@@ -238,9 +238,6 @@ def draw_weather(surface: pygame.Surface, fonts: dict, x: int, y: int) -> None:
|
|||||||
lambda h: _trunc(h['desc']))
|
lambda h: _trunc(h['desc']))
|
||||||
|
|
||||||
|
|
||||||
def draw_dot(surface: pygame.Surface, cx: int, y: int, radius: int = 9) -> None:
|
|
||||||
pygame.draw.circle(surface, WHITE, (cx, y), radius)
|
|
||||||
|
|
||||||
|
|
||||||
# ── Font helper ───────────────────────────────────────────────────────────────
|
# ── Font helper ───────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
@@ -271,16 +268,16 @@ def main() -> None:
|
|||||||
pygame.mouse.set_visible(False)
|
pygame.mouse.set_visible(False)
|
||||||
|
|
||||||
fonts = {
|
fonts = {
|
||||||
'large': _load_font(38),
|
'large': _load_font(38),
|
||||||
'small': _load_font(13),
|
'medium': _load_font(18),
|
||||||
'tiny': _load_font(11),
|
'small': _load_font(13),
|
||||||
|
'tiny': _load_font(11),
|
||||||
}
|
}
|
||||||
|
|
||||||
face_rx = int(min(W, H) * 0.085)
|
face_rx = int(min(W, H) * 0.085)
|
||||||
face_ry = int(min(W, H) * 0.100)
|
face_ry = int(min(W, H) * 0.100)
|
||||||
face_cx = W // 2
|
face_cx = W // 2
|
||||||
face_cy = int(face_ry * 1.2) + 8
|
face_cy = int(face_ry * 1.2) + 8
|
||||||
dot_y = int(H * 0.895)
|
|
||||||
|
|
||||||
clock_block_h = fonts['small'].get_height() + 4 + fonts['large'].get_height()
|
clock_block_h = fonts['small'].get_height() + 4 + fonts['large'].get_height()
|
||||||
clock_y = face_cy - clock_block_h // 2
|
clock_y = face_cy - clock_block_h // 2
|
||||||
@@ -324,8 +321,7 @@ def main() -> None:
|
|||||||
|
|
||||||
draw_clock(screen, fonts, 20, clock_y)
|
draw_clock(screen, fonts, 20, clock_y)
|
||||||
draw_weather(screen, fonts, weather_x,
|
draw_weather(screen, fonts, weather_x,
|
||||||
clock_y - fonts['small'].get_height() - 4)
|
clock_y - fonts['medium'].get_height() - 4)
|
||||||
draw_dot(screen, W // 2, dot_y)
|
|
||||||
|
|
||||||
pygame.display.flip()
|
pygame.display.flip()
|
||||||
pg_clock.tick(10)
|
pg_clock.tick(10)
|
||||||
|
|||||||
Reference in New Issue
Block a user