use map; fixed changing quickBible

This commit is contained in:
Andreas Preikschat 2011-04-13 16:28:31 +02:00
parent 2dc2304a2c
commit 6082785b3e
1 changed files with 9 additions and 11 deletions

View File

@ -291,7 +291,11 @@ class BibleMediaItem(MediaManagerItem):
log.debug(u'bible manager initialise')
self.parent.manager.media = self
self.loadBibles()
self.updateAutoCompleter(False)
bible = QtCore.QSettings().value(
self.settingsSection + u'/quick bible', QtCore.QVariant(
self.quickVersionComboBox.currentText())).toString()
find_and_set_in_combo_box(self.quickVersionComboBox, bible)
self.updateAutoCompleter()
self.configUpdated()
log.debug(u'bible manager initialise complete')
@ -376,20 +380,14 @@ class BibleMediaItem(MediaManagerItem):
self.adjustComboBox(1, verse_count, self.advancedFromVerse)
self.adjustComboBox(1, verse_count, self.advancedToVerse)
def updateAutoCompleter(self, updateConfig=True):
def updateAutoCompleter(self):
"""
This updates the bible book completion list for the search field. The
completion depends on the bible. It is only updated when we are doing a
reference search, otherwise the auto completion list is removed.
"""
if updateConfig:
QtCore.QSettings().setValue(self.settingsSection + u'/quick bible',
QtCore.QVariant(self.quickVersionComboBox.currentText()))
else:
book = QtCore.QSettings().value(
self.settingsSection + u'/quick bible',
QtCore.QVariant(u'')).toString()
find_and_set_in_combo_box(self.quickVersionComboBox, book)
QtCore.QSettings().setValue(self.settingsSection + u'/quick bible',
QtCore.QVariant(self.quickVersionComboBox.currentText()))
books = []
# We have to do a 'Reference Search'.
if self.quickSearchEdit.currentSearchType() == BibleSearch.Reference:
@ -397,7 +395,7 @@ class BibleMediaItem(MediaManagerItem):
bible = unicode(self.quickVersionComboBox.currentText())
if bible:
book_data = bibles[bible].get_books()
books = [book.name + u' ' for book in book_data]
books = map(lambda x: x.name + u' ', book_data)
books.sort()
add_widget_completer(books, self.quickSearchEdit)