mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
On startup do not focus the search bar. Instead you can acces the search bar easily by pressing the / key or the standard search keyboard shortcut for your operating system
This commit is contained in:
parent
f0d571df33
commit
a10091170b
@ -7,8 +7,8 @@ __copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
|||||||
__docformat__ = 'restructuredtext en'
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
from PyQt4.Qt import QComboBox, Qt, QLineEdit, QStringList, pyqtSlot, \
|
from PyQt4.Qt import QComboBox, Qt, QLineEdit, QStringList, pyqtSlot, \
|
||||||
pyqtSignal, SIGNAL, QObject, QDialog
|
pyqtSignal, SIGNAL, QObject, QDialog, QCompleter, \
|
||||||
from PyQt4.QtGui import QCompleter
|
QAction, QKeySequence
|
||||||
|
|
||||||
from calibre.gui2 import config
|
from calibre.gui2 import config
|
||||||
from calibre.gui2.dialogs.confirm_delete import confirm
|
from calibre.gui2.dialogs.confirm_delete import confirm
|
||||||
@ -348,8 +348,14 @@ class SearchBoxMixin(object):
|
|||||||
self.do_advanced_search)
|
self.do_advanced_search)
|
||||||
|
|
||||||
self.search.clear()
|
self.search.clear()
|
||||||
self.search.setFocus(Qt.OtherFocusReason)
|
|
||||||
self.search.setMaximumWidth(self.width()-150)
|
self.search.setMaximumWidth(self.width()-150)
|
||||||
|
self.action_focus_search = QAction(self)
|
||||||
|
shortcuts = QKeySequence.keyBindings(QKeySequence.Find)
|
||||||
|
shortcuts = list(shortcuts) + [QKeySequence('/')]
|
||||||
|
self.action_focus_search.setShortcuts(shortcuts)
|
||||||
|
self.action_focus_search.triggered.connect(lambda x:
|
||||||
|
self.search.setFocus(Qt.OtherFocusReason))
|
||||||
|
self.addAction(self.action_focus_search)
|
||||||
|
|
||||||
def search_box_cleared(self):
|
def search_box_cleared(self):
|
||||||
self.tags_view.clear()
|
self.tags_view.clear()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user