From a317af75aaefbc3af8e379e885a0e462fc925726 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 17 Jul 2012 09:08:23 +0530 Subject: [PATCH] Add a tweak to not preselect the first completion in the new combobox --- resources/default_tweaks.py | 8 ++++++++ src/calibre/gui2/complete2.py | 5 +++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/resources/default_tweaks.py b/resources/default_tweaks.py index 420df116ce..3bba5ecca5 100644 --- a/resources/default_tweaks.py +++ b/resources/default_tweaks.py @@ -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 + diff --git a/src/calibre/gui2/complete2.py b/src/calibre/gui2/complete2.py index 59f1070577..603177498d 100644 --- a/src/calibre/gui2/complete2.py +++ b/src/calibre/gui2/complete2.py @@ -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():