mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-05-26 14:03:32 +00:00
fix(dev-preview): address code review issues
- Use get_logger() from src.logging_config instead of logging.getLogger() in visual_display_manager.py to match project logging conventions - Eliminate duplicate public/private weather draw methods — public draw_sun/ draw_cloud/draw_rain/draw_snow now delegate to the private _draw_* variants so plugins get consistent pixel output in tests vs production - Default install_deps=False in dev_server.py and render_plugin.py — dev scripts don't need to run pip install; developers are expected to have plugin deps installed in their venv already - Guard plugins_dir fixture against PermissionError during directory iteration - Fix PluginInstallManager.updateAll() to fall back to window.installedPlugins when PluginStateManager.installedPlugins is empty (plugins_manager.js populates window.installedPlugins independently of PluginStateManager) - Remove 5 debug console.log statements from plugins_manager.js button setup and initialization code Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -12,7 +12,6 @@ MagicMock (which tracks nothing visual), this class creates a real
|
||||
PIL Image canvas and draws text using the actual project fonts.
|
||||
"""
|
||||
|
||||
import logging
|
||||
import math
|
||||
import os
|
||||
import time
|
||||
@@ -21,7 +20,9 @@ from typing import Any, Dict, List, Optional, Tuple
|
||||
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
from src.logging_config import get_logger
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
|
||||
class _MatrixProxy:
|
||||
@@ -322,50 +323,19 @@ class VisualTestDisplayManager:
|
||||
|
||||
def draw_sun(self, x: int, y: int, size: int = 16):
|
||||
"""Draw a sun icon using yellow circles and lines."""
|
||||
center = (x + size // 2, y + size // 2)
|
||||
radius = size // 3
|
||||
self.draw.ellipse(
|
||||
[center[0] - radius, center[1] - radius,
|
||||
center[0] + radius, center[1] + radius],
|
||||
fill=(255, 255, 0),
|
||||
)
|
||||
ray_length = size // 4
|
||||
for angle in range(0, 360, 45):
|
||||
rad = math.radians(angle)
|
||||
start_x = center[0] + (radius * math.cos(rad))
|
||||
start_y = center[1] + (radius * math.sin(rad))
|
||||
end_x = center[0] + ((radius + ray_length) * math.cos(rad))
|
||||
end_y = center[1] + ((radius + ray_length) * math.sin(rad))
|
||||
self.draw.line([start_x, start_y, end_x, end_y], fill=(255, 255, 0), width=2)
|
||||
self._draw_sun(x, y, size)
|
||||
|
||||
def draw_cloud(self, x: int, y: int, size: int = 16, color=(200, 200, 200)):
|
||||
"""Draw a cloud icon."""
|
||||
self.draw.ellipse([x + size // 4, y + size // 3, x + size // 4 + size // 2, y + size // 3 + size // 2], fill=color)
|
||||
self.draw.ellipse([x + size // 2, y + size // 3, x + size // 2 + size // 2, y + size // 3 + size // 2], fill=color)
|
||||
self.draw.ellipse([x + size // 3, y + size // 6, x + size // 3 + size // 2, y + size // 6 + size // 2], fill=color)
|
||||
self._draw_cloud(x, y, size)
|
||||
|
||||
def draw_rain(self, x: int, y: int, size: int = 16):
|
||||
"""Draw rain icon with cloud and droplets."""
|
||||
self.draw_cloud(x, y, size)
|
||||
drop_color = (0, 0, 255)
|
||||
drop_size = size // 6
|
||||
for i in range(3):
|
||||
drop_x = x + size // 4 + (i * size // 3)
|
||||
drop_y = y + size // 2
|
||||
self.draw.line([drop_x, drop_y, drop_x, drop_y + drop_size], fill=drop_color, width=2)
|
||||
self._draw_rain(x, y, size)
|
||||
|
||||
def draw_snow(self, x: int, y: int, size: int = 16):
|
||||
"""Draw snow icon with cloud and snowflakes."""
|
||||
self.draw_cloud(x, y, size)
|
||||
snow_color = (200, 200, 255)
|
||||
for i in range(3):
|
||||
center_x = x + size // 4 + (i * size // 3)
|
||||
center_y = y + size // 2 + size // 4
|
||||
for angle in range(0, 360, 60):
|
||||
rad = math.radians(angle)
|
||||
end_x = center_x + (size // 8 * math.cos(rad))
|
||||
end_y = center_y + (size // 8 * math.sin(rad))
|
||||
self.draw.line([center_x, center_y, end_x, end_y], fill=snow_color, width=1)
|
||||
self._draw_snow(x, y, size)
|
||||
|
||||
def _draw_sun(self, x: int, y: int, size: int) -> None:
|
||||
"""Draw a sun icon with rays (internal weather icon version)."""
|
||||
|
||||
Reference in New Issue
Block a user