forked from openlp/openlp
Change content of booklist combobox in advanced search and autocomplete suggestionlist in quick search if a second bible is choosen the lists refresh and contain only books which are in both bibles.
bzr-revno: 1597
This commit is contained in:
commit
77281d3142
@ -220,8 +220,8 @@ class BibleManager(object):
|
|||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
u'name': book.name,
|
u'name': book.name,
|
||||||
u'chapters': self.db_cache[bible].get_chapter_count(
|
u'book_reference_id': book.book_reference_id,
|
||||||
book)
|
u'chapters': self.db_cache[bible].get_chapter_count(book)
|
||||||
}
|
}
|
||||||
for book in self.db_cache[bible].get_books()
|
for book in self.db_cache[bible].get_books()
|
||||||
]
|
]
|
||||||
|
@ -239,8 +239,14 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.advancedLayout.addWidget(self.advancedToVerse, 4, 2)
|
self.advancedLayout.addWidget(self.advancedToVerse, 4, 2)
|
||||||
self.addSearchFields(u'advanced', UiStrings().Advanced)
|
self.addSearchFields(u'advanced', UiStrings().Advanced)
|
||||||
# Combo Boxes
|
# Combo Boxes
|
||||||
|
QtCore.QObject.connect(self.quickVersionComboBox,
|
||||||
|
QtCore.SIGNAL(u'activated(int)'), self.onQuickVersionComboBox)
|
||||||
|
QtCore.QObject.connect(self.quickSecondComboBox,
|
||||||
|
QtCore.SIGNAL(u'activated(int)'), self.onQuickSecondComboBox)
|
||||||
QtCore.QObject.connect(self.advancedVersionComboBox,
|
QtCore.QObject.connect(self.advancedVersionComboBox,
|
||||||
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedVersionComboBox)
|
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedVersionComboBox)
|
||||||
|
QtCore.QObject.connect(self.advancedSecondComboBox,
|
||||||
|
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedSecondComboBox)
|
||||||
QtCore.QObject.connect(self.advancedBookComboBox,
|
QtCore.QObject.connect(self.advancedBookComboBox,
|
||||||
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedBookComboBox)
|
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedBookComboBox)
|
||||||
QtCore.QObject.connect(self.advancedFromChapter,
|
QtCore.QObject.connect(self.advancedFromChapter,
|
||||||
@ -401,6 +407,16 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'initialiseAdvancedBible %s', bible)
|
log.debug(u'initialiseAdvancedBible %s', bible)
|
||||||
book_data = self.plugin.manager.get_books(bible)
|
book_data = self.plugin.manager.get_books(bible)
|
||||||
|
secondbible = unicode(self.advancedSecondComboBox.currentText())
|
||||||
|
if secondbible != u'':
|
||||||
|
secondbook_data = self.plugin.manager.get_books(secondbible)
|
||||||
|
book_data_temp = []
|
||||||
|
for book in book_data:
|
||||||
|
for secondbook in secondbook_data:
|
||||||
|
if book['book_reference_id'] == \
|
||||||
|
secondbook['book_reference_id']:
|
||||||
|
book_data_temp.append(book)
|
||||||
|
book_data = book_data_temp
|
||||||
self.advancedBookComboBox.clear()
|
self.advancedBookComboBox.clear()
|
||||||
first = True
|
first = True
|
||||||
for book in book_data:
|
for book in book_data:
|
||||||
@ -449,10 +465,26 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
bible = unicode(self.quickVersionComboBox.currentText())
|
bible = unicode(self.quickVersionComboBox.currentText())
|
||||||
if bible:
|
if bible:
|
||||||
book_data = bibles[bible].get_books()
|
book_data = bibles[bible].get_books()
|
||||||
|
secondbible = unicode(self.quickSecondComboBox.currentText())
|
||||||
|
if secondbible != u'':
|
||||||
|
secondbook_data = bibles[secondbible].get_books()
|
||||||
|
book_data_temp = []
|
||||||
|
for book in book_data:
|
||||||
|
for secondbook in secondbook_data:
|
||||||
|
if book.book_reference_id == \
|
||||||
|
secondbook.book_reference_id:
|
||||||
|
book_data_temp.append(book)
|
||||||
|
book_data = book_data_temp
|
||||||
books = [book.name + u' ' for book in book_data]
|
books = [book.name + u' ' for book in book_data]
|
||||||
books.sort(cmp=locale.strcoll)
|
books.sort(cmp=locale.strcoll)
|
||||||
add_widget_completer(books, self.quickSearchEdit)
|
add_widget_completer(books, self.quickSearchEdit)
|
||||||
|
|
||||||
|
def onQuickVersionComboBox(self):
|
||||||
|
self.updateAutoCompleter()
|
||||||
|
|
||||||
|
def onQuickSecondComboBox(self):
|
||||||
|
self.updateAutoCompleter()
|
||||||
|
|
||||||
def onImportClick(self):
|
def onImportClick(self):
|
||||||
if not hasattr(self, u'import_wizard'):
|
if not hasattr(self, u'import_wizard'):
|
||||||
self.import_wizard = BibleImportForm(self, self.plugin.manager,
|
self.import_wizard = BibleImportForm(self, self.plugin.manager,
|
||||||
@ -501,6 +533,10 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.initialiseAdvancedBible(
|
self.initialiseAdvancedBible(
|
||||||
unicode(self.advancedVersionComboBox.currentText()))
|
unicode(self.advancedVersionComboBox.currentText()))
|
||||||
|
|
||||||
|
def onAdvancedSecondComboBox(self):
|
||||||
|
self.initialiseAdvancedBible(
|
||||||
|
unicode(self.advancedVersionComboBox.currentText()))
|
||||||
|
|
||||||
def onAdvancedBookComboBox(self):
|
def onAdvancedBookComboBox(self):
|
||||||
item = int(self.advancedBookComboBox.currentIndex())
|
item = int(self.advancedBookComboBox.currentIndex())
|
||||||
self.initialiseChapterVerse(
|
self.initialiseChapterVerse(
|
||||||
|
Loading…
Reference in New Issue
Block a user