From 7ec6f59e67b8e7f1ab1f7044c24d36cb3a68d784 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Tue, 6 Jun 2023 14:40:32 +1000 Subject: [PATCH] Clear filters when changing context tabs Fixes #238 --- koordinates/gui/koordinates.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/koordinates/gui/koordinates.py b/koordinates/gui/koordinates.py index 6b9464d..a3b1f0b 100644 --- a/koordinates/gui/koordinates.py +++ b/koordinates/gui/koordinates.py @@ -266,6 +266,7 @@ def __init__(self, parent): super().__init__(parent) self.setupUi(self) + self._block_searching = 0 self._facets = {} self._current_facets_reply = None self._visible_count = -1 @@ -666,12 +667,17 @@ def _context_tab_changed(self, current: int): self.context_header.setVisible(True) self._prev_tab = current + + self._block_searching += 1 self.filter_widget.set_starred(current == self.TAB_STARRED_INDEX) is_explore_tab = current == self.TAB_EXPLORE_INDEX self.filter_widget.set_is_browse_tab( is_explore_tab ) + self.filter_widget._clear_all() + + self._block_searching -= 1 if not is_explore_tab: # force browse tab self.filter_widget.set_explore_mode(ExploreMode.Browse) @@ -691,6 +697,9 @@ def _user_menu_about_to_show(self): ) def search(self): + if self._block_searching: + return + browser_query = self.filter_widget.build_query() context = self._current_context self.browse_header_widget.show()