Skip to content
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

Stop AttributeError from SpriteList._atlas and link Lazy SpriteList doc #1901

Conversation

pushfoo
Copy link
Member

@pushfoo pushfoo commented Sep 15, 2023

Changes

Related to #1882

  • Allow None for SpriteList._atlas and SpriteList.atlas
  • Update unit tests
  • Comment and clarify lazy-related unit tests
  • Update SpriteList docstrings:
    • Link the programming guide page on lazy sprite lists
    • Remove or add detail as necessary
  • Nasty performance / typing tricks to avoid overhead from typing.cast

How to test

Code

  1. ./make.py test
  2. Run your choice of sprite examples to look for any issues

Doc

  1. ./make.py clean
  2. ./make.py html (optional, workaround for occasional build loop issue)
  3. ./make.py serve
  4. Navigate to http://localhost:8000/api_docs/api/sprite_list.html#arcade.SpriteList
    1. Is the wording clear?
    2. Do the draw and initialize method links go to SpriteList's methods?
    3. Does the Lazy SpriteLists link go to relevant doc?
  5. Navigate to http://localhost:8000/api_docs/api/sprite_list.html#arcade.SpriteList.draw
    1. Is the wording clear?
    2. Does the initialize method link go to SpriteList.initialize?
    3. Does the Lazy SpriteLists link go to relevant doc?
  6. Navigate to http://localhost:8000/api_docs/api/sprite_list.html#arcade.SpriteList.initialize
    1. Is the wording clear?
    2. Does the draw method link go to SpriteList.draw?
    3. Does the Lazy SpriteLists link go to relevant doc?

@pushfoo pushfoo marked this pull request as ready for review September 15, 2023 14:17
@pushfoo pushfoo changed the title 1882 spritelist atlas property attribute error Fix #1882: eliminate attribute error by allowing None _atlas values Sep 15, 2023
@pushfoo pushfoo changed the title Fix #1882: eliminate attribute error by allowing None _atlas values Fix SpriteList._atlas attribute error by allowing None values Sep 15, 2023
@pushfoo
Copy link
Member Author

pushfoo commented Sep 15, 2023

@bunny-therapist How does this look? On my system and the unit test runner, it seems to work. Your example also runs fine now:

import arcade

class IssueDemonstrationWindow(arcade.Window):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        sl = arcade.SpriteList(lazy=True)
        sl.atlas


window = IssueDemonstrationWindow()
arcade.run()

My remaining concern is that we may want to expose SpriteList._initialized as a read-only initialized property, but that could be left out or put in another PR.

@pushfoo pushfoo changed the title Fix SpriteList._atlas attribute error by allowing None values Stop AttributeError from SpriteList._atlas and link Lazy SpriteList doc Sep 16, 2023
@einarf einarf merged commit d28d14f into pythonarcade:development Sep 16, 2023
7 checks passed
@pushfoo pushfoo deleted the 1882_spritelist_atlas_property_attribute_error branch September 16, 2023 20:31
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