From c0a1ba448e440e6d700446f600b91d10325438b2 Mon Sep 17 00:00:00 2001 From: John Schember Date: Fri, 22 Apr 2011 08:52:31 -0400 Subject: [PATCH] Store: Store, Show dialog when no books are found. --- src/calibre/gui2/store/search/models.py | 3 +++ src/calibre/gui2/store/search/search.py | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/store/search/models.py b/src/calibre/gui2/store/search/models.py index a1d42fafe4..9ebd7b0a0c 100644 --- a/src/calibre/gui2/store/search/models.py +++ b/src/calibre/gui2/store/search/models.py @@ -92,6 +92,9 @@ class Matches(QAbstractItemModel): return self.matches[row] else: return None + + def has_results(self): + return len(self.matches) > 0 def filter_results(self): self.layoutAboutToBeChanged.emit() diff --git a/src/calibre/gui2/store/search/search.py b/src/calibre/gui2/store/search/search.py index fc7fb818ee..a9b3a10f54 100644 --- a/src/calibre/gui2/store/search/search.py +++ b/src/calibre/gui2/store/search/search.py @@ -11,7 +11,7 @@ from random import shuffle from PyQt4.Qt import (QDialog, QTimer, QCheckBox, QVBoxLayout) -from calibre.gui2 import JSONConfig +from calibre.gui2 import JSONConfig, info_dialog from calibre.gui2.progress_indicator import ProgressIndicator from calibre.gui2.store.search.download_thread import SearchThreadPool, SearchThread from calibre.gui2.store.search.search_ui import Ui_Dialog @@ -186,6 +186,11 @@ class SearchDialog(QDialog, Ui_Dialog): res, store_plugin = self.search_pool.get_result() if res: self.results_view.model().add_result(res, store_plugin) + + if not self.checker.isActive(): + if not self.results_view.model().has_results(): + info_dialog(self, _('No matches'), _('Couldn\'t find any books matching your query.'), show=True, show_copy_button=False) + def open_store(self, index): result = self.results_view.model().get_result(index)