mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-10-04 14:25:08 +00:00
Merge branch 'vegas-live/pr7-dev-server-vegas' into vegas-live/strip-in-place
This commit is contained in:
@@ -77,6 +77,12 @@ def main() -> int:
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.timeline > 1 and args.no_live:
|
||||
# A timeline shows live elements changing; plain content never does.
|
||||
parser.error("--timeline shows live elements; it cannot be combined with --no-live")
|
||||
if (args.timeline or args.no_live) and not args.vegas:
|
||||
parser.error("--timeline and --no-live need --vegas")
|
||||
|
||||
if not (MIN_DIMENSION <= args.width <= MAX_DIMENSION):
|
||||
print(f"Error: --width must be between {MIN_DIMENSION} and {MAX_DIMENSION} (got {args.width})")
|
||||
raise SystemExit(1)
|
||||
@@ -163,6 +169,9 @@ def main() -> int:
|
||||
except Exception as e:
|
||||
logger.warning("update() raised: %s — continuing to display()", e)
|
||||
|
||||
if args.vegas:
|
||||
Path(args.output).parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
if args.vegas and args.timeline > 1:
|
||||
from src.plugin_system.testing.vegas import render_vegas_timeline
|
||||
image, rows = render_vegas_timeline(
|
||||
|
||||
@@ -498,8 +498,10 @@ class SportsScrollDisplay:
|
||||
if key not in memo:
|
||||
memo[key] = self.make_vegas_renderer(card_width, rankings_cache)
|
||||
renderer = memo[key]
|
||||
if rankings_cache and hasattr(renderer, 'set_rankings_cache'):
|
||||
renderer.set_rankings_cache(rankings_cache)
|
||||
if hasattr(renderer, 'set_rankings_cache'):
|
||||
# Every time, empty included: the renderer is reused across
|
||||
# slates, and ranks cleared since must not stay drawn.
|
||||
renderer.set_rankings_cache(rankings_cache or {})
|
||||
return renderer
|
||||
|
||||
def build_vegas_elements(
|
||||
|
||||
@@ -405,3 +405,11 @@ def test_the_default_card_type_follows_the_game_state(state, expected):
|
||||
display = _display()
|
||||
display.build_vegas_elements([_game("1", state=state)], ["nfl"], fingerprint=_fp)
|
||||
assert display.renderer.calls[0][1] == expected
|
||||
|
||||
|
||||
def test_ranks_cleared_since_are_not_kept_by_the_reused_renderer():
|
||||
display = _display()
|
||||
display.build_vegas_elements([_game("1")], ["nfl"], {"HOM": 5}, fingerprint=_fp)
|
||||
assert display.renderer.rankings == {"HOM": 5}
|
||||
display.build_vegas_elements([_game("1")], ["nfl"], None, fingerprint=_fp)
|
||||
assert display.renderer.rankings == {}
|
||||
|
||||
Reference in New Issue
Block a user