mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 21:03:01 +00:00
Update display_manager.py
font call order issues
This commit is contained in:
@@ -22,11 +22,7 @@ class DisplayManager:
|
|||||||
if not DisplayManager._initialized:
|
if not DisplayManager._initialized:
|
||||||
self.config = config
|
self.config = config
|
||||||
logger.info("Initializing DisplayManager with config: %s", config)
|
logger.info("Initializing DisplayManager with config: %s", config)
|
||||||
self._setup_matrix() # This now sets self.matrix
|
self._setup_matrix() # This now sets self.matrix and self.font
|
||||||
# Use appropriate font size for 32px height
|
|
||||||
self.font = ImageFont.truetype("DejaVuSans.ttf", 14)
|
|
||||||
self.image = Image.new('RGB', (self.matrix.width, self.matrix.height))
|
|
||||||
self.draw = ImageDraw.Draw(self.image)
|
|
||||||
DisplayManager._initialized = True
|
DisplayManager._initialized = True
|
||||||
|
|
||||||
def _setup_matrix(self):
|
def _setup_matrix(self):
|
||||||
@@ -67,6 +63,14 @@ class DisplayManager:
|
|||||||
self.image = Image.new('RGB', (self.matrix.width, self.matrix.height))
|
self.image = Image.new('RGB', (self.matrix.width, self.matrix.height))
|
||||||
self.draw = ImageDraw.Draw(self.image)
|
self.draw = ImageDraw.Draw(self.image)
|
||||||
|
|
||||||
|
# Initialize font
|
||||||
|
try:
|
||||||
|
self.font = ImageFont.truetype("DejaVuSans.ttf", 14)
|
||||||
|
logger.info("Font initialized successfully")
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Failed to load font: {e}")
|
||||||
|
raise
|
||||||
|
|
||||||
# Draw a test pattern
|
# Draw a test pattern
|
||||||
self._draw_test_pattern()
|
self._draw_test_pattern()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user