Add scroll control to news manager

This commit is contained in:
Chuck
2025-07-27 13:01:02 -05:00
parent 6bbb4f5de8
commit 3ba317c4e4

View File

@@ -359,6 +359,9 @@ class NewsManager:
any(len(headlines) > self.headlines_per_feed for headlines in self.news_data.values())):
self.prepare_headlines_for_display()
self.rotation_count = 0
# Add scroll delay to control speed
time.sleep(self.scroll_delay)
return img
@@ -430,24 +433,16 @@ class NewsManager:
finally:
self.is_fetching = False
# Run continuous scrolling loop for smooth animation
start_time = time.time()
duration = self.get_dynamic_duration()
# Get the current news display image (this updates scroll position)
img = self.get_news_display()
while time.time() - start_time < duration:
# Get the current news display image
img = self.get_news_display()
# Set the image and update display
self.display_manager.image = img
self.display_manager.update_display()
# Add the scroll delay to control speed
time.sleep(self.scroll_delay)
# Debug: log scroll position
if hasattr(self, 'scroll_position') and hasattr(self, 'total_scroll_width'):
logger.debug(f"Scroll position: {self.scroll_position}/{self.total_scroll_width}")
# Set the image and update display
self.display_manager.image = img
self.display_manager.update_display()
# Debug: log scroll position
if hasattr(self, 'scroll_position') and hasattr(self, 'total_scroll_width'):
logger.debug(f"Scroll position: {self.scroll_position}/{self.total_scroll_width}")
return True