mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-01-03 08:16:07 +01:00
Show the search expression for the virtual library in a tooltip when hovering over the tab for the virtual library. Fixes #1291691 [[Enhancement] VL search expression tooltip on hover](https://bugs.launchpad.net/calibre/+bug/1291691)
This commit is contained in:
parent
d78b9c3f0d
commit
aea66db018
1 changed files with 5 additions and 1 deletions
|
|
@ -315,7 +315,8 @@ def current_db(self):
|
|||
def rebuild(self):
|
||||
self.currentChanged.disconnect(self.tab_changed)
|
||||
db = self.current_db
|
||||
virt_libs = frozenset(db.prefs.get('virtual_libraries', {}))
|
||||
vl_map = db.prefs.get('virtual_libraries', {})
|
||||
virt_libs = frozenset(vl_map)
|
||||
hidden = frozenset(db.prefs['virt_libs_hidden'])
|
||||
if hidden - virt_libs:
|
||||
db.prefs['virt_libs_hidden'] = list(hidden.intersection(virt_libs))
|
||||
|
|
@ -328,6 +329,9 @@ def rebuild(self):
|
|||
order = {x:i for i, x in enumerate(order)}
|
||||
for i, vl in enumerate(sorted(virt_libs, key=lambda x:(order.get(x, 0), sort_key(x)))):
|
||||
self.addTab(vl.replace('&', '&&') or _('All books'))
|
||||
sexp = vl_map.get(vl, None)
|
||||
if sexp is not None:
|
||||
self.setTabToolTip(i, _('Search expression for this virtual library:') + '\n\n' + sexp)
|
||||
self.setTabData(i, vl)
|
||||
if vl == current_lib:
|
||||
current_idx = i
|
||||
|
|
|
|||
Loading…
Reference in a new issue