← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~orangeshirt/openlp/bibles into lp:openlp

 

Armin Köhler has proposed merging lp:~orangeshirt/openlp/bibles into lp:openlp.

Requested reviews:
  Raoul Snyman (raoul-snyman)
  Jonathan Corwin (j-corwin)
Related bugs:
  Bug #609356 in OpenLP: "Web bibles don't download all their books on import"
  https://bugs.launchpad.net/openlp/+bug/609356
  Bug #706207 in OpenLP: "New Web Bible download call relies on ASCII addresses"
  https://bugs.launchpad.net/openlp/+bug/706207
  Bug #722458 in OpenLP: "Verse search in two different languages returns error."
  https://bugs.launchpad.net/openlp/+bug/722458

For more details, see:
https://code.launchpad.net/~orangeshirt/openlp/bibles/+merge/62914

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.
-- 
https://code.launchpad.net/~orangeshirt/openlp/bibles/+merge/62914
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/plugins/bibles/lib/manager.py'
--- openlp/plugins/bibles/lib/manager.py	2011-05-27 09:23:46 +0000
+++ openlp/plugins/bibles/lib/manager.py	2011-05-30 20:07:28 +0000
@@ -219,9 +219,9 @@
         log.debug(u'BibleManager.get_books("%s")', bible)
         return [
             {
-            u'name': book.name,
-            u'chapters': self.db_cache[bible].get_chapter_count(
-                book)
+                u'name': book.name,
+                u'book_reference_id': book.book_reference_id, 
+                u'chapters': self.db_cache[bible].get_chapter_count(book)
             }
             for book in self.db_cache[bible].get_books()
         ]

=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py	2011-05-29 15:33:09 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py	2011-05-30 20:07:28 +0000
@@ -239,8 +239,14 @@
         self.advancedLayout.addWidget(self.advancedToVerse, 4, 2)
         self.addSearchFields(u'advanced', UiStrings().Advanced)
         # 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.SIGNAL(u'activated(int)'), self.onAdvancedVersionComboBox)
+        QtCore.QObject.connect(self.advancedSecondComboBox,
+            QtCore.SIGNAL(u'activated(int)'), self.onAdvancedSecondComboBox)
         QtCore.QObject.connect(self.advancedBookComboBox,
             QtCore.SIGNAL(u'activated(int)'), self.onAdvancedBookComboBox)
         QtCore.QObject.connect(self.advancedFromChapter,
@@ -401,6 +407,16 @@
         """
         log.debug(u'initialiseAdvancedBible %s', 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()
         first = True
         for book in book_data:
@@ -449,10 +465,26 @@
             bible = unicode(self.quickVersionComboBox.currentText())
             if bible:
                 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.sort(cmp=locale.strcoll)
         add_widget_completer(books, self.quickSearchEdit)
 
+    def onQuickVersionComboBox(self):
+        self.updateAutoCompleter()
+
+    def onQuickSecondComboBox(self):
+        self.updateAutoCompleter()
+
     def onImportClick(self):
         if not hasattr(self, u'import_wizard'):
             self.import_wizard = BibleImportForm(self, self.plugin.manager,
@@ -501,6 +533,10 @@
         self.initialiseAdvancedBible(
             unicode(self.advancedVersionComboBox.currentText()))
 
+    def onAdvancedSecondComboBox(self):
+        self.initialiseAdvancedBible(
+            unicode(self.advancedVersionComboBox.currentText()))
+
     def onAdvancedBookComboBox(self):
         item = int(self.advancedBookComboBox.currentIndex())
         self.initialiseChapterVerse(


Follow ups