mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add a tweak to not preselect the first completion in the new combobox
This commit is contained in:
parent
e6a4163623
commit
a317af75aa
@ -516,3 +516,11 @@ default_tweak_format = None
|
|||||||
# enable_multicharacters_in_tag_browser = False
|
# enable_multicharacters_in_tag_browser = False
|
||||||
enable_multicharacters_in_tag_browser = True
|
enable_multicharacters_in_tag_browser = True
|
||||||
|
|
||||||
|
#: Do not preselect a completion when editing authors/tags/series/etc.
|
||||||
|
# This means that you can make changes and press Enter and your changes will
|
||||||
|
# not be overwritten by a matching completion. However, if you wish to use the
|
||||||
|
# completions you will now have to press Tab to select one before pressing
|
||||||
|
# Enter. Which technique you prefer will depend on the state of metadata in
|
||||||
|
# your library and your personal editing style.
|
||||||
|
preselect_first_completion = False
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ from PyQt4.Qt import (QLineEdit, QAbstractListModel, Qt, pyqtSignal, QObject,
|
|||||||
from calibre.utils.icu import sort_key, primary_startswith
|
from calibre.utils.icu import sort_key, primary_startswith
|
||||||
from calibre.gui2 import NONE
|
from calibre.gui2 import NONE
|
||||||
from calibre.gui2.widgets import EnComboBox, LineEditECM
|
from calibre.gui2.widgets import EnComboBox, LineEditECM
|
||||||
|
from calibre.utils.config import tweaks
|
||||||
|
|
||||||
class CompleteModel(QAbstractListModel): # {{{
|
class CompleteModel(QAbstractListModel): # {{{
|
||||||
|
|
||||||
@ -157,8 +158,8 @@ class Completer(QListView): # {{{
|
|||||||
|
|
||||||
p.setGeometry(pos.x(), pos.y(), w, h)
|
p.setGeometry(pos.x(), pos.y(), w, h)
|
||||||
|
|
||||||
if (select_first and not self.currentIndex().isValid() and
|
if (tweaks['preselect_first_completion'] and select_first and not
|
||||||
self.model().rowCount() > 0):
|
self.currentIndex().isValid() and self.model().rowCount() > 0):
|
||||||
self.setCurrentIndex(self.model().index(0))
|
self.setCurrentIndex(self.model().index(0))
|
||||||
|
|
||||||
if not p.isVisible():
|
if not p.isVisible():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user