Store: Store, Show dialog when no books are found.

This commit is contained in:
John Schember 2011-04-22 08:52:31 -04:00
parent 6504e80404
commit c0a1ba448e
2 changed files with 9 additions and 1 deletions

View File

@ -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()

View File

@ -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)