Refactor advanced search dialog to use new completer

This commit is contained in:
Kovid Goyal 2011-02-02 12:20:07 -07:00
parent c6260c678a
commit fc3123e4c1
2 changed files with 9 additions and 12 deletions

View File

@ -3,7 +3,7 @@ __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
import re, copy
from PyQt4.Qt import QDialog, QDialogButtonBox, QCompleter, Qt
from PyQt4.Qt import QDialog, QDialogButtonBox
from calibre.gui2.dialogs.search_ui import Ui_Dialog
from calibre.library.caches import CONTAINS_MATCH, EQUALS_MATCH
@ -29,20 +29,17 @@ class SearchDialog(QDialog, Ui_Dialog):
name = name.strip().replace('|', ',')
self.authors_box.addItem(name)
self.authors_box.setEditText('')
self.authors_box.completer().setCompletionMode(QCompleter.PopupCompletion)
self.authors_box.setAutoCompletionCaseSensitivity(Qt.CaseInsensitive)
self.authors_box.set_separator('&')
self.authors_box.set_space_before_sep(True)
self.authors_box.update_items_cache(db.all_author_names())
all_series = db.all_series()
all_series.sort(key=lambda x : sort_key(x[1]))
self.series_box.update_items_cache([x[1] for x in all_series])
for i in all_series:
id, name = i
self.series_box.addItem(name)
self.series_box.setEditText('')
self.series_box.completer().setCompletionMode(QCompleter.PopupCompletion)
self.series_box.setAutoCompletionCaseSensitivity(Qt.CaseInsensitive)
all_tags = db.all_tags()
self.tags_box.update_items_cache(all_tags)

View File

@ -265,21 +265,21 @@
</widget>
</item>
<item row="2" column="1">
<widget class="CompleteComboBox" name="authors_box">
<widget class="MultiCompleteComboBox" name="authors_box">
<property name="toolTip">
<string>Enter an author's name. Only one author can be used.</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="EnComboBox" name="series_box">
<widget class="MultiCompleteComboBox" name="series_box">
<property name="toolTip">
<string>Enter a series name, without an index. Only one series name can be used.</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="CompleteLineEdit" name="tags_box">
<widget class="MultiCompleteLineEdit" name="tags_box">
<property name="toolTip">
<string>Enter tags separated by spaces</string>
</property>
@ -360,14 +360,14 @@
<header>widgets.h</header>
</customwidget>
<customwidget>
<class>CompleteLineEdit</class>
<class>MultiCompleteLineEdit</class>
<extends>QLineEdit</extends>
<header>widgets.h</header>
<header>calibre/gui2/complete.h</header>
</customwidget>
<customwidget>
<class>CompleteComboBox</class>
<class>MultiCompleteComboBox</class>
<extends>QComboBox</extends>
<header>widgets.h</header>
<header>calibre/gui2/complete.h</header>
</customwidget>
</customwidgets>
<tabstops>