Add a tweak to not preselect the first completion in the new combobox

This commit is contained in:
Kovid Goyal 2012-07-17 09:08:23 +05:30
parent e6a4163623
commit a317af75aa
2 changed files with 11 additions and 2 deletions

View File

@ -516,3 +516,11 @@ default_tweak_format = None
# enable_multicharacters_in_tag_browser = False
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

View File

@ -16,6 +16,7 @@ from PyQt4.Qt import (QLineEdit, QAbstractListModel, Qt, pyqtSignal, QObject,
from calibre.utils.icu import sort_key, primary_startswith
from calibre.gui2 import NONE
from calibre.gui2.widgets import EnComboBox, LineEditECM
from calibre.utils.config import tweaks
class CompleteModel(QAbstractListModel): # {{{
@ -157,8 +158,8 @@ class Completer(QListView): # {{{
p.setGeometry(pos.x(), pos.y(), w, h)
if (select_first and not self.currentIndex().isValid() and
self.model().rowCount() > 0):
if (tweaks['preselect_first_completion'] and select_first and not
self.currentIndex().isValid() and self.model().rowCount() > 0):
self.setCurrentIndex(self.model().index(0))
if not p.isVisible():