mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Library icon tooltip now shows the path to the currently displayed library
This commit is contained in:
parent
6574f34903
commit
ebb5c43abc
@ -243,6 +243,7 @@ class BooksModel(QAbstractTableModel):
|
|||||||
|
|
||||||
about_to_be_sorted = pyqtSignal(object, name='aboutToBeSorted')
|
about_to_be_sorted = pyqtSignal(object, name='aboutToBeSorted')
|
||||||
sorting_done = pyqtSignal(object, name='sortingDone')
|
sorting_done = pyqtSignal(object, name='sortingDone')
|
||||||
|
database_changed = pyqtSignal(object, name='databaseChanged')
|
||||||
|
|
||||||
orig_headers = {
|
orig_headers = {
|
||||||
'title' : _("Title"),
|
'title' : _("Title"),
|
||||||
@ -300,6 +301,7 @@ class BooksModel(QAbstractTableModel):
|
|||||||
self.db = db
|
self.db = db
|
||||||
self.custom_columns = self.db.custom_column_label_map
|
self.custom_columns = self.db.custom_column_label_map
|
||||||
self.read_config()
|
self.read_config()
|
||||||
|
self.database_changed.emit(db)
|
||||||
|
|
||||||
def refresh_ids(self, ids, current_row=-1):
|
def refresh_ids(self, ids, current_row=-1):
|
||||||
rows = self.db.refresh_ids(ids)
|
rows = self.db.refresh_ids(ids)
|
||||||
|
@ -602,6 +602,9 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
self.db_images.reset()
|
self.db_images.reset()
|
||||||
|
|
||||||
self.library_view.model().count_changed()
|
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 ##############################
|
########################### Tags Browser ##############################
|
||||||
self.search_restriction.setSizeAdjustPolicy(self.search_restriction.AdjustToMinimumContentsLengthWithIcon)
|
self.search_restriction.setSizeAdjustPolicy(self.search_restriction.AdjustToMinimumContentsLengthWithIcon)
|
||||||
|
@ -23,6 +23,7 @@ from calibre.ebooks import BOOK_EXTENSIONS
|
|||||||
from calibre.ebooks.metadata.meta import metadata_from_filename
|
from calibre.ebooks.metadata.meta import metadata_from_filename
|
||||||
from calibre.utils.config import prefs, XMLConfig
|
from calibre.utils.config import prefs, XMLConfig
|
||||||
from calibre.gui2.progress_indicator import ProgressIndicator as _ProgressIndicator
|
from calibre.gui2.progress_indicator import ProgressIndicator as _ProgressIndicator
|
||||||
|
from calibre.constants import filesystem_encoding
|
||||||
|
|
||||||
history = XMLConfig('history')
|
history = XMLConfig('history')
|
||||||
|
|
||||||
@ -230,13 +231,22 @@ class LocationModel(QAbstractListModel):
|
|||||||
self.free = [-1, -1, -1]
|
self.free = [-1, -1, -1]
|
||||||
self.count = 0
|
self.count = 0
|
||||||
self.highlight_row = 0
|
self.highlight_row = 0
|
||||||
|
self.library_tooltip = _('Click to see the books available on your computer')
|
||||||
self.tooltips = [
|
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 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 A in your reader'),
|
||||||
_('Click to see the books on storage card B 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):
|
def rowCount(self, *args):
|
||||||
return 1 + len([i for i in self.free if i >= 0])
|
return 1 + len([i for i in self.free if i >= 0])
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user