forked from openlp/openlp
Fix Combo Box loading errors
Finish Crosswalk Combon Box and add all bibles Add bibleid to meta data bzr-revno: 319
This commit is contained in:
parent
19395e6880
commit
71f72d5068
@ -325,6 +325,10 @@ class BiblePlugin(Plugin, PluginUtils):
|
|||||||
self.QuickSearchComboBox.clear()
|
self.QuickSearchComboBox.clear()
|
||||||
self.QuickVersionComboBox.clear()
|
self.QuickVersionComboBox.clear()
|
||||||
self.AdvancedVersionComboBox.clear()
|
self.AdvancedVersionComboBox.clear()
|
||||||
|
self.ClearQuickSearchComboBox.clear()
|
||||||
|
self.ClearAdvancedSearchComboBox.clear()
|
||||||
|
self.SettingsOutputStyleComboBox.clear()
|
||||||
|
self.SettingsVerseStyleComboBox.clear()
|
||||||
|
|
||||||
self.QuickSearchComboBox.addItem("Verse Search")
|
self.QuickSearchComboBox.addItem("Verse Search")
|
||||||
self.QuickSearchComboBox.addItem("Text Search")
|
self.QuickSearchComboBox.addItem("Text Search")
|
||||||
|
@ -46,6 +46,7 @@ class BibleImportForm(QDialog, Ui_BibleImportDialog, PluginUtils):
|
|||||||
fbibles=open(filepath, 'r')
|
fbibles=open(filepath, 'r')
|
||||||
self.bible_versions = {}
|
self.bible_versions = {}
|
||||||
self.BibleComboBox.clear()
|
self.BibleComboBox.clear()
|
||||||
|
self.BibleComboBox.addItem("")
|
||||||
for line in fbibles:
|
for line in fbibles:
|
||||||
p = line.split(",")
|
p = line.split(",")
|
||||||
self.bible_versions[p[0]] = p[1].replace('\n', '')
|
self.bible_versions[p[0]] = p[1].replace('\n', '')
|
||||||
@ -118,6 +119,7 @@ class BibleImportForm(QDialog, Ui_BibleImportDialog, PluginUtils):
|
|||||||
|
|
||||||
def onBibleComboBox(self):
|
def onBibleComboBox(self):
|
||||||
self._checkhttp()
|
self._checkhttp()
|
||||||
|
self.BibleNameEdit.setText(str(self.BibleComboBox.currentText()))
|
||||||
|
|
||||||
def _checkhttp(self):
|
def _checkhttp(self):
|
||||||
if len(self.LocationComboBox.currentText()) > 0 or \
|
if len(self.LocationComboBox.currentText()) > 0 or \
|
||||||
@ -180,14 +182,12 @@ class BibleImportForm(QDialog, Ui_BibleImportDialog, PluginUtils):
|
|||||||
else:
|
else:
|
||||||
self.setMax(1) # set a value as it will not be needed
|
self.setMax(1) # set a value as it will not be needed
|
||||||
bible = self.bible_versions[str(self.BibleComboBox.currentText())]
|
bible = self.bible_versions[str(self.BibleComboBox.currentText())]
|
||||||
print bible
|
|
||||||
self.biblemanager.register_http_bible(str(self.BibleComboBox.currentText()), \
|
self.biblemanager.register_http_bible(str(self.BibleComboBox.currentText()), \
|
||||||
str(self.LocationComboBox.currentText()), \
|
str(self.LocationComboBox.currentText()), \
|
||||||
|
str(bible), \
|
||||||
str(self.AddressEdit.displayText()), \
|
str(self.AddressEdit.displayText()), \
|
||||||
str(self.UsernameEdit .displayText()), \
|
str(self.UsernameEdit .displayText()), \
|
||||||
str(self.PasswordEdit.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.biblemanager.save_meta_data(str(self.BibleNameEdit.displayText()), str(self.VersionNameEdit.displayText()), str(self.CopyrightEdit.displayText()), str(self.PermisionEdit.displayText()))
|
||||||
self.bibletype = None
|
self.bibletype = None
|
||||||
self.freeAll() # free the screen state restrictions
|
self.freeAll() # free the screen state restrictions
|
||||||
|
@ -147,6 +147,7 @@ class BibleHTTPImpl():
|
|||||||
bible = {}
|
bible = {}
|
||||||
biblesource = ""
|
biblesource = ""
|
||||||
proxyurl = None
|
proxyurl = None
|
||||||
|
bibleid = None
|
||||||
|
|
||||||
def set_proxy(self,proxyurl):
|
def set_proxy(self,proxyurl):
|
||||||
"""
|
"""
|
||||||
@ -155,6 +156,14 @@ class BibleHTTPImpl():
|
|||||||
log.debug("set_proxy %s", proxyurl)
|
log.debug("set_proxy %s", proxyurl)
|
||||||
self.proxyurl = 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):
|
def set_bible_source(self,biblesource):
|
||||||
"""
|
"""
|
||||||
Set the source of where the bible text is coming from
|
Set the source of where the bible text is coming from
|
||||||
@ -174,7 +183,7 @@ class BibleHTTPImpl():
|
|||||||
else:
|
else:
|
||||||
ev = BGExtract(self.proxyurl)
|
ev = BGExtract(self.proxyurl)
|
||||||
|
|
||||||
return ev.get_bible_chapter(version, bookid, bookname, chapter)
|
return ev.get_bible_chapter(self.bibleid, bookid, bookname, chapter)
|
||||||
except:
|
except:
|
||||||
log.error("Error thrown = %s", sys.exc_info()[1])
|
log.error("Error thrown = %s", sys.exc_info()[1])
|
||||||
|
|
||||||
|
@ -72,7 +72,11 @@ class BibleManager():
|
|||||||
self.bibleHTTPCache[bname] = nhttp
|
self.bibleHTTPCache[bname] = nhttp
|
||||||
proxy = self.bibleDBCache[bname].get_meta("proxy").value # look to see if lazy load bible exists and get create getter.
|
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.
|
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:
|
else:
|
||||||
|
|
||||||
self.bibleHTTPCache[bname] = None # makes the Full / partial code easier.
|
self.bibleHTTPCache[bname] = None # makes the Full / partial code easier.
|
||||||
#
|
#
|
||||||
|
|
||||||
@ -81,12 +85,12 @@ class BibleManager():
|
|||||||
def process_dialog(self, dialogobject):
|
def process_dialog(self, dialogobject):
|
||||||
self.dialogobject = 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.
|
Return a list of bibles from a given URL.
|
||||||
The selected Bible can then be registered and LazyLoaded into a database
|
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):
|
if self._is_new_bible(biblename):
|
||||||
nbible = BibleDBImpl(self.biblePath, biblename, self.config) # Create new Bible
|
nbible = BibleDBImpl(self.biblePath, biblename, self.config) # Create new Bible
|
||||||
nbible.create_tables() # Create Database
|
nbible.create_tables() # Create Database
|
||||||
@ -96,6 +100,7 @@ class BibleManager():
|
|||||||
nhttp.set_bible_source(biblesource)
|
nhttp.set_bible_source(biblesource)
|
||||||
self.bibleHTTPCache[biblename] = nhttp
|
self.bibleHTTPCache[biblename] = nhttp
|
||||||
nbible.save_meta("WEB", biblesource) # register a lazy loading interest
|
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 != "":
|
if proxyurl != None and proxyurl != "":
|
||||||
nbible.save_meta("proxy", proxyurl) # store the proxy URL
|
nbible.save_meta("proxy", proxyurl) # store the proxy URL
|
||||||
nhttp.set_proxy(proxyurl)
|
nhttp.set_proxy(proxyurl)
|
||||||
|
Loading…
Reference in New Issue
Block a user