openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #15369
[Merge] lp:~orangeshirt/openlp/bibles_fixes into lp:openlp
Armin Köhler has proposed merging lp:~orangeshirt/openlp/bibles_fixes into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
Related bugs:
Bug #825205 in OpenLP: "Keep/restore selected book, chapters and verses when changing the bible translation"
https://bugs.launchpad.net/openlp/+bug/825205
For more details, see:
https://code.launchpad.net/~orangeshirt/openlp/bibles_fixes/+merge/103017
fix bug 825205 - Keep/restore selected book, chapters and verses when changing the bible translation in advanced search
--
https://code.launchpad.net/~orangeshirt/openlp/bibles_fixes/+merge/103017
Your team OpenLP Core is requested to review the proposed merge of lp:~orangeshirt/openlp/bibles_fixes into lp:openlp.
=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py 2012-04-12 20:58:11 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py 2012-04-22 18:05:23 +0000
@@ -408,7 +408,7 @@
self.plugin.appStartup()
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
their chapter numbers is added to the combo boxes on the
@@ -417,8 +417,12 @@
``bible``
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)
secondbible = unicode(self.advancedSecondComboBox.currentText())
if secondbible != u'':
@@ -451,8 +455,19 @@
row, QtCore.QVariant(book[u'book_reference_id']))
if first:
first = False
- self.initialiseChapterVerse(bible, book[u'name'],
- book[u'book_reference_id'])
+ first_book = book
+ 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):
log.debug(u'initialiseChapterVerse %s, %s, %s', bible, book,
@@ -597,11 +612,15 @@
QtCore.QSettings().setValue(self.settingsSection + u'/advanced bible',
QtCore.QVariant(self.advancedVersionComboBox.currentText()))
self.initialiseAdvancedBible(
- unicode(self.advancedVersionComboBox.currentText()))
+ unicode(self.advancedVersionComboBox.currentText()),
+ self.advancedBookComboBox.itemData(
+ int(self.advancedBookComboBox.currentIndex())))
def onAdvancedSecondComboBox(self):
self.initialiseAdvancedBible(
- unicode(self.advancedVersionComboBox.currentText()))
+ unicode(self.advancedVersionComboBox.currentText()),
+ self.advancedBookComboBox.itemData(
+ int(self.advancedBookComboBox.currentIndex())))
def onAdvancedBookComboBox(self):
item = int(self.advancedBookComboBox.currentIndex())
Follow ups