mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix virtual library names with ampersands in them not being displayed correctly in the virtual library menu and tab bar
This commit is contained in:
parent
35a95b1d32
commit
22f4baed8e
@ -327,7 +327,7 @@ class VLTabs(QTabBar): # {{{
|
||||
virt_libs = (set(virt_libs) - hidden) | {''}
|
||||
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 or _('All books'))
|
||||
self.addTab(vl.replace('&', '&&') or _('All books'))
|
||||
self.setTabData(i, vl)
|
||||
if vl == current_lib:
|
||||
current_idx = i
|
||||
|
@ -409,7 +409,7 @@ class SearchRestrictionMixin(object):
|
||||
|
||||
virt_libs = db.prefs.get('virtual_libraries', {})
|
||||
for vl in sorted(virt_libs.keys(), key=sort_key):
|
||||
a = m.addAction(self.checked if vl == current_lib else self.empty, vl)
|
||||
a = m.addAction(self.checked if vl == current_lib else self.empty, vl.replace('&', '&&'))
|
||||
a.triggered.connect(partial(self.apply_virtual_library, library=vl))
|
||||
|
||||
p = QPoint(0, self.virtual_library.height())
|
||||
@ -462,7 +462,7 @@ class SearchRestrictionMixin(object):
|
||||
menu.setIcon(self.empty)
|
||||
|
||||
def add_action(name, search):
|
||||
a = menu.addAction(name)
|
||||
a = menu.addAction(name.replace('&', '&&'))
|
||||
a.triggered.connect(partial(handler, name=name))
|
||||
a.setIcon(self.empty)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user