From 8f11ae36e4f62b07015b04a1cdb8d892cb32e25a Mon Sep 17 00:00:00 2001 From: Chuck <33324927+ChuckBuilds@users.noreply.github.com> Date: Thu, 10 Apr 2025 20:27:07 -0500 Subject: [PATCH] News tuning removed test files and increased scroll speed --- config/config.json | 2 +- test_news_ticker.py | 44 -------------------- test_scroll_direction.py | 87 ---------------------------------------- test_smooth_scroll.py | 59 --------------------------- 4 files changed, 1 insertion(+), 191 deletions(-) delete mode 100644 test_news_ticker.py delete mode 100644 test_scroll_direction.py delete mode 100644 test_smooth_scroll.py diff --git a/config/config.json b/config/config.json index b7e189ed..1a6556ca 100644 --- a/config/config.json +++ b/config/config.json @@ -54,7 +54,7 @@ "news": { "enabled": true, "update_interval": 300, - "scroll_speed": 2, + "scroll_speed": 10, "scroll_delay": 0.03, "max_headlines_per_symbol": 1 } diff --git a/test_news_ticker.py b/test_news_ticker.py deleted file mode 100644 index c4d9f2dc..00000000 --- a/test_news_ticker.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env python3 -import time -import sys -import os -from src.config_manager import ConfigManager -from src.display_manager import DisplayManager -from src.news_manager import NewsManager - -def main(): - """Test the news ticker functionality.""" - try: - # Load configuration - config_manager = ConfigManager() - config = config_manager.config - - # Initialize display manager - display_manager = DisplayManager(config.get('display', {})) - - # Initialize news manager - news_manager = NewsManager(config, display_manager) - - print("News ticker test started. Press Ctrl+C to exit.") - print("Displaying news headlines for configured stock symbols...") - - # Display news headlines for a limited time (30 seconds) - start_time = time.time() - while time.time() - start_time < 30: - news_manager.display_news() - - print("Test completed successfully.") - - except KeyboardInterrupt: - print("\nTest interrupted by user.") - except Exception as e: - print(f"Error: {e}") - finally: - # Clean up - if 'display_manager' in locals(): - display_manager.clear() - display_manager.update_display() - display_manager.cleanup() - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/test_scroll_direction.py b/test_scroll_direction.py deleted file mode 100644 index 7fe48583..00000000 --- a/test_scroll_direction.py +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/env python3 -import time -import sys -import os -from src.config_manager import ConfigManager -from src.display_manager import DisplayManager -from src.news_manager import NewsManager - -def main(): - """Test the scrolling direction of the news ticker.""" - try: - # Load configuration - config_manager = ConfigManager() - config = config_manager.load_config() - - # Initialize display manager - display_manager = DisplayManager(config.get('display', {})) - - # Initialize news manager - news_manager = NewsManager(config, display_manager) - - print("Starting scroll direction test...") - print("This test will display a simple text message scrolling from left to right") - print("Press Ctrl+C to exit") - - # Create a simple test message - test_message = "TEST MESSAGE - This is a test of scrolling direction" - - # Create a text image for the test message - text_image = news_manager._create_text_image(test_message) - text_width = text_image.width - - # Clear the display - display_manager.clear() - display_manager.update_display() - - # Test scrolling from left to right - scroll_position = 0 - while True: - # Create a new frame - frame_image = display_manager.create_blank_image() - - # Calculate the visible portion - visible_width = min(display_manager.matrix.width, text_width) - src_x = scroll_position - src_width = min(visible_width, text_width - src_x) - - # Copy the visible portion - if src_width > 0: - src_region = text_image.crop((src_x, 0, src_x + src_width, display_manager.matrix.height)) - frame_image.paste(src_region, (0, 0)) - - # Handle wrapping - if src_x + src_width >= text_width: - remaining_width = display_manager.matrix.width - src_width - if remaining_width > 0: - wrap_src_width = min(remaining_width, text_width) - wrap_region = text_image.crop((0, 0, wrap_src_width, display_manager.matrix.height)) - frame_image.paste(wrap_region, (src_width, 0)) - - # Update the display - display_manager.image = frame_image - display_manager.draw = display_manager.create_draw_object() - display_manager.update_display() - - # Update scroll position - scroll_position += 1 - - # Reset when we've scrolled past the end - if scroll_position > text_width + display_manager.matrix.width: - scroll_position = 0 - time.sleep(1) # Pause briefly before restarting - - time.sleep(0.05) # Control scroll speed - - except KeyboardInterrupt: - print("\nTest interrupted by user") - except Exception as e: - print(f"Error during test: {e}") - finally: - # Clean up - display_manager.clear() - display_manager.update_display() - print("Test completed") - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/test_smooth_scroll.py b/test_smooth_scroll.py deleted file mode 100644 index 4ee1670b..00000000 --- a/test_smooth_scroll.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env python3 -import time -import sys -import os -from src.config_manager import ConfigManager -from src.display_manager import DisplayManager -from src.news_manager import NewsManager - -def main(): - """Test the smooth scrolling performance of the news ticker.""" - try: - # Load configuration - config_manager = ConfigManager() - config = config_manager.config - - # Initialize display manager - display_manager = DisplayManager(config.get('display', {})) - - # Initialize news manager - news_manager = NewsManager(config, display_manager) - - print("Smooth scrolling test started. Press Ctrl+C to exit.") - print("Displaying news headlines with optimized scrolling...") - - # Clear the display first - display_manager.clear() - display_manager.update_display() - - # Display news headlines for a longer time to test scrolling performance - start_time = time.time() - frame_count = 0 - - while time.time() - start_time < 60: # Run for 1 minute - news_manager.display_news() - frame_count += 1 - - # Print FPS every 5 seconds - elapsed = time.time() - start_time - if int(elapsed) % 5 == 0 and int(elapsed) > 0: - fps = frame_count / elapsed - print(f"FPS: {fps:.2f}") - frame_count = 0 - start_time = time.time() - - print("Test completed successfully.") - - except KeyboardInterrupt: - print("\nTest interrupted by user.") - except Exception as e: - print(f"Error: {e}") - finally: - # Clean up - if 'display_manager' in locals(): - display_manager.clear() - display_manager.update_display() - display_manager.cleanup() - -if __name__ == "__main__": - main() \ No newline at end of file