Skip to content

Commit

Permalink
Fix for Tribler#6612
Browse files Browse the repository at this point in the history
  • Loading branch information
drew2a committed Dec 9, 2021
1 parent 3419e31 commit 6c1e265
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
12 changes: 8 additions & 4 deletions src/tribler-gui/tribler_gui/tribler_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -1029,10 +1029,14 @@ def clicked_search_bar(self, checked=False):
def on_top_search_bar_return_pressed(self):
# Initiate a new search query and switch to search loading/results page
query = self.top_search_bar.text()
if query:
self.search_results_page.search(query)
self.deselect_all_menu_buttons()
self.stackedWidget.setCurrentIndex(PAGE_SEARCH_RESULTS)
if not query:
return

if not self.search_results_page.search(query):
return

self.deselect_all_menu_buttons()
self.stackedWidget.setCurrentIndex(PAGE_SEARCH_RESULTS)

def clicked_menu_button_discovered(self):
self.deselect_all_menu_buttons()
Expand Down
8 changes: 5 additions & 3 deletions src/tribler-gui/tribler_gui/widgets/searchresultswidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def check_can_show(self, query):

def search(self, query):
if not self.check_can_show(query):
return
return None

self.last_search_query = query
self.last_search_time = time.time()
Expand All @@ -113,9 +113,11 @@ def register_request(response):
self.timeout_progress_bar.start()
self.setCurrentWidget(self.loading_page)

params = {'txt_filter': to_fts_query(query), 'hide_xxx': self.hide_xxx}
if (fts_query := to_fts_query(query)) is None:
return None

TriblerNetworkRequest('remote_query', register_request, method="PUT", url_params=params)
params = {'txt_filter': fts_query, 'hide_xxx': self.hide_xxx}
return TriblerNetworkRequest('remote_query', register_request, method="PUT", url_params=params)

def reset(self):
if self.currentWidget() == self.results_page:
Expand Down

0 comments on commit 6c1e265

Please sign in to comment.