mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Forgot about the clear virtual library button on the search bar. Should also be flat
This commit is contained in:
parent
932079f1e9
commit
2e90c865ff
@ -531,12 +531,6 @@ numeric_collation = False
|
|||||||
# number here. The default is ten libraries.
|
# number here. The default is ten libraries.
|
||||||
many_libraries = 10
|
many_libraries = 10
|
||||||
|
|
||||||
#: Highlight the virtual library name when using a Virtual library
|
|
||||||
# The virtual library name next to the Virtual library button is highlighted in
|
|
||||||
# yellow when using a Virtual library. You can choose the color used for the
|
|
||||||
# highlight with this tweak. Set it to 'transparent' to disable highlighting.
|
|
||||||
highlight_virtual_library = 'yellow'
|
|
||||||
|
|
||||||
#: Choose available output formats for conversion
|
#: Choose available output formats for conversion
|
||||||
# Restrict the list of available output formats in the conversion dialogs.
|
# Restrict the list of available output formats in the conversion dialogs.
|
||||||
# For example, if you only want to convert to EPUB and AZW3, change this to
|
# For example, if you only want to convert to EPUB and AZW3, change this to
|
||||||
|
@ -174,11 +174,10 @@ class SearchBar(QWidget): # {{{
|
|||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
QWidget.__init__(self, parent)
|
QWidget.__init__(self, parent)
|
||||||
self._layout = l = QHBoxLayout()
|
self._layout = l = QHBoxLayout(self)
|
||||||
self.setLayout(self._layout)
|
l.setContentsMargins(0,5,0,0)
|
||||||
self._layout.setContentsMargins(0,5,0,0)
|
|
||||||
|
|
||||||
x = QToolButton(self)
|
x = parent.virtual_library = QToolButton(self)
|
||||||
x.setCursor(Qt.PointingHandCursor)
|
x.setCursor(Qt.PointingHandCursor)
|
||||||
x.setText(_('Virtual library'))
|
x.setText(_('Virtual library'))
|
||||||
x.setAutoRaise(True)
|
x.setAutoRaise(True)
|
||||||
@ -186,19 +185,20 @@ class SearchBar(QWidget): # {{{
|
|||||||
x.setObjectName("virtual_library")
|
x.setObjectName("virtual_library")
|
||||||
x.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
|
x.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
|
||||||
l.addWidget(x)
|
l.addWidget(x)
|
||||||
self.vl_sep = QFrame(self)
|
|
||||||
self.vl_sep.setFrameShape(QFrame.VLine)
|
|
||||||
self.vl_sep.setFrameShadow(QFrame.Sunken)
|
|
||||||
l.addWidget(self.vl_sep)
|
|
||||||
parent.virtual_library = x
|
|
||||||
|
|
||||||
x = QToolButton(self)
|
x = QToolButton(self)
|
||||||
|
x.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
|
||||||
|
x.setAutoRaise(True)
|
||||||
x.setIcon(QIcon(I('minus.png')))
|
x.setIcon(QIcon(I('minus.png')))
|
||||||
x.setObjectName('clear_vl')
|
x.setObjectName('clear_vl')
|
||||||
l.addWidget(x)
|
l.addWidget(x)
|
||||||
x.setVisible(False)
|
x.setVisible(False)
|
||||||
x.setToolTip(_('Close the Virtual library'))
|
x.setToolTip(_('Close the Virtual library'))
|
||||||
parent.clear_vl = x
|
parent.clear_vl = x
|
||||||
|
self.vl_sep = QFrame(self)
|
||||||
|
self.vl_sep.setFrameShape(QFrame.VLine)
|
||||||
|
self.vl_sep.setFrameShadow(QFrame.Sunken)
|
||||||
|
l.addWidget(self.vl_sep)
|
||||||
|
|
||||||
x = QLabel(self)
|
x = QLabel(self)
|
||||||
x.setObjectName("search_count")
|
x.setObjectName("search_count")
|
||||||
|
@ -15,7 +15,6 @@ from PyQt5.Qt import (
|
|||||||
from calibre.gui2 import error_dialog, question_dialog, gprefs
|
from calibre.gui2 import error_dialog, question_dialog, gprefs
|
||||||
from calibre.gui2.dialogs.confirm_delete import confirm
|
from calibre.gui2.dialogs.confirm_delete import confirm
|
||||||
from calibre.gui2.widgets import ComboBoxWithHelp
|
from calibre.gui2.widgets import ComboBoxWithHelp
|
||||||
from calibre.utils.config_base import tweaks
|
|
||||||
from calibre.utils.icu import sort_key
|
from calibre.utils.icu import sort_key
|
||||||
from calibre.utils.search_query_parser import ParseException
|
from calibre.utils.search_query_parser import ParseException
|
||||||
from calibre.utils.localization import localize_user_manual_link
|
from calibre.utils.localization import localize_user_manual_link
|
||||||
@ -342,7 +341,7 @@ class SearchRestrictionMixin(object):
|
|||||||
|
|
||||||
self.search_restriction = ComboBoxWithHelp(self)
|
self.search_restriction = ComboBoxWithHelp(self)
|
||||||
self.search_restriction.setVisible(False)
|
self.search_restriction.setVisible(False)
|
||||||
self.search_count.setText(_("(all books)"))
|
self.clear_vl.setText(_("(all books)"))
|
||||||
self.ar_menu = QMenu(_('Additional restriction'))
|
self.ar_menu = QMenu(_('Additional restriction'))
|
||||||
self.edit_menu = QMenu(_('Edit Virtual library'))
|
self.edit_menu = QMenu(_('Edit Virtual library'))
|
||||||
self.rm_menu = QMenu(_('Remove Virtual library'))
|
self.rm_menu = QMenu(_('Remove Virtual library'))
|
||||||
@ -624,18 +623,12 @@ class SearchRestrictionMixin(object):
|
|||||||
t = ' :: '.join(restrictions)
|
t = ' :: '.join(restrictions)
|
||||||
if len(t) > 20:
|
if len(t) > 20:
|
||||||
t = t[:19] + u'…'
|
t = t[:19] + u'…'
|
||||||
self.search_count.setStyleSheet(
|
|
||||||
'QLabel { border-radius: 6px; background-color: %s }' %
|
|
||||||
tweaks['highlight_virtual_library'])
|
|
||||||
self.clear_vl.setVisible(True)
|
self.clear_vl.setVisible(True)
|
||||||
self.search_count.setVisible(not gprefs['show_vl_tabs'])
|
self.clear_vl.setVisible(not gprefs['show_vl_tabs'])
|
||||||
else: # No restriction or not library view
|
else: # No restriction or not library view
|
||||||
t = ''
|
t = ''
|
||||||
self.search_count.setStyleSheet(
|
|
||||||
'QLabel { background-color: transparent; }')
|
|
||||||
self.clear_vl.setVisible(False)
|
self.clear_vl.setVisible(False)
|
||||||
self.search_count.setVisible(False)
|
self.clear_vl.setText(t.replace('&', '&&'))
|
||||||
self.search_count.setText(t)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user