mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 21:03:01 +00:00
Add scroll control to news manager
This commit is contained in:
@@ -359,6 +359,9 @@ class NewsManager:
|
|||||||
any(len(headlines) > self.headlines_per_feed for headlines in self.news_data.values())):
|
any(len(headlines) > self.headlines_per_feed for headlines in self.news_data.values())):
|
||||||
self.prepare_headlines_for_display()
|
self.prepare_headlines_for_display()
|
||||||
self.rotation_count = 0
|
self.rotation_count = 0
|
||||||
|
|
||||||
|
# Add scroll delay to control speed
|
||||||
|
time.sleep(self.scroll_delay)
|
||||||
|
|
||||||
return img
|
return img
|
||||||
|
|
||||||
@@ -430,24 +433,16 @@ class NewsManager:
|
|||||||
finally:
|
finally:
|
||||||
self.is_fetching = False
|
self.is_fetching = False
|
||||||
|
|
||||||
# Run continuous scrolling loop for smooth animation
|
# Get the current news display image (this updates scroll position)
|
||||||
start_time = time.time()
|
img = self.get_news_display()
|
||||||
duration = self.get_dynamic_duration()
|
|
||||||
|
|
||||||
while time.time() - start_time < duration:
|
# Set the image and update display
|
||||||
# Get the current news display image
|
self.display_manager.image = img
|
||||||
img = self.get_news_display()
|
self.display_manager.update_display()
|
||||||
|
|
||||||
# Set the image and update display
|
# Debug: log scroll position
|
||||||
self.display_manager.image = img
|
if hasattr(self, 'scroll_position') and hasattr(self, 'total_scroll_width'):
|
||||||
self.display_manager.update_display()
|
logger.debug(f"Scroll position: {self.scroll_position}/{self.total_scroll_width}")
|
||||||
|
|
||||||
# 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}")
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user