Skip to content

Fix City Selection closing itself and double-showing missing-file warning - #5

Merged
pQu4k3r merged 2 commits into
mainfrom
develop
Sep 9, 2026
Merged

Fix City Selection closing itself and double-showing missing-file warning#5
pQu4k3r merged 2 commits into
mainfrom
develop

Conversation

@pQu4k3r

@pQu4k3r pQu4k3r commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #4. User tested the crash fix and reported: opening Select City with no offline new_city.cfg showed "City list file not found" twice, then dropped back to the main plugin screen instead of staying on a usable search panel.

Root causes:

  • onShown fires more than once per screen open in Enigma2, and prepare_city_list() was bound directly to onShown with no guard, so the warning popped up on every firing.
  • The warning's callback closed the entire CityPanel4 screen (self.close(None)), not just the popup — contradicting its own "use the search" message, since the search screen no longer existed by the time the user could act on it.

Fix

  • Guard the warning so it shows once per screen instance (self._missing_file_warned).
  • Leave CityPanel4 open afterward (with an empty list) instead of closing it, so the user can press RED to open the keyboard and search online — confirmed open_keyboard/filter_cities/search_online/search_offline are all self-contained and don't depend on the offline file being present.

pQu4k3r and others added 2 commits September 9, 2026 20:06
…ning

Reported: opening Select City with no offline new_city.cfg showed
"City list file not found" twice, then dropped back to the main
plugin screen instead of staying on a usable search panel.

Root causes:
- onShown fires more than once per screen open in Enigma2, and
  prepare_city_list() was bound directly to onShown with no guard,
  so the warning popped up on every firing.
- The warning's callback closed the entire CityPanel4 screen
  (self.close(None)), not just the popup, contradicting its own
  "use the search" message since the search screen no longer
  existed by the time the user could act on it.

Fixed by guarding the warning to show once per screen instance, and
leaving CityPanel4 open afterward (with an empty list) so the user
can press RED to search online, per PR #4's Test plan note that this
mechanism needed follow-up.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UPpumFb2PP21ATpDwJBYBB
# Conflicts:
#	usr/lib/enigma2/python/Plugins/Extensions/Foreca1/city_panel.py
@pQu4k3r
pQu4k3r merged commit c0cc17e into main Sep 9, 2026
6 checks passed
pQu4k3r added a commit that referenced this pull request Sep 10, 2026
README documents that the offline city list "is created automatically
during a search" if it doesn't exist, but that mechanism was never
actually implemented anywhere in the codebase - new_city.cfg was only
ever read, never written.

Implemented it: after a successful online search (search_online),
append any newly found cities to new_city.cfg, deduped by city id
against what's already in the file, in the same "ID/City_Name" format
the reader already expects (verified with a write/read round-trip,
including a non-ASCII city name). Creates SYSTEM_DIR if needed,
mirroring the pattern already used elsewhere (e.g. ForecaSetup.save
in plugin.py). The offline list now builds up over time as users
search, so City Selection's offline browsing (and search_offline's
fallback) actually has something to work with after the fix in #4/#5.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UPpumFb2PP21ATpDwJBYBB
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