Skip to content

Fix/mainview draw buttons filter#1

Merged
Donsezan merged 10 commits into
mainfrom
fix/mainview-draw-buttons-filter
Jun 12, 2025
Merged

Fix/mainview draw buttons filter#1
Donsezan merged 10 commits into
mainfrom
fix/mainview-draw-buttons-filter

Conversation

@Donsezan

Copy link
Copy Markdown
Owner

No description provided.

NIk and others added 10 commits May 10, 2024 15:28
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.
@Donsezan Donsezan merged commit 36eeadd into main Jun 12, 2025
1 check failed
@Donsezan Donsezan deleted the fix/mainview-draw-buttons-filter branch June 12, 2025 20:48
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.

1 participant