From 5763a337da5f582194cf34ae4ecb454a9e8093c1 Mon Sep 17 00:00:00 2001 From: pQu4k3r Date: Wed, 9 Sep 2026 20:06:35 +0000 Subject: [PATCH] Fix City Selection closing itself and double-showing missing-file warning 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 Claude-Session: https://claude.ai/code/session_01UPpumFb2PP21ATpDwJBYBB --- .../Plugins/Extensions/Foreca1/city_panel.py | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/usr/lib/enigma2/python/Plugins/Extensions/Foreca1/city_panel.py b/usr/lib/enigma2/python/Plugins/Extensions/Foreca1/city_panel.py index 09b42eae..4f846802 100644 --- a/usr/lib/enigma2/python/Plugins/Extensions/Foreca1/city_panel.py +++ b/usr/lib/enigma2/python/Plugins/Extensions/Foreca1/city_panel.py @@ -165,18 +165,19 @@ def prepare_city_list(self): self.Mlist = [] self.city_list = [] - def _close_panel(*args): - self.close(None) - city_cfg_path = join(SYSTEM_DIR, "new_city.cfg") if not exists(city_cfg_path): - self.session.openWithCallback( - _close_panel, - MessageBox, - _("City list file not found! Use the search to find your city first."), - MessageBox.TYPE_WARNING, - timeout=5 - ) + # onShown can fire more than once per screen open; only warn once. + if not getattr(self, '_missing_file_warned', False): + self._missing_file_warned = True + self.session.open( + MessageBox, + _("City list file not found! Press RED to search for your city online."), + MessageBox.TYPE_WARNING, + timeout=5 + ) + self.filtered_list = self.Mlist + self["Mlist"].setList(self.filtered_list) return try: