forked from openlp/openlp
fix bug 825205 - Keep/restore selected book, chapters and verses when changing the bible translation in advanced search
This commit is contained in:
parent
44a7c32baf
commit
7e9c30dfaf
@ -408,7 +408,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.plugin.appStartup()
|
self.plugin.appStartup()
|
||||||
self.updateAutoCompleter()
|
self.updateAutoCompleter()
|
||||||
|
|
||||||
def initialiseAdvancedBible(self, bible):
|
def initialiseAdvancedBible(self, bible, last_book_id=None):
|
||||||
"""
|
"""
|
||||||
This initialises the given bible, which means that its book names and
|
This initialises the given bible, which means that its book names and
|
||||||
their chapter numbers is added to the combo boxes on the
|
their chapter numbers is added to the combo boxes on the
|
||||||
@ -417,8 +417,12 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
|
|
||||||
``bible``
|
``bible``
|
||||||
The bible to initialise (unicode).
|
The bible to initialise (unicode).
|
||||||
|
|
||||||
|
``last_book_id``
|
||||||
|
The "book reference id" of the book which is choosen at the moment.
|
||||||
|
(int)
|
||||||
"""
|
"""
|
||||||
log.debug(u'initialiseAdvancedBible %s', bible)
|
log.debug(u'initialiseAdvancedBible %s, %s', bible, last_book_id)
|
||||||
book_data = self.plugin.manager.get_books(bible)
|
book_data = self.plugin.manager.get_books(bible)
|
||||||
secondbible = unicode(self.advancedSecondComboBox.currentText())
|
secondbible = unicode(self.advancedSecondComboBox.currentText())
|
||||||
if secondbible != u'':
|
if secondbible != u'':
|
||||||
@ -451,8 +455,19 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
row, QtCore.QVariant(book[u'book_reference_id']))
|
row, QtCore.QVariant(book[u'book_reference_id']))
|
||||||
if first:
|
if first:
|
||||||
first = False
|
first = False
|
||||||
self.initialiseChapterVerse(bible, book[u'name'],
|
first_book = book
|
||||||
book[u'book_reference_id'])
|
initialise_chapter_verse = True
|
||||||
|
if last_book_id and last_book_id == int(book[u'book_reference_id']):
|
||||||
|
index = self.advancedBookComboBox.findData(
|
||||||
|
QtCore.QVariant(book[u'book_reference_id']))
|
||||||
|
if index == -1:
|
||||||
|
# Not Found.
|
||||||
|
index = 0
|
||||||
|
self.advancedBookComboBox.setCurrentIndex(index)
|
||||||
|
initialise_chapter_verse = False
|
||||||
|
if initialise_chapter_verse:
|
||||||
|
self.initialiseChapterVerse(bible, first_book[u'name'],
|
||||||
|
first_book[u'book_reference_id'])
|
||||||
|
|
||||||
def initialiseChapterVerse(self, bible, book, book_ref_id):
|
def initialiseChapterVerse(self, bible, book, book_ref_id):
|
||||||
log.debug(u'initialiseChapterVerse %s, %s, %s', bible, book,
|
log.debug(u'initialiseChapterVerse %s, %s, %s', bible, book,
|
||||||
@ -597,11 +612,15 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
QtCore.QSettings().setValue(self.settingsSection + u'/advanced bible',
|
QtCore.QSettings().setValue(self.settingsSection + u'/advanced bible',
|
||||||
QtCore.QVariant(self.advancedVersionComboBox.currentText()))
|
QtCore.QVariant(self.advancedVersionComboBox.currentText()))
|
||||||
self.initialiseAdvancedBible(
|
self.initialiseAdvancedBible(
|
||||||
unicode(self.advancedVersionComboBox.currentText()))
|
unicode(self.advancedVersionComboBox.currentText()),
|
||||||
|
self.advancedBookComboBox.itemData(
|
||||||
|
int(self.advancedBookComboBox.currentIndex())))
|
||||||
|
|
||||||
def onAdvancedSecondComboBox(self):
|
def onAdvancedSecondComboBox(self):
|
||||||
self.initialiseAdvancedBible(
|
self.initialiseAdvancedBible(
|
||||||
unicode(self.advancedVersionComboBox.currentText()))
|
unicode(self.advancedVersionComboBox.currentText()),
|
||||||
|
self.advancedBookComboBox.itemData(
|
||||||
|
int(self.advancedBookComboBox.currentIndex())))
|
||||||
|
|
||||||
def onAdvancedBookComboBox(self):
|
def onAdvancedBookComboBox(self):
|
||||||
item = int(self.advancedBookComboBox.currentIndex())
|
item = int(self.advancedBookComboBox.currentIndex())
|
||||||
|
Loading…
Reference in New Issue
Block a user