Skip to content

adding PageLayout and examples #69

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

Merged
merged 3 commits into from
Apr 9, 2022
Merged

Conversation

FoamyGuy
Copy link
Contributor

A new type of layout that allows you to organize your UI into pages that you can change between using name, index, or prev/next functions.

@rsbohn
Copy link
Contributor

rsbohn commented Mar 27, 2022

Consider adding a property to retrieve the current page content:

showing_page_content -> Displayable

Make it easy for the user to retrieve the object they added using add_content() without any wrappers.

The user shouldn't need to know about _page_group and sub_view_obj, these are implementation details.

@FoamyGuy
Copy link
Contributor Author

Consider adding a property to retrieve the current page content:

showing_page_content -> Displayable

Make it easy for the user to retrieve the object they added using add_content() without any wrappers.

The user shouldn't need to know about _page_group and sub_view_obj, these are implementation details.

Good idea, I like that functionality. Thanks for trying this out and suggesting improvements. I'll add another commit with this new property

@FoamyGuy
Copy link
Contributor Author

Also I like the idea of a Displayable typing protocol (I think that is the right term). Lots of functions can accept this type of argument. Originally TileGrid and Group were the only that existed but now the vectorio shapes exist and are similar. Having this type defined somewhere will allow us to more easily update it if we end up adding any more types that can be shown directly like this.

@FoamyGuy
Copy link
Contributor Author

Latest commit adds the showing_page_content property as well as an illustration of it's usage in the advanced example script

@FoamyGuy
Copy link
Contributor Author

Not sure of the cause of CI failure. It passes locally for me:
image

Will look into this a bit later on today.

@FoamyGuy
Copy link
Contributor Author

I think this is the root caused of the CI failure. psf/black#2964 Looks like there are a few options to get past it but it might be something we'll need to decided on across all of the libraries if I am understanding correctly.

@FoamyGuy
Copy link
Contributor Author

Indeed the Black / Click version issue is what was causing CI to fail. There was a commit yesterday to change the version used and I just re-ran the jobs and now it's passing 🎉

@aioue
Copy link

aioue commented Apr 8, 2022

LGTM.

Tested code on a Titano successfully.

Test process:

  • Loaded page_layout.py onto a Titano
  • Ran the 2 test files using adapted import line from page_layout import PageLayout (hobbyist python user)

Test results:

  • simpletest PASS. Rendered both pages successfully and switches between them.
  • advancedtest PASS. Rendered all three pages successfully and modifies the second page as expected.

Notes:

  • Feels faster to load the code and render the text and shapes than other Learning System templates 🚀 Nice work FoamyGuy 👏

@FoamyGuy FoamyGuy merged commit a53e5ed into adafruit:main Apr 9, 2022
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Apr 10, 2022
Updating https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_Layout to 1.18.0 from 1.17.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_DisplayIO_Layout#69 from FoamyGuy/paged_layout
  > Update Black to latest.
  > Fixed readthedocs build
  > Consolidate Documentation sections of README
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.

3 participants