Skip to content

[New Feature] Multi-resolution screenshot generator #747

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 28 commits into
base: dev
Choose a base branch
from

Conversation

kdmukai
Copy link
Contributor

@kdmukai kdmukai commented Apr 28, 2025

Overview

Adds support for generating screenshots beyond our original 240x240 resolution.

  • Automatically adds all supported display resolutions found in SettingsConstants.
  • Adds a --resolution command line option to render any new arbitrary resolution. Note that our baseline 240x240 resolution is always rendered, regardless of this option.
  • Adds a --no-clean option to prevent wiping out the screenshots dir before generating.
  • Minor refactor in generator.py to treat it as a class-based test case. This provides a clear universal setup/teardown, regardless of how many screenshot combinations (locale @ resolution) are generated.

Discussion items

  • I needed to be able to track state in the screenshot generator across individual locale / resolution invocations within a given run. Now that it's been refactored into a class based test, I opted to use some slightly hack-y class-level attrs for that state management (locale_combos, have_cleaned_screenshots_dir). I can't decide if it's clever, ugly, or somewhere inbetween.

  • Default behavior: clean the screenshots dir. Many times in the past I've been confused by a screenshot that turned out to just be stale that wasn't part of the most recent run. But on the flip side, there have definitely been times when I found it convenient to keep prior screenshots around (e.g. screenshots for a new locale I'm testing), even if they did risk becoming a bit stale. So the --no-clean option gives us flexibility. But either way, the final README will only link up the screenshots from that particular run.

Future TODO items

  • As we get deeper into supporting a wider variety of screens, it'll be easier to figure out how to clean up the slightly half-baked organizational overlap between SettingsConstants.ALL_DISPLAY_CONFIGURATIONS and the display_driver.ALL_DISPLAY_TYPES constants. It's currently a little redundant but it's not horrible enough to need refactoring right now.

  • The final README hard codes four of the English 240x240 screenshots to enhance the README's presentation. But the --locale option plus the default dir clean means that those screenshots aren't guaranteed to exist. A future enhancement would be to make those preview embeds dynamic.


This pull request is categorized as a:

  • New feature

Checklist

  • I’ve run pytest and made sure all unit tests pass before sumbitting the PR

If you modified or added functionality/workflow, did you add new unit tests?

  • N/A

I have tested this PR on the following platforms/os:

  • Other: screenshot generator is only meant to run in local dev

kdmukai added 28 commits April 28, 2025 14:06
Still seems a bit off (overshoots the horizontal center to the right), but close enough.
@kdmukai kdmukai marked this pull request as ready for review May 1, 2025 14:19
@kdmukai kdmukai moved this to 9.0 Needs Code Review in @SeedSigner Development Board May 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 9.0 Needs Code Review
Development

Successfully merging this pull request may close these issues.

1 participant