diff --git a/src/calibre/gui2/library.py b/src/calibre/gui2/library.py index c7e2991010..9f209a0066 100644 --- a/src/calibre/gui2/library.py +++ b/src/calibre/gui2/library.py @@ -243,6 +243,7 @@ class BooksModel(QAbstractTableModel): about_to_be_sorted = pyqtSignal(object, name='aboutToBeSorted') sorting_done = pyqtSignal(object, name='sortingDone') + database_changed = pyqtSignal(object, name='databaseChanged') orig_headers = { 'title' : _("Title"), @@ -300,6 +301,7 @@ class BooksModel(QAbstractTableModel): self.db = db self.custom_columns = self.db.custom_column_label_map self.read_config() + self.database_changed.emit(db) def refresh_ids(self, ids, current_row=-1): rows = self.db.refresh_ids(ids) diff --git a/src/calibre/gui2/ui.py b/src/calibre/gui2/ui.py index 12f620532e..f8bce11114 100644 --- a/src/calibre/gui2/ui.py +++ b/src/calibre/gui2/ui.py @@ -602,6 +602,9 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI): self.db_images.reset() self.library_view.model().count_changed() + self.location_view.model().database_changed(self.library_view.model().db) + self.library_view.model().database_changed.connect(self.location_view.model().database_changed, + type=Qt.QueuedConnection) ########################### Tags Browser ############################## self.search_restriction.setSizeAdjustPolicy(self.search_restriction.AdjustToMinimumContentsLengthWithIcon) diff --git a/src/calibre/gui2/widgets.py b/src/calibre/gui2/widgets.py index 586966d94f..c48ded1dc2 100644 --- a/src/calibre/gui2/widgets.py +++ b/src/calibre/gui2/widgets.py @@ -23,6 +23,7 @@ from calibre.ebooks import BOOK_EXTENSIONS from calibre.ebooks.metadata.meta import metadata_from_filename from calibre.utils.config import prefs, XMLConfig from calibre.gui2.progress_indicator import ProgressIndicator as _ProgressIndicator +from calibre.constants import filesystem_encoding history = XMLConfig('history') @@ -230,13 +231,22 @@ class LocationModel(QAbstractListModel): self.free = [-1, -1, -1] self.count = 0 self.highlight_row = 0 + self.library_tooltip = _('Click to see the books available on your computer') self.tooltips = [ - _('Click to see the books available on your computer'), + self.library_tooltip, _('Click to see the books in the main memory of your reader'), _('Click to see the books on storage card A in your reader'), _('Click to see the books on storage card B in your reader') ] + def database_changed(self, db): + lp = db.library_path + if not isinstance(lp, unicode): + lp = lp.decode(filesystem_encoding, 'replace') + self.tooltips[0] = self.library_tooltip + '\n\n' + \ + _('Books located at') + ' ' + lp + self.dataChanged.emit(self.index(0), self.index(0)) + def rowCount(self, *args): return 1 + len([i for i in self.free if i >= 0])