mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #1700217 [Virtual library button not pressed down](https://bugs.launchpad.net/calibre/+bug/1700217)
This commit is contained in:
parent
9b118f35d2
commit
27e39f6885
@ -181,6 +181,7 @@ class SearchBar(QFrame): # {{{
|
||||
|
||||
x = parent.virtual_library = QToolButton(self)
|
||||
x.setCursor(Qt.PointingHandCursor)
|
||||
x.setPopupMode(x.InstantPopup)
|
||||
x.setText(_('Virtual library'))
|
||||
x.setAutoRaise(True)
|
||||
x.setIcon(QIcon(I('lt.png')))
|
||||
|
@ -9,7 +9,7 @@ __copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
from functools import partial
|
||||
|
||||
from PyQt5.Qt import (
|
||||
Qt, QMenu, QPoint, QIcon, QDialog, QGridLayout, QLabel, QLineEdit, QComboBox,
|
||||
Qt, QMenu, QIcon, QDialog, QGridLayout, QLabel, QLineEdit, QComboBox,
|
||||
QDialogButtonBox, QSize, QVBoxLayout, QListWidget, QRadioButton, QAction, QTextBrowser)
|
||||
|
||||
from calibre.gui2 import error_dialog, question_dialog, gprefs
|
||||
@ -331,8 +331,9 @@ class SearchRestrictionMixin(object):
|
||||
self.search_based_vl = None
|
||||
|
||||
self.virtual_library_menu = QMenu()
|
||||
self.virtual_library.setMenu(self.virtual_library_menu)
|
||||
self.virtual_library_menu.aboutToShow.connect(self.virtual_library_menu_about_to_show)
|
||||
|
||||
self.virtual_library.clicked.connect(self.virtual_library_clicked)
|
||||
self.clear_vl.clicked.connect(lambda x: (self.apply_virtual_library(), self.clear_additional_restriction()))
|
||||
|
||||
self.virtual_library_tooltip = \
|
||||
@ -364,7 +365,7 @@ class SearchRestrictionMixin(object):
|
||||
self.apply_virtual_library(cd.library_name)
|
||||
self.rebuild_vl_tabs()
|
||||
|
||||
def virtual_library_clicked(self):
|
||||
def virtual_library_menu_about_to_show(self):
|
||||
m = self.virtual_library_menu
|
||||
m.clear()
|
||||
|
||||
@ -420,9 +421,6 @@ class SearchRestrictionMixin(object):
|
||||
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())
|
||||
self.virtual_library_menu.popup(self.virtual_library.mapToGlobal(p))
|
||||
|
||||
def rebuild_vl_tabs(self):
|
||||
self.vl_tabs.rebuild()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user