mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Move the advanced search button into the line edit
This commit is contained in:
parent
5404ba04d2
commit
d7886a0001
@ -8,7 +8,7 @@ __docformat__ = 'restructuredtext en'
|
||||
from functools import partial
|
||||
|
||||
from PyQt5.Qt import (QIcon, Qt, QWidget, QSize, QFrame,
|
||||
pyqtSignal, QToolButton, QMenu, QAction, QCoreApplication,
|
||||
pyqtSignal, QToolButton, QMenu, QLineEdit, QCoreApplication,
|
||||
QObject, QVBoxLayout, QSizePolicy, QLabel, QHBoxLayout, QActionGroup)
|
||||
|
||||
|
||||
@ -205,18 +205,6 @@ class SearchBar(QWidget): # {{{
|
||||
parent.search_count = x
|
||||
x.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
|
||||
|
||||
parent.advanced_search_button = x = QToolButton(self)
|
||||
x.setCursor(Qt.PointingHandCursor)
|
||||
parent.advanced_search_toggle_action = ac = QAction(parent)
|
||||
parent.addAction(ac)
|
||||
parent.keyboard.register_shortcut('advanced search toggle',
|
||||
_('Advanced search'), default_keys=("Shift+Ctrl+F",),
|
||||
action=ac)
|
||||
ac.triggered.connect(x.click)
|
||||
x.setIcon(QIcon(I('search.png')))
|
||||
l.addWidget(x)
|
||||
x.setToolTip(_("Advanced search"))
|
||||
|
||||
x = parent.search = SearchBox2(self)
|
||||
x.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
|
||||
x.setObjectName("search")
|
||||
@ -225,6 +213,12 @@ class SearchBar(QWidget): # {{{
|
||||
x.setMinimumContentsLength(10)
|
||||
l.addWidget(x)
|
||||
|
||||
parent.advanced_search_toggle_action = ac = parent.search.add_action('search.png', QLineEdit.LeadingPosition)
|
||||
parent.addAction(ac)
|
||||
parent.keyboard.register_shortcut('advanced search toggle',
|
||||
_('Advanced search'), default_keys=("Shift+Ctrl+F",),
|
||||
action=ac)
|
||||
|
||||
self.search_button = QToolButton()
|
||||
self.search_button.setToolButtonStyle(Qt.ToolButtonTextOnly)
|
||||
self.search_button.setText(_('Search'))
|
||||
|
@ -447,13 +447,13 @@ class SearchBoxMixin(object): # {{{
|
||||
|
||||
def init_search_box_mixin(self):
|
||||
self.search.initialize('main_search_history', colorize=True,
|
||||
help_text=_('Search (For advanced search click the button to the left)'))
|
||||
help_text=_('Search (For advanced search click the icon to the left)'))
|
||||
self.search.cleared.connect(self.search_box_cleared)
|
||||
# Queued so that search.current_text will be correct
|
||||
self.search.changed.connect(self.search_box_changed,
|
||||
type=Qt.QueuedConnection)
|
||||
self.search.focus_to_library.connect(self.focus_to_library)
|
||||
self.advanced_search_button.clicked[bool].connect(self.do_advanced_search)
|
||||
self.advanced_search_toggle_action.triggered.connect(self.do_advanced_search)
|
||||
|
||||
self.search.clear()
|
||||
self.search.setMaximumWidth(self.width()-150)
|
||||
@ -468,7 +468,6 @@ class SearchBoxMixin(object): # {{{
|
||||
self.addAction(self.action_focus_search)
|
||||
self.search.setStatusTip(re.sub(r'<\w+>', ' ',
|
||||
unicode(self.search.toolTip())))
|
||||
self.advanced_search_button.setStatusTip(self.advanced_search_button.toolTip())
|
||||
self.set_highlight_only_button_icon()
|
||||
self.highlight_only_button.clicked.connect(self.highlight_only_clicked)
|
||||
tt = _('Enable or disable search highlighting.') + '<br><br>'
|
||||
|
Loading…
x
Reference in New Issue
Block a user