mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-11 05:13:01 +00:00
feat(weather): Adjust layout and reduce font size
Remove update time text and use smaller font for pressure/humidity/wind details.
This commit is contained in:
@@ -128,12 +128,17 @@ class DisplayManager:
|
|||||||
# Use the same font for small text, just at a smaller size
|
# Use the same font for small text, just at a smaller size
|
||||||
self.small_font = ImageFont.truetype("assets/fonts/PressStart2P-Regular.ttf", 8)
|
self.small_font = ImageFont.truetype("assets/fonts/PressStart2P-Regular.ttf", 8)
|
||||||
logger.info("Press Start 2P small font loaded successfully")
|
logger.info("Press Start 2P small font loaded successfully")
|
||||||
|
|
||||||
|
# Add an even smaller font
|
||||||
|
self.extra_small_font = ImageFont.truetype("assets/fonts/PressStart2P-Regular.ttf", 6)
|
||||||
|
logger.info("Press Start 2P extra small font loaded successfully")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error in font loading: {e}")
|
logger.error(f"Error in font loading: {e}")
|
||||||
# Fallback to default font
|
# Fallback to default font
|
||||||
self.regular_font = ImageFont.load_default()
|
self.regular_font = ImageFont.load_default()
|
||||||
self.small_font = self.regular_font
|
self.small_font = self.regular_font
|
||||||
|
self.extra_small_font = self.regular_font # Fallback for extra small
|
||||||
|
|
||||||
def draw_text(self, text: str, x: int = None, y: int = None, color: Tuple[int, int, int] = (255, 255, 255), small_font: bool = False) -> None:
|
def draw_text(self, text: str, x: int = None, y: int = None, color: Tuple[int, int, int] = (255, 255, 255), small_font: bool = False) -> None:
|
||||||
"""Draw text on the display with improved clarity."""
|
"""Draw text on the display with improved clarity."""
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ class WeatherManager:
|
|||||||
pressure_text = f"P:{pressure:.1f}in" # Even shorter format
|
pressure_text = f"P:{pressure:.1f}in" # Even shorter format
|
||||||
draw.text((2, y_start),
|
draw.text((2, y_start),
|
||||||
pressure_text,
|
pressure_text,
|
||||||
font=self.display_manager.small_font,
|
font=self.display_manager.extra_small_font,
|
||||||
fill=self.COLORS['dim']) # Using dimmer color
|
fill=self.COLORS['dim']) # Using dimmer color
|
||||||
|
|
||||||
# Humidity (shortened format)
|
# Humidity (shortened format)
|
||||||
@@ -276,7 +276,7 @@ class WeatherManager:
|
|||||||
humidity_text = f"H:{humidity}%" # Even shorter format
|
humidity_text = f"H:{humidity}%" # Even shorter format
|
||||||
draw.text((2, y_start + spacing),
|
draw.text((2, y_start + spacing),
|
||||||
humidity_text,
|
humidity_text,
|
||||||
font=self.display_manager.small_font,
|
font=self.display_manager.extra_small_font,
|
||||||
fill=self.COLORS['dim']) # Using dimmer color
|
fill=self.COLORS['dim']) # Using dimmer color
|
||||||
|
|
||||||
# Wind speed and direction (shortened format)
|
# Wind speed and direction (shortened format)
|
||||||
@@ -286,7 +286,7 @@ class WeatherManager:
|
|||||||
wind_text = f"W:{wind_speed:.0f}{wind_dir}" # Even shorter format, removed decimal
|
wind_text = f"W:{wind_speed:.0f}{wind_dir}" # Even shorter format, removed decimal
|
||||||
draw.text((2, y_start + spacing * 2),
|
draw.text((2, y_start + spacing * 2),
|
||||||
wind_text,
|
wind_text,
|
||||||
font=self.display_manager.small_font,
|
font=self.display_manager.extra_small_font,
|
||||||
fill=self.COLORS['dim']) # Using dimmer color
|
fill=self.COLORS['dim']) # Using dimmer color
|
||||||
|
|
||||||
# Update the display
|
# Update the display
|
||||||
|
|||||||
Reference in New Issue
Block a user