Skip to content

Warn when layout width/height is given but size_hint will override it#2834

Merged
eruvanos merged 4 commits intodevelopmentfrom
copilot/add-warning-for-size-hints
Mar 11, 2026
Merged

Warn when layout width/height is given but size_hint will override it#2834
eruvanos merged 4 commits intodevelopmentfrom
copilot/add-warning-for-size-hints

Conversation

Copy link
Contributor

Copilot AI commented Mar 10, 2026

  • Understand the issue: layouts should warn when explicit width/height is given but size_hint is not set to None (hint would override the fixed size)
  • Add _NO_EXPLICIT_SIZE sentinel and _warn_if_size_hint_overrides_fixed_size() helper to layout.py
  • Update UIAnchorLayout.init to use sentinel defaults and call warning helper
  • Update UIBoxLayout.init to use sentinel defaults and call warning helper
  • Update UIGridLayout.init to use sentinel defaults and call warning helper
  • Update existing tests to add size_hint=None where they intentionally set fixed dimensions
  • Add new test file test_layout_size_hint_warning.py with 15 tests covering warning behavior
  • All 338 GUI tests pass
  • Use ... (Ellipsis) instead of object() for the sentinel value
  • Add float | EllipsisType type hints for width/height in all three layout init methods
  • Use warnings.catch_warnings() with simplefilter("error") in "no warning" tests
  • Inline the ... sentinel directly (no named variable)
  • Move _warn_if_size_hint_overrides_fixed_size to a method on UILayout

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

…cts with active size_hint

Co-authored-by: eruvanos <9437863+eruvanos@users.noreply.github.com>
Copilot AI changed the title [WIP] Add warning for missing size_hint in Arcade GUI layouts Warn when layout width/height is given but size_hint will override it Mar 10, 2026
Copy link
Member

@eruvanos eruvanos left a comment

Choose a reason for hiding this comment

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

…atch_warnings in tests

Co-authored-by: eruvanos <9437863+eruvanos@users.noreply.github.com>
Copy link
Member

@eruvanos eruvanos left a comment

Choose a reason for hiding this comment

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

Co-authored-by: eruvanos <9437863+eruvanos@users.noreply.github.com>
@eruvanos eruvanos marked this pull request as ready for review March 11, 2026 11:21
@eruvanos eruvanos merged commit a557053 into development Mar 11, 2026
7 checks passed
@eruvanos eruvanos deleted the copilot/add-warning-for-size-hints branch March 11, 2026 20:46
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.

2 participants