Skip to content

fix: sprite disappears in pokemon details when changing pages#298

Open
abr-Projects wants to merge 2 commits intoh0tp-ftw:mainfrom
abr-Projects:sprite-disappear
Open

fix: sprite disappears in pokemon details when changing pages#298
abr-Projects wants to merge 2 commits intoh0tp-ftw:mainfrom
abr-Projects:sprite-disappear

Conversation

@abr-Projects
Copy link

Resolves issue #295

Cause:
refresh_gui() clears the entire main layout , recursively deleting all widgets. go_to_box() calls refresh_gui(), so when page changes the detail panel is deleted. the ui maintains a reference to a layout that is invalid, resulting in missing elements

Solution:
Introduce self.selected_pokemon to track the current pokemon in view. So when refresh_gui() is called the detail panel is reconstructed with self.selected_pokemon

Copilot AI review requested due to automatic review settings February 5, 2026 18:59
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug where the Pokemon sprite and details disappear when changing PC pages after showing Pokemon details. The issue occurred because refresh_gui() clears and rebuilds the entire layout, destroying the details panel widget.

Changes:

  • Replaced self.pokemon_details_layout with self.selected_pokemon to track which Pokemon's details should be displayed
  • Modified create_gui() to reconstruct the details panel from stored Pokemon data when refresh_gui() is called
  • Simplified show_pokemon_details() to just store the Pokemon and trigger a GUI refresh
  • Updated on_window_close() to clear the selected Pokemon reference instead of the details layout

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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