From 6082785b3eb2304f434395608545dc2d8ba41bdb Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 13 Apr 2011 16:28:31 +0200 Subject: [PATCH] use map; fixed changing quickBible --- openlp/plugins/bibles/lib/mediaitem.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index fbafcd725..3f1c2b612 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -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)