Fix/mainview draw buttons filter#1
Merged
Merged
Conversation
Implements a fallback mechanism to load cached content (`rehydrate_contnet`) when internet connectivity issues or API errors occur. Changes include: - Modified `Services/GraberServices.py` to propagate standard `requests` exceptions (`requests.exceptions.RequestException`) instead of a custom error. It now uses `response.raise_for_status()` to handle HTTP errors. - Updated `main_logic.py` to catch these standard `requests` exceptions during content loading. If an error occurs or no new content is fetched, it triggers `rehydrate_contnet` with an `offline_error=True` flag. - The `Context` was updated to store and provide this `offline_error` status. - `Views/mainView.py` now checks this status and displays an "Offline/Connection Problem: Displaying cached content." message to you if applicable. It also shows a "No cached content available." message if the cache is empty during offline mode. Unit tests were written and updated for these changes in `Tests/test_graber_services.py`, `Tests/test_main_logic.py`, and `Tests/test_main_view.py`. However, persistent environment and tooling issues prevented their successful execution and verification during the development process. The test files are included in the commit.
The `draw_content__buttons` method in `MainView` now filters content based on the currently selected tab. - When the "All" tab is selected, all content items from `finalContent` are displayed. - When a specific parameter tab is selected, `finalContent` is filtered using `FiltersServices` according to that tab's defined criteria (search terms, price, etc., from `MainParameters`). - Displays a message like "No content available for this tab" or "No cached content available for this tab" (if offline) when the filtered list for a tab is empty. - Includes error handling for image loading, allowing buttons to be drawn even if an image file is missing or corrupt, printing an error to the console instead of crashing. This change addresses the issue where content buttons were not being drawn according to the selected tab's specific filter context.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.