mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-07 09:01:38 -04:00
...
This commit is contained in:
parent
3bca088525
commit
152af5efce
@ -9,7 +9,7 @@ __docformat__ = 'restructuredtext en'
|
|||||||
from PyQt4.Qt import (QLineEdit, QAbstractListModel, Qt,
|
from PyQt4.Qt import (QLineEdit, QAbstractListModel, Qt,
|
||||||
QApplication, QCompleter)
|
QApplication, QCompleter)
|
||||||
|
|
||||||
from calibre.utils.icu import sort_key, lower
|
from calibre.utils.icu import sort_key
|
||||||
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_base import tweaks
|
from calibre.utils.config_base import tweaks
|
||||||
@ -24,12 +24,11 @@ class CompleteModel(QAbstractListModel):
|
|||||||
def set_items(self, items):
|
def set_items(self, items):
|
||||||
items = [unicode(x.strip()) for x in items]
|
items = [unicode(x.strip()) for x in items]
|
||||||
if len(items) < tweaks['completion_change_to_ascii_sorting']:
|
if len(items) < tweaks['completion_change_to_ascii_sorting']:
|
||||||
self.items = sorted(items, key=lambda x: sort_key(x))
|
self.items = sorted(items, key=sort_key)
|
||||||
self.sorting = QCompleter.UnsortedModel
|
self.sorting = QCompleter.UnsortedModel
|
||||||
else:
|
else:
|
||||||
self.items = sorted(items, key=lambda x:x.lower())
|
self.items = sorted(items, key=lambda x:x.lower())
|
||||||
self.sorting = QCompleter.CaseInsensitivelySortedModel
|
self.sorting = QCompleter.CaseInsensitivelySortedModel
|
||||||
self.lowered_items = [lower(x) for x in self.items]
|
|
||||||
self.reset()
|
self.reset()
|
||||||
|
|
||||||
def rowCount(self, *args):
|
def rowCount(self, *args):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user