diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py index 76b8e4ba2..f505b51cb 100644 --- a/openlp/plugins/bibles/bibleplugin.py +++ b/openlp/plugins/bibles/bibleplugin.py @@ -325,7 +325,11 @@ class BiblePlugin(Plugin, PluginUtils): self.QuickSearchComboBox.clear() self.QuickVersionComboBox.clear() self.AdvancedVersionComboBox.clear() - + self.ClearQuickSearchComboBox.clear() + self.ClearAdvancedSearchComboBox.clear() + self.SettingsOutputStyleComboBox.clear() + self.SettingsVerseStyleComboBox.clear() + self.QuickSearchComboBox.addItem("Verse Search") self.QuickSearchComboBox.addItem("Text Search") self.ClearQuickSearchComboBox.addItem("Clear") diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index f05b52365..699af4323 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -46,6 +46,7 @@ class BibleImportForm(QDialog, Ui_BibleImportDialog, PluginUtils): fbibles=open(filepath, 'r') self.bible_versions = {} self.BibleComboBox.clear() + self.BibleComboBox.addItem("") for line in fbibles: p = line.split(",") self.bible_versions[p[0]] = p[1].replace('\n', '') @@ -118,6 +119,7 @@ class BibleImportForm(QDialog, Ui_BibleImportDialog, PluginUtils): def onBibleComboBox(self): self._checkhttp() + self.BibleNameEdit.setText(str(self.BibleComboBox.currentText())) def _checkhttp(self): if len(self.LocationComboBox.currentText()) > 0 or \ @@ -172,22 +174,20 @@ class BibleImportForm(QDialog, Ui_BibleImportDialog, PluginUtils): self.ProgressBar.setValue(self.progress) def _import_bible(self): - log.debug("Import Bible ") + log.debug("Import Bible ") if self.bibletype == "OSIS": self.biblemanager.register_osis_file_bible(str(self.BibleNameEdit.displayText()), self.OSISLocationEdit.displayText()) elif self.bibletype == "CSV": - self.biblemanager.register_csv_file_bible(str(self.BibleNameEdit.displayText()), self.BooksLocationEdit.displayText(), self.VerseLocationEdit.displayText()) + self.biblemanager.register_csv_file_bible(str(self.BibleNameEdit.displayText()), self.BooksLocationEdit.displayText(), self.VerseLocationEdit.displayText()) else: self.setMax(1) # set a value as it will not be needed bible = self.bible_versions[str(self.BibleComboBox.currentText())] - print bible self.biblemanager.register_http_bible(str(self.BibleComboBox.currentText()), \ str(self.LocationComboBox.currentText()), \ + str(bible), \ str(self.AddressEdit.displayText()), \ str(self.UsernameEdit .displayText()), \ str(self.PasswordEdit.displayText())) - self.BibleNameEdit.setText(str(self.BibleComboBox.currentText())) - self.biblemanager.save_meta_data(str(self.BibleNameEdit.displayText()), str(self.VersionNameEdit.displayText()), str(self.CopyrightEdit.displayText()), str(self.PermisionEdit.displayText())) self.bibletype = None self.freeAll() # free the screen state restrictions diff --git a/openlp/plugins/bibles/lib/bibleHTTPimpl.py b/openlp/plugins/bibles/lib/bibleHTTPimpl.py index e8f86985d..2293f4f3a 100644 --- a/openlp/plugins/bibles/lib/bibleHTTPimpl.py +++ b/openlp/plugins/bibles/lib/bibleHTTPimpl.py @@ -147,6 +147,7 @@ class BibleHTTPImpl(): bible = {} biblesource = "" proxyurl = None + bibleid = None def set_proxy(self,proxyurl): """ @@ -154,6 +155,14 @@ class BibleHTTPImpl(): """ log.debug("set_proxy %s", proxyurl) self.proxyurl = proxyurl + + def set_bibleid(self,bibleid): + """ + Set the bible id. + The shore identifier of the the bible. + """ + log.debug("set_bibleid %s", bibleid) + self.bibleid = bibleid def set_bible_source(self,biblesource): """ @@ -174,7 +183,7 @@ class BibleHTTPImpl(): else: ev = BGExtract(self.proxyurl) - return ev.get_bible_chapter(version, bookid, bookname, chapter) + return ev.get_bible_chapter(self.bibleid, bookid, bookname, chapter) except: log.error("Error thrown = %s", sys.exc_info()[1]) diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index 2e787abfa..31f787753 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -72,7 +72,11 @@ class BibleManager(): self.bibleHTTPCache[bname] = nhttp proxy = self.bibleDBCache[bname].get_meta("proxy").value # look to see if lazy load bible exists and get create getter. nhttp.set_proxy(proxy) # tell The Server where to get the verses from. + bibleid = self.bibleDBCache[bname].get_meta("bibleid").value # look to see if lazy load bible exists and get create getter. + nhttp.set_bibleid(bibleid) # tell The Server where to get the verses from. + else: + self.bibleHTTPCache[bname] = None # makes the Full / partial code easier. # @@ -81,12 +85,12 @@ class BibleManager(): def process_dialog(self, dialogobject): self.dialogobject = dialogobject - def register_http_bible(self, biblename, biblesource, proxyurl=None, proxyid=None, proxypass=None): + def register_http_bible(self, biblename, biblesource, bibleid, proxyurl=None, proxyid=None, proxypass=None): """ Return a list of bibles from a given URL. The selected Bible can then be registered and LazyLoaded into a database """ - log.debug( "register_HTTP_bible %s,%s,%s,%s,%s", biblename, biblesource, proxyurl, proxyid, proxypass) + log.debug( "register_HTTP_bible %s,%s,%s,%s,%s,%s", biblename, biblesource, bibleid, proxyurl, proxyid, proxypass) if self._is_new_bible(biblename): nbible = BibleDBImpl(self.biblePath, biblename, self.config) # Create new Bible nbible.create_tables() # Create Database @@ -96,6 +100,7 @@ class BibleManager(): nhttp.set_bible_source(biblesource) self.bibleHTTPCache[biblename] = nhttp nbible.save_meta("WEB", biblesource) # register a lazy loading interest + nbible.save_meta("bibleid", bibleid) # store the we id of the bible if proxyurl != None and proxyurl != "": nbible.save_meta("proxy", proxyurl) # store the proxy URL nhttp.set_proxy(proxyurl)