Skip to content

fix(masters): fix startup errors, display timing, and hole card layout#80

Merged
ChuckBuilds merged 4 commits intomainfrom
fix/masters-tournament-display
Apr 1, 2026
Merged

fix(masters): fix startup errors, display timing, and hole card layout#80
ChuckBuilds merged 4 commits intomainfrom
fix/masters-tournament-display

Conversation

@ChuckBuilds
Copy link
Copy Markdown
Owner

@ChuckBuilds ChuckBuilds commented Apr 1, 2026

Summary

  • Fix two startup crashes: self.plugin_dir AttributeError and draw_image missing on DisplayManager
  • Add time-based rotation for hole cards and paginated modes (default 15s per item, user-configurable)
  • Slow down fun facts scroll speed (2s per step instead of 1s)
  • Redesign hole card layout: left info panel + full-height hole image on right
  • Add black glow behind Masters logo on countdown screen
  • Move zone badge (AMEN CORNER, FEATURED) to bottom-right to avoid text overlap

Test plan

  • All 9 active display modes render without errors on 192x48 display
  • Hole cards hold for 15s before advancing
  • Paginated modes (champions, stats, course overview) hold 15s per page
  • Monitored for 50+ minutes with zero rendering errors

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Style

    • Countdown gets a subtle glow outline and a new left-logo / right-text tiered layout on large displays for improved legibility.
  • New Features

    • Hole card redesigned into separate info and image panels for clearer hole details.
    • Content carousels (leaderboards, schedules, featured holes, fun facts, course tour) now advance on configurable timing intervals.
    • Display timing settings are re-read on config changes to apply new durations immediately.
  • Bug Fixes

    • Improved image rendering for more reliable display composition.

Fixes three issues preventing the Masters plugin from running and
improves the display experience:

Startup fixes:
- Replace self.plugin_dir (not set by BasePlugin) with
  os.path.dirname(__file__) for MastersLogoLoader initialization
- Replace self.display_manager.draw_image() (doesn't exist) with
  self.display_manager.image.paste() matching other plugins

Display timing:
- Hole cards (course_tour, featured_holes) now hold each hole for
  hole_display_duration (default 15s) instead of switching every 1s
- Paginated modes (past_champions, tournament_stats, course_overview,
  schedule, leaderboard) hold each page for page_display_duration
  (default 15s) via new _advance_page() timer
- Fun facts scroll steps advance every 2s instead of every 1s
- Both durations are user-configurable

Visual improvements:
- Countdown: Masters logo has black glow outline for visibility
- Hole cards: redesigned layout with left info panel (hole #, name,
  par, yardage) and right side dedicated to hole image at full height
- Zone badge (AMEN CORNER, FEATURED) moved to bottom-right corner
  to avoid overlapping left panel text

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 1, 2026

📝 Walkthrough

Walkthrough

Adds time-gated rotation for pages, holes, and fun-facts; resets timers on config changes; fixes MastersLogoLoader path; switches image rendering to paste; adds RGBA-aware logo glow; and reworks hole card to a left info panel plus right image panel.

Changes

Cohort / File(s) Summary
Manager / Display Timing
plugins/masters-tournament/manager.py
Introduces timed advancement state (_last_* timestamps, _page_interval, _hole_switch_interval, _fact_advance_interval) and helper _advance_page(); replaces unconditional per-call increments with interval checks; clears timers on config changes; initializes MastersLogoLoader with the plugin file dir; uses self.display_manager.image.paste(...) for rendering.
Countdown / Logo Rendering
plugins/masters-tournament/masters_renderer.py
Reworks render_countdown() into two-column layout on large displays (left scaled logo, right stacked text) with fallback compact layout; adds _draw_logo_with_glow() to composite a black glow for RGBA logos and reuse across layouts.
Hole Card Layout
plugins/masters-tournament/masters_renderer_enhanced.py
Replaces header/footer card with two-panel composition: left fixed-width info panel (centered hole number, wrapped/truncated hole name, separate par/yardage lines) and right image region (resized, vertically centered); updates zone-badge anchor to bottom-right near image.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant Manager as Manager (timing state)
participant Renderer as MastersRenderer / EnhancedRenderer
participant Display as DisplayManager
participant Loader as MastersLogoLoader

Manager->>Display: request render for current mode
Display->>Renderer: render frame for mode
alt logo required
    Renderer->>Loader: load logo (path from manager)
    Loader-->>Renderer: return logo image
    Renderer->>Display: compose & return image (logo + text)
else no logo
    Renderer->>Display: return composed image
end
Display->>Manager: present image
Note right of Manager: Manager updates timestamps; advances page/hole/fact only if interval elapsed

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 45.45% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the three main changes: startup error fixes, display timing implementation, and hole card layout redesign.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/masters-tournament-display

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
plugins/masters-tournament/manager.py (1)

538-544: ⚠️ Potential issue | 🟠 Major

Hot config reload never applies the new rotation durations.

hole_display_duration and page_display_duration are only read in __init__, so changing them at runtime has no effect until the plugin restarts. Update the cached intervals in on_config_change() and reset the related last-advance state so the new cadence applies immediately.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/masters-tournament/manager.py` around lines 538 - 544,
on_config_change currently updates _update_interval and display_duration but
does not refresh the cached rotation durations read in __init__
(hole_display_duration and page_display_duration) nor reset the per-rotation
timers, so hot reloads don't take effect; update hole_display_duration and
page_display_duration from new_config inside on_config_change and reset any
last-advance state variables (e.g., _last_hole_advance, _last_page_advance or
similar) so the new cadence is applied immediately, keeping the existing call to
super().on_config_change(new_config) and _build_enabled_modes().
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@plugins/masters-tournament/manager.py`:
- Around line 114-120: Both hole-rotation modes (_display_course_tour and
_display_featured_holes) currently share a single _last_hole_switch timestamp so
they throttle each other and advance immediately on first render; change this to
a per-rotation-key timestamp (similar to _last_page_advance) — replace
_last_hole_switch with a dict (e.g., _last_hole_switch = {}) keyed by mode or
rotation id, consult _hole_switch_interval as before, and in the rotation logic
initialize the key on first render (do not advance when the key is missing or
zero) so the first shown hole holds for the full interval; apply the same
pattern where hole rotation is used (also around the region referenced 405-429)
and keep _advance_page behavior unchanged.

In `@plugins/masters-tournament/masters_renderer_enhanced.py`:
- Around line 214-241: The name block and par/yard lines overlap on the "small"
tier because par_y is a hardcoded value and wrapping only splits by word count
without measuring widths/heights; update the rendering in the method that draws
the left panel (references: self.tier, name_text, self._text_width,
self.font_detail, left_w, par_y, hole_info) to: measure the rendered height of
the name lines using self._text_width and font metrics, compute
name_block_height and set par_y = self.height - 20 (or a configurable bottom
padding) minus the measured par/yard height so the par/yard never overlap the
name; for wrapping, implement width-aware line breaking by building lines that
fit left_w - 4 using self._text_width and, if self.tier == "small", fall back to
truncating the second line with an ellipsis when it exceeds the available
width/height; ensure all centering uses measured line widths when positioning
text.

---

Outside diff comments:
In `@plugins/masters-tournament/manager.py`:
- Around line 538-544: on_config_change currently updates _update_interval and
display_duration but does not refresh the cached rotation durations read in
__init__ (hole_display_duration and page_display_duration) nor reset the
per-rotation timers, so hot reloads don't take effect; update
hole_display_duration and page_display_duration from new_config inside
on_config_change and reset any last-advance state variables (e.g.,
_last_hole_advance, _last_page_advance or similar) so the new cadence is applied
immediately, keeping the existing call to super().on_config_change(new_config)
and _build_enabled_modes().
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 45f56cdd-d5bd-4b43-a0f8-9647be60325c

📥 Commits

Reviewing files that changed from the base of the PR and between 9d3ad6a and d370f97.

📒 Files selected for processing (3)
  • plugins/masters-tournament/manager.py
  • plugins/masters-tournament/masters_renderer.py
  • plugins/masters-tournament/masters_renderer_enhanced.py

Chuck and others added 2 commits April 1, 2026 10:10
- Replace shared _last_hole_switch with per-mode _last_hole_advance dict
  so course_tour and featured_holes don't throttle each other, and first
  hole holds for the full interval before advancing
- Fix name/par text overlap on small displays: use width-aware line
  wrapping with measured heights, and anchor par/yardage below the name
  block with a minimum gap
- Update on_config_change to refresh hole_display_duration and
  page_display_duration and reset timer state so hot reloads take effect

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move the Masters logo from a small centered-top position (48x20 max)
to a large left-side position (55% width, nearly full height) with
black glow. Stack the countdown info (label, number, unit) vertically
centered in the right panel using smaller font. The logo now dominates
the display while keeping all countdown information visible.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@plugins/masters-tournament/masters_renderer.py`:
- Around line 815-816: The split-layout that places the countdown to the right
(using right_x = lx + logo.width + 6 and computing the right panel width as
self.width - logo.width - 12) must be gated to avoid clipping on tiny/small
tiers; update the rendering branch around those lines (where logo_max_w,
logo_max_h, right_x are used and the countdown is split) to only use the
two-column layout when the display is large enough — e.g., either if self.tier
in ("large","xlarge") or if (self.width - logo.width - 12) >= MIN_RIGHT_WIDTH
(choose a MIN_RIGHT_WIDTH equal to the minimum label+value width you need);
otherwise fall back to the compact single-column countdown path (the existing
"UNTIL THE MASTERS"/"TO MASTERS" + count/unit layout) so the count and unit
remain visible.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3845f6d9-53f7-4955-a3f1-136b6d8c29f9

📥 Commits

Reviewing files that changed from the base of the PR and between ad1a3c0 and 48d6569.

📒 Files selected for processing (1)
  • plugins/masters-tournament/masters_renderer.py

The two-column countdown layout (large logo left, text right) clips
on tiny/small displays where the right panel is too narrow for text.
Gate the split layout to tier=="large" (width > 64) with a minimum
right panel width check (40px). Fall back to the compact centered
layout (logo top, countdown below) for smaller displays.

Also extract _draw_logo_with_glow() helper to deduplicate the black
glow rendering between both layout paths.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
plugins/masters-tournament/masters_renderer.py (1)

877-899: ⚠️ Potential issue | 🔴 Critical

Compact countdown fallback still clips on small and tiny panels.

Line 898 draws the unit at mid_y + 16, which lands at y == 32 on the documented 64x32 small tier and y == 24 on the 32x16 tiny tier, so that line never renders there. On tiny, Line 893 also pushes the count into the bottom edge. This fallback needs to stack from logo.height and measured text heights instead of fixed offsets, and it should drop the logo or unit when the remaining height is too small.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/masters-tournament/masters_renderer.py` around lines 877 - 899, The
compact-layout drawing uses fixed offsets (mid_y + 4 / +16) which clip on
small/tiny panels; change the layout in the rendering method that calls
logo_loader.get_masters_logo and _draw_logo_with_glow to compute positions from
the actual occupied heights instead of hard-coded mid_y offsets: measure logo
height (logo.height) if present and measure text heights via the font metrics
(use draw.textbbox/textsize with font_detail and font_score) to compute a
stacked y offset (logo_top -> until_text -> count_text -> unit_text) and center
each line horizontally using _text_width; if total required height exceeds
self.height, drop the logo first, then the unit_text as needed, and ensure
count_text never overflows the bottom by reducing spacing or font (or hiding
optional elements) so all rendered text fits inside self.height.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@plugins/masters-tournament/masters_renderer.py`:
- Around line 877-899: The compact-layout drawing uses fixed offsets (mid_y + 4
/ +16) which clip on small/tiny panels; change the layout in the rendering
method that calls logo_loader.get_masters_logo and _draw_logo_with_glow to
compute positions from the actual occupied heights instead of hard-coded mid_y
offsets: measure logo height (logo.height) if present and measure text heights
via the font metrics (use draw.textbbox/textsize with font_detail and
font_score) to compute a stacked y offset (logo_top -> until_text -> count_text
-> unit_text) and center each line horizontally using _text_width; if total
required height exceeds self.height, drop the logo first, then the unit_text as
needed, and ensure count_text never overflows the bottom by reducing spacing or
font (or hiding optional elements) so all rendered text fits inside self.height.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 03de0c85-3fde-4be4-a404-0f080de7097e

📥 Commits

Reviewing files that changed from the base of the PR and between 48d6569 and deff22f.

📒 Files selected for processing (1)
  • plugins/masters-tournament/masters_renderer.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant